mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
fix another bug uncovered by Dunlop, prepare grounds for equality solving within NNFs
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
eaa80d5b02
commit
0b84c60886
13 changed files with 283 additions and 122 deletions
|
@ -383,6 +383,7 @@ public:
|
|||
}
|
||||
if (core.empty()) {
|
||||
IF_VERBOSE(100, verbose_stream() << "(opt.maxres core is empty)\n";);
|
||||
TRACE("opt", tout << "empty core\n";);
|
||||
cores.reset();
|
||||
m_lower = m_upper;
|
||||
return l_true;
|
||||
|
@ -517,6 +518,10 @@ public:
|
|||
max_resolve(core, w);
|
||||
fml = mk_not(m, mk_and(m, core.size(), core.c_ptr()));
|
||||
add(fml);
|
||||
// save small cores such that lex-combinations of maxres can reuse these cores.
|
||||
if (core.size() <= 2) {
|
||||
m_defs.push_back(fml);
|
||||
}
|
||||
m_lower += w;
|
||||
if (m_st == s_primal_dual) {
|
||||
m_lower = std::min(m_lower, m_upper);
|
||||
|
@ -847,7 +852,10 @@ public:
|
|||
_solver->assert_expr(s().get_assertions());
|
||||
_solver->assert_expr(core);
|
||||
lbool is_sat = _solver->check_sat(0, nullptr);
|
||||
IF_VERBOSE(0, verbose_stream() << "core status (l_false:) " << is_sat << "\n");
|
||||
IF_VERBOSE(0, verbose_stream() << "core status (l_false:) " << is_sat << " core size " << core.size() << "\n");
|
||||
CTRACE("opt", is_sat != l_false,
|
||||
for (expr* c : core) tout << "core: " << mk_pp(c, m) << "\n";
|
||||
_solver->display(tout););
|
||||
VERIFY(is_sat == l_false);
|
||||
}
|
||||
|
||||
|
|
|
@ -383,7 +383,7 @@ namespace opt {
|
|||
lbool context::execute_min_max(unsigned index, bool committed, bool scoped, bool is_max) {
|
||||
if (scoped) get_solver().push();
|
||||
lbool result = m_optsmt.lex(index, is_max);
|
||||
if (result == l_true) m_optsmt.get_model(m_model, m_labels);
|
||||
if (result == l_true) { m_optsmt.get_model(m_model, m_labels); SASSERT(m_model); }
|
||||
if (scoped) get_solver().pop(1);
|
||||
if (result == l_true && committed) m_optsmt.commit_assignment(index);
|
||||
if (result == l_true && m_optsmt.is_unbounded(index, is_max) && contains_quantifiers()) {
|
||||
|
@ -1604,6 +1604,7 @@ namespace opt {
|
|||
void context::validate_lex() {
|
||||
rational r1;
|
||||
expr_ref val(m);
|
||||
SASSERT(m_model);
|
||||
for (unsigned i = 0; i < m_objectives.size(); ++i) {
|
||||
objective const& obj = m_objectives[i];
|
||||
switch(obj.m_type) {
|
||||
|
|
|
@ -171,6 +171,7 @@ namespace opt {
|
|||
}
|
||||
|
||||
lbool optsmt::geometric_lex(unsigned obj_index, bool is_maximize) {
|
||||
TRACE("opt", tout << "index: " << obj_index << " is-max: " << is_maximize << "\n";);
|
||||
arith_util arith(m);
|
||||
bool is_int = arith.is_int(m_objs[obj_index].get());
|
||||
lbool is_sat = l_true;
|
||||
|
@ -189,9 +190,11 @@ namespace opt {
|
|||
SASSERT(delta_per_step.is_int());
|
||||
SASSERT(delta_per_step.is_pos());
|
||||
is_sat = m_s->check_sat(0, nullptr);
|
||||
TRACE("opt", tout << "check " << is_sat << "\n";);
|
||||
if (is_sat == l_true) {
|
||||
m_s->maximize_objective(obj_index, bound);
|
||||
m_s->get_model(m_model);
|
||||
SASSERT(m_model);
|
||||
m_s->get_labels(m_labels);
|
||||
inf_eps obj = m_s->saved_objective_value(obj_index);
|
||||
update_lower_lex(obj_index, obj, is_maximize);
|
||||
|
@ -220,13 +223,17 @@ namespace opt {
|
|||
delta_per_step = rational::one();
|
||||
SASSERT(num_scopes > 0);
|
||||
--num_scopes;
|
||||
m_s->pop(1);
|
||||
m_s->pop(1);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_s->pop(num_scopes);
|
||||
|
||||
if (is_sat == l_false && !m_model) {
|
||||
return l_false;
|
||||
}
|
||||
|
||||
if (m.canceled() || is_sat == l_undef) {
|
||||
return l_undef;
|
||||
|
@ -574,7 +581,7 @@ namespace opt {
|
|||
return m_upper[i];
|
||||
}
|
||||
|
||||
void optsmt::get_model(model_ref& mdl, svector<symbol> & labels) {
|
||||
void optsmt::get_model(model_ref& mdl, svector<symbol> & labels) {
|
||||
mdl = m_model.get();
|
||||
labels = m_labels;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue