Skip to content

Commit 89ee10f

Browse files
committed
Add max scale factor for cuts
1 parent f74f972 commit 89ee10f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

highs/mip/HighsCutGeneration.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,8 @@ bool HighsCutGeneration::postprocessCut() {
781781
}
782782
}
783783

784+
if (rowlen == 0) return false;
785+
784786
if (integralSupport) {
785787
// integral support -> determine scale to make all coefficients integral
786788
double intscale =
@@ -861,6 +863,8 @@ bool HighsCutGeneration::postprocessCut() {
861863
int expshift;
862864
std::frexp(maxAbsValue - epsilon, &expshift);
863865
expshift = -expshift;
866+
// Don't scale the coefficients by more than +1024 (violations can increase)
867+
expshift = std::min(10, expshift);
864868
rhs = std::ldexp((double)rhs, expshift);
865869

866870
for (HighsInt i = 0; i != rowlen; ++i)
@@ -895,6 +899,8 @@ bool HighsCutGeneration::preprocessBaseInequality(bool& hasUnboundedInts,
895899
int expshift = 0;
896900
std::frexp(maxAbsVal, &expshift);
897901
expshift = -expshift;
902+
// Don't scale the coefficients by more than +1024 (violations can increase)
903+
expshift = std::min(10, expshift);
898904
initialScale = std::ldexp(1.0, expshift);
899905
rhs *= initialScale;
900906
for (HighsInt i = 0; i < rowlen; ++i) vals[i] = std::ldexp(vals[i], expshift);

0 commit comments

Comments
 (0)