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

Method transformNewIntegerFeasibleSolution

highs/mip/HighsMipSolverData.cpp:1159–1308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1157}
1158
1159double HighsMipSolverData::transformNewIntegerFeasibleSolution(
1160 const std::vector<double>& sol,
1161 const bool possibly_store_as_new_incumbent) {
1162 HighsSolution solution;
1163 solution.col_value = sol;
1164 solution.value_valid = true;
1165 // Perform primal postsolve to get the original column values
1166 postSolveStack.undoPrimal(*mipsolver.options_mip_, solution);
1167 // Determine the row values, as they aren't computed in primal
1168 // postsolve
1169 HighsStatus return_status =
1170 calculateRowValuesQuad(*mipsolver.orig_model_, solution);
1171 if (kAllowDeveloperAssert) assert(return_status == HighsStatus::kOk);
1172 bool allow_try_again = true;
1173try_again:
1174
1175 // compute the objective value in the original space
1176 double bound_violation_ = 0;
1177 double row_violation_ = 0;
1178 double integrality_violation_ = 0;
1179 HighsCDouble mipsolver_quad_objective_value = 0;
1180 bool feasible = mipsolver.solutionFeasible(
1181 mipsolver.orig_model_, solution.col_value, &solution.row_value,
1182 bound_violation_, row_violation_, integrality_violation_,
1183 mipsolver_quad_objective_value);
1184 double mipsolver_objective_value = double(mipsolver_quad_objective_value);
1185 if (!feasible && allow_try_again) {
1186 // printf(
1187 // "trying to repair sol that is violated by %.12g bounds, %.12g "
1188 // "integrality, %.12g rows\n",
1189 // bound_violation_, integrality_violation_, row_violation_);
1190 HighsLp fixedModel = *mipsolver.orig_model_;
1191 fixedModel.integrality_.clear();
1192 for (HighsInt i = 0; i != mipsolver.orig_model_->num_col_; ++i) {
1193 if (mipsolver.orig_model_->integrality_[i] == HighsVarType::kInteger) {
1194 double solval = std::round(solution.col_value[i]);
1195 fixedModel.col_lower_[i] = std::max(fixedModel.col_lower_[i], solval);
1196 fixedModel.col_upper_[i] = std::min(fixedModel.col_upper_[i], solval);
1197 }
1198 }
1199 this->total_repair_lp++;
1200 double time_available = std::max(
1201 mipsolver.options_mip_->time_limit - mipsolver.timer_.read(), 0.1);
1202 // Highs instantiation
1203 Highs tmpSolver;
1204 tmpSolver.setProfiling(mipsolver.profiling_);
1205 const bool debug_report = false;
1206 if (debug_report) {
1207 tmpSolver.setOptionValue("log_dev_level", 2);
1208 tmpSolver.setOptionValue("highs_analysis_level", 4);
1209 } else {
1210 tmpSolver.setOptionValue("output_flag", false);
1211 }
1212 // tmpSolver.setOptionValue("simplex_scale_strategy", 0);
1213 // tmpSolver.setOptionValue("presolve", kHighsOffString);
1214 tmpSolver.setOptionValue("time_limit", time_available);
1215 // Set primal feasibility tolerance for LP solves according to
1216 // mip_feasibility_tolerance. Interestingly, dual feasibility

Callers 1

performRestartMethod · 0.45

Calls 14

calculateRowValuesQuadFunction · 0.85
highsLogUserFunction · 0.85
undoPrimalMethod · 0.80
solutionFeasibleMethod · 0.80
passModelMethod · 0.80
optimizeLpMethod · 0.80
clearMethod · 0.45
readMethod · 0.45
setProfilingMethod · 0.45
setOptionValueMethod · 0.45
getInfoMethod · 0.45

Tested by

no test coverage detected