mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 20:18:18 +00:00
throttle monomial unit prop and and nl params
This commit is contained in:
parent
896aba31f8
commit
6ff4856e38
|
@ -1913,6 +1913,10 @@ void core::add_lower_bound_monic(lpvar j, const lp::mpq& v, bool is_strict, std:
|
||||||
}
|
}
|
||||||
|
|
||||||
void core::propagate_monic_with_non_fixed(lpvar monic_var, const svector<lpvar>& vars, lpvar non_fixed, const rational& k) {
|
void core::propagate_monic_with_non_fixed(lpvar monic_var, const svector<lpvar>& vars, lpvar non_fixed, const rational& k) {
|
||||||
|
if (params().arith_nl_use_lemmas_in_unit_prop()) {
|
||||||
|
propagate_monic_non_fixed_with_lemma(monic_var, vars, non_fixed, k);
|
||||||
|
return;
|
||||||
|
}
|
||||||
lp::impq bound_value;
|
lp::impq bound_value;
|
||||||
bool is_strict;
|
bool is_strict;
|
||||||
auto& lps = lra;
|
auto& lps = lra;
|
||||||
|
@ -2003,12 +2007,37 @@ void core::add_lower_bound_monic(lpvar j, const lp::mpq& v, bool is_strict, std:
|
||||||
add_upper_bound_monic(monic_var, lp::mpq(0), false, lambda);
|
add_upper_bound_monic(monic_var, lp::mpq(0), false, lambda);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void core::propagate_monic_non_fixed_with_lemma(lpvar monic_var, const svector<lpvar>& vars, lpvar non_fixed, const rational& k) {
|
||||||
|
lp::impq bound_value;
|
||||||
|
new_lemma lemma(*this, "propagate monic with non fixed");
|
||||||
|
// using += to not assert thath the inequality does not hold
|
||||||
|
lemma += ineq(term(rational(1), monic_var, -k, non_fixed), llc::EQ, 0);
|
||||||
|
lp::explanation exp;
|
||||||
|
for (auto v : m_emons[monic_var].vars()) {
|
||||||
|
if (v == non_fixed) continue;
|
||||||
|
u_dependency* dep = lra.get_column_lower_bound_witness(v);
|
||||||
|
for (auto ci : lra.flatten(dep)) {
|
||||||
|
exp.push_back(ci);
|
||||||
|
}
|
||||||
|
dep = lra.get_column_upper_bound_witness(v);
|
||||||
|
for (auto ci : lra.flatten(dep)) {
|
||||||
|
exp.push_back(ci);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lemma &= exp;
|
||||||
|
}
|
||||||
|
|
||||||
void core::calculate_implied_bounds_for_monic(lp::lpvar monic_var) {
|
void core::calculate_implied_bounds_for_monic(lp::lpvar monic_var) {
|
||||||
|
m_propagated.reserve(monic_var + 1, false);
|
||||||
|
bool throttle = params().arith_nl_throttle_unit_prop();
|
||||||
|
if (throttle && m_propagated[monic_var])
|
||||||
|
return;
|
||||||
lpvar non_fixed, zero_var;
|
lpvar non_fixed, zero_var;
|
||||||
const auto& vars = m_emons[monic_var].vars();
|
const auto& vars = m_emons[monic_var].vars();
|
||||||
if (!is_linear(vars, zero_var, non_fixed))
|
if (!is_linear(vars, zero_var, non_fixed))
|
||||||
return;
|
return;
|
||||||
|
if (throttle)
|
||||||
|
trail().push(set_bitvector_trail(m_propagated, monic_var));
|
||||||
if (zero_var != null_lpvar)
|
if (zero_var != null_lpvar)
|
||||||
add_bounds_for_zero_var(monic_var, zero_var);
|
add_bounds_for_zero_var(monic_var, zero_var);
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -114,7 +114,7 @@ class core {
|
||||||
bool m_cautious_patching = true;
|
bool m_cautious_patching = true;
|
||||||
lpvar m_patched_var = 0;
|
lpvar m_patched_var = 0;
|
||||||
monic const* m_patched_monic = nullptr;
|
monic const* m_patched_monic = nullptr;
|
||||||
|
bool_vector m_propagated;
|
||||||
void check_weighted(unsigned sz, std::pair<unsigned, std::function<void(void)>>* checks);
|
void check_weighted(unsigned sz, std::pair<unsigned, std::function<void(void)>>* checks);
|
||||||
void add_bounds();
|
void add_bounds();
|
||||||
std_vector<lp::implied_bound> & m_implied_bounds;
|
std_vector<lp::implied_bound> & m_implied_bounds;
|
||||||
|
@ -438,6 +438,7 @@ public:
|
||||||
bool is_linear(const svector<lpvar>& m, lpvar& zero_var, lpvar& non_fixed);
|
bool is_linear(const svector<lpvar>& m, lpvar& zero_var, lpvar& non_fixed);
|
||||||
void add_bounds_for_zero_var(lpvar monic_var, lpvar zero_var);
|
void add_bounds_for_zero_var(lpvar monic_var, lpvar zero_var);
|
||||||
void propagate_monic_with_non_fixed(lpvar monic_var, const svector<lpvar>& vars, lpvar non_fixed, const rational& k);
|
void propagate_monic_with_non_fixed(lpvar monic_var, const svector<lpvar>& vars, lpvar non_fixed, const rational& k);
|
||||||
|
void core::propagate_monic_non_fixed_with_lemma(lpvar monic_var, const svector<lpvar>& vars, lpvar non_fixed, const rational& k);
|
||||||
void propagate_monic_with_all_fixed(lpvar monic_var, const svector<lpvar>& vars, const rational& k);
|
void propagate_monic_with_all_fixed(lpvar monic_var, const svector<lpvar>& vars, const rational& k);
|
||||||
void add_lower_bound_monic(lpvar j, const lp::mpq& v, bool is_strict, std::function<u_dependency*()> explain_dep);
|
void add_lower_bound_monic(lpvar j, const lp::mpq& v, bool is_strict, std::function<u_dependency*()> explain_dep);
|
||||||
void add_upper_bound_monic(lpvar j, const lp::mpq& v, bool is_strict, std::function<u_dependency*()> explain_dep);
|
void add_upper_bound_monic(lpvar j, const lp::mpq& v, bool is_strict, std::function<u_dependency*()> explain_dep);
|
||||||
|
|
|
@ -71,6 +71,8 @@ def_module_params(module_name='smt',
|
||||||
('arith.nl.grobner_row_length_limit', UINT, 10, 'row is disregarded by the heuristic if its length is longer than the value'),
|
('arith.nl.grobner_row_length_limit', UINT, 10, 'row is disregarded by the heuristic if its length is longer than the value'),
|
||||||
('arith.nl.grobner_frequency', UINT, 4, 'grobner\'s call frequency'),
|
('arith.nl.grobner_frequency', UINT, 4, 'grobner\'s call frequency'),
|
||||||
('arith.nl.grobner', BOOL, True, 'run grobner\'s basis heuristic'),
|
('arith.nl.grobner', BOOL, True, 'run grobner\'s basis heuristic'),
|
||||||
|
('arith.nl.use_lemmas_in_unit_prop', BOOL, False, 'use lemmas in monomial unit propagation'),
|
||||||
|
('arith.nl.throttle_unit_prop', BOOL, True, 'unit propogate a monomial only once per scope'),
|
||||||
('arith.nl.grobner_eqs_growth', UINT, 10, 'grobner\'s number of equalities growth '),
|
('arith.nl.grobner_eqs_growth', UINT, 10, 'grobner\'s number of equalities growth '),
|
||||||
('arith.nl.grobner_expr_size_growth', UINT, 2, 'grobner\'s maximum expr size growth'),
|
('arith.nl.grobner_expr_size_growth', UINT, 2, 'grobner\'s maximum expr size growth'),
|
||||||
('arith.nl.grobner_expr_degree_growth', UINT, 2, 'grobner\'s maximum expr degree growth'),
|
('arith.nl.grobner_expr_degree_growth', UINT, 2, 'grobner\'s maximum expr degree growth'),
|
||||||
|
|
|
@ -3209,7 +3209,7 @@ public:
|
||||||
svector<enode_pair> m_eqs;
|
svector<enode_pair> m_eqs;
|
||||||
vector<parameter> m_params;
|
vector<parameter> m_params;
|
||||||
|
|
||||||
void reset_evidence() {
|
void reset_evidence() {
|
||||||
m_core.reset();
|
m_core.reset();
|
||||||
m_eqs.reset();
|
m_eqs.reset();
|
||||||
m_params.reset();
|
m_params.reset();
|
||||||
|
|
Loading…
Reference in a new issue