mirror of
https://github.com/Z3Prover/z3
synced 2025-06-06 22:23:22 +00:00
fix bugs
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
6ca0c7c6c7
commit
87141f4cb3
2 changed files with 9 additions and 7 deletions
|
@ -68,7 +68,6 @@ namespace opt {
|
||||||
arith_util autil(m);
|
arith_util autil(m);
|
||||||
|
|
||||||
opt_solver::scoped_push _push(*s);
|
opt_solver::scoped_push _push(*s);
|
||||||
opt_solver::toggle_objective _t(*s, true);
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < objectives.size(); ++i) {
|
for (unsigned i = 0; i < objectives.size(); ++i) {
|
||||||
m_vars.push_back(s->add_objective(objectives[i].get()));
|
m_vars.push_back(s->add_objective(objectives[i].get()));
|
||||||
|
@ -77,6 +76,7 @@ namespace opt {
|
||||||
lbool is_sat = l_true;
|
lbool is_sat = l_true;
|
||||||
// ready to test: is_sat = update_upper();
|
// ready to test: is_sat = update_upper();
|
||||||
while (is_sat == l_true && !m_cancel) {
|
while (is_sat == l_true && !m_cancel) {
|
||||||
|
opt_solver::toggle_objective _t(*s, true);
|
||||||
is_sat = update_lower();
|
is_sat = update_lower();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,20 +117,22 @@ namespace opt {
|
||||||
smt::theory_inf_arith& th = dynamic_cast<smt::theory_inf_arith&>(opt);
|
smt::theory_inf_arith& th = dynamic_cast<smt::theory_inf_arith&>(opt);
|
||||||
|
|
||||||
expr_ref bound(m);
|
expr_ref bound(m);
|
||||||
lbool is_sat = l_true;
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < m_lower.size(); ++i) {
|
for (unsigned i = 0; i < m_lower.size() && !m_cancel; ++i) {
|
||||||
if (m_lower[i] < m_upper[i]) {
|
if (m_lower[i] < m_upper[i]) {
|
||||||
opt_solver::scoped_push _push(*s);
|
opt_solver::scoped_push _push(*s);
|
||||||
smt::theory_var v = m_vars[i];
|
smt::theory_var v = m_vars[i];
|
||||||
|
// TBD: this version just works for m_upper[i] being infinity.
|
||||||
bound = th.block_upper_bound(v, m_upper[i]);
|
bound = th.block_upper_bound(v, m_upper[i]);
|
||||||
expr* bounds[1] = { bound };
|
expr* bounds[1] = { bound };
|
||||||
is_sat = s->check_sat(1, bounds);
|
lbool is_sat = s->check_sat(1, bounds);
|
||||||
if (is_sat) {
|
if (is_sat == l_true) {
|
||||||
IF_VERBOSE(1, verbose_stream() << "Setting lower bound for " << v << " to " << m_upper[i] << "\n";);
|
IF_VERBOSE(1, verbose_stream() << "Setting lower bound for " << v << " to " << m_upper[i] << "\n";);
|
||||||
m_lower[i] = m_upper[i];
|
m_lower[i] = m_upper[i];
|
||||||
}
|
}
|
||||||
// else: TBD extract Farkas coefficients.
|
else if (is_sat == l_false) {
|
||||||
|
// else: TBD extract Farkas coefficients.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return l_true;
|
return l_true;
|
||||||
|
|
|
@ -1005,7 +1005,7 @@ namespace smt {
|
||||||
strm << val << " <= " << v;
|
strm << val << " <= " << v;
|
||||||
expr* b = m.mk_fresh_const(strm.str().c_str(), m.mk_bool_sort());
|
expr* b = m.mk_fresh_const(strm.str().c_str(), m.mk_bool_sort());
|
||||||
bool_var bv = ctx.mk_bool_var(b);
|
bool_var bv = ctx.mk_bool_var(b);
|
||||||
atom* a = alloc(atom, bv, v, val, A_LOWER);
|
atom* a = alloc(atom, bv, v, val+Ext::m_real_epsilon, A_LOWER);
|
||||||
m_unassigned_atoms[v]++;
|
m_unassigned_atoms[v]++;
|
||||||
m_var_occs[v].push_back(a);
|
m_var_occs[v].push_back(a);
|
||||||
m_atoms.push_back(a);
|
m_atoms.push_back(a);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue