mirror of
https://github.com/Z3Prover/z3
synced 2025-08-13 14:40:55 +00:00
prepare bound_analyzer for using in dio
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
67d77e26d2
commit
c3461c60eb
3 changed files with 360 additions and 333 deletions
|
@ -92,13 +92,13 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
const impq & ub(unsigned j) const {
|
const impq & ub(unsigned j) const {
|
||||||
lp_assert(m_bp.upper_bound_is_available(j));
|
lp_assert(upper_bound_is_available(j));
|
||||||
return m_bp.get_upper_bound(j);
|
return get_upper_bound(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
const impq & lb(unsigned j) const {
|
const impq & lb(unsigned j) const {
|
||||||
lp_assert(m_bp.lower_bound_is_available(j));
|
lp_assert(lower_bound_is_available(j));
|
||||||
return m_bp.get_lower_bound(j);
|
return get_lower_bound(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
const mpq & monoid_max_no_mult(bool a_is_pos, unsigned j, bool & strict) const {
|
const mpq & monoid_max_no_mult(bool a_is_pos, unsigned j, bool & strict) const {
|
||||||
|
@ -310,7 +310,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void analyze_bound_on_var_on_coeff(int j, const mpq &a) {
|
void analyze_bound_on_var_on_coeff(int j, const mpq &a) {
|
||||||
switch (m_bp.get_column_type(j)) {
|
switch (get_column_type(j)) {
|
||||||
case column_type::lower_bound:
|
case column_type::lower_bound:
|
||||||
if (numeric_traits<mpq>::is_pos(a))
|
if (numeric_traits<mpq>::is_pos(a))
|
||||||
advance_u(j);
|
advance_u(j);
|
||||||
|
@ -332,8 +332,42 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
const impq& get_upper_bound(unsigned j) const {
|
||||||
|
return lp().get_upper_bound(j);
|
||||||
|
}
|
||||||
|
|
||||||
|
const impq& get_lower_bound(unsigned j) const {
|
||||||
|
return lp().get_lower_bound(j);
|
||||||
|
}
|
||||||
|
|
||||||
|
column_type get_column_type(unsigned j) const {
|
||||||
|
return (lp().get_column_types())[j];
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& lp() const { return m_bp.lp(); }
|
||||||
|
|
||||||
|
auto& lp() { return m_bp.lp(); }
|
||||||
|
|
||||||
|
bool upper_bound_is_available(unsigned j) const {
|
||||||
|
switch (get_column_type(j)) {
|
||||||
|
case column_type::fixed:
|
||||||
|
case column_type::boxed:
|
||||||
|
case column_type::upper_bound:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool lower_bound_is_available(unsigned j) const {
|
||||||
|
switch (get_column_type(j)) {
|
||||||
|
case column_type::fixed:
|
||||||
|
case column_type::boxed:
|
||||||
|
case column_type::lower_bound:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1623,7 +1623,17 @@ namespace lp {
|
||||||
}
|
}
|
||||||
|
|
||||||
lia_move propagate_bounds_on_tightened_columns() {
|
lia_move propagate_bounds_on_tightened_columns() {
|
||||||
|
for (unsigned j : m_tightened_columns) {
|
||||||
|
const auto& t = lra.get_term(j);
|
||||||
|
// SASSERT(get_term_value(t).x = lra.get_column_value(j).x);
|
||||||
|
bound_analyzer_on_row<lar_term, dioph_eq::imp>::analyze_row(t, lra.get_column_value(j), *this);
|
||||||
|
}
|
||||||
return lia_move::undef;
|
return lia_move::undef;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void add_bound(mpq const& v, unsigned j, bool is_low, bool strict, std::function<u_dependency* ()> explain_bound) {
|
||||||
|
NOT_IMPLEMENTED_YET();
|
||||||
}
|
}
|
||||||
// m_espace contains the coefficients of the term
|
// m_espace contains the coefficients of the term
|
||||||
// m_c contains the fixed part of the term
|
// m_c contains the fixed part of the term
|
||||||
|
@ -1647,7 +1657,7 @@ namespace lp {
|
||||||
return lia_move::conflict;
|
return lia_move::conflict;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::cout << "new tbs:" << m_tightened_columns.size() << "\n";
|
|
||||||
return lia_move::undef;
|
return lia_move::undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2559,6 +2569,10 @@ namespace lp {
|
||||||
SASSERT(!ret || m_var_register.local_to_external(j) == UINT_MAX);
|
SASSERT(!ret || m_var_register.local_to_external(j) == UINT_MAX);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
// needed for the template bound_analyzer_on_row.h
|
||||||
|
const lar_solver& lp() const { return lra; }
|
||||||
|
lar_solver& lp() {return lra;}
|
||||||
|
|
||||||
};
|
};
|
||||||
// Constructor definition
|
// Constructor definition
|
||||||
dioph_eq::dioph_eq(int_solver& lia) {
|
dioph_eq::dioph_eq(int_solver& lia) {
|
||||||
|
|
|
@ -44,26 +44,6 @@ class lp_bound_propagator {
|
||||||
public:
|
public:
|
||||||
const lar_solver& lp() const { return m_imp.lp(); }
|
const lar_solver& lp() const { return m_imp.lp(); }
|
||||||
lar_solver& lp() { return m_imp.lp(); }
|
lar_solver& lp() { return m_imp.lp(); }
|
||||||
bool upper_bound_is_available(unsigned j) const {
|
|
||||||
switch (get_column_type(j)) {
|
|
||||||
case column_type::fixed:
|
|
||||||
case column_type::boxed:
|
|
||||||
case column_type::upper_bound:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bool lower_bound_is_available(unsigned j) const {
|
|
||||||
switch (get_column_type(j)) {
|
|
||||||
case column_type::fixed:
|
|
||||||
case column_type::boxed:
|
|
||||||
case column_type::lower_bound:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private:
|
private:
|
||||||
void try_add_equation_with_internal_fixed_tables(unsigned r1) {
|
void try_add_equation_with_internal_fixed_tables(unsigned r1) {
|
||||||
unsigned v1, v2;
|
unsigned v1, v2;
|
||||||
|
@ -145,7 +125,6 @@ public:
|
||||||
return (*m_column_types)[j] == column_type::fixed && get_lower_bound(j).y.is_zero();
|
return (*m_column_types)[j] == column_type::fixed && get_lower_bound(j).y.is_zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void add_bound(mpq const& v, unsigned j, bool is_low, bool strict, std::function<u_dependency* ()> explain_bound) {
|
void add_bound(mpq const& v, unsigned j, bool is_low, bool strict, std::function<u_dependency* ()> explain_bound) {
|
||||||
lconstraint_kind kind = is_low ? GE : LE;
|
lconstraint_kind kind = is_low ? GE : LE;
|
||||||
if (strict)
|
if (strict)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue