diff --git a/src/opt/maxsmt.cpp b/src/opt/maxsmt.cpp index 3d083447203..37f888120da 100644 --- a/src/opt/maxsmt.cpp +++ b/src/opt/maxsmt.cpp @@ -178,14 +178,14 @@ namespace opt { maxsmt::maxsmt(maxsat_context& c, unsigned index): m(c.get_manager()), m_c(c), m_index(index), m_answer(m) {} - lbool maxsmt::operator()() { + lbool maxsmt::operator()(bool committed) { lbool is_sat = l_undef; m_msolver = nullptr; opt_params optp(m_params); symbol const& maxsat_engine = m_c.maxsat_engine(); IF_VERBOSE(1, verbose_stream() << "(maxsmt)\n";); TRACE("opt_verbose", s().display(tout << "maxsmt\n") << "\n";); - if (optp.maxlex_enable() && is_maxlex(m_soft)) + if (!committed && optp.maxlex_enable() && is_maxlex(m_soft)) m_msolver = mk_maxlex(m_c, m_index, m_soft); else if (m_soft.empty() || maxsat_engine == symbol("maxres") || maxsat_engine == symbol::null) m_msolver = mk_maxres(m_c, m_index, m_soft); @@ -401,7 +401,7 @@ namespace opt { for (auto const& p : soft) { maxsmt.add(p.first, p.second); } - lbool r = maxsmt(); + lbool r = maxsmt(true); if (r == l_true) { svector labels; maxsmt.get_model(m_model, labels); diff --git a/src/opt/maxsmt.h b/src/opt/maxsmt.h index ac39d78913a..17306b222f6 100644 --- a/src/opt/maxsmt.h +++ b/src/opt/maxsmt.h @@ -137,7 +137,7 @@ namespace opt { params_ref m_params; public: maxsmt(maxsat_context& c, unsigned id); - lbool operator()(); + lbool operator()(bool committed); void updt_params(params_ref& p); void add(expr* f, rational const& w); unsigned size() const { return m_soft.size(); } diff --git a/src/opt/opt_context.cpp b/src/opt/opt_context.cpp index 5895643bd06..11eddc2eb08 100644 --- a/src/opt/opt_context.cpp +++ b/src/opt/opt_context.cpp @@ -453,8 +453,8 @@ namespace opt { lbool context::execute_maxsat(symbol const& id, bool committed, bool scoped) { model_ref tmp; maxsmt& ms = *m_maxsmts.find(id); - if (scoped) get_solver().push(); - lbool result = ms(); + if (scoped) get_solver().push(); + lbool result = ms(committed); if (result != l_false && (ms.get_model(tmp, m_labels), tmp.get())) { ms.get_model(m_model, m_labels); }