Skip to content

Commit ded7602

Browse files
committed
Only search for lifting opportunities of there are continuous variables
1 parent bdeaf1d commit ded7602

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

src/presolve/HPresolve.cpp

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,13 +1500,29 @@ HPresolve::Result HPresolve::runProbing(HighsPostsolveStack& postsolve_stack) {
15001500
10 * numNonzeros());
15011501
HighsInt numFail = 0;
15021502

1503-
// Collect up to 10 lifting opportunities per row
1503+
// lambda to check if model has enough continuous variables to perform
1504+
// lifting for probing
1505+
auto modelHasPercentageContVars = [&](size_t percentage) {
1506+
size_t num_cols = 0, num_cont_cols = 0;
1507+
for (size_t col = 0; col < colsize.size(); col++) {
1508+
if (colDeleted[col]) continue;
1509+
num_cols++;
1510+
if (model->integrality_[col] == HighsVarType::kContinuous)
1511+
num_cont_cols++;
1512+
}
1513+
return size_t{100} * num_cont_cols >= percentage * num_cols;
1514+
};
1515+
1516+
// collect up to 10 lifting opportunities per row
15041517
const size_t maxNumLiftOpps = std::max(
15051518
size_t{100000}, size_t{10} * static_cast<size_t>(model->num_row_));
15061519

1507-
// store lifting opportunities
1520+
// only search for lifting opportunities if at least 2 percent of the
1521+
// variables in the problem are continuous
15081522
size_t numLiftOpps = 0;
1509-
if (mipsolver->options_mip_->mip_lifting_for_probing) {
1523+
if (mipsolver->options_mip_->mip_lifting_for_probing &&
1524+
modelHasPercentageContVars(size_t{2})) {
1525+
// store lifting opportunities
15101526
implications.storeLiftingOpportunity = [&](HighsInt row, HighsInt col,
15111527
double val) {
15121528
// find lifting opportunities for row
@@ -1655,25 +1671,10 @@ HPresolve::Result HPresolve::runProbing(HighsPostsolveStack& postsolve_stack) {
16551671
// finally apply substitutions
16561672
HPRESOLVE_CHECKED_CALL(applyConflictGraphSubstitutions(postsolve_stack));
16571673

1658-
// lambda to check if model has enough continuous variables to perform
1659-
// lifting for probing
1660-
auto modelHasPercentageContVars = [&](size_t percentage) {
1661-
size_t num_cols = 0, num_cont_cols = 0;
1662-
for (size_t col = 0; col < colsize.size(); col++) {
1663-
if (colDeleted[col]) continue;
1664-
num_cols++;
1665-
if (model->integrality_[col] == HighsVarType::kContinuous)
1666-
num_cont_cols++;
1667-
}
1668-
return size_t{100} * num_cont_cols >= percentage * num_cols;
1669-
};
1670-
16711674
// lifting for probing (only performed when probing did not modify the
1672-
// problem so far and at least 2 percent of the variables in the problem are
1673-
// continuous)
1675+
// problem so far)
16741676
if (mipsolver->options_mip_->mip_lifting_for_probing) {
1675-
if (numDeletedRows == 0 && numDeletedCols == 0 && addednnz == 0 &&
1676-
modelHasPercentageContVars(size_t{2})) {
1677+
if (numDeletedRows == 0 && numDeletedCols == 0 && addednnz == 0) {
16771678
// apply lifting
16781679
liftingForProbing();
16791680
}

0 commit comments

Comments
 (0)