Skip to content

Commit 57214c9

Browse files
committed
Minor changes
1 parent b465d7d commit 57214c9

File tree

1 file changed

+64
-67
lines changed

1 file changed

+64
-67
lines changed

src/presolve/HPresolve.cpp

Lines changed: 64 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,77 +1456,75 @@ HPresolve::Result HPresolve::runProbing(HighsPostsolveStack& postsolve_stack) {
14561456
for (const auto& binvar : binaries) {
14571457
HighsInt i = std::get<3>(binvar);
14581458

1459-
if (cliquetable.getSubstitution(i) != nullptr) continue;
1460-
1461-
if (domain.isBinary(i)) {
1462-
// when a large percentage of columns have been deleted, stop this round
1463-
// of probing
1464-
// if (numDel > std::max(model->num_col_ * 0.2, 1000.)) break;
1465-
if (numDel >
1466-
std::max(1000., (model->num_row_ + model->num_col_) * 0.05)) {
1467-
probingEarlyAbort = true;
1468-
break;
1469-
}
1459+
if (cliquetable.getSubstitution(i) != nullptr || !domain.isBinary(i))
1460+
continue;
14701461

1471-
// break in case of too many new implications to not spent ages in
1472-
// probing
1473-
if (cliquetable.isFull() ||
1474-
cliquetable.numCliques() - numCliquesStart >
1475-
std::max(HighsInt{1000000}, 2 * numNonzeros()) ||
1476-
implications.getNumImplications() - numImplicsStart >
1477-
std::max(HighsInt{1000000}, 2 * numNonzeros()))
1478-
break;
1462+
// when a large percentage of columns have been deleted, stop this round
1463+
// of probing
1464+
// if (numDel > std::max(model->num_col_ * 0.2, 1000.)) break;
1465+
probingEarlyAbort =
1466+
numDel >
1467+
std::max(HighsInt{1000}, (model->num_row_ + model->num_col_) / 20);
1468+
if (probingEarlyAbort) break;
1469+
1470+
// break in case of too many new implications to not spent ages in
1471+
// probing
1472+
if (cliquetable.isFull() ||
1473+
cliquetable.numCliques() - numCliquesStart >
1474+
std::max(HighsInt{1000000}, 2 * numNonzeros()) ||
1475+
implications.getNumImplications() - numImplicsStart >
1476+
std::max(HighsInt{1000000}, 2 * numNonzeros()))
1477+
break;
14791478

1480-
// if (numProbed % 10 == 0)
1481-
// printf(
1482-
// "numprobed=%d numDel=%d newcliques=%d "
1483-
// "numNeighbourhoodQueries=%ld "
1484-
// "splayContingent=%ld\n",
1485-
// numProbed, numDel, cliquetable.numCliques() - numCliquesStart,
1486-
// cliquetable.numNeighbourhoodQueries, splayContingent);
1487-
if (cliquetable.numNeighbourhoodQueries > splayContingent) break;
1488-
1489-
if (probingContingent - numProbed < 0) break;
1490-
1491-
HighsInt numBoundChgs = 0;
1492-
HighsInt numNewCliques = -cliquetable.numCliques();
1493-
if (!implications.runProbing(i, numBoundChgs)) continue;
1494-
probingContingent += numBoundChgs;
1495-
numNewCliques += cliquetable.numCliques();
1496-
numNewCliques = std::max(numNewCliques, HighsInt{0});
1497-
while (domain.getChangedCols().size() != numChangedCols) {
1498-
if (domain.isFixed(domain.getChangedCols()[numChangedCols++]))
1499-
++probingNumDelCol;
1500-
}
1501-
HighsInt newNumDel = probingNumDelCol - numDelStart +
1502-
implications.substitutions.size() +
1503-
cliquetable.getSubstitutions().size();
1504-
1505-
if (newNumDel > numDel) {
1506-
probingContingent += numDel;
1507-
if (!mipsolver->submip) {
1508-
splayContingent += 100 * (newNumDel + numDelStart);
1509-
splayContingent += 1000 * numNewCliques;
1510-
}
1511-
numDel = newNumDel;
1512-
numFail = 0;
1513-
} else if (mipsolver->submip || numNewCliques == 0) {
1514-
splayContingent -= 100 * numFail;
1515-
++numFail;
1516-
} else {
1479+
// if (numProbed % 10 == 0)
1480+
// printf(
1481+
// "numprobed=%d numDel=%d newcliques=%d "
1482+
// "numNeighbourhoodQueries=%ld "
1483+
// "splayContingent=%ld\n",
1484+
// numProbed, numDel, cliquetable.numCliques() - numCliquesStart,
1485+
// cliquetable.numNeighbourhoodQueries, splayContingent);
1486+
if (cliquetable.numNeighbourhoodQueries > splayContingent) break;
1487+
1488+
if (probingContingent - numProbed < 0) break;
1489+
1490+
HighsInt numBoundChgs = 0;
1491+
HighsInt numNewCliques = -cliquetable.numCliques();
1492+
if (!implications.runProbing(i, numBoundChgs)) continue;
1493+
probingContingent += numBoundChgs;
1494+
numNewCliques += cliquetable.numCliques();
1495+
numNewCliques = std::max(numNewCliques, HighsInt{0});
1496+
while (domain.getChangedCols().size() != numChangedCols) {
1497+
if (domain.isFixed(domain.getChangedCols()[numChangedCols++]))
1498+
++probingNumDelCol;
1499+
}
1500+
HighsInt newNumDel = probingNumDelCol - numDelStart +
1501+
implications.substitutions.size() +
1502+
cliquetable.getSubstitutions().size();
1503+
1504+
if (newNumDel > numDel) {
1505+
probingContingent += numDel;
1506+
if (!mipsolver->submip) {
1507+
splayContingent += 100 * (newNumDel + numDelStart);
15171508
splayContingent += 1000 * numNewCliques;
1518-
numFail = 0;
15191509
}
1510+
numDel = newNumDel;
1511+
numFail = 0;
1512+
} else if (mipsolver->submip || numNewCliques == 0) {
1513+
splayContingent -= 100 * numFail;
1514+
++numFail;
1515+
} else {
1516+
splayContingent += 1000 * numNewCliques;
1517+
numFail = 0;
1518+
}
15201519

1521-
++numProbed;
1522-
numProbes[i] += 1;
1520+
++numProbed;
1521+
numProbes[i] += 1;
15231522

1524-
// printf("nprobed: %" HIGHSINT_FORMAT ", numCliques: %" HIGHSINT_FORMAT
1525-
// "\n", nprobed,
1526-
// cliquetable.numCliques());
1527-
if (domain.infeasible()) {
1528-
return Result::kPrimalInfeasible;
1529-
}
1523+
// printf("nprobed: %" HIGHSINT_FORMAT ", numCliques: %" HIGHSINT_FORMAT
1524+
// "\n", nprobed,
1525+
// cliquetable.numCliques());
1526+
if (domain.infeasible()) {
1527+
return Result::kPrimalInfeasible;
15301528
}
15311529
}
15321530

@@ -5195,8 +5193,7 @@ HighsInt HPresolve::strengthenInequalities() {
51955193

51965194
// do not run on very dense rows as this could get expensive
51975195
if (rowsize[row] >
5198-
std::max(HighsInt{1000},
5199-
HighsInt(0.05 * (model->num_col_ - numDeletedCols))))
5196+
std::max(HighsInt{1000}, (model->num_col_ - numDeletedCols) / 20))
52005197
continue;
52015198

52025199
// printf("strengthening knapsack of %" HIGHSINT_FORMAT " vars\n",

0 commit comments

Comments
 (0)