mirror of
https://github.com/Z3Prover/z3
synced 2025-06-19 20:33:38 +00:00
tune lexicographic products, avoid push/pop and ensure correction sets are not used for multiple objectives
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
e3840a7fc6
commit
b25e8e2288
3 changed files with 19 additions and 2 deletions
|
@ -507,7 +507,7 @@ public:
|
||||||
--m_correction_set_size;
|
--m_correction_set_size;
|
||||||
}
|
}
|
||||||
trace();
|
trace();
|
||||||
if (m_pivot_on_cs && m_csmodel.get() && m_correction_set_size < core.size()) {
|
if (m_c.num_objectives() == 1 && m_pivot_on_cs && m_csmodel.get() && m_correction_set_size < core.size()) {
|
||||||
exprs cs;
|
exprs cs;
|
||||||
get_current_correction_set(m_csmodel.get(), cs);
|
get_current_correction_set(m_csmodel.get(), cs);
|
||||||
m_correction_set_size = cs.size();
|
m_correction_set_size = cs.size();
|
||||||
|
|
|
@ -314,12 +314,27 @@ namespace opt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief there is no need to use push/pop when all objectives are maxsat and engine
|
||||||
|
is maxres.
|
||||||
|
*/
|
||||||
|
bool context::scoped_lex() {
|
||||||
|
if (m_maxsat_engine == symbol("maxres")) {
|
||||||
|
for (unsigned i = 0; i < m_objectives.size(); ++i) {
|
||||||
|
if (m_objectives[i].m_type != O_MAXSMT) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
lbool context::execute_lex() {
|
lbool context::execute_lex() {
|
||||||
lbool r = l_true;
|
lbool r = l_true;
|
||||||
|
bool sc = scoped_lex();
|
||||||
IF_VERBOSE(1, verbose_stream() << "(optsmt:lex)\n";);
|
IF_VERBOSE(1, verbose_stream() << "(optsmt:lex)\n";);
|
||||||
for (unsigned i = 0; r == l_true && i < m_objectives.size(); ++i) {
|
for (unsigned i = 0; r == l_true && i < m_objectives.size(); ++i) {
|
||||||
bool is_last = i + 1 == m_objectives.size();
|
bool is_last = i + 1 == m_objectives.size();
|
||||||
r = execute(m_objectives[i], i + 1 < m_objectives.size(), !is_last);
|
r = execute(m_objectives[i], i + 1 < m_objectives.size(), sc && !is_last);
|
||||||
if (r == l_true && !get_lower_as_num(i).is_finite()) {
|
if (r == l_true && !get_lower_as_num(i).is_finite()) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ namespace opt {
|
||||||
virtual symbol const& maxsat_engine() const = 0; // retrieve maxsat engine configuration parameter.
|
virtual symbol const& maxsat_engine() const = 0; // retrieve maxsat engine configuration parameter.
|
||||||
virtual void get_base_model(model_ref& _m) = 0; // retrieve model from initial satisfiability call.
|
virtual void get_base_model(model_ref& _m) = 0; // retrieve model from initial satisfiability call.
|
||||||
virtual smt::context& smt_context() = 0; // access SMT context for SMT based MaxSMT solver (wmax requires SMT core)
|
virtual smt::context& smt_context() = 0; // access SMT context for SMT based MaxSMT solver (wmax requires SMT core)
|
||||||
|
virtual unsigned num_objectives() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -228,6 +229,7 @@ namespace opt {
|
||||||
lbool execute_lex();
|
lbool execute_lex();
|
||||||
lbool execute_box();
|
lbool execute_box();
|
||||||
lbool execute_pareto();
|
lbool execute_pareto();
|
||||||
|
bool scoped_lex();
|
||||||
expr_ref to_expr(inf_eps const& n);
|
expr_ref to_expr(inf_eps const& n);
|
||||||
|
|
||||||
void reset_maxsmts();
|
void reset_maxsmts();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue