Skip to content

Commit cb85ccc

Browse files
committed
Add HPresolve::isRanged
1 parent a1402df commit cb85ccc

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

highs/presolve/HPresolve.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,11 @@ bool HPresolve::isEquation(HighsInt row) const {
238238
return (model->row_lower_[row] == model->row_upper_[row]);
239239
}
240240

241+
bool HPresolve::isRanged(HighsInt row) const {
242+
return (model->row_lower_[row] != -kHighsInf &&
243+
model->row_upper_[row] != kHighsInf);
244+
}
245+
241246
bool HPresolve::isImpliedEquationAtLower(HighsInt row) const {
242247
// if the implied lower bound on a row dual is strictly positive then the row
243248
// is an implied equation (using its lower bound) due to complementary
@@ -3899,8 +3904,7 @@ HPresolve::Result HPresolve::rowPresolve(HighsPostsolveStack& postsolve_stack,
38993904
}
39003905
}
39013906
}
3902-
} else if (model->row_lower_[row] == -kHighsInf ||
3903-
model->row_upper_[row] == kHighsInf) {
3907+
} else if (!isRanged(row)) {
39043908
// Chvatal-Gomory strengthening
39053909
// See section 3.4 "Chvatal-Gomory strengthening of inequalities",
39063910
// Achterberg et al., Presolve Reductions in Mixed Integer
@@ -4321,9 +4325,7 @@ HPresolve::Result HPresolve::colPresolve(HighsPostsolveStack& postsolve_stack,
43214325
HighsInt direction,
43224326
bool isBoundImplied, HighsInt numInf) {
43234327
if (isBoundImplied && row != -1 && numInf == 1 &&
4324-
direction * model->col_cost_[col] >= 0 &&
4325-
(model->row_lower_[row] == -kHighsInf ||
4326-
model->row_upper_[row] == kHighsInf)) {
4328+
direction * model->col_cost_[col] >= 0 && !isRanged(row)) {
43274329
HighsInt nzPos = findNonzero(row, col);
43284330

43294331
if (model->integrality_[col] != HighsVarType::kInteger ||
@@ -5700,9 +5702,7 @@ HPresolve::Result HPresolve::strengthenInequalities(
57005702

57015703
for (HighsInt row = 0; row != model->num_row_; ++row) {
57025704
if (rowsize[row] <= 1) continue;
5703-
if (model->row_lower_[row] != -kHighsInf &&
5704-
model->row_upper_[row] != kHighsInf)
5705-
continue;
5705+
if (isRanged(row)) continue;
57065706

57075707
// do not run on very dense rows as this could get expensive
57085708
HighsInt rowsize_limit =

highs/presolve/HPresolve.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ class HPresolve {
209209

210210
bool isEquation(HighsInt row) const;
211211

212+
bool isRanged(HighsInt row) const;
213+
212214
bool isImpliedEquationAtLower(HighsInt row) const;
213215

214216
bool isImpliedEquationAtUpper(HighsInt row) const;

0 commit comments

Comments
 (0)