Skip to content

Commit d308ab0

Browse files
committed
Add comments. Fix domain check for fixval
1 parent 16229b7 commit d308ab0

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

highs/mip/HighsPrimalHeuristics.cpp

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,15 +1573,18 @@ void HighsPrimalHeuristics::fixAndPropagate() {
15731573
double feastol = mipsolver.mipdata_->feastol;
15741574
std::vector<HighsInt> diveperm = intcols;
15751575
std::map<HighsInt, std::tuple<
1576-
bool, bool, HighsInt, double, HighsInt>> permkey;
1576+
bool, bool, bool, HighsInt, double, HighsInt>> permkey;
15771577
for (HighsInt col : intcols) {
1578-
permkey.emplace(col, std::tuple<bool, bool, HighsInt, double, HighsInt>(
1579-
localdom.isBinary(col),
1580-
(rootsol[col] <= localdom.col_lower_[col] +feastol) ||
1581-
(rootsol[col] >= localdom.col_upper_[col] - feastol),
1582-
-heurlp.getLp().col_cost_[col],
1583-
mipsolver.mipdata_->cliquetable.getNumImplications(col),
1584-
col));
1578+
permkey.emplace(
1579+
col, std::tuple<bool, bool, bool, HighsInt, double, HighsInt>(
1580+
localdom.isBinary(col),
1581+
(lpsol[col] <= localdom.col_lower_[col] + feastol) ||
1582+
(lpsol[col] >= localdom.col_upper_[col] - feastol),
1583+
(rootsol[col] <= localdom.col_lower_[col] +feastol) ||
1584+
(rootsol[col] >= localdom.col_upper_[col] - feastol),
1585+
mipsolver.mipdata_->cliquetable.getNumImplications(col),
1586+
-heurlp.getLp().col_cost_[col],
1587+
col));
15851588
}
15861589
pdqsort(diveperm.begin(), diveperm.end(),
15871590
[&](const HighsInt c1, const HighsInt c2) {
@@ -1603,8 +1606,10 @@ void HighsPrimalHeuristics::fixAndPropagate() {
16031606
return;
16041607
}
16051608

1609+
// TODO: Is this case only reached when the root is infeasible?
16061610
if (!heur.backtrack()) {
1607-
break;
1611+
lp_iterations += heur.getLocalLpIterations();
1612+
return;
16081613
}
16091614
}
16101615
bool branched = false;
@@ -1615,10 +1620,10 @@ void HighsPrimalHeuristics::fixAndPropagate() {
16151620
if (localdom.col_lower_[col] == localdom.col_upper_[col]) continue;
16161621
// Decide on the fix value
16171622
double fixval = localdom.col_upper_[col];
1618-
if (rootsol[col] <= localdom.col_lower_[col] + feastol) {
1623+
if (rootsol[col] <= heurlp.colLower(col) + feastol) {
16191624
fixval = localdom.col_lower_[col];
16201625
}
1621-
else if (rootsol[col] >= localdom.col_upper_[col] - feastol) {
1626+
else if (rootsol[col] >= heurlp.colUpper(col) - feastol) {
16221627
fixval = localdom.col_upper_[col];
16231628
}
16241629
else if (localdom.isBinary(col) && lpsol[col] < 0.1) {
@@ -1673,8 +1678,8 @@ void HighsPrimalHeuristics::fixAndPropagate() {
16731678
}
16741679
}
16751680

1681+
// Solve the LP with all integer variables fixed
16761682
if (!heur.hasNode()) return;
1677-
16781683
heurlp.getLpSolver().changeColsBounds(0, mipsolver.numCol() - 1,
16791684
localdom.col_lower_.data(),
16801685
localdom.col_upper_.data());

0 commit comments

Comments
 (0)