diff --git a/src/math/lp/int_solver.cpp b/src/math/lp/int_solver.cpp index 54bbe6d12..5ddd8bc04 100644 --- a/src/math/lp/int_solver.cpp +++ b/src/math/lp/int_solver.cpp @@ -289,19 +289,6 @@ lia_move int_solver::hnf_cut() { return r; } -void int_solver::set_value_for_nbasic_column_ignore_old_values(unsigned j, const impq & new_val) { - lp_assert(!is_base(j)); - auto & x = lrac.m_r_x[j]; - auto delta = new_val - x; - x = new_val; - TRACE("int_solver", tout << "x[" << j << "] = " << x << "\n";); - lra.change_basic_columns_dependend_on_a_given_nb_column(j, delta); -} - - - - - bool int_solver::has_lower(unsigned j) const { switch (lrac.m_column_types()[j]) { case column_type::fixed: @@ -530,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; - set_value_for_nbasic_column_ignore_old_values(j, new_val); + lra.set_value_for_nbasic_column_ignore_old_values(j, new_val); return true; } if (column_is_int(j)) { @@ -547,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)); - set_value_for_nbasic_column_ignore_old_values(j, new_val); + lra.set_value_for_nbasic_column_ignore_old_values(j, new_val); return true; } if (inf_l) { SASSERT(!inf_u); impq new_val = x - m * impq(random() % (range + 1)); - set_value_for_nbasic_column_ignore_old_values(j, new_val); + lra.set_value_for_nbasic_column_ignore_old_values(j, new_val); return true; } @@ -576,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); - set_value_for_nbasic_column_ignore_old_values(j, new_val); + lra.set_value_for_nbasic_column_ignore_old_values(j, new_val); return true; } diff --git a/src/math/lp/int_solver.h b/src/math/lp/int_solver.h index d281411f5..332fb1eea 100644 --- a/src/math/lp/int_solver.h +++ b/src/math/lp/int_solver.h @@ -94,7 +94,6 @@ private: bool is_fixed(unsigned j) const; bool is_free(unsigned j) const; bool value_is_int(unsigned j) const; - void set_value_for_nbasic_column_ignore_old_values(unsigned j, const impq & new_val); bool is_feasible() const; bool column_is_int_inf(unsigned j) const; std::ostream& display_inf_rows(std::ostream&) const; diff --git a/src/math/lp/lar_solver.cpp b/src/math/lp/lar_solver.cpp index b14c0e92f..7f847ced1 100644 --- a/src/math/lp/lar_solver.cpp +++ b/src/math/lp/lar_solver.cpp @@ -2431,6 +2431,17 @@ 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 bf6efb1f5..45198ca1f 100644 --- a/src/math/lp/lar_solver.h +++ b/src/math/lp/lar_solver.h @@ -323,19 +323,16 @@ public: const mpq & a = c.coeff(); unsigned rj = m_mpq_lar_core_solver.m_r_basis[row_index]; impq rj_new_val = a * delta + get_column_value(rj); - if (column_is_int(rj) && !rj_new_val.is_int()) - return false; - if (!inside_bounds(rj, rj_new_val) || blocker(rj)) + // if (column_is_int(rj) && !rj_new_val.is_int()) + // return false; + if (blocker(rj)) return false; } - set_column_value(j, ival); + set_value_for_nbasic_column_ignore_old_values(j, ival); change_report(j); for (const auto &c : A_r().column(j)) { - unsigned row_index = c.var(); - const mpq & a = c.coeff(); - unsigned rj = m_mpq_lar_core_solver.m_r_basis[row_index]; - m_mpq_lar_core_solver.m_r_solver.add_delta_to_x(rj, a * delta); + unsigned rj = m_mpq_lar_core_solver.m_r_basis[c.var()]; change_report(rj); } @@ -509,6 +506,7 @@ 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; diff --git a/src/math/lp/nla_core.cpp b/src/math/lp/nla_core.cpp index 1de52130d..97d2d885d 100644 --- a/src/math/lp/nla_core.cpp +++ b/src/math/lp/nla_core.cpp @@ -1392,6 +1392,12 @@ void core::patch_monomials() { if (m_to_refine.size() == 0) break; } + NOT_IMPLEMENTED_YET(); + /* + If the tableau is not feasible we need to fix all non-linear + vars that do not satisfy var_breaks_correct_monic() + and find a feasible solution, fix the integral values too. + */ TRACE("nla_solver", tout << "sz = " << m_to_refine.size() << "\n";); SASSERT(m_lar_solver.ax_is_correct()); }