Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions highs/presolve/HPresolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1545,12 +1545,20 @@ HPresolve::Result HPresolve::runProbing(HighsPostsolveStack& postsolve_stack) {
if (cliquetable.getSubstitution(i) != nullptr || !domain.isBinary(i))
continue;

bool tightenLimits = (numProbed - oldNumProbed) >= 2500;

// when a large percentage of columns have been deleted, stop this round
// of probing
// if (numDel > std::max(model->num_col_ * 0.2, 1000.)) break;
probingEarlyAbort =
numDel >
std::max(HighsInt{1000}, (model->num_row_ + model->num_col_) / 20);
if (!tightenLimits) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a question of taste, but if you would want to avoid the if-else, you could have the following here:

     bool tightenLimits = (numProbed - oldNumProbed) >= 2500;
     HighsInt multiplier = tightenLimits ? -1 : 1;
     // when a large percentage of columns have been deleted, stop this round
     // of probing
     // if (numDel > std::max(model->num_col_ * 0.2, 1000.)) break;
     probingEarlyAbort =
         numDel >
         multiplier *
             std::max(multiplier * HighsInt{1000},
                      multiplier * (model->num_row_ + model->num_col_) / 20);
     if (probingEarlyAbort) break;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for missing this comment! I'm happy with if-else logic. I find it easier to read than the double multiplier.

probingEarlyAbort =
numDel >
std::max(HighsInt{1000}, (model->num_row_ + model->num_col_) / 20);
} else {
probingEarlyAbort =
numDel >
std::min(HighsInt{1000}, (model->num_row_ + model->num_col_) / 20);
}
if (probingEarlyAbort) break;

// break in case of too many new implications to not spent ages in
Expand Down Expand Up @@ -1597,7 +1605,7 @@ HPresolve::Result HPresolve::runProbing(HighsPostsolveStack& postsolve_stack) {
numDel = newNumDel;
numFail = 0;
} else if (mipsolver->submip || numNewCliques == 0) {
splayContingent -= 100 * numFail;
splayContingent -= (tightenLimits ? 250 : 100) * numFail;
++numFail;
} else {
splayContingent += 1000 * numNewCliques;
Expand Down
Loading