mirror of
https://github.com/Z3Prover/z3
synced 2025-06-05 21:53:23 +00:00
fixes in bound setting in cube, and in lar_solver
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
9cce01e632
commit
a80eb13420
3 changed files with 10 additions and 7 deletions
|
@ -1781,17 +1781,19 @@ void lar_solver::activate(constraint_index ci) {
|
||||||
update_column_type_and_bound(c.column(), c.kind(), c.rhs(), ci);
|
update_column_type_and_bound(c.column(), c.kind(), c.rhs(), ci);
|
||||||
}
|
}
|
||||||
|
|
||||||
mpq lar_solver::adjust_bound_for_int(lpvar j, lconstraint_kind k, const mpq& bound) {
|
mpq lar_solver::adjust_bound_for_int(lpvar j, lconstraint_kind& k, const mpq& bound) {
|
||||||
if (!column_is_int(j))
|
if (!column_is_int(j))
|
||||||
return bound;
|
return bound;
|
||||||
switch (k) {
|
switch (k) {
|
||||||
case LT:
|
case LT:
|
||||||
|
k = LE;
|
||||||
case LE:
|
case LE:
|
||||||
return floor(bound);
|
return floor(bound);
|
||||||
case GT:
|
case GT:
|
||||||
|
k = GE;
|
||||||
case GE:
|
case GE:
|
||||||
return ceil(bound);
|
return ceil(bound);
|
||||||
case EQ:
|
case EQ:
|
||||||
return bound;
|
return bound;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
@ -2193,13 +2195,13 @@ bool lar_solver::tighten_term_bounds_by_delta(unsigned term_index, const impq& d
|
||||||
}
|
}
|
||||||
TRACE("cube", tout << "can tighten";);
|
TRACE("cube", tout << "can tighten";);
|
||||||
if (slv.column_has_upper_bound(j)) {
|
if (slv.column_has_upper_bound(j)) {
|
||||||
if (!is_zero(delta.y))
|
if (!is_zero(delta.y) || !is_zero(slv.m_upper_bounds[j].y))
|
||||||
add_var_bound(tj, lconstraint_kind::LT, slv.m_upper_bounds[j].x - delta.x);
|
add_var_bound(tj, lconstraint_kind::LT, slv.m_upper_bounds[j].x - delta.x);
|
||||||
else
|
else
|
||||||
add_var_bound(tj, lconstraint_kind::LE, slv.m_upper_bounds[j].x - delta.x);
|
add_var_bound(tj, lconstraint_kind::LE, slv.m_upper_bounds[j].x - delta.x);
|
||||||
}
|
}
|
||||||
if (slv.column_has_lower_bound(j)) {
|
if (slv.column_has_lower_bound(j)) {
|
||||||
if (!is_zero(delta.y))
|
if (!is_zero(delta.y) || !is_zero(slv.m_lower_bounds[j].y))
|
||||||
add_var_bound(tj, lconstraint_kind::GT, slv.m_lower_bounds[j].x + delta.x);
|
add_var_bound(tj, lconstraint_kind::GT, slv.m_lower_bounds[j].x + delta.x);
|
||||||
else
|
else
|
||||||
add_var_bound(tj, lconstraint_kind::GE, slv.m_lower_bounds[j].x + delta.x);
|
add_var_bound(tj, lconstraint_kind::GE, slv.m_lower_bounds[j].x + delta.x);
|
||||||
|
|
|
@ -169,7 +169,7 @@ public:
|
||||||
|
|
||||||
void add_new_var_to_core_fields_for_mpq(bool register_in_basis);
|
void add_new_var_to_core_fields_for_mpq(bool register_in_basis);
|
||||||
|
|
||||||
mpq adjust_bound_for_int(lpvar j, lconstraint_kind, const mpq&);
|
mpq adjust_bound_for_int(lpvar j, lconstraint_kind&, const mpq&);
|
||||||
|
|
||||||
|
|
||||||
// terms
|
// terms
|
||||||
|
|
|
@ -504,6 +504,7 @@ template <typename T, typename X> bool lp_core_solver_base<T, X>::calc_current_x
|
||||||
unsigned j = this->m_n();
|
unsigned j = this->m_n();
|
||||||
while (j--) {
|
while (j--) {
|
||||||
if (!column_is_feasible(j)) {
|
if (!column_is_feasible(j)) {
|
||||||
|
TRACE("lar_solver", tout << "infeasible column: "; print_column_info(j, tout) << "\n";);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue