mirror of
https://github.com/Z3Prover/z3
synced 2025-07-23 04:38:53 +00:00
runs a simple test
This commit is contained in:
parent
c050af922f
commit
c309d52283
11 changed files with 291 additions and 112 deletions
|
@ -311,26 +311,34 @@ class lar_solver : public column_namer {
|
|||
|
||||
template <typename T>
|
||||
void explain_implied_bound(const implied_bound& ib, lp_bound_propagator<T>& bp) {
|
||||
unsigned i = ib.m_row_or_term_index;
|
||||
int bound_sign = (ib.m_is_lower_bound ? 1 : -1);
|
||||
int j_sign = (ib.m_coeff_before_j_is_pos ? 1 : -1) * bound_sign;
|
||||
unsigned bound_j = ib.m_j;
|
||||
if (tv::is_term(bound_j))
|
||||
bound_j = m_var_register.external_to_local(bound_j);
|
||||
u_dependency* dep = ib.explain();
|
||||
for (auto ci : flatten(dep))
|
||||
bp.consume(mpq(1), ci); // TODO: flatten should provid the coefficients
|
||||
/*
|
||||
if (ib.m_is_monic) {
|
||||
NOT_IMPLEMENTED_YET();
|
||||
} else {
|
||||
unsigned i = ib.m_row_or_term_index;
|
||||
int bound_sign = (ib.m_is_lower_bound ? 1 : -1);
|
||||
int j_sign = (ib.m_coeff_before_j_is_pos ? 1 : -1) * bound_sign;
|
||||
unsigned bound_j = ib.m_j;
|
||||
if (tv::is_term(bound_j))
|
||||
bound_j = m_var_register.external_to_local(bound_j);
|
||||
|
||||
for (auto const& r : get_row(i)) {
|
||||
unsigned j = r.var();
|
||||
if (j == bound_j)
|
||||
continue;
|
||||
mpq const& a = r.coeff();
|
||||
int a_sign = is_pos(a) ? 1 : -1;
|
||||
int sign = j_sign * a_sign;
|
||||
const ul_pair& ul = m_columns_to_ul_pairs[j];
|
||||
auto* witness = sign > 0 ? ul.upper_bound_witness() : ul.lower_bound_witness();
|
||||
lp_assert(witness);
|
||||
for (auto ci : flatten(witness))
|
||||
bp.consume(a, ci);
|
||||
}
|
||||
for (auto const& r : get_row(i)) {
|
||||
unsigned j = r.var();
|
||||
if (j == bound_j)
|
||||
continue;
|
||||
mpq const& a = r.coeff();
|
||||
int a_sign = is_pos(a) ? 1 : -1;
|
||||
int sign = j_sign * a_sign;
|
||||
const ul_pair& ul = m_columns_to_ul_pairs[j];
|
||||
auto* witness = sign > 0 ? ul.upper_bound_witness() : ul.lower_bound_witness();
|
||||
lp_assert(witness);
|
||||
for (auto ci : flatten(witness))
|
||||
bp.consume(a, ci);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void set_value_for_nbasic_column(unsigned j, const impq& new_val);
|
||||
|
@ -564,6 +572,16 @@ class lar_solver : public column_namer {
|
|||
const ul_pair& ul = m_columns_to_ul_pairs[j];
|
||||
return m_dependencies.mk_join(ul.lower_bound_witness(), ul.upper_bound_witness());
|
||||
}
|
||||
template <typename T>
|
||||
u_dependency* get_bound_constraint_witnesses_for_columns(const T& collection) {
|
||||
u_dependency* dep = nullptr;
|
||||
for (auto j : collection) {
|
||||
u_dependency* d = get_bound_constraint_witnesses_for_column(j);
|
||||
dep = m_dependencies.mk_join(dep, d);
|
||||
}
|
||||
return dep;
|
||||
}
|
||||
u_dependency* join_deps(u_dependency* a, u_dependency *b) { return m_dependencies.mk_join(a, b); }
|
||||
inline constraint_set const& constraints() const { return m_constraints; }
|
||||
void push();
|
||||
void pop();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue