mirror of
https://github.com/Z3Prover/z3
synced 2025-08-13 14:40:55 +00:00
Arith min max (#6864)
* prepare for dependencies Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * snapshot Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * more refactoring Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * more refactoring Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * build Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * pass in u_dependency_manager Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * address NYIs Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * more refactoring names Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * eq_explanation update Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * add outline of bounds improvement functionality Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * fix unit tests Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * remove unused structs Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * more bounds Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * more bounds Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * convert more internals to use u_dependency instead of constraint_index Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * convert more internals to use u_dependency instead of constraint_index Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * remember to push/pop scopes Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * use the main function for updating bounds Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * remove reset of shared dep manager Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * disable improve-bounds, add statistics Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> --------- Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
c3b344ec47
commit
5e3df9ee77
40 changed files with 630 additions and 529 deletions
|
@ -39,7 +39,7 @@ namespace lp {
|
|||
m_overflow = false;
|
||||
}
|
||||
|
||||
void hnf_cutter::add_term(const lar_term* t, const mpq &rs, constraint_index ci, bool upper_bound) {
|
||||
void hnf_cutter::add_term(const lar_term* t, const mpq &rs, u_dependency* ci, bool upper_bound) {
|
||||
m_terms.push_back(t);
|
||||
m_terms_upper.push_back(upper_bound);
|
||||
if (upper_bound)
|
||||
|
@ -146,7 +146,7 @@ namespace lp {
|
|||
}
|
||||
#endif
|
||||
void hnf_cutter::shrink_explanation(const svector<unsigned>& basis_rows) {
|
||||
svector<unsigned> new_expl;
|
||||
ptr_vector<u_dependency> new_expl;
|
||||
for (unsigned i : basis_rows) {
|
||||
new_expl.push_back(m_constraints_for_explanation[i]);
|
||||
}
|
||||
|
@ -232,10 +232,10 @@ branch y_i >= ceil(y0_i) is impossible.
|
|||
void hnf_cutter::try_add_term_to_A_for_hnf(tv const &i) {
|
||||
mpq rs;
|
||||
const lar_term& t = lra.get_term(i);
|
||||
constraint_index ci;
|
||||
u_dependency* dep;
|
||||
bool upper_bound;
|
||||
if (!is_full() && lra.get_equality_and_right_side_for_term_on_current_x(i, rs, ci, upper_bound)) {
|
||||
add_term(&t, rs, ci, upper_bound);
|
||||
if (!is_full() && lra.get_equality_and_right_side_for_term_on_current_x(i, rs, dep, upper_bound)) {
|
||||
add_term(&t, rs, dep, upper_bound);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,8 +259,9 @@ branch y_i >= ceil(y0_i) is impossible.
|
|||
}
|
||||
lia.settings().stats().m_hnf_cutter_calls++;
|
||||
TRACE("hnf_cut", tout << "settings().stats().m_hnf_cutter_calls = " << lia.settings().stats().m_hnf_cutter_calls << "\n";
|
||||
for (unsigned i : constraints_for_explanation()) {
|
||||
lra.constraints().display(tout, i);
|
||||
for (u_dependency* d : constraints_for_explanation()) {
|
||||
for (auto ci : lra.flatten(d))
|
||||
lra.constraints().display(tout, ci);
|
||||
}
|
||||
tout << lra.constraints();
|
||||
);
|
||||
|
@ -277,16 +278,16 @@ branch y_i >= ceil(y0_i) is impossible.
|
|||
TRACE("hnf_cut",
|
||||
lra.print_term(lia.m_t, tout << "cut:");
|
||||
tout << " <= " << lia.m_k << std::endl;
|
||||
for (unsigned i : constraints_for_explanation()) {
|
||||
lra.constraints().display(tout, i);
|
||||
}
|
||||
for (auto* dep : constraints_for_explanation())
|
||||
for (auto ci : lra.flatten(dep))
|
||||
lra.constraints().display(tout, ci);
|
||||
);
|
||||
lp_assert(lia.current_solution_is_inf_on_cut());
|
||||
lia.settings().stats().m_hnf_cuts++;
|
||||
lia.m_ex->clear();
|
||||
for (unsigned i : constraints_for_explanation()) {
|
||||
lia.m_ex->push_back(i);
|
||||
}
|
||||
for (u_dependency* dep : constraints_for_explanation())
|
||||
for (auto ci : lia.lra.flatten(dep))
|
||||
lia.m_ex->push_back(ci);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue