Skip to content
Snippets Groups Projects
Commit e2c98267 authored by erwan's avatar erwan
Browse files

Test: add an example that uses the dot initialisation feature.

parent de716e1c
No related branches found
No related tags found
No related merge requests found
# Time-stamp: <modified the 19/06/2019 (at 15:41) by Erwan Jahier>
# Time-stamp: <modified the 21/06/2019 (at 17:55) by Erwan Jahier>
test: test0 lurette0 lurette1
test: test0 test2 lurette0 lurette1
test0: cmxs
$(sasa) -rif -l 200 fig5.1-noinit.dot -sd
cmxs:root.cmxs p.cmxs root.cma p.cma
root.cmxs:root.ml
......
graph fig4_1 {
p1 [algo="root.ml" init="d=2" init="par=0"]
p2 [algo="p.ml" init="d=0" init="par=0"]
p3 [algo="p.ml" init="d=2" init="par=0"]
p4 [algo="p.ml" init="d=4" init="par=1"]
p5 [algo="p.ml" init="d=3" init="par=1"]
p6 [algo="p.ml" init="d=4" init="par=1"]
p7 [algo="p.ml" init="d=1" init="par=2"]
p8 [algo="p.ml" init="d=3" init="par=0"]
p1 [algo="root.ml" init="{d=2;par=0}"]
p2 [algo="p.ml" init="{d=0;par=0}"]
p3 [algo="p.ml" init="{d=2;par=0}"]
p4 [algo="p.ml" init="{d=4;par=1}"]
p5 [algo="p.ml" init="{d=3;par=1}"]
p6 [algo="p.ml" init="{d=4;par=1}"]
p7 [algo="p.ml" init="{d=1;par=2}"]
p8 [algo="p.ml" init="{d=3;par=0}"]
p1 -- p2 -- p3 -- p4 -- p5 -- p6 -- p7 -- p8 -- p1
p3 -- p7
......
(* Time-stamp: <modified the 19/06/2019 (at 16:26) by Erwan Jahier> *)
(* Time-stamp: <modified the 21/06/2019 (at 17:58) by Erwan Jahier> *)
(* This is algo 5.4 in the book *)
......@@ -14,7 +14,12 @@ type state = {
let (state_to_string: ('v -> string)) =
fun s ->
Printf.sprintf "d=%d par=%d" s.d s.par
let (parse_state: string -> state) =
fun s ->
Printf.eprintf "Calling parse_state!\n";flush stderr;
Scanf.sscanf s "{d=%d;par=%d}" (fun d par -> {d = d; par = par})
let (copy_state : ('v -> 'v)) = fun x -> x
......
(* Time-stamp: <modified the 21/06/2019 (at 17:28) by Erwan Jahier> *)
(* Time-stamp: <modified the 21/06/2019 (at 17:54) by Erwan Jahier> *)
(* This is algo 5.3 in the book *)
......@@ -11,7 +11,7 @@ let (init_state: int -> 'v) =
P.d = Random.int P.d;
P.par = -1;
}
let (enable_f:'v neighbor list -> 'v -> action list) =
fun nl st ->
if st.d <> 0 then ["CD"] else []
......@@ -41,7 +41,6 @@ let () =
}
];
state_to_string = P.state_to_string;
state_of_string = None;
state_of_string = (Some P.parse_state);
copy_state = P.copy_state;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment