Skip to content

Commit 4c52811

Browse files
committed
Simplify
1 parent 9988e99 commit 4c52811

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

highs/presolve/HPresolve.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3996,12 +3996,12 @@ HPresolve::Result HPresolve::rowPresolve(HighsPostsolveStack& postsolve_stack,
39963996
};
39973997

39983998
// try different scalars and return an improving one
3999-
auto scalarToTightenRow = [&](const HighsCDouble& rhs,
4000-
HighsCDouble& roundedRhs) {
3999+
auto rowCanBeTightened = [&](const HighsCDouble& rhs,
4000+
HighsCDouble& roundedRhs) {
40014001
for (double s : scalars) {
4002-
if (roundRow(s, rhs, roundedRhs)) return s;
4002+
if (roundRow(s, rhs, roundedRhs)) return true;
40034003
}
4004-
return 0.0;
4004+
return false;
40054005
};
40064006

40074007
// replace the model row by the rounded one
@@ -4036,8 +4036,7 @@ HPresolve::Result HPresolve::rowPresolve(HighsPostsolveStack& postsolve_stack,
40364036
// identify scalars for row
40374037
setScalars(minAbsCoef, maxAbsCoef);
40384038
// find a scalar that produces improved coefficients
4039-
double s = scalarToTightenRow(rhs, roundedRhs);
4040-
if (s != 0.0) {
4039+
if (rowCanBeTightened(rhs, roundedRhs)) {
40414040
// undo complementation and shifting
40424041
undoComplementOrShift(direction, roundedRhs);
40434042
// replace row by rounded one

0 commit comments

Comments
 (0)