Skip to content

Commit 3c7917b

Browse files
committed
Merge branch 'latest' of https://github.com/ERGO-Code/HiGHS into coeffStren
2 parents 8cbdd88 + c7e48d5 commit 3c7917b

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

FEATURES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ Added `Highs_changeRowsBoundsByRange` to C API, fixing [#2296](https://github.co
2020

2121
Corrected docstrings for `Highs_getReducedRow`, motivated by [#2312](https://github.com/ERGO-Code/HiGHS/issues/2312))
2222

23+
LP file reader no longer fails when there is no objective section. Fix is [#2316](https://github.com/ERGO-Code/HiGHS/pull/2316)), but this exposes code quality issue [#2318](https://github.com/ERGO-Code/HiGHS/issues/2318))
24+
25+
26+

check/TestFilereader.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,19 @@ TEST_CASE("filereader-edge-cases", "[highs_filereader]") {
9898
}
9999

100100
if (test_garbage_lp) {
101+
// Since #2316, reading an LP file of garbage yields an empty
102+
// model, since the absence of an objecive is (rightly) no
103+
// longer an error. However the LP file reader should fail due
104+
// to the requirement that a LP format file must begin with a
105+
// keyword.
101106
if (dev_run) printf("\ngarbage.lp\n");
102107
model_file = std::string(HIGHS_DIR) + "/check/instances/" + model + ".lp";
103108
read_status = highs.readModel(model_file);
104-
REQUIRE(read_status == HighsStatus::kError);
109+
// Should be HighsStatus::kError); #2316
110+
REQUIRE(read_status == HighsStatus::kOk);
111+
REQUIRE(highs.getLp().num_col_ == 0);
112+
REQUIRE(highs.getLp().num_row_ == 0);
113+
REQUIRE(highs.getLp().a_matrix_.numNz() == 0);
105114
}
106115
}
107116

@@ -110,7 +119,8 @@ TEST_CASE("filereader-edge-cases", "[highs_filereader]") {
110119
if (dev_run) printf("\n%s.mps\n", model.c_str());
111120
model_file = std::string(HIGHS_DIR) + "/check/instances/" + model + ".lp";
112121
read_status = highs.readModel(model_file);
113-
REQUIRE(read_status == HighsStatus::kError);
122+
// Should be HighsStatus::kError); #2316
123+
REQUIRE(read_status == HighsStatus::kOk);
114124

115125
// Gurobi cannot read
116126
//

extern/filereaderlp/reader.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -308,23 +308,6 @@ Model Reader::read() {
308308
splittokens();
309309

310310
// std::clog << "Setting up model..." << std::endl;
311-
//
312-
// Since
313-
//
314-
// "The problem statement must begin with the word MINIMIZE or
315-
// MAXIMIZE, MINIMUM or MAXIMUM, or the abbreviations MIN or MAX, in
316-
// any combination of upper- and lower-case characters. The word
317-
// introduces the objective function section."
318-
//
319-
// Use positivity of sectiontokens.count(LpSectionKeyword::OBJMIN) +
320-
// sectiontokens.count(LpSectionKeyword::OBJMAX) to identify garbage file
321-
//
322-
323-
const int num_objective_section =
324-
sectiontokens.count(LpSectionKeyword::OBJMIN) +
325-
sectiontokens.count(LpSectionKeyword::OBJMAX);
326-
lpassert(num_objective_section>0);
327-
328311
processsections();
329312
processedtokens.clear();
330313
processedtokens.shrink_to_fit();

0 commit comments

Comments
 (0)