From a53ed5bddd6f34cee6e9072236277f14fa1e70a1 Mon Sep 17 00:00:00 2001 From: Lev Nachmanson Date: Tue, 26 May 2020 16:25:32 -0700 Subject: [PATCH] change try_patch to a template Signed-off-by: Lev Nachmanson --- src/math/lp/int_solver.cpp | 8 ++++---- src/math/lp/lar_solver.cpp | 11 ----------- src/math/lp/lar_solver.h | 3 +-- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/math/lp/int_solver.cpp b/src/math/lp/int_solver.cpp index 5ddd8bc04..14e9132fb 100644 --- a/src/math/lp/int_solver.cpp +++ b/src/math/lp/int_solver.cpp @@ -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; } diff --git a/src/math/lp/lar_solver.cpp b/src/math/lp/lar_solver.cpp index 7f847ced1..b14c0e92f 100644 --- a/src/math/lp/lar_solver.cpp +++ b/src/math/lp/lar_solver.cpp @@ -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]); diff --git a/src/math/lp/lar_solver.h b/src/math/lp/lar_solver.h index 3060f6544..e9d6cc890 100644 --- a/src/math/lp/lar_solver.h +++ b/src/math/lp/lar_solver.h @@ -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;