mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
follow logic annotation/enable diff logic when configured
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
18b491eee0
commit
c1580fb85a
11 changed files with 71 additions and 30 deletions
|
@ -284,6 +284,7 @@ namespace opt {
|
|||
|
||||
lbool context::execute_lex() {
|
||||
lbool r = l_true;
|
||||
IF_VERBOSE(1, verbose_stream() << "(optsmt:lex)\n";);
|
||||
for (unsigned i = 0; r == l_true && i < m_objectives.size(); ++i) {
|
||||
bool is_last = i + 1 == m_objectives.size();
|
||||
r = execute(m_objectives[i], i + 1 < m_objectives.size(), !is_last);
|
||||
|
@ -435,7 +436,8 @@ namespace opt {
|
|||
void context::init_solver() {
|
||||
#pragma omp critical (opt_context)
|
||||
{
|
||||
m_opt_solver = alloc(opt_solver, m, m_params, m_fm, symbol());
|
||||
m_opt_solver = alloc(opt_solver, m, m_params, m_fm);
|
||||
m_opt_solver->set_logic(m_logic);
|
||||
m_solver = m_opt_solver.get();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,6 +128,7 @@ namespace opt {
|
|||
bool m_enable_sat;
|
||||
bool m_enable_sls;
|
||||
symbol m_maxsat_engine;
|
||||
symbol m_logic;
|
||||
public:
|
||||
context(ast_manager& m);
|
||||
virtual ~context();
|
||||
|
@ -153,6 +154,7 @@ namespace opt {
|
|||
|
||||
virtual void display_assignment(std::ostream& out);
|
||||
virtual bool is_pareto() { return m_pareto.get() != 0; }
|
||||
virtual void set_logic(symbol const& s) { m_logic = s; }
|
||||
|
||||
void display(std::ostream& out);
|
||||
static void collect_param_descrs(param_descrs & r);
|
||||
|
|
|
@ -36,17 +36,14 @@ Notes:
|
|||
namespace opt {
|
||||
|
||||
opt_solver::opt_solver(ast_manager & mgr, params_ref const & p,
|
||||
filter_model_converter& fm, symbol const & l):
|
||||
filter_model_converter& fm):
|
||||
solver_na2as(mgr),
|
||||
m_params(p),
|
||||
m_context(mgr, m_params),
|
||||
m(mgr),
|
||||
m_dump_benchmarks(false),
|
||||
m_fm(fm) {
|
||||
m_logic = l;
|
||||
if (m_logic != symbol::null) {
|
||||
m_context.set_logic(m_logic);
|
||||
}
|
||||
m_fm(fm),
|
||||
m_first(true) {
|
||||
m_params.updt_params(p);
|
||||
m_params.m_relevancy_lvl = 0;
|
||||
}
|
||||
|
@ -83,6 +80,10 @@ namespace opt {
|
|||
m_context.pop(n);
|
||||
}
|
||||
|
||||
void opt_solver::set_logic(symbol const& logic) {
|
||||
m_context.set_logic(logic);
|
||||
}
|
||||
|
||||
smt::theory_opt& opt_solver::get_optimizer() {
|
||||
smt::context& ctx = m_context.get_context();
|
||||
smt::theory_id arith_id = m_context.m().get_family_id("arith");
|
||||
|
@ -143,7 +144,14 @@ namespace opt {
|
|||
IF_VERBOSE(1, verbose_stream() << "(created benchmark: " << file_name.str() << "...";
|
||||
verbose_stream().flush(););
|
||||
}
|
||||
lbool r = m_context.check(num_assumptions, assumptions);
|
||||
lbool r;
|
||||
if (m_first && num_assumptions == 0 && m_context.get_scope_level() == 0) {
|
||||
r = m_context.setup_and_check();
|
||||
}
|
||||
else {
|
||||
r = m_context.check(num_assumptions, assumptions);
|
||||
}
|
||||
m_first = false;
|
||||
if (dump_benchmarks()) {
|
||||
w.stop();
|
||||
IF_VERBOSE(1, verbose_stream() << ".. " << r << " " << std::fixed << w.get_seconds() << ")\n";);
|
||||
|
|
|
@ -51,8 +51,9 @@ namespace opt {
|
|||
bool m_dump_benchmarks;
|
||||
static unsigned m_dump_count;
|
||||
statistics m_stats;
|
||||
bool m_first;
|
||||
public:
|
||||
opt_solver(ast_manager & m, params_ref const & p, filter_model_converter& fm, symbol const & l);
|
||||
opt_solver(ast_manager & m, params_ref const & p, filter_model_converter& fm);
|
||||
virtual ~opt_solver();
|
||||
|
||||
virtual void updt_params(params_ref & p);
|
||||
|
@ -61,7 +62,7 @@ namespace opt {
|
|||
virtual void assert_expr(expr * t);
|
||||
virtual void push_core();
|
||||
virtual void pop_core(unsigned n);
|
||||
virtual lbool check_sat_core(unsigned num_assumptions, expr * const * assumptions);
|
||||
virtual lbool check_sat_core(unsigned num_assumptions, expr * const * assumptions);
|
||||
virtual void get_unsat_core(ptr_vector<expr> & r);
|
||||
virtual void get_model(model_ref & m);
|
||||
virtual proof * get_proof();
|
||||
|
@ -72,6 +73,7 @@ namespace opt {
|
|||
virtual unsigned get_num_assertions() const;
|
||||
virtual expr * get_assertion(unsigned idx) const;
|
||||
virtual void display(std::ostream & out) const;
|
||||
void set_logic(symbol const& logic);
|
||||
|
||||
smt::theory_var add_objective(app* term);
|
||||
void reset_objectives();
|
||||
|
|
|
@ -235,7 +235,6 @@ namespace opt {
|
|||
}
|
||||
|
||||
lbool optsmt::lex(unsigned obj_index) {
|
||||
IF_VERBOSE(1, verbose_stream() << "(optsmt:lex)\n";);
|
||||
TRACE("opt", tout << "optsmt:lex\n";);
|
||||
solver::scoped_push _push(*m_s);
|
||||
SASSERT(obj_index < m_vars.size());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue