Skip to content

Commit ca7294a

Browse files
committed
Tidy up HPresolve::dominatedColumns
1 parent aefaca0 commit ca7294a

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

highs/presolve/HPresolve.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,12 +1328,8 @@ HPresolve::Result HPresolve::dominatedColumns(
13281328
if (!tryToFix) numDomChecksPredBndAnalysis++;
13291329
// check for domination
13301330
if (checkDomination(direction, col, direction_k, k)) {
1331-
// Re-check the implied bound condition since earlier fixings in
1332-
// this dominatedColumns call may have changed the model state
1333-
bool currentBoundImplied =
1334-
direction > 0 ? isUpperImplied(col) : isLowerImplied(col);
13351331
if (tryToFix &&
1336-
(currentBoundImplied ||
1332+
(boundImplied ||
13371333
mipsolver->mipdata_->cliquetable.haveCommonClique(
13381334
HighsCliqueTable::CliqueVar(col, direction > 0 ? 1 : 0),
13391335
HighsCliqueTable::CliqueVar(k, direction_k > 0 ? 1 : 0)))) {
@@ -1365,9 +1361,8 @@ HPresolve::Result HPresolve::dominatedColumns(
13651361

13661362
// lambda for finding a domination relationship in the given row
13671363
auto checkRow = [&](HighsInt row, HighsInt col, HighsInt direction,
1368-
double bestVal, bool boundImplied, bool hasCliques) {
1364+
double bestVal, bool hasCliques) {
13691365
storeRow(row);
1370-
bool onlyPredBndAnalysis = !boundImplied && !hasCliques;
13711366
for (const HighsSliceNonzero& nonz : getStoredRow()) {
13721367
// get column index
13731368
HighsInt k = nonz.index();
@@ -1381,8 +1376,12 @@ HPresolve::Result HPresolve::dominatedColumns(
13811376
// check if variables have the same type
13821377
bool sameVarType = varsHaveSameType(col, k);
13831378

1379+
// check if bound is implied (computed fresh due to earlier fixings)
1380+
bool boundImplied =
1381+
direction > 0 ? isUpperImplied(col) : isLowerImplied(col);
1382+
13841383
// skip checks if nothing to do
1385-
if (onlyPredBndAnalysis && !sameVarType) continue;
1384+
if (!boundImplied && !hasCliques && !sameVarType) continue;
13861385

13871386
// try to fix variables or strengthen bounds
13881387
// check already known non-zeros in respective columns in advance to
@@ -1417,15 +1416,13 @@ HPresolve::Result HPresolve::dominatedColumns(
14171416
if (bestRowMinus != -1 &&
14181417
(allowPredBndAnalysis || lowerImplied || hasNegCliques))
14191418
HPRESOLVE_CHECKED_CALL(checkRow(bestRowMinus, j, HighsInt{-1},
1420-
ajBestRowMinus, lowerImplied,
1421-
hasNegCliques));
1419+
ajBestRowMinus, hasNegCliques));
14221420

14231421
// use row 'bestRowPlus'
14241422
if (!colDeleted[j] && bestRowPlus != -1 &&
14251423
(allowPredBndAnalysis || upperImplied || hasPosCliques))
1426-
HPRESOLVE_CHECKED_CALL(checkRow(bestRowPlus, j, HighsInt{1},
1427-
ajBestRowPlus, upperImplied,
1428-
hasPosCliques));
1424+
HPRESOLVE_CHECKED_CALL(
1425+
checkRow(bestRowPlus, j, HighsInt{1}, ajBestRowPlus, hasPosCliques));
14291426

14301427
// do not use predictive bound analysis if it requires many domination
14311428
// checks and only yields few fixings or improved bounds on average

0 commit comments

Comments
 (0)