mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
expose bounds as vector expressions instead of containing ad-hoc expressions. Issue #911
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
e744d0f271
commit
e02160c674
11 changed files with 158 additions and 4 deletions
|
@ -1290,6 +1290,15 @@ namespace opt {
|
|||
return to_expr(get_upper_as_num(idx));
|
||||
}
|
||||
|
||||
void context::to_exprs(inf_eps const& n, expr_ref_vector& es) {
|
||||
rational inf = n.get_infinity();
|
||||
rational r = n.get_rational();
|
||||
rational eps = n.get_infinitesimal();
|
||||
es.push_back(m_arith.mk_numeral(inf, inf.is_int()));
|
||||
es.push_back(m_arith.mk_numeral(r, r.is_int()));
|
||||
es.push_back(m_arith.mk_numeral(eps, eps.is_int()));
|
||||
}
|
||||
|
||||
expr_ref context::to_expr(inf_eps const& n) {
|
||||
rational inf = n.get_infinity();
|
||||
rational r = n.get_rational();
|
||||
|
@ -1455,9 +1464,10 @@ namespace opt {
|
|||
|
||||
void context::validate_maxsat(symbol const& id) {
|
||||
maxsmt& ms = *m_maxsmts.find(id);
|
||||
TRACE("opt", tout << "Validate: " << id << "\n";);
|
||||
for (unsigned i = 0; i < m_objectives.size(); ++i) {
|
||||
objective const& obj = m_objectives[i];
|
||||
if (obj.m_id == id) {
|
||||
if (obj.m_id == id && obj.m_type == O_MAXSMT) {
|
||||
SASSERT(obj.m_type == O_MAXSMT);
|
||||
rational value(0);
|
||||
expr_ref val(m);
|
||||
|
|
|
@ -207,6 +207,9 @@ namespace opt {
|
|||
expr_ref get_lower(unsigned idx);
|
||||
expr_ref get_upper(unsigned idx);
|
||||
|
||||
void get_lower(unsigned idx, expr_ref_vector& es) { to_exprs(get_lower_as_num(idx), es); }
|
||||
void get_upper(unsigned idx, expr_ref_vector& es) { to_exprs(get_upper_as_num(idx), es); }
|
||||
|
||||
std::string to_string() const;
|
||||
|
||||
|
||||
|
@ -238,6 +241,7 @@ namespace opt {
|
|||
lbool adjust_unknown(lbool r);
|
||||
bool scoped_lex();
|
||||
expr_ref to_expr(inf_eps const& n);
|
||||
void to_exprs(inf_eps const& n, expr_ref_vector& es);
|
||||
|
||||
void reset_maxsmts();
|
||||
void import_scoped_state();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue