3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-04-03 16:37:59 -07:00
parent 0b856638e9
commit 426e4cc75c
65 changed files with 135 additions and 146 deletions

View file

@ -159,7 +159,7 @@ namespace opt {
switch (is_sat) {
case l_true:
update_assignment();
SASSERT(soft.value == l_true || m.canceled());
SASSERT(soft.value == l_true || m.limit().get_cancel_flag());
break;
case l_false:
soft.set_value(l_false);

View file

@ -207,7 +207,7 @@ public:
s().display(tout << m_asms << "\n") << "\n";
display(tout););
is_sat = check_sat_hill_climb(m_asms);
if (m.canceled()) {
if (!m.inc()) {
return l_undef;
}
switch (is_sat) {
@ -247,7 +247,7 @@ public:
if (is_sat != l_true) return is_sat;
while (m_lower < m_upper) {
is_sat = check_sat_hill_climb(m_asms);
if (m.canceled()) {
if (!m.inc()) {
return l_undef;
}
switch (is_sat) {
@ -862,7 +862,7 @@ public:
tout << "other solver\n";
s().display(tout);
);
VERIFY(is_sat == l_false || m.canceled());
VERIFY(is_sat == l_false || !m.inc());
}
void verify_assumptions() {

View file

@ -615,7 +615,7 @@ namespace opt {
std::string context::reason_unknown() const {
if (m.canceled()) {
if (!m.inc()) {
return Z3_CANCELED_MSG;
}
if (m_solver.get()) {

View file

@ -36,7 +36,7 @@ namespace opt {
m_solver->get_model(m_model);
solver::scoped_push _s(*m_solver.get());
while (is_sat == l_true) {
if (m.canceled()) {
if (!m.inc()) {
return l_undef;
}
@ -96,7 +96,7 @@ namespace opt {
lbool oia_pareto::operator()() {
solver::scoped_push _s(*m_solver.get());
lbool is_sat = m_solver->check_sat(0, nullptr);
if (m.canceled()) {
if (!m.inc()) {
is_sat = l_undef;
}
if (is_sat == l_true) {

View file

@ -71,7 +71,7 @@ namespace opt {
expr* vars[1];
solver::scoped_push _push(*m_s);
while (is_sat == l_true && !m.canceled()) {
while (is_sat == l_true && m.inc()) {
tmp = m.mk_fresh_const("b", m.mk_bool_sort());
vars[0] = tmp;
@ -83,7 +83,7 @@ namespace opt {
}
}
if (m.canceled() || is_sat == l_undef) {
if (!m.inc() || is_sat == l_undef) {
return l_undef;
}
@ -110,7 +110,7 @@ namespace opt {
unsigned num_scopes = 0;
unsigned delta_index = 0; // index of objective to speed up.
while (!m.canceled()) {
while (m.inc()) {
SASSERT(delta_per_step.is_int());
SASSERT(delta_per_step.is_pos());
is_sat = m_s->check_sat(0, nullptr);
@ -176,7 +176,7 @@ namespace opt {
}
}
if (m.canceled() || is_sat == l_undef) {
if (!m.inc() || is_sat == l_undef) {
return l_undef;
}
@ -208,7 +208,7 @@ namespace opt {
rational delta_per_step(1);
unsigned num_scopes = 0;
while (!m.canceled()) {
while (m.inc()) {
SASSERT(delta_per_step.is_int());
SASSERT(delta_per_step.is_pos());
is_sat = m_s->check_sat(0, nullptr);
@ -265,7 +265,7 @@ namespace opt {
return l_false;
}
if (m.canceled() || is_sat == l_undef) {
if (!m.inc() || is_sat == l_undef) {
return l_undef;
}
@ -315,7 +315,7 @@ namespace opt {
lbool is_sat = l_true;
solver::scoped_push _push(*m_s);
while (!m.canceled()) {
while (m.inc()) {
m_s->assert_expr(fml);
TRACE("opt", tout << fml << "\n";);
is_sat = m_s->check_sat(1,vars);
@ -349,7 +349,7 @@ namespace opt {
bound = mk_or(m_lower_fmls);
m_s->assert_expr(bound);
if (m.canceled()) {
if (!m.inc()) {
return l_undef;
}
return geometric_opt();
@ -418,7 +418,7 @@ namespace opt {
vector<inf_eps> mid;
for (unsigned i = 0; i < m_lower.size() && !m.canceled(); ++i) {
for (unsigned i = 0; i < m_lower.size() && m.inc(); ++i) {
if (m_lower[i] < m_upper[i]) {
mid.push_back((m_upper[i]+m_lower[i])/rational(2));
bound = m_s->mk_ge(i, mid[i]);
@ -430,7 +430,7 @@ namespace opt {
}
}
bool progress = false;
for (unsigned i = 0; i < m_lower.size() && !m.canceled(); ++i) {
for (unsigned i = 0; i < m_lower.size() && m.inc(); ++i) {
if (m_lower[i] <= mid[i] && mid[i] <= m_upper[i] && m_lower[i] < m_upper[i]) {
th.enable_record_conflict(bounds[i].get());
lbool is_sat = m_s->check_sat(1, bounds.c_ptr() + i);
@ -460,7 +460,7 @@ namespace opt {
progress = true;
}
}
if (m.canceled()) {
if (!m.inc()) {
return l_undef;
}
if (!progress) {

View file

@ -194,7 +194,7 @@ namespace smt {
while (m_max_flips > 0) {
--m_max_flips;
literal lit = flip();
if (m.canceled()) {
if (!m.inc()) {
return l_undef;
}
IF_VERBOSE(3, verbose_stream()

View file

@ -90,7 +90,7 @@ namespace opt {
s().assert_expr(out[first]);
is_sat = s().check_sat(0, nullptr);
TRACE("opt", tout << is_sat << "\n"; s().display(tout); tout << "\n";);
if (m.canceled()) {
if (!m.inc()) {
is_sat = l_undef;
}
if (is_sat == l_true) {

View file

@ -77,9 +77,9 @@ namespace opt {
TRACE("opt",
s().display(tout)<< "\n";
tout << "lower: " << m_lower << " upper: " << m_upper << "\n";);
while (!m.canceled() && m_lower < m_upper) {
while (m.inc() && m_lower < m_upper) {
is_sat = s().check_sat(0, nullptr);
if (m.canceled()) {
if (!m.inc()) {
is_sat = l_undef;
}
if (is_sat == l_undef) {
@ -106,7 +106,7 @@ namespace opt {
update_assignment();
if (!m.canceled() && is_sat == l_undef && m_lower == m_upper) {
if (m.inc() && is_sat == l_undef && m_lower == m_upper) {
is_sat = l_true;
}
if (is_sat == l_false) {