Skip to content

Commit 98c9fa7

Browse files
prepare for handling integer intervals
1 parent 36453c5 commit 98c9fa7

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/nlsat/nlsat_evaluator.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ namespace nlsat {
488488
return sign;
489489
}
490490

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

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

692692
void evaluator::push() {

src/nlsat/nlsat_evaluator.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace nlsat {
5151
Let x be a->max_var(). Then, the resultant set specifies which
5252
values of x falsify the given literal.
5353
*/
54-
interval_set_ref infeasible_intervals(atom * a, bool neg, clause const* cls);
54+
interval_set_ref infeasible_intervals(atom * a, bool is_int, bool neg, clause const* cls);
5555

5656
void push();
5757
void pop(unsigned num_scopes);

src/nlsat/nlsat_interval_set.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -695,12 +695,11 @@ namespace nlsat {
695695
scoped_mpq _w(m_am.qm());
696696
m_am.qm().set(_w, num, den);
697697
m_am.set(w, _w);
698-
return;
699698
}
700699
else {
701700
m_am.set(w, 0);
702-
return;
703701
}
702+
return;
704703
}
705704

706705
unsigned n = 0;
@@ -741,7 +740,7 @@ namespace nlsat {
741740
for (unsigned i = 1; i < num; i++) {
742741
if (s->m_intervals[i-1].m_upper_open && s->m_intervals[i].m_lower_open) {
743742
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
744-
if (m_am.is_rational(s->m_intervals[i-1].m_upper)) {
743+
if (m_am.is_rational(s->m_intervals[i-1].m_upper)) {
745744
m_am.set(w, s->m_intervals[i-1].m_upper);
746745
return;
747746
}

src/nlsat/nlsat_solver.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ namespace nlsat {
486486
SASSERT(x == num_vars());
487487
m_is_int. push_back(is_int);
488488
m_watches. push_back(clause_vector());
489-
m_infeasible.push_back(0);
489+
m_infeasible.push_back(nullptr);
490490
m_var2eq. push_back(nullptr);
491491
m_perm. push_back(x);
492492
m_inv_perm. push_back(x);
@@ -1006,7 +1006,8 @@ namespace nlsat {
10061006
}
10071007

10081008
void undo_set_updt(interval_set * old_set) {
1009-
if (m_xk == null_var) return;
1009+
if (m_xk == null_var)
1010+
return;
10101011
var x = m_xk;
10111012
if (x < m_infeasible.size()) {
10121013
m_ism.dec_ref(m_infeasible[x]);
@@ -1356,7 +1357,7 @@ namespace nlsat {
13561357
atom * a = m_atoms[b];
13571358
SASSERT(a != nullptr);
13581359
interval_set_ref curr_set(m_ism);
1359-
curr_set = m_evaluator.infeasible_intervals(a, l.sign(), &cls);
1360+
curr_set = m_evaluator.infeasible_intervals(a, is_int(m_xk), l.sign(), &cls);
13601361
TRACE("nlsat_inf_set", tout << "infeasible set for literal: "; display(tout, l); tout << "\n"; m_ism.display(tout, curr_set); tout << "\n";
13611362
display(tout, cls) << "\n";);
13621363
if (m_ism.is_empty(curr_set)) {

0 commit comments

Comments
 (0)