Skip to content

Commit ee761dd

Browse files
committed
More minor code improvements
1 parent 1b97c0c commit ee761dd

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

highs/mip/HighsCutGeneration.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -507,12 +507,12 @@ bool HighsCutGeneration::separateLiftedMixedIntegerCover() {
507507
bool HighsCutGeneration::separateLiftedFlowCover() {
508508
// Compute the lifting data (ld) first
509509
struct LiftingData {
510-
std::vector<HighsCDouble> m;
510+
std::vector<double> m;
511511
std::vector<HighsCDouble> M;
512512
HighsInt r = 0;
513513
HighsInt t = 0;
514514
double mp = kHighsInf;
515-
HighsCDouble ml = 0;
515+
double ml = 0;
516516
HighsCDouble d1 = 0;
517517
};
518518
LiftingData ld;
@@ -559,7 +559,7 @@ bool HighsCutGeneration::separateLiftedFlowCover() {
559559

560560
pdqsort_branchless(
561561
ld.m.begin(), ld.m.begin() + ld.r,
562-
[&](const HighsCDouble a, const HighsCDouble b) { return a > b; });
562+
[&](const double a, const double b) { return a > b; });
563563

564564
for (HighsInt i = 0; i != ld.r + 1; ++i) {
565565
if (i == 0) {
@@ -626,7 +626,7 @@ bool HighsCutGeneration::separateLiftedFlowCover() {
626626
snfr.lambda + vubcoef <=
627627
ld.M[i] + ld.ml + feastol +
628628
std::max(0.0, static_cast<double>(
629-
ld.m[i] - (ld.mp - snfr.lambda) - ld.ml)));
629+
ld.m[i] - (HighsCDouble(ld.mp) - snfr.lambda) - ld.ml)));
630630
return static_cast<double>(i * HighsCDouble(snfr.lambda) + vubcoef -
631631
ld.M[i]);
632632
}
@@ -1613,7 +1613,7 @@ bool HighsCutGeneration::preprocessSNFRelaxation() {
16131613
// 5. Don't consider any inequality with too few continuous cols
16141614

16151615
HighsInt numZeros = 0;
1616-
HighsInt numCont = 0;
1616+
HighsInt numContCols = 0;
16171617
double maxact = -feastol;
16181618
double maxAbsVal = 0;
16191619
HighsInt slackOffset = lpRelaxation.getMipSolver().numCol();
@@ -1637,10 +1637,10 @@ bool HighsCutGeneration::preprocessSNFRelaxation() {
16371637
if (lb == -kHighsInf || ub == kHighsInf) {
16381638
return false;
16391639
}
1640-
if (!lpRelaxation.isColIntegral(col)) numCont++;
1640+
if (col < slackOffset && !lpRelaxation.isColIntegral(col)) numContCols++;
16411641
}
16421642

1643-
if (numCont <= 1) return false;
1643+
if (numContCols == 0) return false;
16441644
scale(maxAbsVal);
16451645

16461646
for (HighsInt i = 0; i != rowlen; ++i) {

highs/mip/HighsTransformedLp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ bool HighsTransformedLp::transformSNFRelaxation(
772772
}
773773

774774
// We are using vectorsum to keep track of the binary coefficients
775-
if (colIsBinary(col, lb, ub) && vectorsum.getValue(col) == 0) {
775+
if (i >= numNz - numBinCols && vectorsum.getValue(col) == 0) {
776776
++i;
777777
continue;
778778
}
@@ -813,7 +813,7 @@ bool HighsTransformedLp::transformSNFRelaxation(
813813
}
814814

815815
// Transform entry into the SNFR
816-
if (colIsBinary(col, lb, ub)) {
816+
if (i >= numNz - numBinCols) {
817817
// Binary columns can be added directly to the SNFR
818818
if (vals[i] >= 0) {
819819
addSNFRentry(col, -1, getLpSolution(col), 1, vals[i], 0,

0 commit comments

Comments
 (0)