Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sasa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
verimag
synchrone
sasa
Commits
1ff0fa2b
Commit
1ff0fa2b
authored
2 years ago
by
erwan
Browse files
Options
Downloads
Patches
Plain Diff
fix: the mutant generation was wrong
parent
fa338e34
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/sasacore/worstInit.ml
+36
-21
36 additions, 21 deletions
lib/sasacore/worstInit.ml
test/coloring/p.ml
+2
-1
2 additions, 1 deletion
test/coloring/p.ml
with
38 additions
and
22 deletions
lib/sasacore/worstInit.ml
+
36
−
21
View file @
1ff0fa2b
(* Time-stamp: <modified the
06
/04/2022 (at 1
5:39
) by Erwan Jahier> *)
(* Time-stamp: <modified the
14
/04/2022 (at 1
7:20
) by Erwan Jahier> *)
open
Register
open
Register
...
@@ -10,32 +10,46 @@ let debug = false
...
@@ -10,32 +10,46 @@ let debug = false
type
distance
=
Far
|
Close
type
distance
=
Far
|
Close
let
mutate_value
distance
=
function
let
mutate_value
distance
=
function
|
F
(
minf
,
f
,
maxf
)
->
|
F
(
minf
,
f
,
maxf
)
->
let
deltaf
=
match
distance
with
let
nf
=
match
distance
with
|
Far
->
(
maxf
-.
minf
)
|
Far
->
Random
.
float
(
maxf
-.
minf
)
+.
minf
|
Close
->
(
maxf
-.
minf
)
/.
100
.
|
Close
->
in
let
delta
=
Random
.
float
(
maxf
-.
minf
)
/.
100
.
-.
(
maxf
-.
minf
)
/.
200
.
in
let
nf
=
if
f
+.
delta
<
minf
||
f
+.
delta
>
maxf
then
f
-.
delta
else
f
+.
delta
if
minf
>
f
-.
deltaf
then
minf
+.
(
Random
.
float
(
2
.
0
*.
deltaf
))
else
if
maxf
<
f
+.
deltaf
then
maxf
-.
(
Random
.
float
(
2
.
0
*.
deltaf
))
else
f
+.
(
Random
.
float
(
2
.
0
*.
deltaf
))
-.
deltaf
in
in
F
(
minf
,
nf
,
maxf
)
F
(
minf
,
nf
,
maxf
)
|
I
(
mini
,
i
,
maxi
)
->
|
I
(
mini
,
i
,
maxi
)
->
let
deltai
=
match
distance
with
assert
(
mini
<
maxi
);
|
Far
->
(
maxi
-
mini
)
/
2
let
ni
=
match
distance
with
|
Close
->
((
maxi
-
mini
)
/
100
)
|
Far
->
in
let
ni
=
Random
.
int
(
maxi
-
mini
)
+
mini
in
let
deltai
=
1
+
Random
.
int
(
max
1
deltai
)
in
if
ni
=
i
then
maxi
else
ni
let
ni
=
if
i
=
mini
then
i
+
deltai
else
if
i
=
maxi
then
i
-
deltai
else
|
Close
->
if
Random
.
bool
()
then
i
+
deltai
else
i
-
deltai
if
i
=
mini
then
i
+
1
else
if
i
=
maxi
then
i
-
1
else
if
Random
.
bool
()
then
i
+
1
else
i
-
1
in
in
I
(
mini
,
ni
,
maxi
)
I
(
mini
,
ni
,
maxi
)
|
B
b
->
B
(
not
b
)
|
B
b
->
B
(
not
b
)
(*
in order to test the distribution of the mutants
let a = Array.make 10 0 in
let p = ref (I (3, 4, 6)) in
for i=1 to 100000 do
p:=mutate_value Far !p;
match !p with I(_,i,_) -> a.(i) <-a.(i)+1;
done;
a;;
let a = Array.make 10 0 in
let p = ref (F (3., 4., 6.)) in
for i=1 to 100000 do
p:=mutate_value Far !p;
match !p with F(_,f,_) -> a.(int_of_float f) <-a.(int_of_float f)+1;
done;
a;;
*)
let
one_dim_succ
d
n
=
let
one_dim_succ
d
n
=
let
p
=
Array
.
copy
n
in
let
p
=
Array
.
copy
n
in
let
j
=
Random
.
int
(
Array
.
length
p
)
in
let
j
=
Random
.
int
(
Array
.
length
p
)
in
...
@@ -176,6 +190,7 @@ let (fchc : out_channel -> ('v SimuState.t -> int) -> 'v SimuState.t -> int
...
@@ -176,6 +190,7 @@ let (fchc : out_channel -> ('v SimuState.t -> int) -> 'v SimuState.t -> int
let
cost
p
=
run
(
point_to_ss
p
ss_init
)
in
let
cost
p
=
run
(
point_to_ss
p
ss_init
)
in
let
pinit
=
ss_to_point
ss_init
in
let
pinit
=
ss_to_point
ss_init
in
let
percent_done
=
ref
0
in
let
percent_done
=
ref
0
in
Functory
.
Cores
.
set_number_of_cores
ss_init
.
sasarg
.
cores_nb
;
let
g
=
let
g
=
{
{
init
=
({
st
=
pinit
;
d
=
0
;
cost
=
cost
pinit
;
cpt
=
0
}
,
Q
.
empty
,
()
);
init
=
({
st
=
pinit
;
d
=
0
;
cost
=
cost
pinit
;
cpt
=
0
}
,
Q
.
empty
,
()
);
...
...
This diff is collapsed.
Click to expand it.
test/coloring/p.ml
+
2
−
1
View file @
1ff0fa2b
(* Time-stamp: <modified the 1
2/10
/202
1
(at 1
5:42
) by Erwan Jahier> *)
(* Time-stamp: <modified the 1
4/04
/202
2
(at 1
7:17
) by Erwan Jahier> *)
(* This is algo 3.1 in the book *)
(* This is algo 3.1 in the book *)
open
Algo
open
Algo
...
@@ -16,6 +16,7 @@ let (colors : 'v neighbor list -> 'v list) = fun nl ->
...
@@ -16,6 +16,7 @@ let (colors : 'v neighbor list -> 'v list) = fun nl ->
nb: suppose that all states are in [0;k-1]
nb: suppose that all states are in [0;k-1]
*)
*)
let
(
free
:
'
v
neighbor
list
->
'
v
list
)
=
fun
nl
->
let
(
free
:
'
v
neighbor
list
->
'
v
list
)
=
fun
nl
->
assert
(
List
.
for_all
(
fun
n
->
state
n
<
k
)
nl
);
(* all colors should be < k *)
let
comp_neg
x
y
=
-
(
compare
x
y
)
in
let
comp_neg
x
y
=
-
(
compare
x
y
)
in
let
n_colors
=
List
.
map
(
fun
n
->
state
n
)
nl
in
(* neighbor colors *)
let
n_colors
=
List
.
map
(
fun
n
->
state
n
)
nl
in
(* neighbor colors *)
let
n_colors
=
(* neighbor colors, no duplicate, in descending order *)
let
n_colors
=
(* neighbor colors, no duplicate, in descending order *)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment