diff --git a/lib/algo/algo.mli b/lib/algo/algo.mli index e327a437e4ccc505e580ed1223673114d765cb62..a3e6f3e6d4050e46ae975db413bb1864307a96d8 100644 --- a/lib/algo/algo.mli +++ b/lib/algo/algo.mli @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 12/06/2019 (at 09:54) by Erwan Jahier> *) +(* Time-stamp: <modified the 14/06/2019 (at 13:46) by Erwan Jahier> *) (** Process programmer API *) diff --git a/lib/sasacore/env.ml b/lib/sasacore/env.ml index b3ed7adb147b4cc47af4321939e5300df3b10d21..3edf157af9e51dc532a54aec0625dfb68cedc2c6 100644 --- a/lib/sasacore/env.ml +++ b/lib/sasacore/env.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 12/06/2019 (at 08:06) by Erwan Jahier> *) +(* Time-stamp: <modified the 14/06/2019 (at 13:46) by Erwan Jahier> *) module Dico = Map.Make(String) @@ -21,6 +21,7 @@ let (get_copy: Algo.vars -> 'v t -> string -> 'v Algo.local_env) = let (set: 'v t -> string -> 'v Algo.local_env -> 'v t) = fun e pid lenv -> (* Printf.printf "--> set pid %s\n" pid; flush stdout; *) + let lenv = Algo.set lenv "pid" (Algo.S pid) in Dico.add pid lenv e let (init:unit -> 'v t) = fun () -> Dico.empty diff --git a/lib/sasacore/sasa.ml b/lib/sasacore/sasa.ml index 095322f6ec13ac025f84818bb2358140df405011..faee220218a8c824fbad81eb2f9c608bd5a53d30 100644 --- a/lib/sasacore/sasa.ml +++ b/lib/sasacore/sasa.ml @@ -1,9 +1,8 @@ -(* Time-stamp: <modified the 12/06/2019 (at 09:57) by Erwan Jahier> *) +(* Time-stamp: <modified the 14/06/2019 (at 13:45) by Erwan Jahier> *) open Algo open Sasacore - let (update_env_with_init : 'v Env.t -> 'v Process.t list -> 'v Env.t) = fun e pl -> let (aux: 'v Env.t -> 'v Process.t -> 'v Env.t) = diff --git a/test/coloring/p.ml b/test/coloring/p.ml index 49bc40c4f28d242e771f0f23c1353b403f01d114..05478947a3804cb8f1c1d33dc63834554677c3a5 100644 --- a/test/coloring/p.ml +++ b/test/coloring/p.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 11/06/2019 (at 16:32) by Erwan Jahier> *) +(* Time-stamp: <modified the 14/06/2019 (at 13:26) by Erwan Jahier> *) (* This is algo 3.1 in the book *) @@ -12,7 +12,7 @@ let (init_vars: neighbor list -> local_env) = set empty_env "c" (I (Random.int k)) -let verbose = false +let verbose = true let (neigbhors_values : neighbor list -> Algo.value list) = fun nl -> @@ -23,7 +23,8 @@ let (clash : Algo.value -> neighbor list -> bool) = fun v nl -> let inl = List.map (fun n -> n.pid()) nl in let res = List.mem v vnl in if verbose then ( - Printf.printf "%s %s in [%s] (%s)\n" (value_to_string v) (if res then "" else "not") + Printf.printf "%s %s in [%s] (%s)\n" (value_to_string v) + (if res then "" else "not") (String.concat "," (List.map value_to_string vnl)) (String.concat "," (inl)); flush stdout @@ -46,7 +47,7 @@ let (free : neighbor list -> Algo.value list) = fun nl -> let (enable_f:neighbor list -> local_env -> action list) = fun nl e -> if (clash (get e "c") nl) then ["conflict"] else [] - + let (step_f : neighbor list -> local_env -> action -> local_env) = fun nl e a -> let f = free nl in