Skip to content

Commit 4d1d067

Browse files
fix divergence reported by Guido Martinez
1 parent 6afed08 commit 4d1d067

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

src/math/lp/emonics.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,4 +611,19 @@ void emonics::set_propagated(monic const& m) {
611611
m_u_f_stack.push(set_unpropagated(*this, m.var()));
612612
}
613613

614+
void emonics::set_bound_propagated(monic const& m) {
615+
struct set_bound_unpropagated : public trail {
616+
emonics& em;
617+
unsigned var;
618+
public:
619+
set_bound_unpropagated(emonics& em, unsigned var): em(em), var(var) {}
620+
void undo() override {
621+
em[var].set_bound_propagated(false);
622+
}
623+
};
624+
SASSERT(!m.is_bound_propagated());
625+
(*this)[m.var()].set_bound_propagated(true);
626+
m_u_f_stack.push(set_bound_unpropagated(*this, m.var()));
627+
}
628+
614629
}

src/math/lp/emonics.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class emonics {
143143
void after_merge_eh(unsigned r2, unsigned r1, unsigned v2, unsigned v1) {}
144144

145145
void set_propagated(monic const& m);
146+
void set_bound_propagated(monic const& m);
146147

147148
// this method is required by union_find
148149
trail_stack & get_trail_stack() { return m_u_f_stack; }

src/math/lp/monic.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class monic: public mon_eq {
5959
bool m_rsign;
6060
mutable unsigned m_visited;
6161
bool m_propagated = false;
62+
bool m_bound_propagated = false;
6263
public:
6364
// constructors
6465
monic(lpvar v, unsigned sz, lpvar const* vs, unsigned idx):
@@ -77,6 +78,8 @@ class monic: public mon_eq {
7778
void sort_rvars() { std::sort(m_rvars.begin(), m_rvars.end()); }
7879
void set_propagated(bool p) { m_propagated = p; }
7980
bool is_propagated() const { return m_propagated; }
81+
void set_bound_propagated(bool p) { m_bound_propagated = p; }
82+
bool is_bound_propagated() const { return m_bound_propagated; }
8083

8184
svector<lpvar>::const_iterator begin() const { return vars().begin(); }
8285
svector<lpvar>::const_iterator end() const { return vars().end(); }

src/math/lp/nla_core.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,9 @@ void core::add_bounds() {
15171517
for (lpvar j : m.vars()) {
15181518
if (!var_is_free(j))
15191519
continue;
1520+
if (m.is_bound_propagated())
1521+
continue;
1522+
m_emons.set_bound_propagated(m);
15201523
// split the free variable (j <= 0, or j > 0), and return
15211524
m_literals.push_back(ineq(j, lp::lconstraint_kind::EQ, rational::zero()));
15221525
TRACE("nla_solver", print_ineq(m_literals.back(), tout) << "\n");

0 commit comments

Comments
 (0)