Skip to content

Commit 211253d

Browse files
committed
Improve handling of col_status and row_status from the C++ class HighsIis when an IIS isn't found
1 parent b406ac6 commit 211253d

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

highs/lp_data/HighsInterface.cpp

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,18 +1828,30 @@ HighsStatus Highs::getRangingInterface() {
18281828

18291829
HighsStatus Highs::getIisInterfaceReturn(const HighsStatus return_status) {
18301830
if (return_status != HighsStatus::kError) {
1831-
// Construct the ISS LP
1832-
this->iis_.getLp(this->model_.lp_);
1833-
// Check that the IIS LP data are OK (correspond to original model
1834-
// reduced to IIS col/row and bound data).
1835-
if (!this->iis_.lpDataOk(this->model_.lp_, this->options_))
1836-
return HighsStatus::kError;
1837-
// Check that the IIS LP is OK (infeasible and optimal/unbounded
1838-
// is any bound is relaxed)
1839-
if (!this->iis_.lpOk(this->options_)) return HighsStatus::kError;
1840-
// Construct the ISS status vectors for cols and rows of original
1841-
// model
1842-
this->iis_.getStatus(model_.lp_);
1831+
// A valid IIS is one for which the IIS information is known to be
1832+
// correct. In the case of a system that's feasible this will give
1833+
// empty HighsIis::col_index_ and HighsIis::col_index_.
1834+
const bool has_iis =
1835+
this->iis_.col_index_.size() || this->iis_.row_index_.size();
1836+
if (has_iis) {
1837+
assert(this->iis_.valid_);
1838+
// Construct the ISS LP
1839+
this->iis_.getLp(this->model_.lp_);
1840+
// Check that the IIS LP data are OK (correspond to original model
1841+
// reduced to IIS col/row and bound data).
1842+
if (!this->iis_.lpDataOk(this->model_.lp_, this->options_))
1843+
return HighsStatus::kError;
1844+
// Check that the IIS LP is OK (infeasible and optimal/unbounded
1845+
// is any bound is relaxed)
1846+
if (!this->iis_.lpOk(this->options_)) return HighsStatus::kError;
1847+
// Construct the ISS status vectors for cols and rows of original
1848+
// model
1849+
this->iis_.getStatus(model_.lp_);
1850+
} else {
1851+
// No IIS, so check that the IIS LP is empty
1852+
assert(this->iis_.model_.lp_.num_col_ == 0);
1853+
assert(this->iis_.model_.lp_.num_row_ == 0);
1854+
}
18431855
}
18441856
return return_status;
18451857
}

0 commit comments

Comments
 (0)