Skip to content

Commit 1b15b6c

Browse files
committed
Protect cases where global domain is tightened
1 parent 5143968 commit 1b15b6c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

highs/mip/HighsTransformedLp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -854,10 +854,10 @@ bool HighsTransformedLp::transformSNFRelaxation(
854854
aggrvbcoef = static_cast<double>(vals[i] * (HighsCDouble(ub) - lb));
855855
aggrconstant = static_cast<double>(HighsCDouble(vals[i]) * ub);
856856
if (vals[i] >= 0) {
857-
addSNFRentry(-1, col, (ub - getLpSolution(col)) / (ub - lb), -1, aggrvbcoef, aggrconstant, 0,
857+
addSNFRentry(-1, col, std::max(0.0, std::min(1.0, (ub - getLpSolution(col)) / (ub - lb))), -1, aggrvbcoef, aggrconstant, 0,
858858
-vals[i], false);
859859
} else {
860-
addSNFRentry(-1, col, (ub - getLpSolution(col)) / (ub - lb), 1, -aggrvbcoef, -aggrconstant, 0, vals[i],
860+
addSNFRentry(-1, col, std::max(0.0, std::min(1.0, (ub - getLpSolution(col)) / (ub - lb))), 1, -aggrvbcoef, -aggrconstant, 0, vals[i],
861861
false);
862862
}
863863
tmpSnfrRhs -= aggrconstant;
@@ -871,10 +871,10 @@ bool HighsTransformedLp::transformSNFRelaxation(
871871
aggrvbcoef = static_cast<double>(vals[i] * (HighsCDouble(ub) - lb));
872872
aggrconstant = static_cast<double>(HighsCDouble(vals[i]) * lb);
873873
if (vals[i] >= 0) {
874-
addSNFRentry(-1, col, (getLpSolution(col) - lb) / (ub - lb), 1, aggrvbcoef, -aggrconstant, 0, vals[i],
874+
addSNFRentry(-1, col, std::max(0.0, std::min(1.0, (getLpSolution(col) - lb) / (ub - lb))), 1, aggrvbcoef, -aggrconstant, 0, vals[i],
875875
false);
876876
} else {
877-
addSNFRentry(-1, col, (getLpSolution(col) - lb) / (ub - lb), -1, -aggrvbcoef, aggrconstant, 0, -vals[i],
877+
addSNFRentry(-1, col, std::max(0.0, std::min(1.0, (getLpSolution(col) - lb) / (ub - lb))), -1, -aggrvbcoef, aggrconstant, 0, -vals[i],
878878
false);
879879
}
880880
tmpSnfrRhs -= aggrconstant;

0 commit comments

Comments
 (0)