3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-20 23:56:37 +00:00

track _all_ interval end-points for propagation (in fact only need end-points at unit location, not the others so this can be tuned

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2022-04-13 12:22:43 +02:00
parent be488f75ab
commit da168cad2d
2 changed files with 43 additions and 1 deletions

View file

@ -472,9 +472,14 @@ namespace polysat {
if (is_bailout())
goto bailout;
if (j.is_propagation())
if (j.is_propagation()) {
for (auto const& c : s.m_viable.get_constraints(v))
propagate(c);
for (auto const& i : s.m_viable.units(v)) {
propagate(s.eq(i.lo(), i.lo_val()));
propagate(s.eq(i.hi(), i.hi_val()));
}
}
LOG("try-explain v" << v);
if (try_explain(v))

View file

@ -168,6 +168,43 @@ namespace polysat {
return constraints(*this, v);
}
class int_iterator {
entry* curr = nullptr;
bool visited = false;
public:
int_iterator(entry* curr, bool visited) :
curr(curr), visited(visited || !curr) {}
int_iterator& operator++() {
visited = true;
curr = curr->next();
return *this;
}
eval_interval const& operator*() {
return curr->interval;
}
bool operator==(int_iterator const& other) const {
return visited == other.visited && curr == other.curr;
}
bool operator!=(int_iterator const& other) const {
return !(*this == other);
}
};
class intervals {
viable const& v;
pvar var;
public:
intervals(viable const& v, pvar var): v(v), var(var) {}
int_iterator begin() const { return int_iterator(v.m_units[var], false); }
int_iterator end() const { return int_iterator(v.m_units[var], true); }
};
intervals units(pvar v) { return intervals(*this, v); }
std::ostream& display(std::ostream& out, pvar v) const;
struct var_pp {