Skip to content
Snippets Groups Projects
Commit c25cdb1c authored by erwan's avatar erwan
Browse files

feat: add a --es-dont-cut option, that unactivates B&B during ES

parent 03b830c2
No related branches found
No related tags found
No related merge requests found
(* Time-stamp: <modified the 27/02/2023 (at 15:25) by Erwan Jahier> *)
(* Time-stamp: <modified the 01/03/2023 (at 15:10) by Erwan Jahier> *)
open LocalSearch
......@@ -178,7 +178,7 @@ let (bnb : out_channel -> bool -> 'v ss ->
Some(x, t));
visiting = visiting;
visited = visited;
cut = (fun psol n -> if psol.cost >= n.cost then (
cut = (fun psol n -> if not args.es_dont_cut && psol.cost >= n.cost then (
if do_log args then
pf log "%d: cut at depth %d of cost %.1f<=%.1f\n%!" !cpt n.d n.cost psol.cost;
true
......@@ -241,8 +241,6 @@ let (bnb : out_channel -> bool -> 'v ss ->
cpt_of_last_improvement := nsol.cpt;
run_more nsol more
) else (
pf log "==> I've found a path of length %d! (after #%d steps)\n%!" nsol.d !cpt;
pf stdout "==> I've found a path of length %d (after #%d steps)\n%!" nsol.d !cpt;
run_more psol more
)
in
......
(* Time-stamp: <modified the 09/02/2023 (at 09:46) by Erwan Jahier> *)
(* Time-stamp: <modified the 01/03/2023 (at 12:21) by Erwan Jahier> *)
type init_search =
No_init_search | Local of int | Global of int | Annealing of int
......@@ -15,6 +15,7 @@ type t = {
mutable es_dfs: bool;
mutable es_tabu_mode: bool;
mutable es_continue_after_best: bool;
mutable es_dont_cut: bool;
mutable rif: bool;
mutable output_file_name: string option;
mutable no_data_file: bool;
......@@ -54,6 +55,7 @@ let (make_args : unit -> t) =
es_dfs = false;
es_tabu_mode = true;
es_continue_after_best = false;
es_dont_cut= false;
rif = false;
output_file_name = None;
no_data_file = false;
......@@ -175,7 +177,11 @@ let (mkoptab : string array -> t -> unit) =
mkopt args ~hide:true ["--es-continue-when-best-sol-found"]
(Arg.Unit(fun () -> args.es_continue_after_best <- true))
["For experiment purposes: do not stop when |path(sol)|=pot(init)" ];
["Do not stop when |path(sol)|=pot(init): this is necessary when E.x phi'(c)>0 (pseudo pot)" ];
mkopt args ~hide:true ["--es-dont-cut"]
(Arg.Unit(fun () -> args.es_dont_cut <- true))
["Do not cut path when n.cost < prev_sol.cost : this is useful when E.x phi'(c)>0 (pseudo pot)" ];
(* mkopt args ["--bad-daemon";"-bd"] ~arg:" <int>" *)
......
(* Time-stamp: <modified the 09/02/2023 (at 09:46) by Erwan Jahier> *)
(* Time-stamp: <modified the 01/03/2023 (at 12:20) by Erwan Jahier> *)
type init_search =
No_init_search | Local of int | Global of int | Annealing of int
......@@ -13,6 +13,7 @@ type t = {
mutable es_dfs: bool;
mutable es_tabu_mode: bool;
mutable es_continue_after_best: bool;
mutable es_dont_cut: bool;
mutable rif: bool;
mutable output_file_name: string option;
mutable no_data_file: bool;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment