Skip to content

Commit 6eafa1b

Browse files
committed
Simplify
1 parent 19a39a7 commit 6eafa1b

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

highs/presolve/HPresolve.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5041,17 +5041,19 @@ HPresolve::Result HPresolve::enumerateSolutions(
50415041
// analyse worst-case bounds
50425042
for (HighsInt col : worstCaseBounds) {
50435043
if (numWorstCaseBounds[col] == numSolutions) {
5044-
double lb = std::max(domain.col_lower_[col], worstCaseLowerBound[col]);
5045-
double ub = std::min(domain.col_upper_[col], worstCaseUpperBound[col]);
5046-
if (lb > domain.col_lower_[col]) {
5044+
assert(worstCaseLowerBound[col] >= domain.col_lower_[col]);
5045+
assert(worstCaseUpperBound[col] <= domain.col_upper_[col]);
5046+
if (worstCaseLowerBound[col] > domain.col_lower_[col]) {
50475047
// tighten lower bound
5048-
domain.changeBound(HighsBoundType::kLower, col, lb,
5048+
domain.changeBound(HighsBoundType::kLower, col,
5049+
worstCaseLowerBound[col],
50495050
HighsDomain::Reason::unspecified());
50505051
if (domain.infeasible()) return Result::kPrimalInfeasible;
50515052
}
5052-
if (ub < domain.col_upper_[col]) {
5053+
if (worstCaseUpperBound[col] < domain.col_upper_[col]) {
50535054
// tighten upper bound
5054-
domain.changeBound(HighsBoundType::kUpper, col, ub,
5055+
domain.changeBound(HighsBoundType::kUpper, col,
5056+
worstCaseUpperBound[col],
50555057
HighsDomain::Reason::unspecified());
50565058
if (domain.infeasible()) return Result::kPrimalInfeasible;
50575059
}
@@ -5097,22 +5099,19 @@ HPresolve::Result HPresolve::enumerateSolutions(
50975099
HighsInt numBndsTightened = 0;
50985100
for (HighsInt i = 0; i != model->num_col_; ++i) {
50995101
if (colDeleted[i]) continue;
5100-
bool newbnd = false;
5101-
if (model->col_lower_[i] < domain.col_lower_[i]) {
5102-
newbnd = true;
5103-
changeColLower(i, domain.col_lower_[i]);
5104-
}
5105-
if (model->col_upper_[i] > domain.col_upper_[i]) {
5106-
newbnd = true;
5107-
changeColUpper(i, domain.col_upper_[i]);
5108-
}
5102+
bool newLowerBnd = model->col_lower_[i] < domain.col_lower_[i];
5103+
bool newUpperBnd = model->col_upper_[i] > domain.col_upper_[i];
5104+
if (newLowerBnd) changeColLower(i, domain.col_lower_[i]);
5105+
if (newUpperBnd) changeColUpper(i, domain.col_upper_[i]);
51095106
if (domain.isFixed(i)) {
51105107
numVarsFixed++;
51115108
postsolve_stack.removedFixedCol(i, model->col_lower_[i], 0.0,
51125109
HighsEmptySlice());
51135110
removeFixedCol(i);
5114-
} else if (newbnd)
5115-
numBndsTightened++;
5111+
} else {
5112+
if (newLowerBnd) numBndsTightened++;
5113+
if (newUpperBnd) numBndsTightened++;
5114+
}
51165115
HPRESOLVE_CHECKED_CALL(checkLimits(postsolve_stack));
51175116
}
51185117

0 commit comments

Comments
 (0)