Commit 61b1c5a3 authored by erwan's avatar erwan
Browse files

Chore: rename some type aliases

parent ef5219ea
(* Time-stamp: <modified the 17/06/2021 (at 11:32) by Erwan Jahier> *)
(* Time-stamp: <modified the 18/06/2021 (at 16:23) by Erwan Jahier> *)
(* Enabled processes (with its enabling action + neighbors) *)
type 'v pna = 'v Process.t * 'v Register.neighbor list * Register.action
type 'v step = 'v pna list -> 'v SimuState.t -> 'v SimuState.t
type 'v enabled = 'v pna list list
type 'v triggered = 'v pna list
type 'v step = 'v triggered -> 'v SimuState.t -> 'v SimuState.t
let (random_list : 'a list -> 'a) = fun l ->
assert (l <> []);
......@@ -43,7 +46,7 @@ let (synchrone: 'a list list -> 'a list) = fun all ->
XXX this daemon is not fair: it is biased by the degree of nodes.
*)
let (locally_central_pna: 'v pna list list -> 'v pna list) =
let (locally_central_pna: 'v enabled -> 'v triggered) =
fun all ->
let remove_one_conflict al =
let _a, al = random_list2 al in
......@@ -93,8 +96,8 @@ let rec map3 f l1 l2 l3 =
| (_, _, []) -> invalid_arg "map3 (3rd arg too short)"
let (custom: 'v pna list list -> 'v Process.t list -> bool list list ->
(string -> string -> bool) -> bool list list * 'v pna list) =
let (custom: 'v enabled -> 'v Process.t list -> bool list list ->
(string -> string -> bool) -> bool list list * 'v triggered) =
fun pnall pl enab_ll get_action_value ->
let f p pnal enab_l =
let actions = p.Process.actions in
......@@ -122,7 +125,7 @@ let (remove_empty_list: 'a list list -> 'a list list) =
fun ll ->
List.filter (fun l -> l<>[]) ll
let (get_activate_val: 'v pna list -> 'v Process.t list -> bool list list)=
let (get_activate_val: 'v triggered -> 'v Process.t list -> bool list list)=
fun al pl ->
let actions =
List.map (fun p -> List.map (fun a -> p,a) p.Process.actions) pl
......@@ -132,8 +135,8 @@ let (get_activate_val: 'v pna list -> 'v Process.t list -> bool list list)=
let (f: bool -> bool -> DaemonType.t -> 'v Process.t list ->
(string -> 'v * ('v Register.neighbor * string) list) -> 'v SimuState.t ->
'v pna list list -> bool list list -> (string -> string -> bool) -> 'v step ->
bool list list * 'v pna list) =
'v enabled -> bool list list -> (string -> string -> bool) -> 'v step ->
bool list list * 'v triggered) =
fun dummy_in verbose_mode daemon pl neigbors_of_pid st all enab get_action_value step ->
let nall = remove_empty_list all in
if nall = [] then (
......
(* Time-stamp: <modified the 17/06/2021 (at 11:33) by Erwan Jahier> *)
(* Time-stamp: <modified the 18/06/2021 (at 16:22) by Erwan Jahier> *)
type 'v pna = 'v Process.t * 'v Register.neighbor list * Register.action
type 'v enabled = 'v pna list list
type 'v triggered = 'v pna list
(** f dummy_input_flag verbose_mode daemon p_nl_l actions_ll enab
inputs:
......@@ -28,12 +30,12 @@ nb: it is possible that we read on stdin that an action should be
inhibit the activation.
*)
type 'v step = 'v pna list -> 'v SimuState.t -> 'v SimuState.t
type 'v step = 'v triggered -> 'v SimuState.t -> 'v SimuState.t
val f : bool -> bool -> DaemonType.t -> 'v Process.t list ->
(string -> 'v * ('v Register.neighbor * string) list) ->
'v SimuState.t -> 'v pna list list -> bool list list ->
(string -> string -> bool) -> 'v step -> bool list list * 'v pna list
'v SimuState.t -> 'v enabled -> bool list list ->
(string -> string -> bool) -> 'v step -> bool list list * 'v triggered
(** Used in gtkgui.ml *)
......
(* Time-stamp: <modified the 17/06/2021 (at 11:32) by Erwan Jahier> *)
(* Time-stamp: <modified the 18/06/2021 (at 16:25) by Erwan Jahier> *)
type 'v pna = 'v Process.t * 'v Register.neighbor list * Register.action
type 'v step = 'v pna list -> 'v SimuState.t -> 'v SimuState.t
type 'v enabled = 'v pna list list
type 'v triggered = 'v pna list
type 'v step = 'v triggered -> 'v SimuState.t -> 'v SimuState.t
(* Enumerate all schedules using continuations *)
type 'a cont = NoMore | Elt of 'a * (unit -> 'a cont)
......
(* Time-stamp: <modified the 17/06/2021 (at 15:28) by Erwan Jahier> *)
(* Time-stamp: <modified the 18/06/2021 (at 16:25) by Erwan Jahier> *)
(** This module gathers daemons that tries to reach the worst case with
a potential function using various heuristic. *)
type 'v pna = 'v Process.t * 'v Register.neighbor list * Register.action
type 'v step = 'v pna list -> 'v SimuState.t -> 'v SimuState.t
type 'v enabled = 'v pna list list
type 'v triggered = 'v pna list
type 'v step = 'v triggered -> 'v SimuState.t -> 'v SimuState.t
(** [greedy verb st pl neighbors_of_pid step all] take the worst case
among the combinations of length 1, i.e., O(2^n) where n is the
number of enabled processes (|all|) *)
val greedy: bool -> 'v SimuState.t -> 'v Process.t list ->
(string -> 'v * ('v Register.neighbor * string) list) ->
'v step -> 'v pna list list -> 'v pna list
'v step -> 'v enabled -> 'v triggered
(** Ditto, but for central daemons (of a connected component) *)
val greedy_central:
bool -> 'v SimuState.t -> 'v Process.t list ->
(string -> 'v * ('v Register.neighbor * string) list) ->
'v step -> 'v pna list list -> 'v pna list
'v step -> 'v enabled -> 'v triggered
(** Returns the worst case among the combinations of length 1 for
convex potential functions, and just a bad one otherwise (O(n)
where n is the number of enabled processes). *)
val worst4convex: 'v SimuState.t -> 'v pna list list -> 'v pna list
val worst4convex: 'v SimuState.t -> 'v enabled -> 'v triggered
(** enumerate all the cases (of length 1) in sub-graphs of given size (O(2^size_max)) *)
val bad: int -> 'v SimuState.t -> 'v pna list list -> 'v pna list
val bad: int -> 'v SimuState.t -> 'v enabled -> 'v triggered
......@@ -238,7 +238,7 @@ let u () = undo (); ignore (round !e);;
let r () =
let seed = Seed.get dotfile in
Seed.set seed;
Printf.sprintf "Restarting using the seed %d" seed;
Printf.printf "Restarting using the seed %d" seed;
!e.RdbgEvent.reset();
e:=RdbgStdLib.run ~call_hooks:true ();
round_reset !e.nb;
......
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