Skip to content

Commit

Permalink
check cancel flag to avoid unsound conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Nov 19, 2023
1 parent 32f8705 commit 4350bd7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/math/lp/int_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ namespace lp {
#endif
m_cut_vars.reset();
if (r == lia_move::undef) r = int_branch(*this)();
if (settings().get_cancel_flag()) r = lia_move::undef;
return r;
}

Expand Down Expand Up @@ -854,14 +855,16 @@ namespace lp {

struct ex { explanation m_ex; lar_term m_term; mpq m_k; bool m_is_upper; };
vector<ex> cuts;
for (unsigned i = 0; i < num_cuts && has_inf_int() && !settings().get_cancel_flag(); ++i) {
for (unsigned i = 0; i < num_cuts && has_inf_int(); ++i) {
m_ex->clear();
m_t.clear();
m_k.reset();
auto r = cut_fn();
if (r != lia_move::cut)
break;
cuts.push_back({ *m_ex, m_t, m_k, is_upper() });
if (settings().get_cancel_flag())
return lia_move::undef;
}
m_cut_vars.reset();

Expand All @@ -882,7 +885,7 @@ namespace lp {

auto _check_feasible = [&](void) {
auto st = lra.find_feasible_solution();
if (!lra.is_feasible()) {
if (!lra.is_feasible() && !settings().get_cancel_flag()) {
lra.get_infeasibility_explanation(*m_ex);
return false;
}
Expand Down Expand Up @@ -910,6 +913,9 @@ namespace lp {
bool feas = _check_feasible();
lra.pop(1);

if (settings().get_cancel_flag())
return lia_move::undef;

if (!feas)
return lia_move::conflict;

Expand Down
2 changes: 2 additions & 0 deletions src/math/lp/nla_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1567,6 +1567,8 @@ lbool core::check() {
{1, check3} };
check_weighted(3, checks);

if (lp_settings().get_cancel_flag())
return l_undef;
if (!m_lemmas.empty() || !m_literals.empty() || m_check_feasible)
return l_false;
}
Expand Down

0 comments on commit 4350bd7

Please sign in to comment.