3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-14 21:08:46 +00:00

renamed LP bound propagator to avoid linker name clashes

This commit is contained in:
Christoph M. Wintersteiger 2017-08-01 16:07:51 +01:00
parent 6bc5209e26
commit e315d063c5
5 changed files with 285 additions and 285 deletions

View file

@ -1351,9 +1351,9 @@ namespace smt {
return false; return false;
} }
struct local_bound_propagator: public lean::bound_propagator { struct local_bound_propagator: public lean::lp_bound_propagator {
imp & m_imp; imp & m_imp;
local_bound_propagator(imp& i) : bound_propagator(*i.m_solver), m_imp(i) {} local_bound_propagator(imp& i) : lp_bound_propagator(*i.m_solver), m_imp(i) {}
bool bound_is_interesting(unsigned j, lean::lconstraint_kind kind, const rational & v) { bool bound_is_interesting(unsigned j, lean::lconstraint_kind kind, const rational & v) {
return m_imp.bound_is_interesting(j, kind, v); return m_imp.bound_is_interesting(j, kind, v);

View file

@ -18,7 +18,7 @@ namespace lean {
class bound_analyzer_on_row { class bound_analyzer_on_row {
linear_combination_iterator<mpq> & m_it; linear_combination_iterator<mpq> & m_it;
bound_propagator & m_bp; lp_bound_propagator & m_bp;
unsigned m_row_or_term_index; unsigned m_row_or_term_index;
int m_column_of_u; // index of an unlimited from above monoid int m_column_of_u; // index of an unlimited from above monoid
// -1 means that such a value is not found, -2 means that at least two of such monoids were found // -1 means that such a value is not found, -2 means that at least two of such monoids were found
@ -31,7 +31,7 @@ public :
linear_combination_iterator<mpq> &it, linear_combination_iterator<mpq> &it,
const numeric_pair<mpq>& rs, const numeric_pair<mpq>& rs,
unsigned row_or_term_index, unsigned row_or_term_index,
bound_propagator & bp lp_bound_propagator & bp
) )
: :
m_it(it), m_it(it),
@ -325,7 +325,7 @@ public :
static void analyze_row(linear_combination_iterator<mpq> &it, static void analyze_row(linear_combination_iterator<mpq> &it,
const numeric_pair<mpq>& rs, const numeric_pair<mpq>& rs,
unsigned row_or_term_index, unsigned row_or_term_index,
bound_propagator & bp lp_bound_propagator & bp
) { ) {
bound_analyzer_on_row a(it, rs, row_or_term_index, bp); bound_analyzer_on_row a(it, rs, row_or_term_index, bp);
a.analyze(); a.analyze();

View file

@ -203,7 +203,7 @@ public:
void analyze_new_bounds_on_row( void analyze_new_bounds_on_row(
unsigned row_index, unsigned row_index,
bound_propagator & bp) { lp_bound_propagator & bp) {
lean_assert(!use_tableau()); lean_assert(!use_tableau());
iterator_on_pivot_row<mpq> it(m_mpq_lar_core_solver.get_pivot_row(), m_mpq_lar_core_solver.m_r_basis[row_index]); iterator_on_pivot_row<mpq> it(m_mpq_lar_core_solver.get_pivot_row(), m_mpq_lar_core_solver.m_r_basis[row_index]);
@ -217,7 +217,7 @@ public:
void analyze_new_bounds_on_row_tableau( void analyze_new_bounds_on_row_tableau(
unsigned row_index, unsigned row_index,
bound_propagator & bp lp_bound_propagator & bp
) { ) {
if (A_r().m_rows[row_index].size() > settings().max_row_length_for_bound_propagation) if (A_r().m_rows[row_index].size() > settings().max_row_length_for_bound_propagation)
@ -244,7 +244,7 @@ public:
} }
} }
void calculate_implied_bounds_for_row(unsigned i, bound_propagator & bp) { void calculate_implied_bounds_for_row(unsigned i, lp_bound_propagator & bp) {
if(use_tableau()) { if(use_tableau()) {
analyze_new_bounds_on_row_tableau(i, bp); analyze_new_bounds_on_row_tableau(i, bp);
} else { } else {
@ -348,12 +348,12 @@ public:
return ext_var_or_term < m_terms_start_index ? j : ext_var_or_term; return ext_var_or_term < m_terms_start_index ? j : ext_var_or_term;
} }
void propagate_bounds_on_a_term(const lar_term& t, bound_propagator & bp, unsigned term_offset) { void propagate_bounds_on_a_term(const lar_term& t, lp_bound_propagator & bp, unsigned term_offset) {
lean_assert(false); // not implemented lean_assert(false); // not implemented
} }
void explain_implied_bound(implied_bound & ib, bound_propagator & bp) { void explain_implied_bound(implied_bound & ib, lp_bound_propagator & bp) {
unsigned i = ib.m_row_or_term_index; unsigned i = ib.m_row_or_term_index;
int bound_sign = ib.m_is_low_bound? 1: -1; int bound_sign = ib.m_is_low_bound? 1: -1;
int j_sign = (ib.m_coeff_before_j_is_pos ? 1 :-1) * bound_sign; int j_sign = (ib.m_coeff_before_j_is_pos ? 1 :-1) * bound_sign;
@ -384,7 +384,7 @@ public:
return contains(m_ext_vars_to_columns, term); return contains(m_ext_vars_to_columns, term);
} }
void propagate_bounds_on_terms(bound_propagator & bp) { void propagate_bounds_on_terms(lp_bound_propagator & bp) {
for (unsigned i = 0; i < m_terms.size(); i++) { for (unsigned i = 0; i < m_terms.size(); i++) {
if (term_is_used_as_row(i + m_terms_start_index)) if (term_is_used_as_row(i + m_terms_start_index))
continue; // this term is used a left side of a constraint, continue; // this term is used a left side of a constraint,
@ -395,7 +395,7 @@ public:
// goes over touched rows and tries to induce bounds // goes over touched rows and tries to induce bounds
void propagate_bounds_for_touched_rows(bound_propagator & bp) { void propagate_bounds_for_touched_rows(lp_bound_propagator & bp) {
if (!use_tableau()) if (!use_tableau())
return; // ! todo : enable bound propagaion here. The current bug is that after the pop return; // ! todo : enable bound propagaion here. The current bug is that after the pop
// the changed terms become incorrect! // the changed terms become incorrect!

View file

@ -4,18 +4,18 @@
*/ */
#include "util/lp/lar_solver.h" #include "util/lp/lar_solver.h"
namespace lean { namespace lean {
bound_propagator::bound_propagator(lar_solver & ls): lp_bound_propagator::lp_bound_propagator(lar_solver & ls):
m_lar_solver(ls) {} m_lar_solver(ls) {}
column_type bound_propagator::get_column_type(unsigned j) const { column_type lp_bound_propagator::get_column_type(unsigned j) const {
return m_lar_solver.m_mpq_lar_core_solver.m_column_types()[j]; return m_lar_solver.m_mpq_lar_core_solver.m_column_types()[j];
} }
const impq & bound_propagator::get_low_bound(unsigned j) const { const impq & lp_bound_propagator::get_low_bound(unsigned j) const {
return m_lar_solver.m_mpq_lar_core_solver.m_r_low_bounds()[j]; return m_lar_solver.m_mpq_lar_core_solver.m_r_low_bounds()[j];
} }
const impq & bound_propagator::get_upper_bound(unsigned j) const { const impq & lp_bound_propagator::get_upper_bound(unsigned j) const {
return m_lar_solver.m_mpq_lar_core_solver.m_r_upper_bounds()[j]; return m_lar_solver.m_mpq_lar_core_solver.m_r_upper_bounds()[j];
} }
void bound_propagator::try_add_bound(const mpq & v, unsigned j, bool is_low, bool coeff_before_j_is_pos, unsigned row_or_term_index, bool strict) { void lp_bound_propagator::try_add_bound(const mpq & v, unsigned j, bool is_low, bool coeff_before_j_is_pos, unsigned row_or_term_index, bool strict) {
j = m_lar_solver.adjust_column_index_to_term_index(j); j = m_lar_solver.adjust_column_index_to_term_index(j);
lconstraint_kind kind = is_low? GE : LE; lconstraint_kind kind = is_low? GE : LE;
if (strict) if (strict)

View file

@ -6,14 +6,14 @@
#include "util/lp/lp_settings.h" #include "util/lp/lp_settings.h"
namespace lean { namespace lean {
class lar_solver; class lar_solver;
class bound_propagator { class lp_bound_propagator {
std::unordered_map<unsigned, unsigned> m_improved_low_bounds; // these maps map a column index to the corresponding index in ibounds std::unordered_map<unsigned, unsigned> m_improved_low_bounds; // these maps map a column index to the corresponding index in ibounds
std::unordered_map<unsigned, unsigned> m_improved_upper_bounds; std::unordered_map<unsigned, unsigned> m_improved_upper_bounds;
lar_solver & m_lar_solver; lar_solver & m_lar_solver;
public: public:
vector<implied_bound> m_ibounds; vector<implied_bound> m_ibounds;
public: public:
bound_propagator(lar_solver & ls); lp_bound_propagator(lar_solver & ls);
column_type get_column_type(unsigned) const; column_type get_column_type(unsigned) const;
const impq & get_low_bound(unsigned) const; const impq & get_low_bound(unsigned) const;
const impq & get_upper_bound(unsigned) const; const impq & get_upper_bound(unsigned) const;