Skip to content

Commit

Permalink
prepare for handling integer intervals
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Jan 23, 2024
1 parent 36453c5 commit 98c9fa7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/nlsat/nlsat_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ namespace nlsat {
return sign;
}

interval_set_ref infeasible_intervals(ineq_atom * a, bool neg, clause const* cls) {
interval_set_ref infeasible_intervals(ineq_atom * a, bool is_int, bool neg, clause const* cls) {
sign_table & table = m_sign_table_tmp;
table.reset();
TRACE("nlsat_evaluator", m_solver.display(tout, *a) << "\n";);
Expand Down Expand Up @@ -685,8 +685,8 @@ namespace nlsat {
return m_imp->eval(a, neg);
}

interval_set_ref evaluator::infeasible_intervals(atom * a, bool neg, clause const* cls) {
return m_imp->infeasible_intervals(a, neg, cls);
interval_set_ref evaluator::infeasible_intervals(atom * a, bool is_int, bool neg, clause const* cls) {
return m_imp->infeasible_intervals(a, is_int, neg, cls);
}

void evaluator::push() {
Expand Down
2 changes: 1 addition & 1 deletion src/nlsat/nlsat_evaluator.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace nlsat {
Let x be a->max_var(). Then, the resultant set specifies which
values of x falsify the given literal.
*/
interval_set_ref infeasible_intervals(atom * a, bool neg, clause const* cls);
interval_set_ref infeasible_intervals(atom * a, bool is_int, bool neg, clause const* cls);

void push();
void pop(unsigned num_scopes);
Expand Down
5 changes: 2 additions & 3 deletions src/nlsat/nlsat_interval_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,12 +695,11 @@ namespace nlsat {
scoped_mpq _w(m_am.qm());
m_am.qm().set(_w, num, den);
m_am.set(w, _w);
return;
}
else {
m_am.set(w, 0);
return;
}
return;
}

unsigned n = 0;
Expand Down Expand Up @@ -741,7 +740,7 @@ namespace nlsat {
for (unsigned i = 1; i < num; i++) {
if (s->m_intervals[i-1].m_upper_open && s->m_intervals[i].m_lower_open) {
SASSERT(m_am.eq(s->m_intervals[i-1].m_upper, s->m_intervals[i].m_lower)); // otherwise we would have found it in the previous step
if (m_am.is_rational(s->m_intervals[i-1].m_upper)) {
if (m_am.is_rational(s->m_intervals[i-1].m_upper)) {
m_am.set(w, s->m_intervals[i-1].m_upper);
return;
}
Expand Down
7 changes: 4 additions & 3 deletions src/nlsat/nlsat_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ namespace nlsat {
SASSERT(x == num_vars());
m_is_int. push_back(is_int);
m_watches. push_back(clause_vector());
m_infeasible.push_back(0);
m_infeasible.push_back(nullptr);
m_var2eq. push_back(nullptr);
m_perm. push_back(x);
m_inv_perm. push_back(x);
Expand Down Expand Up @@ -1006,7 +1006,8 @@ namespace nlsat {
}

void undo_set_updt(interval_set * old_set) {
if (m_xk == null_var) return;
if (m_xk == null_var)
return;
var x = m_xk;
if (x < m_infeasible.size()) {
m_ism.dec_ref(m_infeasible[x]);
Expand Down Expand Up @@ -1356,7 +1357,7 @@ namespace nlsat {
atom * a = m_atoms[b];
SASSERT(a != nullptr);
interval_set_ref curr_set(m_ism);
curr_set = m_evaluator.infeasible_intervals(a, l.sign(), &cls);
curr_set = m_evaluator.infeasible_intervals(a, is_int(m_xk), l.sign(), &cls);
TRACE("nlsat_inf_set", tout << "infeasible set for literal: "; display(tout, l); tout << "\n"; m_ism.display(tout, curr_set); tout << "\n";
display(tout, cls) << "\n";);
if (m_ism.is_empty(curr_set)) {
Expand Down

0 comments on commit 98c9fa7

Please sign in to comment.