Skip to content

Commit

Permalink
do_optimize only performs side effects
Browse files Browse the repository at this point in the history
  • Loading branch information
bclement-ocp committed Aug 29, 2024
1 parent a16677e commit 4275551
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/lib/reasoners/satml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1949,7 +1949,7 @@ module Make (Th : Theory.S) : SAT_ML with type th = Th.t = struct
about these at the SAT level. *)
let rec loop env =
let acts = theory_slice env in
env.tenv <- Th.do_optimize ~acts env.tenv;
Th.do_optimize ~acts env.tenv;
if not (is_sat env) then
try solve env; assert false
with Sat -> loop env
Expand Down
9 changes: 4 additions & 5 deletions src/lib/reasoners/theory.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module type S = sig
val get_real_env : t -> Ccx.Main.t
val get_case_split_env : t -> Ccx.Main.t
val do_optimize :
acts:Shostak.Literal.t Th_util.acts -> t -> t
acts:Shostak.Literal.t Th_util.acts -> t -> unit
val do_case_split :
?acts:Shostak.Literal.t Th_util.acts ->
t -> Util.case_split_policy -> t * Expr.Set.t
Expand Down Expand Up @@ -677,9 +677,8 @@ module Main_Default : S = struct
match Objective.Model.next_unknown objectives with
| Some obj ->
let add_objective = acts.Th_util.acts_add_objective in
optimize_obj ~for_model:false add_objective obj t;
t
| None -> t
optimize_obj ~for_model:false add_objective obj t
| None -> ()

let do_sat_splits acts t =
let splits, t = sat_splits t in
Expand Down Expand Up @@ -963,7 +962,7 @@ module Main_Empty : S = struct

let get_real_env _ = CC_X.empty
let get_case_split_env _ = CC_X.empty
let do_optimize ~acts:_ env = env
let do_optimize ~acts:_ _ = ()
let do_case_split ?acts:_ env _ = env, E.Set.empty
let add_term env _ ~add_in_cs:_ = env
let compute_concrete_model ~acts:_ _env = ()
Expand Down
2 changes: 1 addition & 1 deletion src/lib/reasoners/theory.mli
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module type S = sig
val get_real_env : t -> Ccx.Main.t
val get_case_split_env : t -> Ccx.Main.t
val do_optimize :
acts:Shostak.Literal.t Th_util.acts -> t -> t
acts:Shostak.Literal.t Th_util.acts -> t -> unit
val do_case_split :
?acts:Shostak.Literal.t Th_util.acts ->
t -> Util.case_split_policy -> t * Expr.Set.t
Expand Down

0 comments on commit 4275551

Please sign in to comment.