MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / calledOptimizeModel

Method calledOptimizeModel

highs/lp_data/Highs.cpp:1173–2061  ·  view source on GitHub ↗

Checks the options calls presolve and postsolve if needed. LP solvers are called with callSolveLp(..)

Source from the content-addressed store, hash-verified

1171//
1172// LP solvers are called with callSolveLp(..)
1173HighsStatus Highs::calledOptimizeModel() {
1174 // Level 2b of Highs::run()
1175 //
1176 HighsInt min_highs_debug_level = kHighsDebugLevelMin;
1177 // kHighsDebugLevelCostly;
1178 // kHighsDebugLevelMax;
1179 if (options_.highs_debug_level < min_highs_debug_level)
1180 options_.highs_debug_level = min_highs_debug_level;
1181
1182 const bool possibly_use_log_dev_level_2 = false;
1183 const HighsInt log_dev_level = options_.log_dev_level;
1184 const bool output_flag = options_.output_flag;
1185 HighsInt use_log_dev_level = log_dev_level;
1186 bool use_output_flag = output_flag;
1187 const HighsInt check_debug_run_call_num = -103757;
1188 const HighsInt check_num_col = -317;
1189 const HighsInt check_num_row = -714;
1190 if (possibly_use_log_dev_level_2) {
1191 if (this->debug_optimize_call_num_ == check_debug_run_call_num &&
1192 model_.lp_.num_col_ == check_num_col &&
1193 model_.lp_.num_row_ == check_num_row) {
1194 std::string message =
1195 "Entering Highs::optimizeModel(): run/col/row matching check ";
1196 highsLogDev(options_.log_options, HighsLogType::kInfo,
1197 "%s: run %d: LP(%6d, %6d)\n", message.c_str(),
1198 int(this->debug_optimize_call_num_), int(model_.lp_.num_col_),
1199 int(model_.lp_.num_row_));
1200 // highsPause(true, message);
1201 use_log_dev_level = 2;
1202 use_output_flag = true;
1203 }
1204 }
1205
1206 if (!options_.use_warm_start) this->clearSolver();
1207 if (ekk_instance_.status_.has_nla)
1208 assert(ekk_instance_.lpFactorRowCompatible(model_.lp_.num_row_));
1209
1210 // returnFromOptimizeModel() is a common exit method to ensure
1211 // consistency of values set by optimizeModel() and many other
1212 // things. It's important to be able to check that it's been called,
1213 // and this is done with this->called_return_from_optimize_model
1214 //
1215 // Make sure here that returnFromOptimizeModel() has been called
1216 // after any previous call to optimizeModel()
1217
1218 assert(called_return_from_optimize_model);
1219 if (!called_return_from_optimize_model) {
1220 highsLogDev(options_.log_options, HighsLogType::kError,
1221 "Highs::optimizeModel() called with "
1222 "called_return_from_optimize_model false\n");
1223 return HighsStatus::kError;
1224 }
1225
1226 // HiGHS solvers require models with no infinite costs, and no semi-variables
1227 //
1228 // Since completeSolutionFromDiscreteAssignment() may require a call
1229 // to optimizeModel() - with initial check that
1230 // called_return_from_optimize_model is true

Callers 2

optimizeLpMethod · 0.95
optimizeModelMethod · 0.95

Calls 15

clearSolverMethod · 0.95
invalidateBasisMethod · 0.95
callLpKktCheckMethod · 0.95
highsLogDevFunction · 0.85
highsLogUserFunction · 0.85
assessLpFunction · 0.85
interpretCallStatusFunction · 0.85
assessSemiVariablesFunction · 0.85
relaxSemiVariablesFunction · 0.85
okHessianDiagonalFunction · 0.85
solverValidForQpFunction · 0.85
warnSolverInvalidFunction · 0.85

Tested by

no test coverage detected