mirror of
https://github.com/Z3Prover/z3
synced 2025-08-26 04:56:03 +00:00
working on #5614
there are some different sources for the performance regression illustrated by the example. The mitigations will be enabled separately: - m_bv_to_propagate is too expensive - lp_bound_propagator misses equalities in two different ways: - it resets row checks after backtracking even though they could still propagate - it misses equalities for fixed rows when the fixed constant value does not correspond to a fixed variable. FYI @levnach
This commit is contained in:
parent
a94e2e62af
commit
87d4ce2659
13 changed files with 422 additions and 385 deletions
|
@ -301,26 +301,27 @@ namespace arith {
|
|||
m_explanation.add_pair(j, v);
|
||||
}
|
||||
|
||||
void solver::add_eq(lpvar u, lpvar v, lp::explanation const& e) {
|
||||
bool solver::add_eq(lpvar u, lpvar v, lp::explanation const& e, bool is_fixed) {
|
||||
if (s().inconsistent())
|
||||
return;
|
||||
return false;
|
||||
theory_var uv = lp().local_to_external(u); // variables that are returned should have external representations
|
||||
theory_var vv = lp().local_to_external(v); // so maybe better to have them already transformed to external form
|
||||
if (is_equal(uv, vv))
|
||||
return;
|
||||
return false;
|
||||
enode* n1 = var2enode(uv);
|
||||
enode* n2 = var2enode(vv);
|
||||
expr* e1 = n1->get_expr();
|
||||
expr* e2 = n2->get_expr();
|
||||
if (m.is_ite(e1) || m.is_ite(e2))
|
||||
return;
|
||||
if (!is_fixed && !a.is_numeral(e1) && !a.is_numeral(e2) && (m.is_ite(e1) || m.is_ite(e2)))
|
||||
return false;
|
||||
if (e1->get_sort() != e2->get_sort())
|
||||
return;
|
||||
return false;
|
||||
reset_evidence();
|
||||
for (auto ev : e)
|
||||
set_evidence(ev.ci(), m_core, m_eqs);
|
||||
auto* jst = euf::th_explain::propagate(*this, m_core, m_eqs, n1, n2);
|
||||
ctx.propagate(n1, n2, jst->to_index());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool solver::bound_is_interesting(unsigned vi, lp::lconstraint_kind kind, const rational& bval) const {
|
||||
|
|
|
@ -450,7 +450,7 @@ namespace arith {
|
|||
lp::lar_solver& lp() { return *m_solver; }
|
||||
lp::lar_solver const& lp() const { return *m_solver; }
|
||||
bool is_equal(theory_var x, theory_var y) const;
|
||||
void add_eq(lpvar u, lpvar v, lp::explanation const& e);
|
||||
bool add_eq(lpvar u, lpvar v, lp::explanation const& e, bool is_fixed);
|
||||
void consume(rational const& v, lp::constraint_index j);
|
||||
bool bound_is_interesting(unsigned vi, lp::lconstraint_kind kind, const rational& bval) const;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue