Skip to content

Commit 0283068

Browse files
committed
Handle cases where global bounds tightened
1 parent 803860d commit 0283068

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

highs/mip/HighsTransformedLp.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -875,12 +875,14 @@ bool HighsTransformedLp::transformSNFRelaxation(
875875
// rhs -= a_j * u_j
876876
aggrvbcoef = static_cast<double>(vals[i] * (HighsCDouble(ub) - lb));
877877
aggrconstant = static_cast<double>(HighsCDouble(vals[i]) * ub);
878+
binsolval = std::min(
879+
1.0, std::max(0.0, (ub - getLpSolution(col)) / (ub - lb)));
878880
if (vals[i] >= 0) {
879-
addSNFRentry(-1, col, (ub - getLpSolution(col)) / (ub - lb), -1, aggrvbcoef, aggrconstant, 0,
881+
addSNFRentry(-1, col, binsolval, -1, aggrvbcoef, aggrconstant, 0,
880882
-vals[i], false);
881883
} else {
882-
addSNFRentry(-1, col, (ub - getLpSolution(col)) / (ub - lb), 1, -aggrvbcoef, -aggrconstant, 0, vals[i],
883-
false);
884+
addSNFRentry(-1, col, binsolval, 1, -aggrvbcoef, -aggrconstant, 0,
885+
vals[i], false);
884886
}
885887
tmpSnfrRhs -= aggrconstant;
886888
break;
@@ -892,12 +894,14 @@ bool HighsTransformedLp::transformSNFRelaxation(
892894
// rhs -= a_j * l_j
893895
aggrvbcoef = static_cast<double>(vals[i] * (HighsCDouble(ub) - lb));
894896
aggrconstant = static_cast<double>(HighsCDouble(vals[i]) * lb);
897+
binsolval = std::min(
898+
1.0, std::max(0.0, (getLpSolution(col) - lb) / (ub - lb)));
895899
if (vals[i] >= 0) {
896-
addSNFRentry(-1, col, (getLpSolution(col) - lb) / (ub - lb), 1, aggrvbcoef, -aggrconstant, 0, vals[i],
897-
false);
900+
addSNFRentry(-1, col, binsolval, 1, aggrvbcoef, -aggrconstant, 0,
901+
vals[i], false);
898902
} else {
899-
addSNFRentry(-1, col, (getLpSolution(col) - lb) / (ub - lb), -1, -aggrvbcoef, aggrconstant, 0, -vals[i],
900-
false);
903+
addSNFRentry(-1, col, binsolval, -1, -aggrvbcoef, aggrconstant, 0,
904+
-vals[i], false);
901905
}
902906
tmpSnfrRhs -= aggrconstant;
903907
break;

0 commit comments

Comments
 (0)