No commas in test case name.
| 202 | |
| 203 | // No commas in test case name. |
| 204 | void testBasisReloadModel(Highs& highs, const std::string& basis_file, |
| 205 | const bool from_file) { |
| 206 | // Checks that no simplex iterations are required if a saved optimal |
| 207 | // basis is used for the original LP after solving a different LP |
| 208 | HighsStatus return_status; |
| 209 | std::string model0_file = |
| 210 | std::string(HIGHS_DIR) + "/check/instances/adlittle.mps"; |
| 211 | std::string model1_file = |
| 212 | std::string(HIGHS_DIR) + "/check/instances/avgas.mps"; |
| 213 | // Clear the current model |
| 214 | highs.clearModel(); |
| 215 | |
| 216 | // Cannot load non-trivial basis for empty model |
| 217 | if (from_file) { |
| 218 | return_status = highs.readBasis(basis_file); |
| 219 | } else { |
| 220 | return_status = highs.setBasis(basis_data); |
| 221 | } |
| 222 | REQUIRE(return_status == HighsStatus::kError); |
| 223 | |
| 224 | // Read and solve a different model |
| 225 | highs.readModel(model1_file); |
| 226 | highs.run(); |
| 227 | |
| 228 | // Cannot load basis for model of different size |
| 229 | if (from_file) { |
| 230 | return_status = highs.readBasis(basis_file); |
| 231 | } else { |
| 232 | return_status = highs.setBasis(basis_data); |
| 233 | } |
| 234 | REQUIRE(return_status == HighsStatus::kError); |
| 235 | |
| 236 | // Clear and load original model and basis |
| 237 | highs.clearModel(); |
| 238 | highs.readModel(model0_file); |
| 239 | if (from_file) { |
| 240 | return_status = highs.readBasis(basis_file); |
| 241 | } else { |
| 242 | return_status = highs.setBasis(basis_data); |
| 243 | } |
| 244 | REQUIRE(return_status == HighsStatus::kOk); |
| 245 | |
| 246 | // Ensure that no simplex iterations are required when solved from |
| 247 | // the optimal basis |
| 248 | highs.run(); |
| 249 | // highs.writeSolution("", kSolutionStyleRaw); |
| 250 | REQUIRE(highs.getInfo().simplex_iteration_count == 0); |
| 251 | } |
| 252 | |
| 253 | void testBasisRestart(Highs& highs, const std::string& basis_file, |
| 254 | const bool from_file) { |
no test coverage detected