3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 12:08:18 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-02-15 12:39:08 -08:00
parent a231ff3735
commit fadcac8f6d

View file

@ -402,8 +402,8 @@ namespace opt {
*/ */
bool context::scoped_lex() { bool context::scoped_lex() {
if (m_maxsat_engine == symbol("maxres")) { if (m_maxsat_engine == symbol("maxres")) {
for (unsigned i = 0; i < m_objectives.size(); ++i) { for (auto const& o : m_objectives) {
if (m_objectives[i].m_type != O_MAXSMT) return true; if (o.m_type != O_MAXSMT) return true;
} }
return false; return false;
} }
@ -413,14 +413,16 @@ namespace opt {
lbool context::execute_lex() { lbool context::execute_lex() {
lbool r = l_true; lbool r = l_true;
bool sc = scoped_lex(); bool sc = scoped_lex();
IF_VERBOSE(1, verbose_stream() << "(optsmt:lex)\n";); IF_VERBOSE(1, verbose_stream() << "(opt :lex)\n";);
for (unsigned i = 0; r == l_true && i < m_objectives.size(); ++i) { unsigned sz = m_objectives.size();
bool is_last = i + 1 == m_objectives.size(); for (unsigned i = 0; r == l_true && i < sz; ++i) {
r = execute(m_objectives[i], i + 1 < m_objectives.size(), sc && !is_last); objective const& o = m_objectives[i];
bool is_last = i + 1 == sz;
r = execute(o, i + 1 < sz, sc && !is_last && o.m_type != O_MAXSMT);
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;
} }
if (r == l_true && i + 1 < m_objectives.size()) { if (r == l_true && i + 1 < sz) {
update_lower(); update_lower();
} }
} }