mirror of
https://github.com/Z3Prover/z3
synced 2025-08-08 12:11:23 +00:00
fix a but in adjusting term indices for implied_bounds
This commit is contained in:
parent
d12a0133ce
commit
712619a9cf
3 changed files with 14 additions and 11 deletions
|
@ -15,7 +15,7 @@ public:
|
||||||
T a;
|
T a;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
while (it->next(a, i)) {
|
while (it->next(a, i)) {
|
||||||
coeff.emplace_back(a, i);
|
coeff.push_back(std::make_pair(a, i));
|
||||||
}
|
}
|
||||||
print_linear_combination_of_column_indices(coeff, out);
|
print_linear_combination_of_column_indices(coeff, out);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1543,7 +1543,5 @@ public:
|
||||||
quick_xplain::run(explanation, *this);
|
quick_xplain::run(explanation, *this);
|
||||||
lean_assert(this->explanation_is_correct(explanation));
|
lean_assert(this->explanation_is_correct(explanation));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,31 +16,36 @@ const impq & lp_bound_propagator::get_upper_bound(unsigned j) const {
|
||||||
return m_lar_solver.m_mpq_lar_core_solver.m_r_upper_bounds()[j];
|
return m_lar_solver.m_mpq_lar_core_solver.m_r_upper_bounds()[j];
|
||||||
}
|
}
|
||||||
void lp_bound_propagator::try_add_bound(const mpq & v, unsigned j, bool is_low, bool coeff_before_j_is_pos, unsigned row_or_term_index, bool strict) {
|
void lp_bound_propagator::try_add_bound(const mpq & v, unsigned j, bool is_low, bool coeff_before_j_is_pos, unsigned row_or_term_index, bool strict) {
|
||||||
j = m_lar_solver.adjust_column_index_to_term_index(j);
|
unsigned term_j = m_lar_solver.adjust_column_index_to_term_index(j);
|
||||||
|
mpq w = v;
|
||||||
|
if (term_j != j) {
|
||||||
|
j = term_j;
|
||||||
|
w += m_lar_solver.get_term(term_j).m_v; // when terms are turned into the columns they "lose" the right side, at this moment they aquire it back
|
||||||
|
}
|
||||||
lconstraint_kind kind = is_low? GE : LE;
|
lconstraint_kind kind = is_low? GE : LE;
|
||||||
if (strict)
|
if (strict)
|
||||||
kind = static_cast<lconstraint_kind>(kind / 2);
|
kind = static_cast<lconstraint_kind>(kind / 2);
|
||||||
|
|
||||||
if (!bound_is_interesting(j, kind, v))
|
if (!bound_is_interesting(j, kind, w))
|
||||||
return;
|
return;
|
||||||
unsigned k; // index to ibounds
|
unsigned k; // index to ibounds
|
||||||
if (is_low) {
|
if (is_low) {
|
||||||
if (try_get_val(m_improved_low_bounds, j, k)) {
|
if (try_get_val(m_improved_low_bounds, j, k)) {
|
||||||
auto & found_bound = m_ibounds[k];
|
auto & found_bound = m_ibounds[k];
|
||||||
if (v > found_bound.m_bound || (v == found_bound.m_bound && found_bound.m_strict == false && strict))
|
if (w > found_bound.m_bound || (w == found_bound.m_bound && found_bound.m_strict == false && strict))
|
||||||
found_bound = implied_bound(v, j, is_low, coeff_before_j_is_pos, row_or_term_index, strict);
|
found_bound = implied_bound(w, j, is_low, coeff_before_j_is_pos, row_or_term_index, strict);
|
||||||
} else {
|
} else {
|
||||||
m_improved_low_bounds[j] = m_ibounds.size();
|
m_improved_low_bounds[j] = m_ibounds.size();
|
||||||
m_ibounds.push_back(implied_bound(v, j, is_low, coeff_before_j_is_pos, row_or_term_index, strict));
|
m_ibounds.push_back(implied_bound(w, j, is_low, coeff_before_j_is_pos, row_or_term_index, strict));
|
||||||
}
|
}
|
||||||
} else { // the upper bound case
|
} else { // the upper bound case
|
||||||
if (try_get_val(m_improved_upper_bounds, j, k)) {
|
if (try_get_val(m_improved_upper_bounds, j, k)) {
|
||||||
auto & found_bound = m_ibounds[k];
|
auto & found_bound = m_ibounds[k];
|
||||||
if (v < found_bound.m_bound || (v == found_bound.m_bound && found_bound.m_strict == false && strict))
|
if (w < found_bound.m_bound || (w == found_bound.m_bound && found_bound.m_strict == false && strict))
|
||||||
found_bound = implied_bound(v, j, is_low, coeff_before_j_is_pos, row_or_term_index, strict);
|
found_bound = implied_bound(w, j, is_low, coeff_before_j_is_pos, row_or_term_index, strict);
|
||||||
} else {
|
} else {
|
||||||
m_improved_upper_bounds[j] = m_ibounds.size();
|
m_improved_upper_bounds[j] = m_ibounds.size();
|
||||||
m_ibounds.push_back(implied_bound(v, j, is_low, coeff_before_j_is_pos, row_or_term_index, strict));
|
m_ibounds.push_back(implied_bound(w, j, is_low, coeff_before_j_is_pos, row_or_term_index, strict));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue