From 028dc3b39f19b5ff28e287c2ef35b024716ca91d Mon Sep 17 00:00:00 2001 From: Laurent Perron Date: Tue, 16 Nov 2021 23:52:58 +0100 Subject: [PATCH] [GLOP] remove unused flag; do not recompute prices if we are not going to use them --- ortools/glop/lp_solver.cc | 16 ---------------- ortools/glop/revised_simplex.cc | 13 +++++++++++++ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/ortools/glop/lp_solver.cc b/ortools/glop/lp_solver.cc index 52e12dab80..23dec6376e 100644 --- a/ortools/glop/lp_solver.cc +++ b/ortools/glop/lp_solver.cc @@ -35,10 +35,6 @@ #include "ortools/util/file_util.h" #endif -ABSL_FLAG(bool, lp_solver_enable_fp_exceptions, false, - "When true, NaNs and division / zero produce errors. " - "This is very useful for debugging, but incompatible with LLVM. " - "It is recommended to set this to false for production usage."); ABSL_FLAG(bool, lp_dump_to_proto_file, false, "Tells whether do dump the problem to a protobuf file."); ABSL_FLAG(bool, lp_dump_compressed_file, true, @@ -172,18 +168,6 @@ ProblemStatus LPSolver::SolveWithTimeLimit(const LinearProgram& lp, "\n* compiling with optimizations enabled and by defining NDEBUG. *" "\n******************************************************************"; - // Note that we only activate the floating-point exceptions after we are sure - // that the program is valid. This way, if we have input NaNs, we will not - // crash. - ScopedFloatingPointEnv scoped_fenv; - if (absl::GetFlag(FLAGS_lp_solver_enable_fp_exceptions)) { -#ifdef _MSC_VER - scoped_fenv.EnableExceptions(_EM_INVALID | EM_ZERODIVIDE); -#else - scoped_fenv.EnableExceptions(FE_DIVBYZERO | FE_INVALID); -#endif - } - // Setup the logger. logger_.EnableLogging(parameters_.log_search_progress()); logger_.SetLogToStdOut(parameters_.log_to_stdout()); diff --git a/ortools/glop/revised_simplex.cc b/ortools/glop/revised_simplex.cc index c118211436..77ab2a996d 100644 --- a/ortools/glop/revised_simplex.cc +++ b/ortools/glop/revised_simplex.cc @@ -2165,6 +2165,19 @@ void RevisedSimplex::OnDualPriceChange(const DenseColumn& squared_norm, void RevisedSimplex::DualPhaseIUpdatePrice(RowIndex leaving_row, ColIndex entering_col) { SCOPED_TIME_STAT(&function_stats_); + + // If the prices are going to be recomputed, there is nothing to do. See the + // logic at the beginning of DualPhaseIChooseLeavingVariableRow() which must + // be in sync with this one. + // + // TODO(user): Move the logic in a single class, so it is easier to enforce + // invariant. + if (reduced_costs_.AreReducedCostsRecomputed() || + dual_edge_norms_.NeedsBasisRefactorization() || + dual_pricing_vector_.empty()) { + return; + } + const VariableTypeRow& variable_type = variables_info_.GetTypeRow(); const Fractional threshold = parameters_.ratio_test_zero_threshold();