mirror of
https://github.com/Z3Prover/z3
synced 2025-04-06 17:44:08 +00:00
Merge branch 'master' into unit_prop_on_monomials
This commit is contained in:
commit
42767b9aab
|
@ -595,4 +595,20 @@ bool emonics::invariant() const {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
void emonics::set_propagated(monic const& m) {
|
||||
struct set_unpropagated : public trail {
|
||||
emonics& em;
|
||||
unsigned var;
|
||||
public:
|
||||
set_unpropagated(emonics& em, unsigned var): em(em), var(var) {}
|
||||
void undo() override {
|
||||
em[var].set_propagated(false);
|
||||
}
|
||||
};
|
||||
SASSERT(!m.is_propagated());
|
||||
(*this)[m.var()].set_propagated(true);
|
||||
m_u_f_stack.push(set_unpropagated(*this, m.var()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -142,6 +142,8 @@ public:
|
|||
void merge_eh(unsigned r2, unsigned r1, unsigned v2, unsigned v1) {}
|
||||
void after_merge_eh(unsigned r2, unsigned r1, unsigned v2, unsigned v1) {}
|
||||
|
||||
void set_propagated(monic const& m);
|
||||
|
||||
// this method is required by union_find
|
||||
trail_stack & get_trail_stack() { return m_u_f_stack; }
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ class monic: public mon_eq {
|
|||
svector<lpvar> m_rvars;
|
||||
bool m_rsign;
|
||||
mutable unsigned m_visited;
|
||||
bool m_propagated = false;
|
||||
public:
|
||||
// constructors
|
||||
monic(lpvar v, unsigned sz, lpvar const* vs, unsigned idx):
|
||||
|
@ -74,6 +75,8 @@ public:
|
|||
void reset_rfields() { m_rsign = false; m_rvars.reset(); SASSERT(m_rvars.size() == 0); }
|
||||
void push_rvar(signed_var sv) { m_rsign ^= sv.sign(); m_rvars.push_back(sv.var()); }
|
||||
void sort_rvars() { std::sort(m_rvars.begin(), m_rvars.end()); }
|
||||
void set_propagated(bool p) { m_propagated = p; }
|
||||
bool is_propagated() const { return m_propagated; }
|
||||
|
||||
svector<lpvar>::const_iterator begin() const { return vars().begin(); }
|
||||
svector<lpvar>::const_iterator end() const { return vars().end(); }
|
||||
|
|
|
@ -32,7 +32,6 @@ namespace nla {
|
|||
// monomial propagation
|
||||
bool_vector m_propagated;
|
||||
bool is_linear(monic const& m, lpvar& zero_var, lpvar& non_fixed);
|
||||
|
||||
public:
|
||||
monomial_bounds(core* core);
|
||||
void propagate();
|
||||
|
|
|
@ -378,6 +378,14 @@ bool all_of(S const& set, T const& p) {
|
|||
return true;
|
||||
}
|
||||
|
||||
template<typename S, typename R>
|
||||
R find(S const& set, std::function<bool(R)> p) {
|
||||
for (auto const& s : set)
|
||||
if (p(s))
|
||||
return s;
|
||||
throw default_exception("element not found");
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Iterator for the [0..sz[0]) X [0..sz[1]) X ... X [0..sz[n-1]).
|
||||
it contains the current value.
|
||||
|
|
Loading…
Reference in a new issue