Observation: In a purely continuous model, a call to getColIntegrality results in an error message: ERROR: Model integrality does not exist for index 0 as well as HighsStatus::kError.
Expectation: Even though no integrality was ever set, I'd simply expect a result of HighsVarType::kContinuous and no error.
Motivation: In some situations, a MIP model is built, but then some variables are relaxed. This way, we can end up with a problem where all variables are continuous. This need not result in an error for otherwise reasonable queries.
Some explanation: When the integrality_ vector is empty, any call to getColIntegrality (with valid column index) will fail. See:
|
HighsStatus Highs::getColIntegrality(const HighsInt col, |
|
HighsVarType& integrality) const { |
|
const HighsInt num_col = this->model_.lp_.num_col_; |
|
if (col < 0 || col >= num_col) { |
|
highsLogUser(options_.log_options, HighsLogType::kError, |
|
"Index %d for column integrality is outside the range [0, " |
|
"num_col = %d)\n", |
|
int(col), int(num_col)); |
|
return HighsStatus::kError; |
|
} |
|
if (static_cast<size_t>(col) < this->model_.lp_.integrality_.size()) { |
|
integrality = this->model_.lp_.integrality_[col]; |
|
return HighsStatus::kOk; |
|
} else { |
|
highsLogUser(options_.log_options, HighsLogType::kError, |
|
"Model integrality does not exist for index %d\n", int(col)); |
|
return HighsStatus::kError; |
The integrality_ vector is initially empty, and only filled when the user calls changeColIntegrality the first time. Further, the integrality_ vector may also be cleared (to save memory?) after all variables are changed back to continuous, see:
|
// If integrality_ contains only HighsVarType::kContinuous then |
|
// clear it |
|
if (!lp.isMip()) lp.integrality_.clear(); |
Observation: In a purely continuous model, a call to
getColIntegralityresults in an error message:ERROR: Model integrality does not exist for index 0as well asHighsStatus::kError.Expectation: Even though no integrality was ever set, I'd simply expect a result of
HighsVarType::kContinuousand no error.Motivation: In some situations, a MIP model is built, but then some variables are relaxed. This way, we can end up with a problem where all variables are continuous. This need not result in an error for otherwise reasonable queries.
Some explanation: When the
integrality_vector is empty, any call togetColIntegrality(with valid column index) will fail. See:HiGHS/src/lp_data/Highs.cpp
Lines 2980 to 2996 in fd86653
The
integrality_vector is initially empty, and only filled when the user callschangeColIntegralitythe first time. Further, theintegrality_vector may also be cleared (to save memory?) after all variables are changed back to continuous, see:HiGHS/src/lp_data/HighsLpUtils.cpp
Lines 1622 to 1624 in fd86653