Skip to content

Commit be510a1

Browse files
committed
Add extra solobj check. Remove assert
1 parent 887dc08 commit be510a1

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

highs/mip/HighsDomain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3215,7 +3215,7 @@ bool HighsDomain::ConflictSet::explainInfeasibility() {
32153215
HighsInt ninfmin;
32163216
HighsCDouble minAct;
32173217
globaldom.computeMinActivity(0, len, inds, vals, ninfmin, minAct);
3218-
assert(ninfmin == 0);
3218+
if (ninfmin > 0) return false;
32193219

32203220
return explainInfeasibilityLeq(inds, vals, len, rhs, double(minAct));
32213221
}

highs/mip/HighsMipSolverData.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,15 @@ double HighsMipSolverData::transformNewIntegerFeasibleSolution(
11201120
}
11211121
}
11221122

1123+
double transformed_solobj;
1124+
if (mipsolver.orig_model_->sense_ == ObjSense::kMaximize) {
1125+
transformed_solobj = -static_cast<double>(mipsolver_quad_objective_value +
1126+
mipsolver.model_->offset_);
1127+
} else {
1128+
transformed_solobj = static_cast<double>(mipsolver_quad_objective_value -
1129+
mipsolver.model_->offset_);
1130+
}
1131+
11231132
// Possible MIP solution callback
11241133
if (!mipsolver.submip && feasible && mipsolver.callback_->user_callback &&
11251134
mipsolver.callback_->active[kCallbackMipSolution]) {
@@ -1130,6 +1139,12 @@ double HighsMipSolverData::transformNewIntegerFeasibleSolution(
11301139
assert(!interrupt);
11311140
}
11321141

1142+
// Catch the case where the repaired solution now has worse objective
1143+
// than the current stored solution
1144+
if (transformed_solobj >= upper_bound && !sol.empty()) {
1145+
return transformed_solobj;
1146+
}
1147+
11331148
if (possibly_store_as_new_incumbent) {
11341149
// Store the solution as incumbent in the original space if there
11351150
// is no solution or if it is feasible
@@ -1171,11 +1186,9 @@ double HighsMipSolverData::transformNewIntegerFeasibleSolution(
11711186
return kHighsInf;
11721187
}
11731188
}
1174-
// return the objective value in the transformed space
1175-
if (mipsolver.orig_model_->sense_ == ObjSense::kMaximize)
1176-
return -double(mipsolver_quad_objective_value + mipsolver.model_->offset_);
11771189

1178-
return double(mipsolver_quad_objective_value - mipsolver.model_->offset_);
1190+
// return the objective value in the transformed space
1191+
return transformed_solobj;
11791192
}
11801193

11811194
double HighsMipSolverData::percentageInactiveIntegers() const {

0 commit comments

Comments
 (0)