3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-16 20:24:45 +00:00

working on pareto and upper/lower bound facilities

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2013-11-08 13:52:27 -08:00
parent 6caee5e3ca
commit f350efffc7
4 changed files with 36 additions and 39 deletions

View file

@ -132,9 +132,7 @@ namespace opt {
lbool optsmt::update_upper() {
smt::theory_opt& opt = s->get_optimizer();
SASSERT(typeid(smt::theory_inf_arith) == typeid(opt));
smt::theory_inf_arith& th = dynamic_cast<smt::theory_inf_arith&>(opt);
expr_ref bound(m);
@ -246,13 +244,28 @@ namespace opt {
return is_sat;
}
inf_eps optsmt::get_value(unsigned index) const {
if (m_is_max[index]) {
return m_lower[index];
}
else {
return -m_lower[index];
}
inf_eps optsmt::get_value(unsigned i) const {
return m_is_max[i]?m_lower[i]:-m_lower[i];
}
inf_eps optsmt::get_lower(unsigned i) const {
return m_is_max[i]?m_lower[i]:-m_upper[i];
}
inf_eps optsmt::get_upper(unsigned i) const {
return m_is_max[i]?m_upper[i]:-m_lower[i];
}
// force lower_bound(i) <= objective_value(i)
void optsmt::commit_assignment(unsigned i) {
smt::theory_var v = m_vars[i];
// TBD: this should be a method on all optimization solvers.
smt::theory_opt& opt = s->get_optimizer();
SASSERT(typeid(smt::theory_inf_arith) == typeid(opt));
smt::theory_inf_arith& th = dynamic_cast<smt::theory_inf_arith&>(opt);
s->assert_expr(th.block_upper_bound(v, get_lower(i)));
}
void optsmt::display(std::ostream& out) const {