From f217913caa0f6c8b9bef972afdf8fb0990d05cf5 Mon Sep 17 00:00:00 2001
From: Erwan Jahier <erwan.jahier@univ-grenoble-alpes.fr>
Date: Tue, 12 Oct 2021 16:01:45 +0200
Subject: [PATCH] ditto for k-clustering

---
 lib/sasacore/worstInit.ml   |  8 +++++---
 test/k-clustering/config.ml | 15 +++++++++++++--
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/lib/sasacore/worstInit.ml b/lib/sasacore/worstInit.ml
index 61926b42..545d7848 100644
--- a/lib/sasacore/worstInit.ml
+++ b/lib/sasacore/worstInit.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 11/10/2021 (at 16:38) by Erwan Jahier> *)
+(* Time-stamp: <modified the 12/10/2021 (at 16:22) by Erwan Jahier> *)
 
 open Register
 
@@ -213,8 +213,10 @@ let (fchc : out_channel -> ('v SimuState.t -> int) -> 'v SimuState.t -> int
       cut  = (fun pn n -> if pn.cost > n.cost then (
           Printf.fprintf log "%d: cut a point at depth %d of cost %d < %d\n%!"
             !cpt n.d n.cost pn.cost;
-          true)
-          else false             );
+          true
+        )
+          else false
+        );
     }
   in
   let rec run_more psol more =
diff --git a/test/k-clustering/config.ml b/test/k-clustering/config.ml
index 200a63d5..705f516c 100644
--- a/test/k-clustering/config.ml
+++ b/test/k-clustering/config.ml
@@ -41,5 +41,16 @@ let (pf: pid list -> (pid -> ('a * ('a neighbor * pid) list)) -> float) =
 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
+
+open State
+let maxi = 2*k+1
+    
+let s2n s = [I (0, s.alpha, maxi)]
+let n2s nl s =
+  match nl with
+  | [I(_, i, _)] ->  { s with alpha = i }
+  | _ -> assert false
+    
+let init_search_utils = Some (s2n, n2s)
+
-- 
GitLab