3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-23 04:38:53 +00:00

better tracking changinc rows and monomials

This commit is contained in:
Lev Nachmanson 2023-09-29 15:27:22 -07:00
parent f30a2c13be
commit b64fdef41f
6 changed files with 35 additions and 38 deletions

View file

@ -89,6 +89,11 @@ class lar_solver : public column_namer {
constraint_set m_constraints;
// the set of column indices j such that bounds have changed for j
indexed_uint_set m_columns_with_changed_bounds;
public:
const indexed_uint_set& columns_with_changed_bounds() const { return m_columns_with_changed_bounds; }
inline void clear_columns_with_changed_bounds() { m_columns_with_changed_bounds.reset(); }
private:
// m_touched_rows contains rows that have been changed by a pivoting or have a column with changed bounds
indexed_uint_set m_touched_rows;
unsigned_vector m_row_bounds_to_replay;
u_dependency_manager m_dependencies;
@ -138,9 +143,7 @@ class lar_solver : public column_namer {
void add_row_from_term_no_constraint(const lar_term* term, unsigned term_ext_index);
void add_basic_var_to_core_fields();
bool compare_values(impq const& lhs, lconstraint_kind k, const mpq& rhs);
inline void clear_columns_with_changed_bounds() { m_columns_with_changed_bounds.reset(); }
public:
public:
void insert_to_columns_with_changed_bounds(unsigned j);
const u_dependency* crossed_bounds_deps() const { return m_crossed_bounds_deps;}
u_dependency*& crossed_bounds_deps() { return m_crossed_bounds_deps;}
@ -149,12 +152,12 @@ class lar_solver : public column_namer {
lpvar& crossed_bounds_column() { return m_crossed_bounds_column; }
private:
private:
void update_column_type_and_bound_check_on_equal(unsigned j, const mpq& right_side, constraint_index ci, unsigned&);
void update_column_type_and_bound(unsigned j, const mpq& right_side, constraint_index ci);
public:
public:
void update_column_type_and_bound(unsigned j, lconstraint_kind kind, const mpq& right_side, u_dependency* dep);
private:
private:
void update_column_type_and_bound_with_ub(var_index j, lconstraint_kind kind, const mpq& right_side, u_dependency* dep);
void update_column_type_and_bound_with_no_ub(var_index j, lconstraint_kind kind, const mpq& right_side, u_dependency* dep);
void update_bound_with_ub_lb(var_index j, lconstraint_kind kind, const mpq& right_side, u_dependency* dep);
@ -358,6 +361,8 @@ class lar_solver : public column_namer {
void add_column_rows_to_touched_rows(lpvar j);
template <typename T>
void propagate_bounds_for_touched_rows(lp_bound_propagator<T>& bp) {
detect_rows_with_changed_bounds();
clear_columns_with_changed_bounds();
if (settings().propagate_eqs()) {
if (settings().random_next() % 10 == 0)
remove_fixed_vars_from_base();
@ -688,7 +693,6 @@ class lar_solver : public column_namer {
return 0;
return m_usage_in_terms[j];
}
std::function<void (const indexed_uint_set& columns_with_changed_bound)> m_find_monics_with_changed_bounds_func = nullptr;
friend int_solver;
friend int_branch;
};