3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

use value function in lar_solver (#4771)

* use value function in lar_solver

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* add missing return

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* check_feasible is called after column is added for fixed variable

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* na
This commit is contained in:
Nikolaj Bjorner 2020-11-03 01:08:24 -08:00 committed by GitHub
parent 5335097768
commit 620204bbb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 110 deletions

View file

@ -18,7 +18,6 @@ namespace lp {
lp_assert(false); // not implemented
}
lar_solver::lar_solver() :
m_status(lp_status::UNKNOWN),
m_crossed_bounds_column(-1),
@ -37,7 +36,6 @@ namespace lp {
return m_mpq_lar_core_solver.m_r_solver.m_pivoted_rows != nullptr;
}
lar_solver::~lar_solver() {
for (auto t : m_terms)
@ -415,9 +413,8 @@ namespace lp {
at_l ? lcs.m_r_upper_bounds()[j] : lcs.m_r_lower_bounds()[j]);
return true;
}
}
break;
break;
}
case column_type::lower_bound:
if (val != lcs.m_r_lower_bounds()[j]) {
set_value_for_nbasic_column(j, lcs.m_r_lower_bounds()[j]);
@ -1174,13 +1171,14 @@ namespace lp {
mpq lar_solver::get_value(column_index const& j) const {
SASSERT(get_status() == lp_status::OPTIMAL || get_status() == lp_status::FEASIBLE);
SASSERT(m_columns_with_changed_bounds.empty());
numeric_pair<mpq> const& rp = get_column_value(j);
return rp.x + m_delta * rp.y;
}
mpq lar_solver::get_value(tv const& t) const {
if (t.is_var())
get_value(t.column());
return get_value(t.column());
mpq r(0);
for (const auto& p : get_term(t))
r += p.coeff() * get_value(p.column());
@ -1189,7 +1187,7 @@ namespace lp {
impq lar_solver::get_ivalue(tv const& t) const {
if (t.is_var())
get_ivalue(t.column());
return get_ivalue(t.column());
impq r;
for (const auto& p : get_term(t))
r += p.coeff() * get_ivalue(p.column());