Skip to content

Commit d03fa6a

Browse files
committed
Created unit test read-lp-file-solution exposing issue 2463
1 parent 887dc08 commit d03fa6a

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

check/TestCheckSolution.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,40 @@ TEST_CASE("read-miplib-solution", "[highs_check_solution]") {
459459
h.resetGlobalScheduler(true);
460460
}
461461

462+
TEST_CASE("read-lp-file-solution", "[highs_check_solution]") {
463+
const std::string test_name = Catch::getResultCapture().getCurrentTestName();
464+
const std::string model_file_name = test_name + ".lp";
465+
const std::string solution_file_name = test_name + ".sol";
466+
HighsLp lp;
467+
lp.num_col_ = 3;
468+
lp.num_row_ = 1;
469+
lp.col_cost_ = {0, 1, 1};
470+
lp.col_lower_ = {0, 10, 0};
471+
lp.col_upper_ = {kHighsInf, kHighsInf, kHighsInf};
472+
lp.col_names_ = {"x", "y", "z"};
473+
lp.row_lower_ = {1};
474+
lp.row_upper_ = {2};
475+
lp.row_names_ = {"r"};
476+
lp.a_matrix_.start_ = {0, 1, 1, 2};
477+
lp.a_matrix_.index_ = {0, 0};
478+
lp.a_matrix_.value_ = {1, 1};
479+
lp.integrality_ = {HighsVarType::kContinuous, HighsVarType::kContinuous, HighsVarType::kInteger};
480+
Highs h;
481+
// h.setOptionValue("output_flag", dev_run);
482+
REQUIRE(h.passModel(lp) == HighsStatus::kOk);
483+
h.run();
484+
h.writeModel(model_file_name);
485+
h.writeSolution(solution_file_name);
486+
487+
h.readModel(model_file_name);
488+
h.readSolution(solution_file_name);
489+
h.run();
490+
491+
// std::remove(model_file_name.c_str());
492+
// std::remove(solution_file_name.c_str());
493+
h.resetGlobalScheduler(true);
494+
}
495+
462496
void runWriteReadCheckSolution(Highs& highs, const std::string& test_name,
463497
const std::string& model,
464498
const HighsModelStatus require_model_status,

0 commit comments

Comments
 (0)