mirror of
https://github.com/Z3Prover/z3
synced 2025-11-05 22:06:03 +00:00
delay evaluation of model, throttle propagation, introduce LUT results into cutset
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
7b2f6791bc
commit
2d59b81353
14 changed files with 112 additions and 84 deletions
|
|
@ -1623,7 +1623,7 @@ public:
|
|||
svector<lpvar> vars;
|
||||
theory_var sz = static_cast<theory_var>(th.get_num_vars());
|
||||
for (theory_var v = 0; v < sz; ++v) {
|
||||
if (can_be_used_in_random_update(v))
|
||||
if (th.is_relevant_and_shared(get_enode(v)))
|
||||
vars.push_back(get_lpvar(v));
|
||||
}
|
||||
if (vars.empty()) {
|
||||
|
|
@ -2368,20 +2368,36 @@ public:
|
|||
|
||||
}
|
||||
|
||||
void propagate_bounds_with_lp_solver() {
|
||||
if (BP_NONE == propagation_mode()) {
|
||||
return;
|
||||
unsigned m_propagation_delay{1};
|
||||
unsigned m_propagation_count{0};
|
||||
|
||||
bool should_propagate() {
|
||||
++m_propagation_count;
|
||||
return BP_NONE != propagation_mode() && (m_propagation_count >= m_propagation_delay);
|
||||
}
|
||||
|
||||
void update_propagation_threshold(bool made_progress) {
|
||||
m_propagation_count = 0;
|
||||
if (made_progress) {
|
||||
m_propagation_delay = std::max(1u, m_propagation_delay-1u);
|
||||
}
|
||||
int num_of_p = lp().settings().stats().m_num_of_implied_bounds;
|
||||
(void)num_of_p;
|
||||
else {
|
||||
m_propagation_delay += 2;
|
||||
}
|
||||
}
|
||||
|
||||
void propagate_bounds_with_lp_solver() {
|
||||
if (!should_propagate())
|
||||
return;
|
||||
local_bound_propagator bp(*this);
|
||||
unsigned num_changed = lp().num_changed_bounds();
|
||||
|
||||
lp().propagate_bounds_for_touched_rows(bp);
|
||||
if (m.canceled()) {
|
||||
return;
|
||||
}
|
||||
int new_num_of_p = lp().settings().stats().m_num_of_implied_bounds;
|
||||
(void)new_num_of_p;
|
||||
CTRACE("arith", new_num_of_p > num_of_p, tout << "found " << new_num_of_p << " implied bounds\n";);
|
||||
unsigned props = m_stats.m_bound_propagations1;
|
||||
|
||||
if (is_infeasible()) {
|
||||
get_infeasibility_explanation_and_set_conflict();
|
||||
}
|
||||
|
|
@ -2390,28 +2406,26 @@ public:
|
|||
propagate_lp_solver_bound(bp.m_ibounds[i]);
|
||||
}
|
||||
}
|
||||
update_propagation_threshold(props < m_stats.m_bound_propagations1);
|
||||
}
|
||||
|
||||
bool bound_is_interesting(unsigned vi, lp::lconstraint_kind kind, const rational & bval) const {
|
||||
theory_var v = lp().local_to_external(vi);
|
||||
if (v == null_theory_var)
|
||||
if (v == null_theory_var) {
|
||||
return false;
|
||||
|
||||
}
|
||||
if (m_unassigned_bounds[v] == 0 || m_bounds.size() <= static_cast<unsigned>(v)) {
|
||||
return false;
|
||||
}
|
||||
for (lp_api::bound* b : m_bounds[v]) {
|
||||
if (ctx().get_assignment(b->get_bv()) == l_undef &&
|
||||
null_literal != is_bound_implied(kind, bval, *b))
|
||||
null_literal != is_bound_implied(kind, bval, *b)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
nla::solver* get_nla_solver() {
|
||||
return m_switcher.m_nla ? m_switcher.m_nla->get() : nullptr;
|
||||
}
|
||||
|
||||
struct local_bound_propagator: public lp::lp_bound_propagator {
|
||||
imp & m_imp;
|
||||
local_bound_propagator(imp& i) : lp_bound_propagator(*i.m_solver), m_imp(i) {}
|
||||
|
|
@ -2476,7 +2490,7 @@ public:
|
|||
);
|
||||
DEBUG_CODE(
|
||||
for (auto& lit : m_core) {
|
||||
SASSERT(ctx().get_assignment(lit) == l_true);
|
||||
VERIFY(ctx().get_assignment(lit) == l_true);
|
||||
});
|
||||
++m_stats.m_bound_propagations1;
|
||||
assign(lit);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue