Skip to content

Commit acf5151

Browse files
authored
Merge pull request ERGO-Code#2203 from fwesselm/fix-2185
Fix 2185
2 parents 6267f7b + 17928bb commit acf5151

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/mip/HighsPrimalHeuristics.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@ void HighsPrimalHeuristics::rootReducedCost() {
319319
}
320320

321321
void HighsPrimalHeuristics::RENS(const std::vector<double>& tmp) {
322+
// return if domain is infeasible
323+
if (mipsolver.mipdata_->domain.infeasible()) return;
324+
322325
HighsPseudocost pscost(mipsolver.mipdata_->pseudocost);
323326
HighsSearch heur(mipsolver, pscost);
324327
HighsDomain& localdom = heur.getLocalDomain();
@@ -567,7 +570,10 @@ void HighsPrimalHeuristics::RENS(const std::vector<double>& tmp) {
567570
}
568571

569572
void HighsPrimalHeuristics::RINS(const std::vector<double>& relaxationsol) {
570-
if (int(relaxationsol.size()) != mipsolver.numCol()) return;
573+
// return if domain is infeasible
574+
if (mipsolver.mipdata_->domain.infeasible()) return;
575+
576+
if (relaxationsol.size() != static_cast<size_t>(mipsolver.numCol())) return;
571577

572578
intcols.erase(std::remove_if(intcols.begin(), intcols.end(),
573579
[&](HighsInt i) {
@@ -979,7 +985,7 @@ bool HighsPrimalHeuristics::linesearchRounding(
979985

980986
void HighsPrimalHeuristics::randomizedRounding(
981987
const std::vector<double>& relaxationsol) {
982-
if (int(relaxationsol.size()) != mipsolver.numCol()) return;
988+
if (relaxationsol.size() != static_cast<size_t>(mipsolver.numCol())) return;
983989

984990
auto localdom = mipsolver.mipdata_->domain;
985991

@@ -1158,7 +1164,8 @@ void HighsPrimalHeuristics::feasibilityPump() {
11581164
}
11591165

11601166
void HighsPrimalHeuristics::centralRounding() {
1161-
if (HighsInt(mipsolver.mipdata_->analyticCenter.size()) != mipsolver.numCol())
1167+
if (mipsolver.mipdata_->analyticCenter.size() !=
1168+
static_cast<size_t>(mipsolver.numCol()))
11621169
return;
11631170

11641171
if (!mipsolver.mipdata_->firstlpsol.empty())

src/mip/HighsSearch.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ HighsSearch::HighsSearch(HighsMipSolver& mipsolver, HighsPseudocost& pseudocost)
3131
countTreeWeight = true;
3232
childselrule = mipsolver.submip ? ChildSelectionRule::kHybridInferenceCost
3333
: ChildSelectionRule::kRootSol;
34+
// the infeasibility flag is overwritten and lost when setDomainChangeStack is
35+
// called. therefore, assert that localdom is not infeasible here.
36+
assert(!this->localdom.infeasible());
3437
this->localdom.setDomainChangeStack(std::vector<HighsDomainChange>());
3538
}
3639

0 commit comments

Comments
 (0)