3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 12:08:18 +00:00

more updates for #1439

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-01-17 18:11:14 -08:00
parent b5335bc34b
commit 57406d6cc4
3 changed files with 16 additions and 8 deletions

View file

@ -122,6 +122,7 @@ namespace opt {
m_bv(m), m_bv(m),
m_hard_constraints(m), m_hard_constraints(m),
m_solver(0), m_solver(0),
m_pareto1(false),
m_box_index(UINT_MAX), m_box_index(UINT_MAX),
m_optsmt(m), m_optsmt(m),
m_scoped_state(m), m_scoped_state(m),
@ -294,12 +295,19 @@ namespace opt {
if (0 == m_objectives.size()) { if (0 == m_objectives.size()) {
// no op // no op
} }
else if (1 == m_objectives.size()) {
if (m_pareto1) {
is_sat = l_false;
m_pareto1 = false;
}
else {
m_pareto1 = (pri == symbol("pareto"));
is_sat = execute(m_objectives[0], true, false);
}
}
else if (pri == symbol("pareto")) { else if (pri == symbol("pareto")) {
is_sat = execute_pareto(); is_sat = execute_pareto();
} }
else if (1 == m_objectives.size()) {
is_sat = execute(m_objectives[0], true, false);
}
else if (pri == symbol("box")) { else if (pri == symbol("box")) {
is_sat = execute_box(); is_sat = execute_box();
} }
@ -1358,13 +1366,14 @@ namespace opt {
} }
void context::clear_state() { void context::clear_state() {
set_pareto(0); set_pareto(0);
m_box_index = UINT_MAX; m_box_index = UINT_MAX;
m_model.reset(); m_model.reset();
} }
void context::set_pareto(pareto_base* p) { void context::set_pareto(pareto_base* p) {
m_pareto = p; m_pareto = p;
m_pareto1 = p != nullptr;
} }
void context::collect_statistics(statistics& stats) const { void context::collect_statistics(statistics& stats) const {

View file

@ -144,7 +144,8 @@ namespace opt {
ref<opt_solver> m_opt_solver; ref<opt_solver> m_opt_solver;
ref<solver> m_solver; ref<solver> m_solver;
ref<solver> m_sat_solver; ref<solver> m_sat_solver;
scoped_ptr<pareto_base> m_pareto; scoped_ptr<pareto_base> m_pareto;
bool m_pareto1;
scoped_ptr<qe::qmax> m_qmax; scoped_ptr<qe::qmax> m_qmax;
sref_vector<model> m_box_models; sref_vector<model> m_box_models;
unsigned m_box_index; unsigned m_box_index;

View file

@ -74,9 +74,7 @@ namespace sat {
DEBUG_CODE({ DEBUG_CODE({
// all clauses must be satisfied // all clauses must be satisfied
bool sat = false; bool sat = false;
it2 = it->m_clauses.begin(); for (literal l : m_clauses) {
for (; it2 != end2; ++it2) {
literal l = *it2;
if (l == null_literal) { if (l == null_literal) {
SASSERT(sat); SASSERT(sat);
sat = false; sat = false;