From 6ab7b45195b64a85a8f9780201c8de76461f59cc Mon Sep 17 00:00:00 2001 From: Erwan Jahier <erwan.jahier@univ-grenoble-alpes.fr> Date: Mon, 31 May 2021 11:33:19 +0200 Subject: [PATCH] Do not raise an error when an algorithm becomes silent. --- lib/sasacore/daemon.ml | 59 +++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/lib/sasacore/daemon.ml b/lib/sasacore/daemon.ml index fbc7298c..1df0f285 100644 --- a/lib/sasacore/daemon.ml +++ b/lib/sasacore/daemon.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 27/05/2021 (at 09:06) by Erwan Jahier> *) +(* Time-stamp: <modified the 31/05/2021 (at 11:22) by Erwan Jahier> *) type t = | Synchronous (* select all actions *) @@ -147,29 +147,34 @@ let (f: bool -> bool -> t -> 'v Process.t list -> bool list list * 'v pna list) = fun dummy_input verbose_mode daemon pl neigbors_of_pid e all enab get_action_value -> let nall = remove_empty_list all in - if nall = [] then failwith "Silent"; - if daemon <> Custom && dummy_input then - ignore (RifRead.bool verbose_mode ((List.hd pl).pid) ""); - match daemon with - | Synchronous -> - let al = synchrone nall in - get_activate_val al pl, al - | Central -> - let al = central nall in - get_activate_val al pl, al - | LocallyCentral -> - let al = locally_central_pna nall in - get_activate_val al pl, al - | Distributed -> - let al = distributed nall in - get_activate_val al pl, al - | Greedy -> - let al = Evil.greedy verbose_mode e pl neigbors_of_pid nall in - get_activate_val al pl, al - | GreedyCentral -> - let al = Evil.greedy_central verbose_mode e pl neigbors_of_pid nall in - get_activate_val al pl, al - | Bad i -> - let al = Evil.bad i e nall in - get_activate_val al pl, al - | Custom -> custom all pl enab get_action_value + if nall = [] then ( + Printf.printf "Warning: the algorithm is now Silent\n%!"; + get_activate_val [] pl, [] + ) + else ( + if daemon <> Custom && dummy_input then + ignore (RifRead.bool verbose_mode ((List.hd pl).pid) ""); + match daemon with + | Synchronous -> + let al = synchrone nall in + get_activate_val al pl, al + | Central -> + let al = central nall in + get_activate_val al pl, al + | LocallyCentral -> + let al = locally_central_pna nall in + get_activate_val al pl, al + | Distributed -> + let al = distributed nall in + get_activate_val al pl, al + | Greedy -> + let al = Evil.greedy verbose_mode e pl neigbors_of_pid nall in + get_activate_val al pl, al + | GreedyCentral -> + let al = Evil.greedy_central verbose_mode e pl neigbors_of_pid nall in + get_activate_val al pl, al + | Bad i -> + let al = Evil.bad i e nall in + get_activate_val al pl, al + | Custom -> custom all pl enab get_action_value + ) -- GitLab