Skip to content

Commit 84000d8

Browse files
committed
Chvatal-Gomory strengthening
1 parent f4a67f7 commit 84000d8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

highs/presolve/HPresolve.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3902,6 +3902,31 @@ HPresolve::Result HPresolve::rowPresolve(HighsPostsolveStack& postsolve_stack,
39023902
}
39033903
}
39043904
}
3905+
} else if (model->row_lower_[row] == -kHighsInf ||
3906+
model->row_upper_[row] == kHighsInf) {
3907+
// try Chvatal-Gomory strengthening
3908+
std::vector<HighsInt> complementedOrShifted;
3909+
complementedOrShifted.resize(rowCoefs.size());
3910+
HighsInt direction =
3911+
model->row_upper_[row] != kHighsInf ? HighsInt{1} : HighsInt{-1};
3912+
double rhs =
3913+
direction > 0 ? model->row_upper_[row] : -model->row_lower_[row];
3914+
for (size_t i = 0; i < rowCoefs.size(); ++i) {
3915+
HighsInt col = rowIndex[i];
3916+
double val = rowCoefs[i];
3917+
if (direction * val < 0.0 && model->col_upper_[col] != kHighsInf) {
3918+
rhs -= direction * val * model->col_upper_[col];
3919+
rowCoefs[i] = -rowCoefs[i];
3920+
complementedOrShifted[i] = -1;
3921+
} else if (direction * val > 0.0 &&
3922+
model->col_lower_[col] != -kHighsInf) {
3923+
rhs -= direction * val * model->col_lower_[col];
3924+
complementedOrShifted[i] = 1;
3925+
} else {
3926+
// no bounds
3927+
break;
3928+
}
3929+
}
39053930
}
39063931
}
39073932

0 commit comments

Comments
 (0)