mirror of
https://github.com/Z3Prover/z3
synced 2025-06-01 03:41:21 +00:00
relax an assertion in int_solver::patcher
This commit is contained in:
parent
305c1c1dc2
commit
fd5902f76e
4 changed files with 1215 additions and 7 deletions
|
@ -150,21 +150,22 @@ namespace lp {
|
||||||
}
|
}
|
||||||
for (auto const& c : A.column(j)) {
|
for (auto const& c : A.column(j)) {
|
||||||
unsigned row_index = c.var();
|
unsigned row_index = c.var();
|
||||||
unsigned i = lrac.m_r_basis[row_index];
|
unsigned bj = lrac.m_r_basis[row_index];
|
||||||
auto old_val = lia.get_value(i);
|
auto old_val = lia.get_value(bj);
|
||||||
auto new_val = old_val - impq(c.coeff()*delta);
|
auto new_val = old_val - impq(c.coeff()*delta);
|
||||||
if (lia.has_lower(i) && new_val < lra.get_lower_bound(i))
|
if (lia.has_lower(bj) && new_val < lra.get_lower_bound(bj))
|
||||||
return false;
|
return false;
|
||||||
if (lia.has_upper(i) && new_val > lra.get_upper_bound(i))
|
if (lia.has_upper(bj) && new_val > lra.get_upper_bound(bj))
|
||||||
return false;
|
return false;
|
||||||
if (old_val.is_int() && !new_val.is_int()){
|
if (old_val.is_int() && !new_val.is_int()){
|
||||||
return false; // do not waste resources on this case
|
return false; // do not waste resources on this case
|
||||||
}
|
}
|
||||||
lp_assert(i != v || new_val.is_int())
|
// if bj == v, then, because we are patching the lra.get_value(v),
|
||||||
|
// we just need to assert that the lra.get_value(v) would be integral.
|
||||||
|
lp_assert(bj != v || lra.from_model_in_impq_to_mpq(new_val).is_int());
|
||||||
}
|
}
|
||||||
|
|
||||||
lra.set_value_for_nbasic_column(j, lia.get_value(j) + impq(delta));
|
lra.set_value_for_nbasic_column(j, lia.get_value(j) + impq(delta));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1019,7 +1019,7 @@ namespace lp {
|
||||||
SASSERT(get_status() == lp_status::OPTIMAL || get_status() == lp_status::FEASIBLE);
|
SASSERT(get_status() == lp_status::OPTIMAL || get_status() == lp_status::FEASIBLE);
|
||||||
SASSERT(m_columns_with_changed_bounds.empty());
|
SASSERT(m_columns_with_changed_bounds.empty());
|
||||||
numeric_pair<mpq> const& rp = get_column_value(j);
|
numeric_pair<mpq> const& rp = get_column_value(j);
|
||||||
return rp.x + m_delta * rp.y;
|
return from_model_in_impq_to_mpq(rp);
|
||||||
}
|
}
|
||||||
|
|
||||||
mpq lar_solver::get_tv_value(tv const& t) const {
|
mpq lar_solver::get_tv_value(tv const& t) const {
|
||||||
|
|
|
@ -497,6 +497,7 @@ class lar_solver : public column_namer {
|
||||||
std::ostream& display(std::ostream& out) const;
|
std::ostream& display(std::ostream& out) const;
|
||||||
|
|
||||||
bool init_model() const;
|
bool init_model() const;
|
||||||
|
mpq from_model_in_impq_to_mpq(const impq& v) const { return v.x + m_delta * v.y; }
|
||||||
mpq get_value(column_index const& j) const;
|
mpq get_value(column_index const& j) const;
|
||||||
mpq get_tv_value(tv const& t) const;
|
mpq get_tv_value(tv const& t) const;
|
||||||
const impq& get_tv_ivalue(tv const& t) const;
|
const impq& get_tv_ivalue(tv const& t) const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue