| 177 | } |
| 178 | |
| 179 | void presolveSolvePostsolve(const std::string& model_file, |
| 180 | const bool solve_relaxation) { |
| 181 | Highs highs0; |
| 182 | Highs highs1; |
| 183 | highs0.setOptionValue("output_flag", dev_run); |
| 184 | highs1.setOptionValue("output_flag", dev_run); |
| 185 | HighsStatus return_status; |
| 186 | highs0.readModel(model_file); |
| 187 | highs0.setOptionValue("solve_relaxation", solve_relaxation); |
| 188 | return_status = highs0.presolve(); |
| 189 | REQUIRE(return_status == HighsStatus::kOk); |
| 190 | HighsPresolveStatus model_presolve_status = highs0.getModelPresolveStatus(); |
| 191 | if (model_presolve_status == HighsPresolveStatus::kTimeout) { |
| 192 | if (dev_run) |
| 193 | printf("Presolve timeout: return status = %d\n", (int)return_status); |
| 194 | } |
| 195 | HighsLp lp = highs0.getPresolvedLp(); |
| 196 | highs1.passModel(lp); |
| 197 | highs1.setOptionValue("solve_relaxation", solve_relaxation); |
| 198 | highs1.setOptionValue("presolve", kHighsOffString); |
| 199 | highs1.run(); |
| 200 | HighsSolution solution = highs1.getSolution(); |
| 201 | const double objective_value = highs1.getInfo().objective_function_value; |
| 202 | if (lp.isMip() && !solve_relaxation) { |
| 203 | return_status = highs0.postsolve(solution); |
| 204 | REQUIRE(return_status == HighsStatus::kWarning); |
| 205 | HighsModelStatus model_status = highs0.getModelStatus(); |
| 206 | REQUIRE(model_status == HighsModelStatus::kUnknown); |
| 207 | const double dl_objective_value = |
| 208 | std::fabs(highs0.getInfo().objective_function_value - objective_value); |
| 209 | REQUIRE(dl_objective_value < 1e-9); |
| 210 | REQUIRE(highs0.getInfo().primal_solution_status == kSolutionStatusFeasible); |
| 211 | double mip_feasibility_tolerance; |
| 212 | highs0.getOptionValue("mip_feasibility_tolerance", |
| 213 | mip_feasibility_tolerance); |
| 214 | REQUIRE(highs0.getInfo().max_integrality_violation <= |
| 215 | mip_feasibility_tolerance); |
| 216 | } else { |
| 217 | HighsBasis basis = highs1.getBasis(); |
| 218 | REQUIRE(basis.valid); |
| 219 | return_status = highs0.postsolve(solution, basis); |
| 220 | REQUIRE(return_status == HighsStatus::kOk); |
| 221 | HighsModelStatus model_status = highs0.getModelStatus(); |
| 222 | REQUIRE(model_status == HighsModelStatus::kOptimal); |
| 223 | REQUIRE(highs0.getInfo().simplex_iteration_count <= 0); |
| 224 | } |
| 225 | |
| 226 | highs1.resetGlobalScheduler(true); |
| 227 | } |
| 228 | |
| 229 | HighsStatus zeroCostColSing() { |
| 230 | HighsLp lp; |
no test coverage detected