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

play with -is on the toy-example-a5sf (something seems wrong)

parent 3b643c06
No related branches found
No related tags found
No related merge requests found
......@@ -15,8 +15,10 @@ let (isEnabledR: pid -> (pid -> ('a * 'a neighbor list)) -> bool) =
let (loc_pot: pid -> pid list -> (pid -> ('a * 'a neighbor list)) -> int) =
fun p pidl get ->
if isEnabledS p get then 1 + vn*(vn-1) + int_of_string (String.sub p 1 ((String.length p) - 1))
else if isEnabledR p get then 1 + (vn - (int_of_string (String.sub p 1 ((String.length p) - 1))))
if isEnabledS p get then
1 + vn*(vn-1) + int_of_string (String.sub p 1 ((String.length p) - 1))
else if isEnabledR p get then
1 + (vn - (int_of_string (String.sub p 1 ((String.length p) - 1))))
else 0
let rec (sum_loc_pots: pid list -> pid list -> (pid -> ('a * 'a neighbor list)) -> int) =
......@@ -38,5 +40,17 @@ let potential = Some pf
let legitimate = None (* None => only silent configuration are legitimate *)
let fault = None (* None => the simulation stop once a legitimate configuration is reached *)
let init_search_utils = None
let fault = None
let mini= 0
let maxi = max_degree ()
let s2n s = [I(mini, s.input, 100); I(mini, s.par, maxi);
I(mini, s.sub, 100); I(mini, s.res, 100)]
let n2s nl s =
match nl with
| [I(_, input, _); I(_, par, _); I(_, sub, _); I(_, res, _)] ->
{ s with input; par; sub; res }
| _ -> assert false
let init_search_utils = Some (s2n, n2s)
......@@ -12,15 +12,24 @@ type t = {
res:int
}
let (to_string: (t -> string)) =
let (to_string_for_rif: (t -> string)) =
fun s ->
Printf.sprintf "input=%d sub=%d res=%d" s.input s.sub s.res
(* sasa --init-search uses to_string for generating the .dot file *)
let (_to_string_for_dot: (t -> string)) =
fun s ->
Printf.sprintf "{pid=%s ; input=%d ; par=%d ; sub=%d ; res=%d}"
s.pid s.input s.par s.sub s.res
let to_string = to_string_for_rif
let (of_string: (string -> t) option) =
Some (fun s ->
try
Scanf.sscanf s "{pid=%s ; input=%d ; par=%d ; sub=%d ; res=%d}"
(fun pid input par sub res -> {pid = pid; input = input; par = par; sub = sub; res = res})
(fun pid input par sub res -> {pid; input; par; sub; res})
with _ -> assert false
)
......
// the potential does not always decrease using this initial conf
graph g {
p1 [algo="p.ml" init="{pid=p1 ; input=1 ; par=-1 ; sub=2 ; res=2}"]
p2 [algo="p.ml" init="{pid=p2 ; input=1 ; par=1 ; sub=1 ; res=2}"]
p3 [algo="p.ml" init="{pid=p3 ; input=1 ; par=1 ; sub=0 ; res=1}"]
p4 [algo="p.ml" init="{pid=p4 ; input=1 ; par=1 ; sub=2 ; res=0}"]
p5 [algo="p.ml" init="{pid=p5 ; input=1 ; par=0 ; sub=0 ; res=0}"]
p6 [algo="p.ml" init="{pid=p6 ; input=1 ; par=1 ; sub=4 ; res=0}"]
p7 [algo="p.ml" init="{pid=p7 ; input=1 ; par=0 ; sub=0 ; res=0}"]
p1 -- p2
p2 -- p3
p3 -- p4
p4 -- p5
p5 -- p6
p6 -- p7
}
\ No newline at end of file
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