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

Function testBasisReloadModel

check/TestBasis.cpp:204–251  ·  view source on GitHub ↗

No commas in test case name.

Source from the content-addressed store, hash-verified

202
203// No commas in test case name.
204void 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
253void testBasisRestart(Highs& highs, const std::string& basis_file,
254 const bool from_file) {

Callers 1

TestBasis.cppFile · 0.85

Calls 6

readBasisMethod · 0.80
clearModelMethod · 0.45
setBasisMethod · 0.45
readModelMethod · 0.45
runMethod · 0.45
getInfoMethod · 0.45

Tested by

no test coverage detected