mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 09:35:32 +00:00
had to nuke mip_tactic, it was based on the smt_solver_exp (experimental), that depends on assertion_sets. This change will affect Z3's performance on QF_LIA and QF_LRA benchmarks. The new mcsat should fix that.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
361b55edfd
commit
96676efeb6
30 changed files with 18 additions and 1819 deletions
|
@ -17,7 +17,6 @@ Notes:
|
|||
|
||||
--*/
|
||||
#include"aig.h"
|
||||
#include"assertion_set.h" // TODO delete
|
||||
#include"goal.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"cooperate.h"
|
||||
|
@ -1006,39 +1005,6 @@ struct aig_manager::imp {
|
|||
r = invert(r);
|
||||
}
|
||||
|
||||
|
||||
void operator()(aig_lit const & l, assertion_set & s) {
|
||||
#if 1
|
||||
s.reset();
|
||||
sbuffer<aig_lit> roots;
|
||||
roots.push_back(l);
|
||||
while (!roots.empty()) {
|
||||
aig_lit n = roots.back();
|
||||
roots.pop_back();
|
||||
if (n.is_inverted()) {
|
||||
s.assert_expr(invert(process_root(n.ptr())));
|
||||
continue;
|
||||
}
|
||||
aig * p = n.ptr();
|
||||
if (m.is_ite(p)) {
|
||||
s.assert_expr(process_root(p));
|
||||
continue;
|
||||
}
|
||||
if (is_var(p)) {
|
||||
s.assert_expr(m.var2expr(p));
|
||||
continue;
|
||||
}
|
||||
roots.push_back(left(p));
|
||||
roots.push_back(right(p));
|
||||
}
|
||||
#else
|
||||
s.reset();
|
||||
expr_ref r(ast_mng);
|
||||
naive(l, r);
|
||||
s.assert_expr(r);
|
||||
#endif
|
||||
}
|
||||
|
||||
void operator()(aig_lit const & l, expr_ref & r) {
|
||||
naive(l, r);
|
||||
}
|
||||
|
@ -1574,11 +1540,6 @@ public:
|
|||
return r;
|
||||
}
|
||||
|
||||
void to_formula(aig_lit const & r, assertion_set & s) {
|
||||
aig2expr proc(*this);
|
||||
proc(r, s);
|
||||
}
|
||||
|
||||
void to_formula(aig_lit const & r, goal & g) {
|
||||
aig2expr proc(*this);
|
||||
proc(r, g);
|
||||
|
@ -1745,10 +1706,6 @@ aig_ref aig_manager::mk_aig(expr * n) {
|
|||
return aig_ref(*this, m_imp->mk_aig(n));
|
||||
}
|
||||
|
||||
aig_ref aig_manager::mk_aig(assertion_set const & s) {
|
||||
return aig_ref(*this, m_imp->mk_aig(s));
|
||||
}
|
||||
|
||||
aig_ref aig_manager::mk_aig(goal const & s) {
|
||||
return aig_ref(*this, m_imp->mk_aig(s));
|
||||
}
|
||||
|
@ -1779,10 +1736,6 @@ void aig_manager::max_sharing(aig_ref & r) {
|
|||
r = aig_ref(*this, m_imp->max_sharing(aig_lit(r)));
|
||||
}
|
||||
|
||||
void aig_manager::to_formula(aig_ref const & r, assertion_set & s) {
|
||||
return m_imp->to_formula(aig_lit(r), s);
|
||||
}
|
||||
|
||||
void aig_manager::to_formula(aig_ref const & r, goal & g) {
|
||||
SASSERT(!g.proofs_enabled());
|
||||
SASSERT(!g.unsat_core_enabled());
|
||||
|
|
|
@ -22,7 +22,6 @@ Notes:
|
|||
#include"ast.h"
|
||||
#include"tactic_exception.h"
|
||||
|
||||
class assertion_set;
|
||||
class goal;
|
||||
class aig_lit;
|
||||
class aig_manager;
|
||||
|
@ -62,7 +61,6 @@ public:
|
|||
~aig_manager();
|
||||
void set_max_memory(unsigned long long max);
|
||||
aig_ref mk_aig(expr * n);
|
||||
aig_ref mk_aig(assertion_set const & s); // TODO delete
|
||||
aig_ref mk_aig(goal const & g);
|
||||
aig_ref mk_not(aig_ref const & r);
|
||||
aig_ref mk_and(aig_ref const & r1, aig_ref const & r2);
|
||||
|
@ -70,7 +68,6 @@ public:
|
|||
aig_ref mk_iff(aig_ref const & r1, aig_ref const & r2);
|
||||
aig_ref mk_ite(aig_ref const & r1, aig_ref const & r2, aig_ref const & r3);
|
||||
void max_sharing(aig_ref & r);
|
||||
void to_formula(aig_ref const & r, assertion_set & s); // TODO delete
|
||||
void to_formula(aig_ref const & r, expr_ref & result);
|
||||
void to_formula(aig_ref const & r, goal & result);
|
||||
void to_cnf(aig_ref const & r, goal & result);
|
||||
|
|
|
@ -1,164 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
add_bounds.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Strategy for bounding unbounded variables.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2011-06-30.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"add_bounds.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"bound_manager.h"
|
||||
#include"for_each_expr.h"
|
||||
#include"assertion_set_util.h"
|
||||
|
||||
struct is_unbounded_proc {
|
||||
struct found {};
|
||||
arith_util m_util;
|
||||
bound_manager & m_bm;
|
||||
|
||||
is_unbounded_proc(bound_manager & bm):m_util(bm.m()), m_bm(bm) {}
|
||||
|
||||
void operator()(app * t) {
|
||||
if (is_uninterp_const(t) && (m_util.is_int(t) || m_util.is_real(t)) && (!m_bm.has_lower(t) || !m_bm.has_upper(t)))
|
||||
throw found();
|
||||
}
|
||||
|
||||
void operator()(var *) {}
|
||||
|
||||
void operator()(quantifier*) {}
|
||||
};
|
||||
|
||||
bool is_unbounded(assertion_set const & s) {
|
||||
ast_manager & m = s.m();
|
||||
bound_manager bm(m);
|
||||
bm(s);
|
||||
is_unbounded_proc proc(bm);
|
||||
return test(s, proc);
|
||||
}
|
||||
|
||||
struct add_bounds::imp {
|
||||
ast_manager & m;
|
||||
rational m_lower;
|
||||
rational m_upper;
|
||||
volatile bool m_cancel;
|
||||
|
||||
imp(ast_manager & _m, params_ref const & p):
|
||||
m(_m) {
|
||||
updt_params(p);
|
||||
}
|
||||
|
||||
void updt_params(params_ref const & p) {
|
||||
m_lower = p.get_rat(":add-bound-lower", rational(-2));
|
||||
m_upper = p.get_rat(":add-bound-upper", rational(2));
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_cancel = f;
|
||||
}
|
||||
|
||||
struct add_bound_proc {
|
||||
arith_util m_util;
|
||||
bound_manager & m_bm;
|
||||
assertion_set & m_set;
|
||||
rational const & m_lower;
|
||||
rational const & m_upper;
|
||||
unsigned m_num_bounds;
|
||||
|
||||
add_bound_proc(bound_manager & bm, assertion_set & s, rational const & l, rational const & u):
|
||||
m_util(bm.m()),
|
||||
m_bm(bm),
|
||||
m_set(s),
|
||||
m_lower(l),
|
||||
m_upper(u) {
|
||||
m_num_bounds = 0;
|
||||
}
|
||||
|
||||
void operator()(app * t) {
|
||||
if (is_uninterp_const(t) && (m_util.is_int(t) || m_util.is_real(t))) {
|
||||
if (!m_bm.has_lower(t)) {
|
||||
m_set.assert_expr(m_util.mk_le(t, m_util.mk_numeral(m_upper, m_util.is_int(t))));
|
||||
m_num_bounds++;
|
||||
}
|
||||
if (!m_bm.has_upper(t)) {
|
||||
m_set.assert_expr(m_util.mk_ge(t, m_util.mk_numeral(m_lower, m_util.is_int(t))));
|
||||
m_num_bounds++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void operator()(var *) {}
|
||||
|
||||
void operator()(quantifier*) {}
|
||||
};
|
||||
|
||||
void operator()(assertion_set & s, model_converter_ref & mc) {
|
||||
mc = 0;
|
||||
if (s.inconsistent())
|
||||
return;
|
||||
as_st_report report("add-bounds", s);
|
||||
bound_manager bm(m);
|
||||
expr_fast_mark1 visited;
|
||||
add_bound_proc proc(bm, s, m_lower, m_upper);
|
||||
unsigned sz = s.size();
|
||||
for (unsigned i = 0; i < sz; i++)
|
||||
quick_for_each_expr(proc, visited, s.form(i));
|
||||
visited.reset();
|
||||
report_st_progress(":added-bounds", proc.m_num_bounds);
|
||||
TRACE("add_bounds", s.display(tout););
|
||||
}
|
||||
};
|
||||
|
||||
add_bounds::add_bounds(ast_manager & m, params_ref const & p):
|
||||
m_params(p) {
|
||||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
add_bounds::~add_bounds() {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
void add_bounds::updt_params(params_ref const & p) {
|
||||
m_params = p;
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
void add_bounds::get_param_descrs(param_descrs & r) {
|
||||
r.insert(":add-bound-lower", CPK_NUMERAL, "(default: -2) lower bound to be added to unbounded variables.");
|
||||
r.insert(":add-bound-upper", CPK_NUMERAL, "(default: 2) upper bound to be added to unbounded variables.");
|
||||
}
|
||||
|
||||
void add_bounds::operator()(assertion_set & s, model_converter_ref & mc) {
|
||||
m_imp->operator()(s, mc);
|
||||
}
|
||||
|
||||
void add_bounds::set_cancel(bool f) {
|
||||
if (m_imp)
|
||||
m_imp->set_cancel(f);
|
||||
}
|
||||
|
||||
void add_bounds::cleanup() {
|
||||
ast_manager & m = m_imp->m;
|
||||
imp * d = m_imp;
|
||||
#pragma omp critical (as_st_cancel)
|
||||
{
|
||||
d = m_imp;
|
||||
}
|
||||
dealloc(d);
|
||||
d = alloc(imp, m, m_params);
|
||||
#pragma omp critical (as_st_cancel)
|
||||
{
|
||||
m_imp = d;
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
add_bounds.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Strategy for bounding unbounded variables.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2011-06-30.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#ifndef _ADD_BOUNDS_H_
|
||||
#define _ADD_BOUNDS_H_
|
||||
|
||||
#include"assertion_set_strategy.h"
|
||||
|
||||
bool is_unbounded(assertion_set const & s);
|
||||
|
||||
class add_bounds : public assertion_set_strategy {
|
||||
struct imp;
|
||||
imp * m_imp;
|
||||
params_ref m_params;
|
||||
public:
|
||||
add_bounds(ast_manager & m, params_ref const & p = params_ref());
|
||||
virtual ~add_bounds();
|
||||
|
||||
virtual void updt_params(params_ref const & p);
|
||||
static void get_param_descrs(param_descrs & r);
|
||||
virtual void collect_param_descrs(param_descrs & r) { get_param_descrs(r); }
|
||||
|
||||
virtual void operator()(assertion_set & s, model_converter_ref & mc);
|
||||
|
||||
virtual void cleanup();
|
||||
|
||||
protected:
|
||||
virtual void set_cancel(bool f);
|
||||
};
|
||||
|
||||
inline as_st * mk_add_bounds(ast_manager & m, params_ref const & p = params_ref()) {
|
||||
return clean(alloc(add_bounds, m, p));
|
||||
}
|
||||
|
||||
#endif
|
|
@ -199,13 +199,6 @@ bool bound_manager::is_disjunctive_bound(expr * f, expr_dependency * d) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void bound_manager::operator()(assertion_set const & s) {
|
||||
unsigned sz = s.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
operator()(s.form(i), 0);
|
||||
}
|
||||
}
|
||||
|
||||
void bound_manager::operator()(goal const & g) {
|
||||
unsigned sz = g.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
|
|
|
@ -20,7 +20,6 @@ Notes:
|
|||
#define _BOUND_MANAGER_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include"assertion_set.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
|
||||
class goal;
|
||||
|
@ -48,7 +47,6 @@ public:
|
|||
|
||||
ast_manager & m() const { return m_util.get_manager(); }
|
||||
|
||||
void operator()(assertion_set const & s); // TODO: delete
|
||||
void operator()(goal const & g);
|
||||
void operator()(expr * n, expr_dependency * d = 0);
|
||||
|
||||
|
|
|
@ -1,174 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
elim_term_ite_strategy.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Eliminate term if-then-else by adding
|
||||
new fresh auxiliary variables.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo (leonardo) 2011-06-15
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#include"elim_term_ite_strategy.h"
|
||||
#include"defined_names.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include"cooperate.h"
|
||||
|
||||
struct elim_term_ite_strategy::imp {
|
||||
|
||||
struct rw_cfg : public default_rewriter_cfg {
|
||||
ast_manager & m;
|
||||
defined_names m_defined_names;
|
||||
ref<filter_model_converter> m_mc;
|
||||
assertion_set * m_set;
|
||||
unsigned long long m_max_memory; // in bytes
|
||||
bool m_produce_models;
|
||||
unsigned m_num_fresh;
|
||||
|
||||
bool max_steps_exceeded(unsigned num_steps) const {
|
||||
cooperate("elim term ite");
|
||||
if (memory::get_allocation_size() > m_max_memory)
|
||||
throw elim_term_ite_exception(STE_MAX_MEMORY_MSG);
|
||||
return false;
|
||||
}
|
||||
|
||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||
if (!m.is_term_ite(f))
|
||||
return BR_FAILED;
|
||||
expr_ref new_ite(m);
|
||||
new_ite = m.mk_app(f, num, args);
|
||||
|
||||
expr_ref new_def(m);
|
||||
proof_ref new_def_pr(m);
|
||||
app_ref _result(m);
|
||||
if (m_defined_names.mk_name(new_ite, new_def, new_def_pr, _result, result_pr)) {
|
||||
m_set->assert_expr(new_def, new_def_pr);
|
||||
m_num_fresh++;
|
||||
if (m_produce_models) {
|
||||
if (!m_mc)
|
||||
m_mc = alloc(filter_model_converter, m);
|
||||
m_mc->insert(_result->get_decl());
|
||||
}
|
||||
}
|
||||
result = _result.get();
|
||||
return BR_DONE;
|
||||
}
|
||||
|
||||
rw_cfg(ast_manager & _m, params_ref const & p):
|
||||
m(_m),
|
||||
m_defined_names(m, 0 /* don't use prefix */) {
|
||||
updt_params(p);
|
||||
m_set = 0;
|
||||
m_num_fresh = 0;
|
||||
}
|
||||
|
||||
void updt_params(params_ref const & p) {
|
||||
m_max_memory = megabytes_to_bytes(p.get_uint(":max-memory", UINT_MAX));
|
||||
m_produce_models = p.get_bool(":produce-models", false);
|
||||
}
|
||||
};
|
||||
|
||||
struct rw : public rewriter_tpl<rw_cfg> {
|
||||
rw_cfg m_cfg;
|
||||
|
||||
rw(ast_manager & m, params_ref const & p):
|
||||
rewriter_tpl<rw_cfg>(m, m.proofs_enabled(), m_cfg),
|
||||
m_cfg(m, p) {
|
||||
}
|
||||
};
|
||||
|
||||
ast_manager & m;
|
||||
rw m_rw;
|
||||
|
||||
imp(ast_manager & _m, params_ref const & p):
|
||||
m(_m),
|
||||
m_rw(m, p) {
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_rw.set_cancel(f);
|
||||
}
|
||||
|
||||
void updt_params(params_ref const & p) {
|
||||
m_rw.cfg().updt_params(p);
|
||||
}
|
||||
|
||||
void operator()(assertion_set & s, model_converter_ref & mc) {
|
||||
mc = 0;
|
||||
if (s.inconsistent())
|
||||
return;
|
||||
{
|
||||
as_st_report report("elim-term-ite", s);
|
||||
m_rw.m_cfg.m_num_fresh = 0;
|
||||
m_rw.m_cfg.m_set = &s;
|
||||
expr_ref new_curr(m);
|
||||
proof_ref new_pr(m);
|
||||
unsigned size = s.size();
|
||||
for (unsigned idx = 0; idx < size; idx++) {
|
||||
expr * curr = s.form(idx);
|
||||
m_rw(curr, new_curr, new_pr);
|
||||
if (m.proofs_enabled()) {
|
||||
proof * pr = s.pr(idx);
|
||||
new_pr = m.mk_modus_ponens(pr, new_pr);
|
||||
}
|
||||
s.update(idx, new_curr, new_pr);
|
||||
}
|
||||
mc = m_rw.m_cfg.m_mc.get();
|
||||
}
|
||||
report_st_progress(":elim-term-ite-consts", m_rw.m_cfg.m_num_fresh);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
elim_term_ite_strategy::elim_term_ite_strategy(ast_manager & m, params_ref const & p):
|
||||
m_params(p) {
|
||||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
elim_term_ite_strategy::~elim_term_ite_strategy() {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
void elim_term_ite_strategy::updt_params(params_ref const & p) {
|
||||
m_params = p;
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
void elim_term_ite_strategy::get_param_descrs(param_descrs & r) {
|
||||
insert_max_memory(r);
|
||||
insert_produce_models(r);
|
||||
}
|
||||
|
||||
void elim_term_ite_strategy::operator()(assertion_set & s, model_converter_ref & mc) {
|
||||
m_imp->operator()(s, mc);
|
||||
}
|
||||
|
||||
void elim_term_ite_strategy::set_cancel(bool f) {
|
||||
if (m_imp)
|
||||
m_imp->set_cancel(f);
|
||||
}
|
||||
|
||||
void elim_term_ite_strategy::cleanup() {
|
||||
ast_manager & m = m_imp->m;
|
||||
imp * d = m_imp;
|
||||
#pragma omp critical (as_st_cancel)
|
||||
{
|
||||
d = m_imp;
|
||||
}
|
||||
dealloc(d);
|
||||
d = alloc(imp, m, m_params);
|
||||
#pragma omp critical (as_st_cancel)
|
||||
{
|
||||
m_imp = d;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
elim_term_ite_strategy.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Eliminate term if-then-else by adding
|
||||
new fresh auxiliary variables.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo (leonardo) 2011-06-15
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#ifndef _ELIM_TERM_ITE_STRATEGY_H_
|
||||
#define _ELIM_TERM_ITE_STRATEGY_H_
|
||||
|
||||
#include"strategy_exception.h"
|
||||
#include"model_converter.h"
|
||||
#include"params.h"
|
||||
#include"assertion_set_strategy.h"
|
||||
|
||||
class assertion_set;
|
||||
MK_ST_EXCEPTION(elim_term_ite_exception);
|
||||
|
||||
class elim_term_ite_strategy : public assertion_set_strategy {
|
||||
struct imp;
|
||||
imp * m_imp;
|
||||
params_ref m_params;
|
||||
public:
|
||||
elim_term_ite_strategy(ast_manager & m, params_ref const & p = params_ref());
|
||||
virtual ~elim_term_ite_strategy();
|
||||
|
||||
virtual void updt_params(params_ref const & p);
|
||||
static void get_param_descrs(param_descrs & r);
|
||||
virtual void collect_param_descrs(param_descrs & r) { get_param_descrs(r); }
|
||||
|
||||
virtual void operator()(assertion_set & s, model_converter_ref & mc);
|
||||
|
||||
virtual void cleanup();
|
||||
virtual void set_cancel(bool f);
|
||||
};
|
||||
|
||||
inline as_st * mk_elim_term_ite(ast_manager & m, params_ref const & p = params_ref()) {
|
||||
return clean(alloc(elim_term_ite_strategy, m, p));
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,96 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
sat_solver_strategy.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Strategy for using the SMT solver.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo (leonardo) 2011-06-25
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#include"smt_solver_strategy.h"
|
||||
#include"smt_solver_exp.h"
|
||||
|
||||
smt_solver_strategy::smt_solver_strategy(ast_manager & _m, params_ref const & p):
|
||||
m(_m),
|
||||
m_params(p) {
|
||||
}
|
||||
|
||||
smt_solver_strategy::~smt_solver_strategy() {
|
||||
}
|
||||
|
||||
void smt_solver_strategy::init_solver() {
|
||||
smt::solver_exp * new_solver = alloc(smt::solver_exp, m, m_params);
|
||||
#pragma omp critical (as_st_cancel)
|
||||
{
|
||||
m_solver = new_solver;
|
||||
}
|
||||
}
|
||||
|
||||
void smt_solver_strategy::updt_params(params_ref const & p) {
|
||||
m_params = p;
|
||||
}
|
||||
|
||||
void smt_solver_strategy::get_param_descrs(param_descrs & r) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void smt_solver_strategy::operator()(assertion_set & s, model_converter_ref & mc) {
|
||||
if (s.m().proofs_enabled())
|
||||
throw smt_solver_exception("smt quick solver does not support proof generation");
|
||||
mc = 0;
|
||||
s.elim_redundancies();
|
||||
if (s.inconsistent())
|
||||
return;
|
||||
|
||||
init_solver();
|
||||
m_solver->assert_set(s);
|
||||
s.reset();
|
||||
|
||||
lbool r = m_solver->check();
|
||||
m_solver->collect_statistics(m_stats);
|
||||
|
||||
if (r == l_false) {
|
||||
s.assert_expr(m.mk_false());
|
||||
}
|
||||
else if (r == l_true) {
|
||||
model_ref md;
|
||||
m_solver->get_model(md);
|
||||
mc = model2model_converter(md.get());
|
||||
}
|
||||
else {
|
||||
// recover simplified assertion set
|
||||
m_solver->get_assertions(s);
|
||||
m_solver->get_model_converter(mc);
|
||||
}
|
||||
}
|
||||
|
||||
void smt_solver_strategy::cleanup() {
|
||||
if (m_solver)
|
||||
m_solver->collect_statistics(m_stats);
|
||||
#pragma omp critical (as_st_cancel)
|
||||
{
|
||||
m_solver = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void smt_solver_strategy::set_cancel(bool f) {
|
||||
if (m_solver)
|
||||
m_solver->set_cancel(f);
|
||||
}
|
||||
|
||||
void smt_solver_strategy::reset_statistics() {
|
||||
m_stats.reset();
|
||||
}
|
||||
|
||||
void smt_solver_strategy::collect_statistics(statistics & st) const {
|
||||
st.copy(m_stats);
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
smt_solver_strategy.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Strategy for using the SAT solver.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo (leonardo) 2011-06-25
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#ifndef _SMT_SOLVER_STRATEGY_H_
|
||||
#define _SMT_SOLVER_STRATEGY_H_
|
||||
|
||||
#include"assertion_set_strategy.h"
|
||||
|
||||
namespace smt { class solver_exp; };
|
||||
|
||||
class smt_solver_strategy : public assertion_set_strategy {
|
||||
struct imp;
|
||||
ast_manager & m;
|
||||
params_ref m_params;
|
||||
statistics m_stats;
|
||||
scoped_ptr<smt::solver_exp> m_solver;
|
||||
void init_solver();
|
||||
public:
|
||||
smt_solver_strategy(ast_manager & m, params_ref const & p = params_ref());
|
||||
virtual ~smt_solver_strategy();
|
||||
|
||||
virtual void updt_params(params_ref const & p);
|
||||
static void get_param_descrs(param_descrs & r);
|
||||
virtual void collect_param_descrs(param_descrs & r) { get_param_descrs(r); }
|
||||
|
||||
virtual void operator()(assertion_set & s, model_converter_ref & mc);
|
||||
|
||||
virtual void cleanup();
|
||||
|
||||
virtual void collect_statistics(statistics & st) const;
|
||||
virtual void reset_statistics();
|
||||
protected:
|
||||
virtual void set_cancel(bool f);
|
||||
};
|
||||
|
||||
inline as_st * mk_smt2_solver(ast_manager & m, params_ref const & p = params_ref()) {
|
||||
return clean(alloc(smt_solver_strategy, m, p));
|
||||
}
|
||||
|
||||
#endif
|
|
@ -59,7 +59,7 @@ Notes:
|
|||
#include"bv_size_reduction_tactic.h"
|
||||
#include"propagate_ineqs_tactic.h"
|
||||
#include"cofactor_term_ite_tactic.h"
|
||||
#include"mip_tactic.h"
|
||||
// include"mip_tactic.h"
|
||||
#include"vsubst_tactic.h"
|
||||
#include"sls_tactic.h"
|
||||
#include"probe_arith.h"
|
||||
|
@ -121,7 +121,6 @@ MK_SIMPLE_TACTIC_FACTORY(reduce_args_fct, mk_reduce_args_tactic(m, p));
|
|||
MK_SIMPLE_TACTIC_FACTORY(bv_size_reduction_fct, mk_bv_size_reduction_tactic(m, p));
|
||||
MK_SIMPLE_TACTIC_FACTORY(propagate_ineqs_fct, mk_propagate_ineqs_tactic(m, p));
|
||||
MK_SIMPLE_TACTIC_FACTORY(cofactor_term_ite_fct, mk_cofactor_term_ite_tactic(m, p));
|
||||
MK_SIMPLE_TACTIC_FACTORY(mip_fct, mk_mip_tactic(m, p));
|
||||
MK_SIMPLE_TACTIC_FACTORY(nla2bv_fct, mk_nla2bv_tactic(m, p));
|
||||
MK_SIMPLE_TACTIC_FACTORY(vsubst_fct, mk_vsubst_tactic(m, p));
|
||||
MK_SIMPLE_TACTIC_FACTORY(qfbv_sls_fct, mk_qfbv_sls_tactic(m, p));
|
||||
|
@ -188,7 +187,6 @@ void install_tactics(tactic_manager & ctx) {
|
|||
ADD_TACTIC_CMD("reduce-bv-size", "try to reduce bit-vector sizes using inequalities.", bv_size_reduction_fct);
|
||||
ADD_TACTIC_CMD("propagate-ineqs", "propagate ineqs/bounds, remove subsumed inequalities.", propagate_ineqs_fct);
|
||||
ADD_TACTIC_CMD("cofactor-term-ite", "eliminate term if-the-else using cofactors.", cofactor_term_ite_fct);
|
||||
ADD_TACTIC_CMD("mip", "solver for mixed integer programming problems.", mip_fct);
|
||||
ADD_TACTIC_CMD("nla2bv", "convert a nonlinear arithmetic problem into a bit-vector problem, in most cases the resultant goal is an under approximation and is useul for finding models.", nla2bv_fct);
|
||||
ADD_TACTIC_CMD("vsubst", "checks satsifiability of quantifier-free non-linear constraints using virtual substitution.", vsubst_fct);
|
||||
ADD_TACTIC_CMD("qfbv-sls", "(try to) solve using stochastic local search for QF_BV.", qfbv_sls_fct);
|
||||
|
@ -223,7 +221,6 @@ void install_tactics(tactic_manager & ctx) {
|
|||
ADD_PROBE("is-qflra", "true if the goal is in QF_LRA.", mk_is_qflra_probe());
|
||||
ADD_PROBE("is-qflira", "true if the goal is in QF_LIRA.", mk_is_qflira_probe());
|
||||
ADD_PROBE("is-ilp", "true if the goal is ILP.", mk_is_ilp_probe());
|
||||
ADD_PROBE("is-mip", "true if the goal is MIP.", mk_is_mip_probe());
|
||||
ADD_PROBE("is-unbounded", "true if the goal contains integer/real constants that do not have lower/upper bounds.", mk_is_unbounded_probe());
|
||||
ADD_PROBE("is-pb", "true if the goal is a pseudo-boolean problem.", mk_is_pb_probe());
|
||||
ADD_PROBE("arith-max-deg", "max polynomial total degree of an arithmetic atom.", mk_arith_max_degree_probe());
|
||||
|
|
|
@ -24,7 +24,7 @@ Notes:
|
|||
#include"solve_eqs_tactic.h"
|
||||
#include"elim_uncnstr_tactic.h"
|
||||
#include"smt_tactic.h"
|
||||
#include"mip_tactic.h"
|
||||
// include"mip_tactic.h"
|
||||
#include"add_bounds_tactic.h"
|
||||
#include"pb2bv_tactic.h"
|
||||
#include"lia2pb_tactic.h"
|
||||
|
@ -109,7 +109,7 @@ static tactic * mk_pb_tactic(ast_manager & m) {
|
|||
fail_if(mk_produce_unsat_cores_probe()),
|
||||
or_else(and_then(fail_if(mk_ge(mk_num_exprs_probe(), mk_const_probe(SMALL_SIZE))),
|
||||
fail_if_not(mk_is_ilp_probe()),
|
||||
try_for(mk_mip_tactic(m), 8000),
|
||||
// try_for(mk_mip_tactic(m), 8000),
|
||||
mk_fail_if_undecided_tactic()),
|
||||
and_then(using_params(mk_pb2bv_tactic(m), pb2bv_p),
|
||||
fail_if_not(mk_is_qfbv_probe()),
|
||||
|
@ -147,14 +147,15 @@ static tactic * mk_ilp_model_finder_tactic(ast_manager & m) {
|
|||
fail_if(mk_produce_proofs_probe()),
|
||||
fail_if(mk_produce_unsat_cores_probe()),
|
||||
mk_propagate_ineqs_tactic(m),
|
||||
or_else(try_for(mk_mip_tactic(m), 5000),
|
||||
or_else(// try_for(mk_mip_tactic(m), 5000),
|
||||
try_for(mk_no_cut_smt_tactic(100), 2000),
|
||||
and_then(using_params(mk_add_bounds_tactic(m), add_bounds_p1),
|
||||
try_for(mk_lia2sat_tactic(m), 5000)),
|
||||
try_for(mk_no_cut_smt_tactic(200), 5000),
|
||||
and_then(using_params(mk_add_bounds_tactic(m), add_bounds_p2),
|
||||
try_for(mk_lia2sat_tactic(m), 10000)),
|
||||
mk_mip_tactic(m)),
|
||||
try_for(mk_lia2sat_tactic(m), 10000))
|
||||
// , mk_mip_tactic(m)
|
||||
),
|
||||
mk_fail_if_undecided_tactic());
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ Notes:
|
|||
#include"solve_eqs_tactic.h"
|
||||
#include"elim_uncnstr_tactic.h"
|
||||
#include"smt_tactic.h"
|
||||
#include"mip_tactic.h"
|
||||
// include"mip_tactic.h"
|
||||
#include"recover_01_tactic.h"
|
||||
#include"ctx_simplify_tactic.h"
|
||||
#include"probe_arith.h"
|
||||
|
@ -47,6 +47,8 @@ tactic * mk_qflra_tactic(ast_manager & m, params_ref const & p) {
|
|||
params_ref elim_to_real_p;
|
||||
elim_to_real_p.set_bool(":elim-to-real", true);
|
||||
|
||||
|
||||
#if 0
|
||||
tactic * mip =
|
||||
and_then(fail_if(mk_produce_proofs_probe()),
|
||||
fail_if(mk_produce_unsat_cores_probe()),
|
||||
|
@ -64,8 +66,11 @@ tactic * mk_qflra_tactic(ast_manager & m, params_ref const & p) {
|
|||
fail_if(mk_not(mk_is_mip_probe())),
|
||||
try_for(mk_mip_tactic(m), 30000),
|
||||
mk_fail_if_undecided_tactic());
|
||||
#endif
|
||||
|
||||
return using_params(or_else(mip,
|
||||
using_params(mk_smt_tactic(), pivot_p)),
|
||||
p);
|
||||
// return using_params(or_else(mip,
|
||||
// using_params(mk_smt_tactic(), pivot_p)),
|
||||
// p);
|
||||
|
||||
return using_params(using_params(mk_smt_tactic(), pivot_p), p);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue