mirror of
https://github.com/Z3Prover/z3
synced 2025-04-15 21:38:44 +00:00
fix minimize->maxsat
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
da348fe1c0
commit
e307c5fdda
|
@ -221,7 +221,18 @@ namespace opt {
|
||||||
if (is_minimize(fml, term, index)) {
|
if (is_minimize(fml, term, index)) {
|
||||||
TRACE("opt", tout << "try to convert minimization" << mk_pp(term, m) << "\n";);
|
TRACE("opt", tout << "try to convert minimization" << mk_pp(term, m) << "\n";);
|
||||||
rational coeff(0);
|
rational coeff(0);
|
||||||
return get_pb_sum(term, terms, weights, coeff);
|
// minimize 2*x + 3*y
|
||||||
|
// <=>
|
||||||
|
// (assret-soft (not x) 2)
|
||||||
|
// (assert-soft (not y) 3)
|
||||||
|
//
|
||||||
|
if (get_pb_sum(term, terms, weights, coeff) && coeff.is_zero()) {
|
||||||
|
// TBD: and weights are positive?
|
||||||
|
for (unsigned i = 0; i < terms.size(); ++i) {
|
||||||
|
terms[i] = m.mk_not(terms[i].get());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue