Skip to content

Commit f8e9290

Browse files
committed
Add option
1 parent 21c4eac commit f8e9290

File tree

4 files changed

+36
-26
lines changed

4 files changed

+36
-26
lines changed

src/lp_data/HighsOptions.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ struct HighsOptionsStruct {
439439
bool mip_improving_solution_report_sparse;
440440
std::string mip_improving_solution_file;
441441
bool mip_root_presolve_only;
442+
bool mip_lifting_for_probing;
442443

443444
// Logging callback identifiers
444445
HighsLogOptions log_options;
@@ -576,7 +577,8 @@ struct HighsOptionsStruct {
576577
mip_improving_solution_report_sparse(false),
577578
// clang-format off
578579
mip_improving_solution_file(""),
579-
mip_root_presolve_only(false) {};
580+
mip_root_presolve_only(false),
581+
mip_lifting_for_probing(false) {};
580582
// clang-format on
581583
};
582584

@@ -1013,6 +1015,11 @@ class HighsOptions : public HighsOptionsStruct {
10131015
&mip_root_presolve_only, false);
10141016
records.push_back(record_bool);
10151017

1018+
record_bool = new OptionRecordBool(
1019+
"mip_lifting_for_probing", "Whether lifting for probing is used",
1020+
advanced, &mip_lifting_for_probing, false);
1021+
records.push_back(record_bool);
1022+
10161023
record_int = new OptionRecordInt(
10171024
"mip_max_leaves", "MIP solver max number of leaf nodes", advanced,
10181025
&mip_max_leaves, 0, kHighsIInf, kHighsIInf);

src/mip/HighsDomain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@ const HighsHashTable<HighsInt>& HighsDomain::getRedundantRows() {
18601860
return redundant_rows_;
18611861
}
18621862

1863-
double HighsDomain::getRedundantRowValue(HighsInt row) {
1863+
double HighsDomain::getRedundantRowValue(HighsInt row) const {
18641864
if (mipsolver->model_->row_lower_[row] != -kHighsInf) {
18651865
assert(mipsolver->model_->row_upper_[row] == kHighsInf);
18661866
return static_cast<double>(activitymin_[row] -

src/mip/HighsDomain.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ class HighsDomain {
642642

643643
const HighsHashTable<HighsInt>& getRedundantRows();
644644

645-
double getRedundantRowValue(HighsInt row);
645+
double getRedundantRowValue(HighsInt row) const;
646646
};
647647

648648
#endif

src/presolve/HPresolve.cpp

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,24 +1501,26 @@ HPresolve::Result HPresolve::runProbing(HighsPostsolveStack& postsolve_stack) {
15011501
HighsInt numFail = 0;
15021502

15031503
// Collect up to 10 lifting opportunities per row
1504-
size_t maxNumLiftOpps = std::max(
1504+
const size_t maxNumLiftOpps = std::max(
15051505
size_t{100000}, size_t{10} * static_cast<size_t>(model->num_row_));
15061506

15071507
// store lifting opportunities
15081508
size_t numLiftOpps = 0;
1509-
implications.storeLiftingOpportunity = [&](HighsInt row, HighsInt col,
1510-
double val) {
1511-
// find lifting opportunities for row
1512-
auto& htree = liftingOpportunities[row];
1513-
// add element
1514-
auto insertresult = htree.insert_or_get(col, val);
1515-
if (insertresult.second) {
1516-
numLiftOpps++;
1517-
} else {
1518-
double& currentval = *insertresult.first;
1519-
currentval = val;
1520-
}
1521-
};
1509+
if (mipsolver->options_mip_->mip_lifting_for_probing) {
1510+
implications.storeLiftingOpportunity = [&](HighsInt row, HighsInt col,
1511+
double val) {
1512+
// find lifting opportunities for row
1513+
auto& htree = liftingOpportunities[row];
1514+
// add element
1515+
auto insertresult = htree.insert_or_get(col, val);
1516+
if (insertresult.second) {
1517+
numLiftOpps++;
1518+
} else {
1519+
double& currentval = *insertresult.first;
1520+
currentval = val;
1521+
}
1522+
};
1523+
}
15221524

15231525
for (const auto& binvar : binaries) {
15241526
HighsInt i = std::get<3>(binvar);
@@ -1669,12 +1671,15 @@ HPresolve::Result HPresolve::runProbing(HighsPostsolveStack& postsolve_stack) {
16691671
// lifting for probing (only performed when probing did not modify the
16701672
// problem so far and at least 2 percent of the variables in the problem are
16711673
// continuous)
1672-
if (numDeletedRows == 0 && numDeletedCols == 0 && addednnz == 0 &&
1673-
modelHasPercentageContVars(size_t{2}))
1674+
if (mipsolver->options_mip_->mip_lifting_for_probing &&
1675+
numDeletedRows == 0 && numDeletedCols == 0 && addednnz == 0 &&
1676+
modelHasPercentageContVars(size_t{2})) {
1677+
// apply lifting
16741678
liftingForProbing();
1675-
// clear lifting opportunities
1676-
liftingOpportunities.clear();
1677-
implications.storeLiftingOpportunity = nullptr;
1679+
// clear lifting opportunities
1680+
liftingOpportunities.clear();
1681+
implications.storeLiftingOpportunity = nullptr;
1682+
}
16781683

16791684
highsLogDev(options->log_options, HighsLogType::kInfo,
16801685
"%" HIGHSINT_FORMAT " probing evaluations: %" HIGHSINT_FORMAT
@@ -1815,10 +1820,8 @@ void HPresolve::liftingForProbing() {
18151820

18161821
// perform actual lifting
18171822
size_t nfill = 0;
1818-
// const size_t maxfillin = std::max(10 * liftingtable.size(),
1819-
// static_cast<size_t>(numNonzeros()) /
1820-
// 100);
1821-
const size_t maxnfill = std::numeric_limits<size_t>::max();
1823+
const size_t maxnfill = std::max(10 * liftingtable.size(),
1824+
static_cast<size_t>(numNonzeros()) / 100);
18221825
for (const auto& lifting : liftingtable) {
18231826
// get clique
18241827
HighsInt row = std::get<0>(lifting);

0 commit comments

Comments
 (0)