[GLOP] remove unused flag; do not recompute prices if we are not going to use them

This commit is contained in:
Laurent Perron
2021-11-16 23:52:58 +01:00
parent 7c4970ebfe
commit 028dc3b39f
2 changed files with 13 additions and 16 deletions

View File

@@ -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());

View File

@@ -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();