mirror of
https://github.com/Z3Prover/z3
synced 2025-06-23 06:13:40 +00:00
parent
7cb6f41d0a
commit
19cdf08818
2 changed files with 8 additions and 1 deletions
|
@ -230,6 +230,8 @@ namespace opt {
|
||||||
causes an additional call to final_check to propagate theory equalities
|
causes an additional call to final_check to propagate theory equalities
|
||||||
when 'has_shared' is true).
|
when 'has_shared' is true).
|
||||||
|
|
||||||
|
Precondition: the state of the solver is satisfiable and such that a current model can be extracted.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
void opt_solver::maximize_objective(unsigned i, expr_ref& blocker) {
|
void opt_solver::maximize_objective(unsigned i, expr_ref& blocker) {
|
||||||
smt::theory_var v = m_objective_vars[i];
|
smt::theory_var v = m_objective_vars[i];
|
||||||
|
@ -249,6 +251,8 @@ namespace opt {
|
||||||
else if (m_context.get_context().update_model(has_shared)) {
|
else if (m_context.get_context().update_model(has_shared)) {
|
||||||
if (has_shared && val != current_objective_value(i)) {
|
if (has_shared && val != current_objective_value(i)) {
|
||||||
decrement_value(i, val);
|
decrement_value(i, val);
|
||||||
|
if (l_true != m_context.check(0, nullptr))
|
||||||
|
throw default_exception("maximization suspended");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
set_model(i);
|
set_model(i);
|
||||||
|
@ -257,6 +261,8 @@ namespace opt {
|
||||||
else {
|
else {
|
||||||
SASSERT(has_shared);
|
SASSERT(has_shared);
|
||||||
decrement_value(i, val);
|
decrement_value(i, val);
|
||||||
|
if (l_true != m_context.check(0, nullptr))
|
||||||
|
throw default_exception("maximization suspended");
|
||||||
}
|
}
|
||||||
m_objective_values[i] = val;
|
m_objective_values[i] = val;
|
||||||
TRACE("opt", {
|
TRACE("opt", {
|
||||||
|
|
|
@ -1543,6 +1543,7 @@ namespace smt {
|
||||||
bool inc = false;
|
bool inc = false;
|
||||||
context& ctx = get_context();
|
context& ctx = get_context();
|
||||||
|
|
||||||
|
|
||||||
SASSERT(!maintain_integrality || valid_assignment());
|
SASSERT(!maintain_integrality || valid_assignment());
|
||||||
SASSERT(satisfy_bounds());
|
SASSERT(satisfy_bounds());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue