3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-11 13:40:52 +00:00

use tv for interfacing on get_term

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-04-05 02:42:00 -07:00
parent 296a97d0d3
commit fddbac0f52
5 changed files with 98 additions and 77 deletions

View file

@ -42,6 +42,7 @@ Revision History:
#include "math/lp/int_solver.h"
#include "math/lp/nra_solver.h"
#include "math/lp/lp_bound_propagator.h"
#include "math/lp/lp_types.h"
namespace lp {
@ -149,6 +150,9 @@ public:
bool column_is_free(unsigned j) const;
bool well_formed(lar_term const& t) const;
const lar_term & get_term(unsigned j) const;
public:
// init region
@ -358,10 +362,10 @@ public:
// return true if found and false if unbounded
lp_status maximize_term(unsigned j_or_term, impq &term_max);
const lar_term & get_term(unsigned j) const;
const lar_term & get_term(tv const& t) const { lp_assert(t.is_term()); return *m_terms[t.id()]; }
void pop_core_solver_params();
void pop_core_solver_params(unsigned k);

View file

@ -18,6 +18,9 @@ Revision History:
--*/
#pragma once
#include <sstream>
namespace lp {
typedef unsigned var_index;
typedef unsigned constraint_index;
@ -52,9 +55,15 @@ public:
// used by var_register. could we encapsulate even this?
static const unsigned left_most_bit = ~EF;
std::string to_string() const {
std::ostringstream strm;
strm << (is_term() ? "t" : "j") << id();
return strm.str();
}
};
}
inline std::ostream& operator<<(lp::tv const& t, std::ostream& out) {
inline std::ostream& operator<<(std::ostream& out, lp::tv const& t) {
return out << (t.is_term() ? "t":"j") << t.id() << "\n";
}

View file

@ -1752,7 +1752,7 @@ std::unordered_set<lpvar> core::get_vars_of_expr_with_opening_terms(const nex *e
for (unsigned i = 0; i < added.size(); ++i) {
lpvar j = added[i];
if (ls.column_corresponds_to_term(j)) {
const auto& t = m_lar_solver.get_term(ls.local_to_external(j));
const auto& t = m_lar_solver.get_term(lp::tv::raw(ls.local_to_external(j)));
for (auto p : t) {
if (ret.find(p.var().index()) == ret.end()) {
added.push_back(p.var().index());