Commit 0aaa2e54 authored by erwan's avatar erwan
Browse files

New: a test/skeleton that contains a dumb algo to get started

parent f7dc8780
Pipeline #24306 passed with stage
in 9 minutes and 21 seconds
# Time-stamp: <modified the 27/05/2019 (at 16:54) by Erwan Jahier>
test: p.cmxs ring.lut
$(sasa) -l 200 ring.dot
cmxs: p.cmxs p.cma
sim2chrogtk: ring.rif
sim2chrogtk -ecran -in $< > /dev/null
gnuplot: ring.rif
gnuplot-rif $<
rdbg: p.cma ring.lut
rdbg -o ring.rif \
-env "$(sasa) g.dot -cd"
-include ../Makefile.inc
../my-rdbg-tuning.ml
\ No newline at end of file
(* Time-stamp: <modified the 27/05/2019 (at 16:52) by Erwan Jahier> *)
(* a dumb algo *)
open Algo
let vars = ["c",It]
let (init_vars: neighbor list -> local_env) =
fun _nl ->
function _ -> I (Random.int 10)
let (enable_f:neighbor list -> local_env -> action list) =
fun nl e ->
match (List.hd nl).lenv "c" with
| I 0 -> ["action2"]
| I 1 -> []
| I _ -> ["action1"]
| _ -> assert false
let (step_f : neighbor list -> local_env -> action -> local_env) =
fun nl e ->
function
| "action1" -> (function "c" -> I 0 | _ -> assert false)
| "action2" -> (function "c" -> I 1 | _ -> assert false)
| _ -> e
let () =
let algo_id = "p" in
Algo.reg_actions algo_id ["action1";"action2"];
Algo.reg_vars algo_id vars;
Algo.reg_init_vars algo_id init_vars;
Algo.reg_enable algo_id enable_f;
Algo.reg_step algo_id step_f;
()
graph ring7 {
p1 [algo="p.ml"]
p2 [algo="p.ml" ]
p3 [algo="p.ml"]
p4 [algo="p.ml"]
p5 [algo="p.ml"]
p6 [algo="p.ml"]
p7 [algo="p.ml"]
p1 -- p2 -- p3 -- p4 -- p5 -- p6 -- p7 -- p1
}
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