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
No related tags found
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
...
...
@@ -10,32 +10,46 @@ let debug = false
type
distance
=
Far
|
Close
let
mutate_value
distance
=
function
|
F
(
minf
,
f
,
maxf
)
->
let
deltaf
=
match
distance
with
|
Far
->
(
maxf
-.
minf
)
|
Close
->
(
maxf
-.
minf
)
/.
100
.
in
let
nf
=
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
let
nf
=
match
distance
with
|
Far
->
Random
.
float
(
maxf
-.
minf
)
+.
minf
|
Close
->
let
delta
=
Random
.
float
(
maxf
-.
minf
)
/.
100
.
-.
(
maxf
-.
minf
)
/.
200
.
in
if
f
+.
delta
<
minf
||
f
+.
delta
>
maxf
then
f
-.
delta
else
f
+.
delta
in
F
(
minf
,
nf
,
maxf
)
|
I
(
mini
,
i
,
maxi
)
->
let
deltai
=
match
distance
with
|
Far
->
(
maxi
-
mini
)
/
2
|
Close
->
((
maxi
-
mini
)
/
100
)
in
let
deltai
=
1
+
Random
.
int
(
max
1
deltai
)
in
let
ni
=
if
i
=
mini
then
i
+
deltai
else
if
i
=
maxi
then
i
-
deltai
else
if
Random
.
bool
()
then
i
+
deltai
else
i
-
deltai
assert
(
mini
<
maxi
);
let
ni
=
match
distance
with
|
Far
->
let
ni
=
Random
.
int
(
maxi
-
mini
)
+
mini
in
if
ni
=
i
then
maxi
else
ni
|
Close
->
if
i
=
mini
then
i
+
1
else
if
i
=
maxi
then
i
-
1
else
if
Random
.
bool
()
then
i
+
1
else
i
-
1
in
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
p
=
Array
.
copy
n
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
let
cost
p
=
run
(
point_to_ss
p
ss_init
)
in
let
pinit
=
ss_to_point
ss_init
in
let
percent_done
=
ref
0
in
Functory
.
Cores
.
set_number_of_cores
ss_init
.
sasarg
.
cores_nb
;
let
g
=
{
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 *)
open
Algo
...
...
@@ -16,6 +16,7 @@ let (colors : 'v neighbor list -> 'v list) = fun nl ->
nb: suppose that all states are in [0;k-1]
*)
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
n_colors
=
List
.
map
(
fun
n
->
state
n
)
nl
in
(* neighbor colors *)
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