3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-15 21:38:44 +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:
Lev Nachmanson 2020-03-08 11:59:23 -07:00
parent 9cce01e632
commit a80eb13420
3 changed files with 10 additions and 7 deletions

View file

@ -1781,17 +1781,19 @@ void lar_solver::activate(constraint_index 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))
return bound;
switch (k) {
case LT:
case LT:
k = LE;
case LE:
return floor(bound);
case GT:
case GT:
k = GE;
case GE:
return ceil(bound);
case EQ:
case EQ:
return bound;
default:
UNREACHABLE();
@ -2193,13 +2195,13 @@ bool lar_solver::tighten_term_bounds_by_delta(unsigned term_index, const impq& d
}
TRACE("cube", tout << "can tighten";);
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);
else
add_var_bound(tj, lconstraint_kind::LE, slv.m_upper_bounds[j].x - delta.x);
}
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);
else
add_var_bound(tj, lconstraint_kind::GE, slv.m_lower_bounds[j].x + delta.x);

View file

@ -169,7 +169,7 @@ public:
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

View file

@ -504,6 +504,7 @@ template <typename T, typename X> bool lp_core_solver_base<T, X>::calc_current_x
unsigned j = this->m_n();
while (j--) {
if (!column_is_feasible(j)) {
TRACE("lar_solver", tout << "infeasible column: "; print_column_info(j, tout) << "\n";);
return false;
}
}