mirror of
https://github.com/Z3Prover/z3
synced 2025-06-20 04:43:39 +00:00
debugging model generation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
56562a725d
commit
f41d23bc0f
4 changed files with 21 additions and 13 deletions
|
@ -29,6 +29,8 @@ Notes:
|
||||||
#include "scoped_ctrl_c.h"
|
#include "scoped_ctrl_c.h"
|
||||||
#include "scoped_timer.h"
|
#include "scoped_timer.h"
|
||||||
#include "parametric_cmd.h"
|
#include "parametric_cmd.h"
|
||||||
|
#include "opt_params.hpp"
|
||||||
|
#include "model_smt2_pp.h"
|
||||||
|
|
||||||
class opt_context {
|
class opt_context {
|
||||||
cmd_context& ctx;
|
cmd_context& ctx;
|
||||||
|
@ -291,10 +293,22 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch(r) {
|
switch(r) {
|
||||||
case l_true:
|
case l_true: {
|
||||||
ctx.regular_stream() << "sat\n";
|
ctx.regular_stream() << "sat\n";
|
||||||
opt.display_assignment(ctx.regular_stream());
|
opt.display_assignment(ctx.regular_stream());
|
||||||
|
opt_params optp(p);
|
||||||
|
if (optp.print_model()) {
|
||||||
|
model_ref mdl;
|
||||||
|
opt.get_model(mdl);
|
||||||
|
if (mdl) {
|
||||||
|
ctx.regular_stream() << "(model " << std::endl;
|
||||||
|
model_smt2_pp(ctx.regular_stream(), ctx, *(mdl.get()), 2);
|
||||||
|
// m->display(ctx.regular_stream());
|
||||||
|
ctx.regular_stream() << ")" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case l_false:
|
case l_false:
|
||||||
ctx.regular_stream() << "unsat\n";
|
ctx.regular_stream() << "unsat\n";
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -28,7 +28,6 @@ Notes:
|
||||||
#include "lia2card_tactic.h"
|
#include "lia2card_tactic.h"
|
||||||
#include "elim01_tactic.h"
|
#include "elim01_tactic.h"
|
||||||
#include "tactical.h"
|
#include "tactical.h"
|
||||||
#include "th_rewriter.h"
|
|
||||||
|
|
||||||
namespace opt {
|
namespace opt {
|
||||||
|
|
||||||
|
@ -65,14 +64,9 @@ namespace opt {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned context::add_objective(app* t, bool is_max) {
|
unsigned context::add_objective(app* t, bool is_max) {
|
||||||
expr_ref tr(t, m);
|
app_ref tr(t, m);
|
||||||
app_ref ar(m);
|
|
||||||
th_rewriter rewrite(m);
|
|
||||||
rewrite(tr);
|
|
||||||
SASSERT(is_app(tr));
|
|
||||||
ar = to_app(tr);
|
|
||||||
unsigned index = m_objectives.size();
|
unsigned index = m_objectives.size();
|
||||||
m_objectives.push_back(objective(is_max, ar, index));
|
m_objectives.push_back(objective(is_max, tr, index));
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ def_module_params('opt',
|
||||||
('maxsat_engine', SYMBOL, 'fu_malik', "select engine for non-weighted maxsat: 'fu_malik', 'core_maxsat'"),
|
('maxsat_engine', SYMBOL, 'fu_malik', "select engine for non-weighted maxsat: 'fu_malik', 'core_maxsat'"),
|
||||||
('priority', SYMBOL, 'lex', "select how to priortize objectives: 'lex' (lexicographic), 'pareto', or 'box'"),
|
('priority', SYMBOL, 'lex', "select how to priortize objectives: 'lex' (lexicographic), 'pareto', or 'box'"),
|
||||||
('dump_benchmarks', BOOL, False, 'dump benchmarks for profiling'),
|
('dump_benchmarks', BOOL, False, 'dump benchmarks for profiling'),
|
||||||
|
('print_model', BOOL, False, 'display model for satisfiable constraints'),
|
||||||
('debug_conflict', BOOL, False, 'debug conflict resolution'),
|
('debug_conflict', BOOL, False, 'debug conflict resolution'),
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
|
@ -126,15 +126,14 @@ namespace opt {
|
||||||
}
|
}
|
||||||
|
|
||||||
void optsmt::update_lower() {
|
void optsmt::update_lower() {
|
||||||
model_ref md;
|
m_s->get_model(m_model);
|
||||||
m_s->get_model(md);
|
|
||||||
set_max(m_lower, m_s->get_objective_values());
|
set_max(m_lower, m_s->get_objective_values());
|
||||||
IF_VERBOSE(1,
|
IF_VERBOSE(1,
|
||||||
for (unsigned i = 0; i < m_lower.size(); ++i) {
|
for (unsigned i = 0; i < m_lower.size(); ++i) {
|
||||||
verbose_stream() << m_lower[i] << " ";
|
verbose_stream() << m_lower[i] << " ";
|
||||||
}
|
}
|
||||||
verbose_stream() << "\n";
|
verbose_stream() << "\n";
|
||||||
model_pp(verbose_stream(), *md);
|
model_pp(verbose_stream(), *m_model);
|
||||||
);
|
);
|
||||||
expr_ref_vector disj(m);
|
expr_ref_vector disj(m);
|
||||||
expr_ref constraint(m);
|
expr_ref constraint(m);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue