mirror of
https://github.com/Z3Prover/z3
synced 2025-06-06 14:13:23 +00:00
add option to disable cardinality solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
c347018cb8
commit
2bcb875559
4 changed files with 17 additions and 3 deletions
|
@ -44,6 +44,7 @@ func_decl * pb_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, p
|
||||||
case OP_PB_LE: sym = m_pble_sym; break;
|
case OP_PB_LE: sym = m_pble_sym; break;
|
||||||
case OP_PB_GE: sym = m_pbge_sym; break;
|
case OP_PB_GE: sym = m_pbge_sym; break;
|
||||||
case OP_PB_EQ: sym = m_pbeq_sym; break;
|
case OP_PB_EQ: sym = m_pbeq_sym; break;
|
||||||
|
case OP_PB_ODD: sym = symbol("is-odd"); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
switch(k) {
|
switch(k) {
|
||||||
|
@ -55,6 +56,14 @@ func_decl * pb_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, p
|
||||||
func_decl_info info(m_family_id, k, 1, parameters);
|
func_decl_info info(m_family_id, k, 1, parameters);
|
||||||
return m.mk_func_decl(sym, arity, domain, m.mk_bool_sort(), info);
|
return m.mk_func_decl(sym, arity, domain, m.mk_bool_sort(), info);
|
||||||
}
|
}
|
||||||
|
case OP_PB_ODD:{
|
||||||
|
if (num_parameters != 0) {
|
||||||
|
m.raise_exception("function expects no parameters");
|
||||||
|
}
|
||||||
|
func_decl_info info(m_family_id, k, 0, parameters);
|
||||||
|
return m.mk_func_decl(sym, arity, domain, m.mk_bool_sort(), info);
|
||||||
|
}
|
||||||
|
|
||||||
case OP_PB_GE:
|
case OP_PB_GE:
|
||||||
case OP_PB_LE:
|
case OP_PB_LE:
|
||||||
case OP_PB_EQ: {
|
case OP_PB_EQ: {
|
||||||
|
@ -97,6 +106,7 @@ void pb_decl_plugin::get_op_names(svector<builtin_name> & op_names, symbol const
|
||||||
op_names.push_back(builtin_name(m_pble_sym.bare_str(), OP_PB_LE));
|
op_names.push_back(builtin_name(m_pble_sym.bare_str(), OP_PB_LE));
|
||||||
op_names.push_back(builtin_name(m_pbge_sym.bare_str(), OP_PB_GE));
|
op_names.push_back(builtin_name(m_pbge_sym.bare_str(), OP_PB_GE));
|
||||||
op_names.push_back(builtin_name(m_pbeq_sym.bare_str(), OP_PB_EQ));
|
op_names.push_back(builtin_name(m_pbeq_sym.bare_str(), OP_PB_EQ));
|
||||||
|
op_names.push_back(builtin_name("is-odd", OP_PB_ODD));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ enum pb_op_kind {
|
||||||
OP_PB_LE, // pseudo-Boolean <= (generalizes at_most_k)
|
OP_PB_LE, // pseudo-Boolean <= (generalizes at_most_k)
|
||||||
OP_PB_GE, // pseudo-Boolean >=
|
OP_PB_GE, // pseudo-Boolean >=
|
||||||
OP_PB_EQ, // equality
|
OP_PB_EQ, // equality
|
||||||
|
OP_PB_ODD, // parity of arguments is odd
|
||||||
OP_PB_AUX_BOOL, // auxiliary internal Boolean variable.
|
OP_PB_AUX_BOOL, // auxiliary internal Boolean variable.
|
||||||
LAST_PB_OP
|
LAST_PB_OP
|
||||||
};
|
};
|
||||||
|
@ -95,12 +96,14 @@ public:
|
||||||
app * mk_ge(unsigned num_args, rational const * coeffs, expr * const * args, rational const& k);
|
app * mk_ge(unsigned num_args, rational const * coeffs, expr * const * args, rational const& k);
|
||||||
app * mk_eq(unsigned num_args, rational const * coeffs, expr * const * args, rational const& k);
|
app * mk_eq(unsigned num_args, rational const * coeffs, expr * const * args, rational const& k);
|
||||||
app * mk_lt(unsigned num_args, rational const * coeffs, expr * const * args, rational const& k);
|
app * mk_lt(unsigned num_args, rational const * coeffs, expr * const * args, rational const& k);
|
||||||
|
app * mk_odd(unsigned num_args, expr * const * args);
|
||||||
bool is_at_most_k(func_decl *a) const;
|
bool is_at_most_k(func_decl *a) const;
|
||||||
bool is_at_most_k(expr *a) const { return is_app(a) && is_at_most_k(to_app(a)->get_decl()); }
|
bool is_at_most_k(expr *a) const { return is_app(a) && is_at_most_k(to_app(a)->get_decl()); }
|
||||||
bool is_at_most_k(expr *a, rational& k) const;
|
bool is_at_most_k(expr *a, rational& k) const;
|
||||||
bool is_at_least_k(func_decl *a) const;
|
bool is_at_least_k(func_decl *a) const;
|
||||||
bool is_at_least_k(expr *a) const { return is_app(a) && is_at_least_k(to_app(a)->get_decl()); }
|
bool is_at_least_k(expr *a) const { return is_app(a) && is_at_least_k(to_app(a)->get_decl()); }
|
||||||
bool is_at_least_k(expr *a, rational& k) const;
|
bool is_at_least_k(expr *a, rational& k) const;
|
||||||
|
bool is_odd(expr* a) const;
|
||||||
rational get_k(func_decl *a) const;
|
rational get_k(func_decl *a) const;
|
||||||
rational get_k(expr *a) const { return get_k(to_app(a)->get_decl()); }
|
rational get_k(expr *a) const { return get_k(to_app(a)->get_decl()); }
|
||||||
bool is_le(func_decl *a) const;
|
bool is_le(func_decl *a) const;
|
||||||
|
|
|
@ -26,4 +26,5 @@ def_module_params('sat',
|
||||||
('dimacs.core', BOOL, False, 'extract core from DIMACS benchmarks'),
|
('dimacs.core', BOOL, False, 'extract core from DIMACS benchmarks'),
|
||||||
('drat.file', SYMBOL, '', 'file to dump DRAT proofs'),
|
('drat.file', SYMBOL, '', 'file to dump DRAT proofs'),
|
||||||
('drat.check', BOOL, False, 'build up internal proof and check'),
|
('drat.check', BOOL, False, 'build up internal proof and check'),
|
||||||
|
('cardinality.solver', BOOL, True, 'use cardinality solver'),
|
||||||
))
|
))
|
||||||
|
|
|
@ -82,9 +82,7 @@ public:
|
||||||
m_num_scopes(0),
|
m_num_scopes(0),
|
||||||
m_dep_core(m),
|
m_dep_core(m),
|
||||||
m_unknown("no reason given") {
|
m_unknown("no reason given") {
|
||||||
m_params.set_bool("elim_vars", false);
|
updt_params(p);
|
||||||
sat_params p1(m_params);
|
|
||||||
m_solver.updt_params(m_params);
|
|
||||||
init_preprocess();
|
init_preprocess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,8 +216,10 @@ public:
|
||||||
m_params.append(p);
|
m_params.append(p);
|
||||||
sat_params p1(p);
|
sat_params p1(p);
|
||||||
m_params.set_bool("elim_vars", false);
|
m_params.set_bool("elim_vars", false);
|
||||||
|
m_params.set_bool("keep_cardinality_constraints", p1.cardinality_solver());
|
||||||
m_solver.updt_params(m_params);
|
m_solver.updt_params(m_params);
|
||||||
m_optimize_model = m_params.get_bool("optimize_model", false);
|
m_optimize_model = m_params.get_bool("optimize_model", false);
|
||||||
|
|
||||||
}
|
}
|
||||||
virtual void collect_statistics(statistics & st) const {
|
virtual void collect_statistics(statistics & st) const {
|
||||||
if (m_preprocess) m_preprocess->collect_statistics(st);
|
if (m_preprocess) m_preprocess->collect_statistics(st);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue