Skip to content

Commit e7c2316

Browse files
committed
Use non-tight VBs for ints. Don't relax small ints
1 parent 543e011 commit e7c2316

File tree

1 file changed

+18
-33
lines changed

1 file changed

+18
-33
lines changed

highs/mip/HighsTransformedLp.cpp

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -216,40 +216,23 @@ bool HighsTransformedLp::transform(std::vector<double>& vals,
216216
// column.
217217
BoundType oldBoundType = boundTypes[col];
218218

219-
if (lprelaxation.isColIntegral(col)) {
220-
if (ub - lb <= 1.5 || boundDist[col] != 0.0 || simpleLbDist[col] == 0 ||
221-
simpleUbDist[col] == 0) {
222-
// since we skip the handling of variable bound constraints for all
223-
// binary and some general-integer variables here, the bound type used
224-
// should be a simple lower or upper bound
225-
if (simpleLbDist[col] < simpleUbDist[col] - mip.mipdata_->feastol) {
226-
boundTypes[col] = BoundType::kSimpleLb;
227-
} else if (simpleUbDist[col] <
228-
simpleLbDist[col] - mip.mipdata_->feastol) {
229-
boundTypes[col] = BoundType::kSimpleUb;
230-
} else if (vals[i] > 0) {
231-
boundTypes[col] = BoundType::kSimpleLb;
232-
} else {
233-
boundTypes[col] = BoundType::kSimpleUb;
234-
}
235-
i++;
236-
continue;
237-
}
238-
if (bestVlb[col].first == -1 ||
239-
ubDist[col] < lbDist[col] - mip.mipdata_->feastol) {
240-
assert(bestVub[col].first != -1);
241-
boundTypes[col] = BoundType::kVariableUb;
242-
} else if (bestVub[col].first == -1 ||
243-
lbDist[col] < ubDist[col] - mip.mipdata_->feastol) {
244-
assert(bestVlb[col].first != -1);
245-
boundTypes[col] = BoundType::kVariableLb;
219+
if (lprelaxation.isColIntegral(col) &&
220+
(ub - lb <= 1.5 || simpleLbDist[col] == 0 || simpleUbDist[col] == 0)) {
221+
// since we skip the handling of variable bound constraints for all
222+
// binary and some general-integer variables here, the bound type used
223+
// should be a simple lower or upper bound
224+
if (simpleLbDist[col] < simpleUbDist[col] - mip.mipdata_->feastol) {
225+
boundTypes[col] = BoundType::kSimpleLb;
226+
} else if (simpleUbDist[col] <
227+
simpleLbDist[col] - mip.mipdata_->feastol) {
228+
boundTypes[col] = BoundType::kSimpleUb;
246229
} else if (vals[i] > 0) {
247-
assert(bestVub[col].first != -1);
248-
boundTypes[col] = BoundType::kVariableUb;
230+
boundTypes[col] = BoundType::kSimpleLb;
249231
} else {
250-
assert(bestVlb[col].first != -1);
251-
boundTypes[col] = BoundType::kVariableLb;
232+
boundTypes[col] = BoundType::kSimpleUb;
252233
}
234+
i++;
235+
continue;
253236
} else {
254237
if (lbDist[col] < ubDist[col] - mip.mipdata_->feastol) {
255238
if (bestVlb[col].first == -1)
@@ -286,7 +269,8 @@ bool HighsTransformedLp::transform(std::vector<double>& vals,
286269

287270
switch (boundTypes[col]) {
288271
case BoundType::kSimpleLb:
289-
if (vals[i] > 0) {
272+
if (vals[i] > 0 &&
273+
(!lprelaxation.isColIntegral(col) || ub - lb >= 3.5)) {
290274
// relax away using lower bound
291275
tmpRhs -= lb * vals[i];
292276
boundTypes[col] = oldBoundType;
@@ -295,7 +279,8 @@ bool HighsTransformedLp::transform(std::vector<double>& vals,
295279
}
296280
break;
297281
case BoundType::kSimpleUb:
298-
if (vals[i] < 0) {
282+
if (vals[i] < 0 &&
283+
(!lprelaxation.isColIntegral(col) || ub - lb >= 3.5)) {
299284
// relax away using upper bound
300285
tmpRhs -= ub * vals[i];
301286
boundTypes[col] = oldBoundType;

0 commit comments

Comments
 (0)