3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-13 12:28:44 +00:00

change try_patch to a template

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2020-05-26 16:25:32 -07:00
parent 2de79be31b
commit a53ed5bddd
3 changed files with 5 additions and 17 deletions

View file

@ -517,7 +517,7 @@ bool int_solver::shift_var(unsigned j, unsigned range) {
// x, the value of j column, might be shifted on a multiple of m
if (inf_l && inf_u) {
impq new_val = m * impq(random() % (range + 1)) + x;
lra.set_value_for_nbasic_column_ignore_old_values(j, new_val);
lra.set_value_for_nbasic_column(j, new_val);
return true;
}
if (column_is_int(j)) {
@ -534,14 +534,14 @@ bool int_solver::shift_var(unsigned j, unsigned range) {
if (inf_u) {
SASSERT(!inf_l);
impq new_val = x + m * impq(random() % (range + 1));
lra.set_value_for_nbasic_column_ignore_old_values(j, new_val);
lra.set_value_for_nbasic_column(j, new_val);
return true;
}
if (inf_l) {
SASSERT(!inf_u);
impq new_val = x - m * impq(random() % (range + 1));
lra.set_value_for_nbasic_column_ignore_old_values(j, new_val);
lra.set_value_for_nbasic_column(j, new_val);
return true;
}
@ -563,7 +563,7 @@ bool int_solver::shift_var(unsigned j, unsigned range) {
impq new_val = x + m * impq(s);
TRACE("int_solver", tout << "new_val = " << new_val << "\n";);
SASSERT(l <= new_val && new_val <= u);
lra.set_value_for_nbasic_column_ignore_old_values(j, new_val);
lra.set_value_for_nbasic_column(j, new_val);
return true;
}

View file

@ -2431,17 +2431,6 @@ bool lar_solver::inside_bounds(lpvar j, const impq& val) const {
return true;
}
void lar_solver::set_value_for_nbasic_column_ignore_old_values(unsigned j, const impq & new_val) {
lp_assert(!is_base(j));
auto & x = m_mpq_lar_core_solver.m_r_x[j];
auto delta = new_val - x;
x = new_val;
TRACE("int_solver", tout << "x[" << j << "] = " << x << "\n";);
change_basic_columns_dependend_on_a_given_nb_column(j, delta);
}
void lar_solver::pivot_column_tableau(unsigned j, unsigned row_index) {
m_mpq_lar_core_solver.m_r_solver.pivot_column_tableau(j, row_index);
m_mpq_lar_core_solver.m_r_solver.change_basis(j, r_basis()[row_index]);

View file

@ -329,7 +329,7 @@ public:
return false;
}
set_value_for_nbasic_column_ignore_old_values(j, ival);
set_value_for_nbasic_column(j, ival);
change_report(j);
for (const auto &c : A_r().column(j)) {
unsigned rj = m_mpq_lar_core_solver.m_r_basis[c.var()];
@ -506,7 +506,6 @@ public:
return 0;
return m_usage_in_terms[j];
}
void set_value_for_nbasic_column_ignore_old_values(unsigned j, const impq & new_val);
friend int_solver;
friend int_branch;