Skip to content

Commit 981a2de

Browse files
committed
WIP
1 parent 1580f3e commit 981a2de

File tree

1 file changed

+35
-20
lines changed

1 file changed

+35
-20
lines changed

highs/presolve/HPresolve.cpp

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,11 @@ HPresolve::Result HPresolve::dominatedColumns(
11571157

11581158
// count number of fixed columns and modified bounds
11591159
HighsInt numFixedCols = 0;
1160-
HighsInt numModifiedBounds = 0;
1160+
HighsInt numFixedColsPredBndAnalysis = 0;
1161+
HighsInt numModifiedBoundsPredBndAnalysis = 0;
1162+
1163+
// perform predictive bound analysis?
1164+
bool allowPredBndAnalysis = false;
11611165

11621166
for (HighsInt j = 0; j < model->num_col_; ++j) {
11631167
// skip deleted columns
@@ -1254,20 +1258,22 @@ HPresolve::Result HPresolve::dominatedColumns(
12541258
if (lowerBound > model->col_lower_[col] + primal_feastol) {
12551259
if (model->integrality_[col] != HighsVarType::kContinuous)
12561260
lowerBound = std::ceil(lowerBound - primal_feastol);
1257-
if (lowerBound == model->col_upper_[col])
1261+
if (lowerBound == model->col_upper_[col]) {
1262+
numFixedColsPredBndAnalysis++;
12581263
HPRESOLVE_CHECKED_CALL(fixCol(col, HighsInt{1}));
1259-
else if (model->integrality_[col] != HighsVarType::kContinuous) {
1260-
numModifiedBounds++;
1264+
} else if (model->integrality_[col] != HighsVarType::kContinuous) {
1265+
numModifiedBoundsPredBndAnalysis++;
12611266
changeColLower(col, lowerBound);
12621267
}
12631268
}
12641269
if (upperBound < model->col_upper_[col] - primal_feastol) {
12651270
if (model->integrality_[col] != HighsVarType::kContinuous)
12661271
upperBound = std::floor(upperBound + primal_feastol);
1267-
if (upperBound == model->col_lower_[col])
1272+
if (upperBound == model->col_lower_[col]) {
1273+
numFixedColsPredBndAnalysis++;
12681274
HPRESOLVE_CHECKED_CALL(fixCol(col, HighsInt{-1}));
1269-
else if (model->integrality_[col] != HighsVarType::kContinuous) {
1270-
numModifiedBounds++;
1275+
} else if (model->integrality_[col] != HighsVarType::kContinuous) {
1276+
numModifiedBoundsPredBndAnalysis++;
12711277
changeColUpper(col, upperBound);
12721278
}
12731279
}
@@ -1346,6 +1352,7 @@ HPresolve::Result HPresolve::dominatedColumns(
13461352
auto checkRow = [&](HighsInt row, HighsInt col, HighsInt direction,
13471353
double bestVal, bool boundImplied, bool hasCliques) {
13481354
storeRow(row);
1355+
bool onlyPredBndAnalysis = !boundImplied && !hasCliques;
13491356
for (const HighsSliceNonzero& nonz : getStoredRow()) {
13501357
// get column index
13511358
HighsInt k = nonz.index();
@@ -1360,7 +1367,7 @@ HPresolve::Result HPresolve::dominatedColumns(
13601367
bool sameVarType = varsHaveSameType(col, k);
13611368

13621369
// skip checks if nothing to do
1363-
if (!boundImplied && !hasCliques && !sameVarType) continue;
1370+
if (onlyPredBndAnalysis && !sameVarType) continue;
13641371

13651372
// try to fix variables or strengthen bounds
13661373
// check already known non-zeros in respective columns in advance to
@@ -1383,26 +1390,34 @@ HPresolve::Result HPresolve::dominatedColumns(
13831390
return Result::kOk;
13841391
};
13851392

1393+
// check if bounds are implied or there are cliques
1394+
bool lowerImplied = isLowerImplied(j);
1395+
bool upperImplied = isUpperImplied(j);
1396+
bool hasNegCliques =
1397+
isBinary(j) && mipsolver->mipdata_->cliquetable.numCliques(j, 0) > 0;
1398+
bool hasPosCliques =
1399+
isBinary(j) && mipsolver->mipdata_->cliquetable.numCliques(j, 1) > 0;
1400+
13861401
// use row 'bestRowMinus'
1387-
if (bestRowMinus != -1)
1388-
HPRESOLVE_CHECKED_CALL(checkRow(
1389-
bestRowMinus, j, HighsInt{-1}, ajBestRowMinus, isLowerImplied(j),
1390-
isBinary(j) &&
1391-
mipsolver->mipdata_->cliquetable.numCliques(j, 0) > 0));
1402+
if (bestRowMinus != -1 &&
1403+
(allowPredBndAnalysis || lowerImplied || hasNegCliques))
1404+
HPRESOLVE_CHECKED_CALL(checkRow(bestRowMinus, j, HighsInt{-1},
1405+
ajBestRowMinus, lowerImplied,
1406+
hasNegCliques));
13921407

13931408
// use row 'bestRowPlus'
1394-
if (!colDeleted[j] && bestRowPlus != -1)
1395-
HPRESOLVE_CHECKED_CALL(checkRow(
1396-
bestRowPlus, j, HighsInt{1}, ajBestRowPlus, isUpperImplied(j),
1397-
isBinary(j) &&
1398-
mipsolver->mipdata_->cliquetable.numCliques(j, 1) > 0));
1409+
if (!colDeleted[j] && bestRowPlus != -1 &&
1410+
(allowPredBndAnalysis || upperImplied || hasPosCliques))
1411+
HPRESOLVE_CHECKED_CALL(checkRow(bestRowPlus, j, HighsInt{1},
1412+
ajBestRowPlus, upperImplied,
1413+
hasPosCliques));
13991414
}
14001415

1401-
if (numFixedCols > 0 || numModifiedBounds > 0)
1416+
if (numFixedCols > 0 || numModifiedBoundsPredBndAnalysis > 0)
14021417
highsLogDev(options->log_options, HighsLogType::kInfo,
14031418
"Fixed %d dominated columns and strengthened %d bounds\n",
14041419
static_cast<int>(numFixedCols),
1405-
static_cast<int>(numModifiedBounds));
1420+
static_cast<int>(numModifiedBoundsPredBndAnalysis));
14061421

14071422
return Result::kOk;
14081423
}

0 commit comments

Comments
 (0)