3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-04-25 05:13:32 +00:00

fix #9012: incorrect optimization of mod in box mode

Push/pop isolation in maximize_objectives1 (added for #7677) can corrupt
LP column values between objectives. For non-linear objectives like mod,
the LP maximize call may return stale values after a preceding
objective's push/pop cycle.

Fix: save the baseline model before the push/pop loop and use it as a
floor for each objective's value. Extract two helpers:
- maximize_objective_isolated: push/pop + save/restore per objective
- update_from_baseline_model: adopt baseline model value when it is better

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Lev Nachmanson 2026-03-16 07:28:34 -10:00
parent fe6efef808
commit f03cac6e51
2 changed files with 65 additions and 23 deletions

View file

@ -167,6 +167,8 @@ namespace opt {
void reset_objectives();
bool maximize_objective(unsigned i, expr_ref& blocker);
bool maximize_objectives1(expr_ref_vector& blockers);
bool maximize_objective_isolated(unsigned i, model_ref& baseline_model, expr_ref& blocker);
void update_from_baseline_model(unsigned i, model_ref& baseline_model, expr_ref& blocker);
inf_eps const & saved_objective_value(unsigned obj_index);
inf_eps current_objective_value(unsigned obj_index);
model* get_model_idx(unsigned obj_index) { return m_models[obj_index]; }