From a38be432642598b2afcaccb050d0f29652d1ea4e Mon Sep 17 00:00:00 2001 From: Lev Nachmanson Date: Sat, 4 Mar 2023 12:15:48 -0800 Subject: [PATCH] rm lu Signed-off-by: Lev Nachmanson --- src/math/lp/lar_core_solver.h | 2 +- src/math/lp/lar_solver.cpp | 19 ++++---------- src/math/lp/lp_core_solver_base_def.h | 20 ++------------- src/math/lp/lp_settings.h | 8 +++--- src/test/lp/lp.cpp | 36 --------------------------- 5 files changed, 11 insertions(+), 74 deletions(-) diff --git a/src/math/lp/lar_core_solver.h b/src/math/lp/lar_core_solver.h index de8fe68adb5..b6c97513919 100644 --- a/src/math/lp/lar_core_solver.h +++ b/src/math/lp/lar_core_solver.h @@ -229,7 +229,7 @@ class lar_core_solver { } bool need_to_presolve_with_double_solver() const { - return settings().simplex_strategy() == simplex_strategy_enum::lu; + return false; } template diff --git a/src/math/lp/lar_solver.cpp b/src/math/lp/lar_solver.cpp index 86ecb02b964..c2a332ad31a 100644 --- a/src/math/lp/lar_solver.cpp +++ b/src/math/lp/lar_solver.cpp @@ -45,7 +45,7 @@ namespace lp { delete t; } - bool lar_solver::use_lu() const { return m_settings.simplex_strategy() == simplex_strategy_enum::lu; } + bool lar_solver::use_lu() const { return false; } bool lar_solver::sizes_are_correct() const { lp_assert(strategy_is_undecided() || !m_mpq_lar_core_solver.need_to_presolve_with_double_solver() || A_r().column_count() == A_d().column_count()); @@ -478,10 +478,7 @@ namespace lp { m_mpq_lar_core_solver.m_r_solver.set_status(lp_status::OPTIMAL); return ret; - case simplex_strategy_enum::lu: - lp_assert(false); // not implemented - return false; - + default: lp_unreachable(); // wrong mode } @@ -1999,20 +1996,14 @@ namespace lp { void lar_solver::decide_on_strategy_and_adjust_initial_state() { lp_assert(strategy_is_undecided()); - if (m_columns_to_ul_pairs.size() > m_settings.column_number_threshold_for_using_lu_in_lar_solver) { - m_settings.set_simplex_strategy(simplex_strategy_enum::lu); - } - else { - m_settings.set_simplex_strategy(simplex_strategy_enum::tableau_rows); // todo: when to switch to tableau_costs? - } + + m_settings.set_simplex_strategy(simplex_strategy_enum::tableau_rows); // todo: when to switch to tableau_costs? + adjust_initial_state(); } void lar_solver::adjust_initial_state() { switch (m_settings.simplex_strategy()) { - case simplex_strategy_enum::lu: - adjust_initial_state_for_lu(); - break; case simplex_strategy_enum::tableau_rows: adjust_initial_state_for_tableau_rows(); break; diff --git a/src/math/lp/lp_core_solver_base_def.h b/src/math/lp/lp_core_solver_base_def.h index 4d29234a815..40e0a527d41 100644 --- a/src/math/lp/lp_core_solver_base_def.h +++ b/src/math/lp/lp_core_solver_base_def.h @@ -894,27 +894,11 @@ template bool lp_core_solver_base::pivot_column_g lp_assert(m_basis_heading[j] < 0); lp_assert(m_basis_heading[j_basic] >= 0); unsigned row_index = m_basis_heading[j_basic]; - if (m_settings.m_simplex_strategy == simplex_strategy_enum::lu) { - if (m_factorization->need_to_refactor()) { - init_lu(); - } - else { - m_factorization->prepare_entering(j, w); // to init vector w - m_factorization->replace_column(zero_of_type(), w, row_index); - } - if (m_factorization->get_status() != LU_status::OK) { - init_lu(); - return false; - } - else { - change_basis(j, j_basic); - } - } - else { // the tableau case + // the tableau case if (pivot_column_tableau(j, row_index)) change_basis(j, j_basic); else return false; - } + return true; } diff --git a/src/math/lp/lp_settings.h b/src/math/lp/lp_settings.h index 2245f6f4ed1..790354e5586 100644 --- a/src/math/lp/lp_settings.h +++ b/src/math/lp/lp_settings.h @@ -55,8 +55,7 @@ inline std::ostream& operator<<(std::ostream& out, column_type const& t) { enum class simplex_strategy_enum { undecided = 3, tableau_rows = 0, - tableau_costs = 1, - lu = 2 + tableau_costs = 1 }; std::string column_type_to_string(column_type t); @@ -341,12 +340,11 @@ struct lp_settings { } bool use_lu() const { - return m_simplex_strategy == simplex_strategy_enum::lu; + return false; } bool use_tableau() const { - return m_simplex_strategy == simplex_strategy_enum::tableau_rows || - m_simplex_strategy == simplex_strategy_enum::tableau_costs; + return true; } bool use_tableau_rows() const { diff --git a/src/test/lp/lp.cpp b/src/test/lp/lp.cpp index 78abf1a6f4d..fe589835d48 100644 --- a/src/test/lp/lp.cpp +++ b/src/test/lp/lp.cpp @@ -1422,42 +1422,6 @@ bool get_double_from_args_parser(const char * option, argument_parser & args_par } -void update_settings(argument_parser & args_parser, lp_settings& settings) { - unsigned n; - settings.m_simplex_strategy = simplex_strategy_enum::lu; - if (get_int_from_args_parser("--rep_frq", args_parser, n)) - settings.report_frequency = n; - else - settings.report_frequency = args_parser.option_is_used("--mpq")? 80: 1000; - - settings.print_statistics = true; - - if (get_int_from_args_parser("--percent_for_enter", args_parser, n)) - settings.percent_of_entering_to_check = n; - if (get_int_from_args_parser("--partial_pivot", args_parser, n)) { - std::cout << "setting partial pivot constant to " << n << std::endl; - settings.c_partial_pivoting = n; - } - if (get_int_from_args_parser("--density", args_parser, n)) { - double density = static_cast(n) / 100.0; - std::cout << "setting density to " << density << std::endl; - settings.density_threshold = density; - } - if (get_int_from_args_parser("--maxng", args_parser, n)) - settings.max_number_of_iterations_with_no_improvements = n; - double d; - if (get_double_from_args_parser("--harris_toler", args_parser, d)) { - std::cout << "setting harris_feasibility_tolerance to " << d << std::endl; - settings.harris_feasibility_tolerance = d; - } - if (get_int_from_args_parser("--random_seed", args_parser, n)) { - settings.set_random_seed(n); - } - if (get_int_from_args_parser("--simplex_strategy", args_parser, n)) { - settings.set_simplex_strategy(static_cast(n)); - } -} - bool values_are_one_percent_close(double a, double b);