Commit 4e795de0 authored by erwan's avatar erwan
Browse files

Add 2 coloring-alea directory in the set of experiments

parent d78a48f1
Pipeline #44118 failed with stages
in 18 seconds
- [Artifact of the article **SASA: a SimulAtor of Self-stabilizing Algorithms** published in TAP 2020](#org7d05b9c)
- [Using The TAP Virtual Machine](#orgbcbe716)
- [Using Docker](#org0017b3c)
- [Instructions to generate the data contained in Fig.1 of Section 2](#org58dea6e)
- [Instructions to generate the data contained in Table 1 of Section 4](#org1f04882)
- [Artifact of the article **SASA: a SimulAtor of Self-stabilizing Algorithms** published in TAP 2020](#orgadcb36c)
- [Using The TAP Virtual Machine](#orgfa132c1)
- [Using Docker](#org25735c2)
- [Instructions to generate the data contained in Fig.1 of Section 2](#orga7c708b)
- [Instructions to generate the data contained in Table 1 of Section 4](#org7196c3c)
<a id="org7d05b9c"></a>
<a id="orgadcb36c"></a>
# Artifact of the article **SASA: a SimulAtor of Self-stabilizing Algorithms** published in TAP 2020
The objective of this artifact is to show how to replicate the experiments mentioned in [this article](sasarticle.pdf).
<https://doi.org/10.5281/zenodo.3751283>
This artifact contains:
- instruction to install the necessary tools;
......@@ -24,18 +26,18 @@ By following the instructions, you should be able to replay the experiments, but
- <https://verimag.gricad-pages.univ-grenoble-alpes.fr/synchrone/sasa/>
<a id="orgbcbe716"></a>
<a id="orgfa132c1"></a>
## Using The TAP Virtual Machine
All the instructions can be found here <http://www-verimag.imag.fr/reproducible-research/TAP2020_ARTIFACT>
They should be executed under a VM that you should find here: <https://struebli.informatik.uni-freiburg.de/tap2020ae/tap2020.ova> (user tap2020 with password tap2020).
They should be executed under a VM that you should find here: <https://doi.org/10.5281/zenodo.3751283>
cf <https://tap.sosy-lab.org/2020/callforartifacts.php>
<a id="org0017b3c"></a>
<a id="org25735c2"></a>
## Using Docker
......@@ -59,7 +61,7 @@ If the last command has run without problem, you are inside a docker image where
You can thus proceed with the instructions below.
<a id="org58dea6e"></a>
<a id="orga7c708b"></a>
### Instructions to generate the data contained in Fig.1 of Section 2
......@@ -88,7 +90,7 @@ Type `<Enter>` 3 more times to see Configurations 4, 5, and 6 of Fig.1.
Type `q` to exit.
<a id="org1f04882"></a>
<a id="org7196c3c"></a>
### Instructions to generate the data contained in Table 1 of Section 4
......@@ -133,4 +135,4 @@ make save_result
Some remarks, comparing the results announced in the paper and the ones obtained on your machine:
- The number of seconds (time/step) may differ as the table was obtained using an other machine.
- 2 examples may run out of memory on your machine: the dfs algo on `hugeER.dot` and `biggrid.dot`. Indeed, as one can notice in Table 1, those examples require more memory (6.6 and 29 G) than your machine have.
- Some examples may run out of memory on your machine: the dfs algo on `hugeER.dot` and `biggrid.dot`. Indeed, as one can notice in Table 1, those examples require a lot of memory (6.6 and 29 G) that your machine may not have.
\ No newline at end of file
......@@ -5,6 +5,8 @@
The objective of this artifact is to show how to replicate the
experiments mentioned in [[file:sasarticle.pdf][this article]].
https://doi.org/10.5281/zenodo.3751283
This artifact contains:
- instruction to install the necessary tools;
- instructions to replay the interactive session described in Section
......@@ -23,8 +25,7 @@ please visit:
All the instructions can be found here http://www-verimag.imag.fr/reproducible-research/TAP2020_ARTIFACT
They should be executed under a VM that you should find here:
https://struebli.informatik.uni-freiburg.de/tap2020ae/tap2020.ova
(user tap2020 with password tap2020).
https://doi.org/10.5281/zenodo.3751283
cf https://tap.sosy-lab.org/2020/callforartifacts.php
......@@ -142,7 +143,8 @@ Some remarks, comparing the results announced in the paper and the ones
obtained on your machine:
- The number of seconds (time/step) may differ as the table was
obtained using an other machine.
- 2 examples may run out of memory on your machine: the dfs algo on =hugeER.dot=
and =biggrid.dot=. Indeed, as one can notice in Table 1, those
examples require more memory (6.6 and 29 G) than your machine have.
- Some examples may run out of memory on your machine: the dfs algo on
=hugeER.dot= and =biggrid.dot=. Indeed, as one can notice in Table
1, those examples require a lot of memory (6.6 and 29 G) that your
machine may not have.
......@@ -6,7 +6,7 @@ all:expe
# dijkstra-ring
TEST_DIRS=async-unison bfs-spanning-tree coloring dfs dfs-list unison
TEST_DIRS=async-unison bfs-spanning-tree coloring dfs dfs-list unison alea-coloring alea-coloring-unif alea-coloring-alt
-include Makefile.local
......
# Time-stamp: <modified the 27/04/2020 (at 14:43) by Erwan Jahier>
test: ring.cmxs
$(sasa) -l 200 ring.dot -cd
DECO_PATTERN="0-:algo_331.ml"
-include ../Makefile.dot
sim2chrogtk: ring.rif
sim2chrogtk -ecran -in $< > /dev/null
gnuplot: ring.rif
gnuplot-rif $<
###################################################################
#
grid44.dot:
gg grid -w 4 -he 4 -o grid44.dot
clique10.dot:
gg clique -n 10 -o $@
#
rdbg321: grid44_331.dot grid44_331.ml
rdbg -sut "sasa $< -lcd"
rdbg331: grid44_331.dot grid44_331.ml
rdbg -sut "sasa $< -lcd"
###################################################################
-include ../Makefile.inc
-include Makefile.untracked
clean: genclean
rm -f ring.lut *~ ring.ml
(* Time-stamp: <modified the 22/04/2020 (at 10:39) by Erwan Jahier> *)
(* A variant of test/alea-coloring:
Algo 3.3.1 (page 16) of Self-stabilizing Vertex Coloring of Arbitrary Graphs
by Maria Gradinariu and Sebastien Tixeuil
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.38.8441&rep=rep1&type=pdf
*)
open Algo
open State
let b=max_degree ()
let (init_state: int -> string -> 'v) =
fun _k _id -> { id = "anonymous" ; r = 0 }
let free_color cl = (* returns the max color that is not in cl, which is sorted *)
let rec f c cl =
match cl with
| [] -> c
| x::t ->
if c > x then c (* x is the max, so c is free *)
else if c = x then f (c-1) t (* c is not free: try a lower color *)
else assert false (* should not occur as cl is sorted *)
in
f b cl
(* Returns the list of used colors, in ascending order *)
let (used_colors : 'v neighbor list -> int list) = fun nl ->
let color s = (state s).r in
let cl = List.map color nl in
List.sort_uniq (fun x y -> compare y x) cl
let agree i cl = i = free_color cl
let (enable_f: 'v -> 'v neighbor list -> action list) =
fun c nl ->
if not (agree c.r (used_colors nl)) then ["C1"] else []
let (step_f : 'v -> 'v neighbor list -> action -> 'v) =
fun e nl ->
function
| "C1" -> if (Random.bool ()) then e else { e with r = free_color (used_colors nl) }
| _ -> e
type t = { id : string ; r: int }
let to_string t = Printf.sprintf "R=%d" t.r
let of_string = None
let copy = fun x -> x
let actions = ["C1";"C2"];
# Time-stamp: <modified the 12/03/2020 (at 17:44) by Erwan Jahier>
test: ring.cmxs
sasa -l 200 ring.dot
DECO_PATTERN="0-:p.ml"
-include ../Makefile.dot
sim2chrogtk: ring.rif
sim2chrogtk -ecran -in $< > /dev/null
gnuplot: ring.rif
gnuplot-rif $<
rdbg: ring.ml ring.lut
rdbg -o ring.rif \
-env "$(sasa) g.dot -cd"
clean: genclean
rm -f ring.ml
-include ../Makefile.inc
-include Makefile.untracked
(* Time-stamp: <modified the 22/04/2020 (at 10:57) by Erwan Jahier> *)
(* "Probabilistic Self-stabilizing Vertex Coloring in Unidirectional
Anonymous Networks" by Samuel Bernard, Stéphane Devismes, Katy
Paroux, Maria Potop-Butucaru, and Sébastien Tixeuil *)
open Algo
let k = max_degree () + 1
let (init_state: int -> string -> 'v) = fun _i _ -> 0
(* Random.int k *)
let (enable_f: 'st -> 'st neighbor list -> action list) =
fun c nl -> (* enabled if one neighbor has color c *)
if List.exists (fun n -> state n = c) nl then ["a"] else []
(* Returns the free colors is ascending order (n.log(n)) *)
let free nl =
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 = (* no duplicate, in descending order *)
List.sort_uniq comp_neg n_colors
in
let rec aux free n_colors i =
(* for i=k-1 to 0, put i in free if not in n_colors *)
if i < 0 then free else
(match n_colors with
| x::tail ->
if x = i then aux free tail (i-1) else aux (i::free) n_colors (i-1)
| [] -> aux (i::free) n_colors (i-1)
)
in
aux [] n_colors (k-1)
let (step_f : 'st -> 'st neighbor list -> action -> 'st ) =
fun c nl _ ->
let free_colors = c::(free nl) in
let i = Random.int (List.length free_colors) in
List.nth free_colors i
(* A variant (quadratic instead of n.log(n)) *)
let all_colors = List.init k (fun i -> i) (* [0;1;...;k-1] *)
let _step_f_v1 c nl _ =
let cl = List.map state nl in
let free_colors = List.filter (fun c -> not(List.mem c cl)) all_colors in
let free_colors = c::free_colors in
let i = Random.int (List.length free_colors) in
List.nth free_colors i
type t = int
let to_string = (fun s -> Printf.sprintf "c=%i" s)
let of_string = Some int_of_string
let copy x = x
let actions = ["a"];
# Time-stamp: <modified the 12/03/2020 (at 17:45) by Erwan Jahier>
# Time-stamp: <modified the 14/04/2020 (at 16:45) by Erwan Jahier>
test: ring.cmxs
$(sasa) -l 200 ring.dot -cd
DECO_PATTERN="0-:p.ml"
DECO_PATTERN="0-:p.ml"
DAEMON=-sd
-include ../Makefile.dot
sim2chrogtk: ring.rif
......
DAEMON=-lcd
DAEMON=-sd
%.dot: ../%.dot
gg-deco "0-:p.ml" $^ -o $@
gg-deco 0-:p.ml $^ -o $@
#use "../my-rdbg-tuning.ml";;
#use "rdbg-cmds.ml";;
#use "../sasa-rdbg-cmds.ml";;
......
(* Time-stamp: <modified the 05/03/2020 (at 21:08) by Erwan Jahier> *)
(* Time-stamp: <modified the 22/04/2020 (at 10:23) by Erwan Jahier> *)
(* Randomized version of algo 3.1 in the book *)
open Algo
let k=max_degree () + 1
let k=max_degree ()
let (init_state: int -> string -> 'v) = fun _i _ -> Random.int k
let (clash : 'v neighbor list -> 'v list) = fun nl ->
let res = List.map (fun n -> state n) nl in
res
let (init_state: int -> string -> 'v) = fun _i _ -> 0
(* Random.int i *)
(* Returns the free colors is ascending order (n.log(n)) *)
let (free : 'v neighbor list -> 'v list) = fun nl ->
let clash_list = List.sort_uniq compare (clash nl) in
let rec aux free clash i =
if i > k then free else
(match clash with
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 *)
List.sort_uniq comp_neg n_colors in
let rec aux free n_colors i =
(* for i=k-1 to 0, put i in free if not in n_colors *)
if i < 0 then free else
(match n_colors with
| x::tail ->
if x = i then aux free tail (i+1) else aux (i::free) clash (i+1)
| [] -> aux (i::free) clash (i+1)
if x = i then aux free tail (i-1) else aux (i::free) n_colors (i-1)
| [] -> aux (i::free) n_colors (i-1)
)
in
let res = aux [] clash_list 0 in
List.rev res
aux [] n_colors (k-1)
let (enable_f: 'v -> 'v neighbor list -> action list) =
fun e nl ->
if List.mem e (clash nl) then ["conflict"] else []
let (step_f : 'v -> 'v neighbor list -> action -> 'v) =
fun e nl ->
function | _ ->
if (Random.bool ()) then e else (List.hd (free nl))
fun c nl ->
if List.exists (fun n -> state n = c) nl then ["conflict"] else []
let (step_f : 'v -> 'v neighbor list -> action -> 'v) =
fun e nl _ ->
if (Random.bool ()) then e else
(* Returns the smallest possible color *)
(List.hd (free nl))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment