Skip to content

Commit ea1360e

Browse files
fix #7578
Signed-off-by: Nikolaj Bjorner <[email protected]>
1 parent c002c77 commit ea1360e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/opt/optsmt.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,16 @@ namespace opt {
109109
rational delta_per_step(1);
110110
unsigned num_scopes = 0;
111111
unsigned delta_index = 0; // index of objective to speed up.
112+
bool has_bound = false; // is the current objective bounded by a constraint.
112113

113114
while (m.inc()) {
114115
SASSERT(delta_per_step.is_int());
115116
SASSERT(delta_per_step.is_pos());
116117
is_sat = m_s->check_sat(0, nullptr);
117118
if (is_sat == l_true) {
118119
bound = update_lower();
120+
if (!m.is_true(bound))
121+
has_bound = true;
119122
if (!can_increment_delta(lower, delta_index)) {
120123
delta_per_step = 1;
121124
}
@@ -133,10 +136,12 @@ namespace opt {
133136
// only try to improve delta_index.
134137
bound = m_s->mk_ge(delta_index, m_lower[delta_index] + inf_eps(delta_per_step));
135138
}
136-
TRACE("opt", tout << mk_pp(m_objs.get(delta_index), m) << " index: " << delta_index << " delta: " << delta_per_step << " : " << bound << "\n";);
139+
TRACE("opt", tout << mk_pp(m_objs.get(delta_index), m) << " index: " << delta_index
140+
<< " delta: " << delta_per_step << " bound: " << bound
141+
<< " " << m_lower[delta_index] << " " << m_upper[delta_index] << "\n");
137142
if (bound == last_bound) {
138143
is_sat = l_false;
139-
if (!m_lower[delta_index].is_finite() && !m_upper[delta_index].is_finite())
144+
if ((!has_bound || !m_lower[delta_index].is_finite()) && !m_upper[delta_index].is_finite())
140145
m_lower[delta_index] = m_upper[delta_index];
141146
}
142147
else {
@@ -171,9 +176,11 @@ namespace opt {
171176
steps = 0;
172177
step_incs = 0;
173178
++delta_index;
179+
has_bound = false;
174180
}
175181
else {
176-
if (num_scopes > 0) m_s->pop(num_scopes);
182+
if (num_scopes > 0)
183+
m_s->pop(num_scopes);
177184
num_scopes = 0;
178185
break;
179186
}

0 commit comments

Comments
 (0)