3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-10 19:27:06 +00:00

disable 'optimization' that led to wrong model'

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2013-12-15 02:40:52 +02:00
parent ac893e907f
commit 50f18a77af
4 changed files with 11 additions and 3 deletions

View file

@ -417,6 +417,7 @@ inline decl_kind arith_decl_plugin::fix_kind(decl_kind k, unsigned arity) {
app * arith_decl_plugin::mk_numeral(rational const & val, bool is_int) {
if (is_int && !val.is_int()) {
SASSERT(false);
m_manager->raise_exception("invalid rational value passed as an integer");
}
if (val.is_unsigned()) {

View file

@ -25,6 +25,7 @@ Notes:
#include "tactic.h"
#include "smt_context.h"
#include "ast_pp.h"
#include "model_smt2_pp.h"
/**
\brief Fu & Malik procedure for MaxSAT. This procedure is based on
@ -323,7 +324,8 @@ namespace opt {
VERIFY(m_model->eval(m_orig_soft[i].get(), val));
m_assignment.push_back(m.is_true(val));
}
TRACE("opt", tout << "maxsat cost: " << m_upper << "\n";);
TRACE("opt", tout << "maxsat cost: " << m_upper << "\n";
model_smt2_pp(tout, m, *m_model, 0););
}
// We are done and soft_constraints has
// been updated with the max-sat assignment.

View file

@ -122,7 +122,7 @@ namespace opt {
lbool context::execute_min_max(unsigned index, bool committed) {
lbool result = m_optsmt.lex(index);
if (committed) m_optsmt.commit_assignment(index);
if (committed && result == l_true) m_optsmt.get_model(m_model);
if (result == l_true) m_optsmt.get_model(m_model);
return result;
}
@ -130,7 +130,7 @@ namespace opt {
maxsmt& ms = *m_maxsmts.find(id);
lbool result = ms(get_solver());
if (committed) ms.commit_assignment();
if (committed && result == l_true) ms.get_model(m_model);
if (result == l_true) ms.get_model(m_model);
return result;
}
@ -736,6 +736,9 @@ namespace opt {
maxsmt& ms = *m_maxsmts.find(obj.m_id);
for (unsigned i = 0; i < obj.m_terms.size(); ++i) {
VERIFY(m_model->eval(obj.m_terms[i], val));
CTRACE("opt",ms.get_assignment(i) != (m.mk_true() == val),
tout << mk_pp(obj.m_terms[i], m) << " evaluates to " << val << "\n";
model_smt2_pp(tout, m, *m_model, 0););
SASSERT(ms.get_assignment(i) == (m.mk_true() == val));
}
break;

View file

@ -26,6 +26,7 @@ Notes:
#include "ast_pp.h"
#include "ast_smt_pp.h"
#include "pp_params.hpp"
#include "model_smt2_pp.h"
namespace opt {
@ -130,6 +131,7 @@ namespace opt {
smt::theory_var v = m_objective_vars[i];
m_objective_values[i] = get_optimizer().maximize(v);
m_context.get_context().update_model();
TRACE("opt", { model_ref mdl; get_model(mdl); model_smt2_pp(tout << "update model: ", m, *mdl, 0); });
}
void opt_solver::get_unsat_core(ptr_vector<expr> & r) {