3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2024-01-02 14:30:09 -08:00
parent 1a742ff784
commit b706434282
7 changed files with 70 additions and 39 deletions

View file

@ -1860,6 +1860,22 @@ namespace dd {
return (*this) * rational::power_of_two(n);
}
bool pdd::has_unit(pdd& x, pdd& rest) const {
if (is_val())
return false;
pdd r = *this;
while (!r.is_val()) {
if (r.hi().is_one()) {
x = m->mk_var(r.var());
rest = *this - x;
return true;
}
r = r.lo();
}
return false;
}
/**
* \brief substitute variable v by r.
* This base line implementation is simplistic and does not use operator caching.

View file

@ -441,6 +441,7 @@ namespace dd {
bool is_unary() const { return !is_val() && lo().is_zero() && hi().is_val(); }
bool is_offset() const { return !is_val() && lo().is_val() && hi().is_one(); }
bool is_binary() const { return m->is_binary(root); }
bool has_unit(pdd& x, pdd& rest) const;
bool is_monomial() const { return m->is_monomial(root); }
bool is_univariate() const { return m->is_univariate(root); }
bool is_univariate_in(unsigned v) const { return m->is_univariate_in(root, v); }

View file

@ -950,14 +950,16 @@ namespace lp {
bool feas = _check_feasible();
lra.pop(1);
if (settings().get_cancel_flag())
return lia_move::undef;
if (!feas)
return lia_move::conflict;
if (!feas) {
for (auto const& cut : cuts)
if (!is_small_cut(cut))
add_cut(cut);
}
}
if (settings().get_cancel_flag())
return lia_move::undef;
if (!_check_feasible())
return lia_move::conflict;