| 1185 | } |
| 1186 | |
| 1187 | void Highs::setNonbasicStatusInterface( |
| 1188 | const HighsIndexCollection& index_collection, const bool columns) { |
| 1189 | HighsBasis& highs_basis = basis_; |
| 1190 | if (!highs_basis.valid) return; |
| 1191 | const bool has_simplex_basis = ekk_instance_.status_.has_basis; |
| 1192 | SimplexBasis& simplex_basis = ekk_instance_.basis_; |
| 1193 | HighsLp& lp = model_.lp_; |
| 1194 | |
| 1195 | assert(ok(index_collection)); |
| 1196 | HighsInt from_k; |
| 1197 | HighsInt to_k; |
| 1198 | limits(index_collection, from_k, to_k); |
| 1199 | HighsInt ix_dim; |
| 1200 | if (columns) { |
| 1201 | ix_dim = lp.num_col_; |
| 1202 | } else { |
| 1203 | ix_dim = lp.num_row_; |
| 1204 | } |
| 1205 | // Surely this is checked elsewhere |
| 1206 | assert(0 <= from_k && to_k < ix_dim); |
| 1207 | assert(from_k <= to_k); |
| 1208 | HighsInt set_from_ix; |
| 1209 | HighsInt set_to_ix; |
| 1210 | HighsInt ignore_from_ix; |
| 1211 | HighsInt ignore_to_ix = -1; |
| 1212 | HighsInt current_set_entry = 0; |
| 1213 | // Given a basic-nonbasic partition, all status settings are defined |
| 1214 | // by the bounds unless boxed, in which case any definitive (ie not |
| 1215 | // just kNonbasic) existing status is retained. Otherwise, set to |
| 1216 | // bound nearer to zero |
| 1217 | for (HighsInt k = from_k; k <= to_k; k++) { |
| 1218 | updateOutInIndex(index_collection, set_from_ix, set_to_ix, ignore_from_ix, |
| 1219 | ignore_to_ix, current_set_entry); |
| 1220 | assert(set_to_ix < ix_dim); |
| 1221 | assert(ignore_to_ix < ix_dim); |
| 1222 | if (columns) { |
| 1223 | for (HighsInt iCol = set_from_ix; iCol <= set_to_ix; iCol++) { |
| 1224 | if (highs_basis.col_status[iCol] == HighsBasisStatus::kBasic) continue; |
| 1225 | // Nonbasic column |
| 1226 | double lower = lp.col_lower_[iCol]; |
| 1227 | double upper = lp.col_upper_[iCol]; |
| 1228 | HighsBasisStatus status = highs_basis.col_status[iCol]; |
| 1229 | int8_t move = kIllegalMoveValue; |
| 1230 | if (lower == upper) { |
| 1231 | if (status == HighsBasisStatus::kNonbasic) |
| 1232 | status = HighsBasisStatus::kLower; |
| 1233 | move = kNonbasicMoveZe; |
| 1234 | } else if (!highs_isInfinity(-lower)) { |
| 1235 | // Finite lower bound so boxed or lower |
| 1236 | if (!highs_isInfinity(upper)) { |
| 1237 | // Finite upper bound so boxed |
| 1238 | if (status == HighsBasisStatus::kNonbasic) { |
| 1239 | // No definitive status, so set to bound nearer to zero |
| 1240 | if (fabs(lower) < fabs(upper)) { |
| 1241 | status = HighsBasisStatus::kLower; |
| 1242 | move = kNonbasicMoveUp; |
| 1243 | } else { |
| 1244 | status = HighsBasisStatus::kUpper; |
nothing calls this directly
no test coverage detected