Skip to content

Commit bc91e0b

Browse files
authored
Merge pull request #2863 from fwesselm/minorImprovementToEnumeration
Minor improvement to enumeration
2 parents 6cfd692 + 85a39c4 commit bc91e0b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

highs/presolve/HPresolve.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5002,11 +5002,15 @@ HPresolve::Result HPresolve::enumerateSolutions(
50025002
if ((++numRowsAccepted) >= maxNumRowsChecked) break;
50035003
// get indices of binary variables in the row
50045004
getBinaryRow(r, binvars, numnzs);
5005+
// initialise counters
5006+
HighsInt numRowsActive = 0;
5007+
HighsInt oldNumRowsRemoved = numRowsRemoved;
50055008
for (size_t ii = i + 1; ii < rows.size(); ii++) {
50065009
// get row index and skip removed rows
50075010
HighsInt& r2 = std::get<3>(rows[ii]);
50085011
if (r2 == -1) continue;
50095012
// compare signatures to see if there may be overlap
5013+
numRowsActive++;
50105014
if ((std::get<4>(rows[i]) & std::get<4>(rows[ii])) == 0) continue;
50115015
// get indices of binary variables in the row
50125016
getBinaryRow(r2, binvars2, numnzs2);
@@ -5019,6 +5023,9 @@ HPresolve::Result HPresolve::enumerateSolutions(
50195023
r2 = -1;
50205024
}
50215025
}
5026+
// stop iterating if at most one of the remaining rows is active (not
5027+
// deleted)
5028+
if (numRowsActive - numRowsRemoved + oldNumRowsRemoved <= 1) break;
50225029
}
50235030
if (numRowsRemoved > 0)
50245031
rows.erase(std::remove_if(rows.begin(), rows.end(),

0 commit comments

Comments
 (0)