mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
throttle dioph equalities
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
128d5b4fa0
commit
392c24a145
|
@ -561,7 +561,7 @@ public:
|
||||||
return lia_move::conflict;
|
return lia_move::conflict;
|
||||||
}
|
}
|
||||||
rewrite_eqs();
|
rewrite_eqs();
|
||||||
if (m_conflict_index != -1) {
|
if (m_conflict_index != UINT_MAX) {
|
||||||
lra.settings().stats().m_dio_conflicts++;
|
lra.settings().stats().m_dio_conflicts++;
|
||||||
return lia_move::conflict;
|
return lia_move::conflict;
|
||||||
}
|
}
|
||||||
|
@ -777,7 +777,7 @@ public:
|
||||||
unsigned h = -1;
|
unsigned h = -1;
|
||||||
auto it = m_f.begin();
|
auto it = m_f.begin();
|
||||||
while (it != m_f.end()) {
|
while (it != m_f.end()) {
|
||||||
if (m_e_matrix.m_rows[m_eprime[*it].m_row_index].size() == 0)
|
if (m_e_matrix.m_rows[m_eprime[*it].m_row_index].size() == 0) {
|
||||||
if (m_eprime[*it].m_c.is_zero()) {
|
if (m_eprime[*it].m_c.is_zero()) {
|
||||||
it = m_f.erase(it);
|
it = m_f.erase(it);
|
||||||
continue;
|
continue;
|
||||||
|
@ -785,10 +785,11 @@ public:
|
||||||
m_conflict_index = *it;
|
m_conflict_index = *it;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
h = *it;
|
h = *it;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (h == -1) return;
|
if (h == UINT_MAX) return;
|
||||||
auto& eprime_entry = m_eprime[h];
|
auto& eprime_entry = m_eprime[h];
|
||||||
TRACE("dioph_eq", print_eprime_entry(h, tout););
|
TRACE("dioph_eq", print_eprime_entry(h, tout););
|
||||||
auto [ahk, k, k_sign] = find_minimal_abs_coeff(eprime_entry.m_row_index);
|
auto [ahk, k, k_sign] = find_minimal_abs_coeff(eprime_entry.m_row_index);
|
||||||
|
|
|
@ -41,13 +41,17 @@ namespace lp {
|
||||||
mpq m_k; // the right side of the cut
|
mpq m_k; // the right side of the cut
|
||||||
hnf_cutter m_hnf_cutter;
|
hnf_cutter m_hnf_cutter;
|
||||||
unsigned m_hnf_cut_period;
|
unsigned m_hnf_cut_period;
|
||||||
|
unsigned m_dioph_eq_period;
|
||||||
int_gcd_test m_gcd;
|
int_gcd_test m_gcd;
|
||||||
|
|
||||||
bool column_is_int_inf(unsigned j) const {
|
bool column_is_int_inf(unsigned j) const {
|
||||||
return lra.column_is_int(j) && (!lia.value_is_int(j));
|
return lra.column_is_int(j) && (!lia.value_is_int(j));
|
||||||
}
|
}
|
||||||
|
|
||||||
imp(int_solver& lia): lia(lia), lra(lia.lra), lrac(lia.lrac), m_hnf_cutter(lia), m_gcd(lia) {}
|
imp(int_solver& lia): lia(lia), lra(lia.lra), lrac(lia.lrac), m_hnf_cutter(lia), m_gcd(lia) {
|
||||||
|
m_hnf_cut_period = settings().hnf_cut_period();
|
||||||
|
m_dioph_eq_period = settings().m_dioph_eq_period;
|
||||||
|
}
|
||||||
|
|
||||||
bool has_lower(unsigned j) const {
|
bool has_lower(unsigned j) const {
|
||||||
switch (lrac.m_column_types()[j]) {
|
switch (lrac.m_column_types()[j]) {
|
||||||
|
@ -170,11 +174,14 @@ namespace lp {
|
||||||
|
|
||||||
if (r == lia_move::conflict) {
|
if (r == lia_move::conflict) {
|
||||||
de.explain(*this->m_ex);
|
de.explain(*this->m_ex);
|
||||||
|
m_dioph_eq_period = settings().m_dioph_eq_period;
|
||||||
return lia_move::conflict;
|
return lia_move::conflict;
|
||||||
} else if (r == lia_move::branch) {
|
} else if (r == lia_move::branch) {
|
||||||
|
m_dioph_eq_period = settings().m_dioph_eq_period;
|
||||||
return lia_move::branch;
|
return lia_move::branch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_dioph_eq_period *= 2; // the overflow is fine, maybe to try again
|
||||||
return lia_move::undef;
|
return lia_move::undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +197,7 @@ namespace lp {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool should_solve_dioph_eq() {
|
bool should_solve_dioph_eq() {
|
||||||
return lia.settings().dio_eqs() && m_number_of_calls % settings().m_dioph_eq_period == 0;
|
return lia.settings().dio_eqs() && m_number_of_calls % m_dioph_eq_period == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool should_hnf_cut() {
|
bool should_hnf_cut() {
|
||||||
|
|
|
@ -219,7 +219,7 @@ public:
|
||||||
unsigned column_number_threshold_for_using_lu_in_lar_solver = 4000;
|
unsigned column_number_threshold_for_using_lu_in_lar_solver = 4000;
|
||||||
unsigned m_int_gomory_cut_period = 4;
|
unsigned m_int_gomory_cut_period = 4;
|
||||||
unsigned m_int_find_cube_period = 4;
|
unsigned m_int_find_cube_period = 4;
|
||||||
unsigned m_dioph_eq_period = 4;
|
unsigned m_dioph_eq_period = 1;
|
||||||
private:
|
private:
|
||||||
unsigned m_hnf_cut_period = 4;
|
unsigned m_hnf_cut_period = 4;
|
||||||
bool m_int_run_gcd_test = true;
|
bool m_int_run_gcd_test = true;
|
||||||
|
|
Loading…
Reference in a new issue