Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 2152 #2156

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions check/TestFilereader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,3 +416,26 @@ TEST_CASE("writeLocalModel", "[highs_filereader]") {

std::remove(write_model_file.c_str());
}

TEST_CASE("write-MI-bound-model", "[highs_filereader]") {
std::string write_model_file = "temp.mps";
Highs h;
h.setOptionValue("output_flag", dev_run);
h.addCol(1, -kHighsInf, 1, 0, nullptr, nullptr);
h.changeColIntegrality(0, HighsVarType::kInteger);
h.passColName(0, "x");
std::vector<HighsInt> index = {0};
std::vector<double> value = {1};
h.addRow(-10, kHighsInf, 1, index.data(), value.data());
h.passRowName(0, "r");
h.run();
double required_objective_value = h.getInfo().objective_function_value;
// writeModel must ensure that there is a line
//
// MI BOUND x
h.writeModel(write_model_file);
h.readModel(write_model_file);
h.run();
REQUIRE(required_objective_value == h.getInfo().objective_function_value);
std::remove(write_model_file.c_str());
}
3 changes: 3 additions & 0 deletions src/io/HMPSIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,9 @@ HighsStatus writeMps(
if (lb || highs_isInfinity(ub))
fprintf(file, " LI BOUND %-8s %.10g\n",
col_names[c_n].c_str(), lb);
} else {
// Infinite lower bound
fprintf(file, " MI BOUND %-8s\n", col_names[c_n].c_str());
}
if (!highs_isInfinity(ub)) {
// Finite upper bound
Expand Down
Loading