3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-19 19:02:02 +00:00

get cached tv value (#6756)

This commit is contained in:
Lev Nachmanson 2023-06-08 19:46:38 -07:00 committed by GitHub
parent f7ec5c5c64
commit 1006955215
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 9 deletions

View file

@ -1034,14 +1034,10 @@ namespace lp {
r += p.coeff() * get_value(p.column()); r += p.coeff() * get_value(p.column());
return r; return r;
} }
//fetches the cached value of the term or the variable by the given index
impq lar_solver::get_tv_ivalue(tv const& t) const { const impq& lar_solver::get_tv_ivalue(tv const& t) const {
if (t.is_var()) unsigned j = t.is_var()? (unsigned)t.column(): this->map_term_index_to_column_index(t.index());
return get_column_value(t.column()); return this->get_column_value(j);
impq r;
for (lar_term::ival p : get_term(t))
r += p.coeff() * get_column_value(p.column());
return r;
} }
void lar_solver::get_rid_of_inf_eps() { void lar_solver::get_rid_of_inf_eps() {

View file

@ -506,7 +506,7 @@ public:
bool init_model() const; bool init_model() const;
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;
impq get_tv_ivalue(tv const& t) const; const impq & get_tv_ivalue(tv const& t) const;
void get_model(std::unordered_map<var_index, mpq> & variable_values) const; void get_model(std::unordered_map<var_index, mpq> & variable_values) const;
void get_rid_of_inf_eps(); void get_rid_of_inf_eps();
void get_model_do_not_care_about_diff_vars(std::unordered_map<var_index, mpq> & variable_values) const; void get_model_do_not_care_about_diff_vars(std::unordered_map<var_index, mpq> & variable_values) const;