mirror of
https://github.com/Z3Prover/z3
synced 2025-06-22 22:03:39 +00:00
Fix unsound handling of upper bounds in wmax, thanks to Patrick Trentin for report and careful repros #847
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
bc6b3007de
commit
7df803c131
5 changed files with 44 additions and 47 deletions
|
@ -62,20 +62,21 @@ namespace opt {
|
|||
}
|
||||
m_upper = m_lower;
|
||||
bool was_sat = false;
|
||||
expr_ref_vector disj(m), asms(m);
|
||||
expr_ref_vector asms(m);
|
||||
vector<expr_ref_vector> cores;
|
||||
obj_map<expr, rational>::iterator it = soft.begin(), end = soft.end();
|
||||
for (; it != end; ++it) {
|
||||
expr* c = assert_weighted(wth(), it->m_key, it->m_value);
|
||||
if (!is_true(it->m_key)) {
|
||||
disj.push_back(m.mk_not(c));
|
||||
m_upper += it->m_value;
|
||||
}
|
||||
}
|
||||
wth().init_min_cost(m_upper - m_lower);
|
||||
s().assert_expr(mk_or(disj));
|
||||
trace_bounds("wmax");
|
||||
|
||||
TRACE("opt",
|
||||
s().display(tout); tout << "\n";
|
||||
tout << "lower: " << m_lower << " upper: " << m_upper << "\n";);
|
||||
while (!m.canceled() && m_lower < m_upper) {
|
||||
//mk_assumptions(asms);
|
||||
//is_sat = s().preferred_sat(asms, cores);
|
||||
|
@ -84,6 +85,7 @@ namespace opt {
|
|||
is_sat = l_undef;
|
||||
}
|
||||
if (is_sat == l_false) {
|
||||
TRACE("opt", tout << "Unsat\n";);
|
||||
break;
|
||||
}
|
||||
if (is_sat == l_true) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue