3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 11:55:51 +00:00

fixes in horner's heuristic

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2019-08-07 16:14:46 -07:00
parent 1b8b09cddb
commit e46de3bc3d
2 changed files with 19 additions and 14 deletions

View file

@ -177,7 +177,7 @@ public:
}
}
unsigned size() {
unsigned size() const {
switch(m_type) {
case expr_type::SUM:
case expr_type::MUL:
@ -376,20 +376,20 @@ public:
return *this;
}
// we need a linear combination of at least two variables
bool sum_is_a_linear_term() const {
SASSERT(is_sum());
int degree = 0;
TRACE("nla_expr_details", tout << *this << "\n";);
unsigned number_of_non_scalars = 0;
for (auto & e : children()) {
int d = e.get_degree();
if (d > 1)
return false;
if (d > degree)
degree = d;
if (!e.is_scalar())
number_of_non_scalars++;
if (d == 0) continue;
if (d > 1) return false;
number_of_non_scalars++;
}
return degree == 1 && number_of_non_scalars > 1;
TRACE("nla_expr_details", tout << (number_of_non_scalars > 1?"linear":"non-linear") << "\n";);
return number_of_non_scalars > 1;
}
int get_degree() const {