Skip to content

Commit 6f740fe

Browse files
committed
Now termination is not performed by sub-MIPs, but they will act on a termination from a MIP solver
1 parent c502d1f commit 6f740fe

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

check/TestMipSolver.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,11 +1049,13 @@ TEST_CASE("mip-race", "[highs_test_mip_solver]") {
10491049
h.setOptionValue("mip_race_concurrency", mip_race_concurrency);
10501050
REQUIRE(h.readModel(model_file) == HighsStatus::kOk);
10511051
REQUIRE(h.run() == HighsStatus::kOk);
1052+
REQUIRE(h.getModelStatus() == HighsModelStatus::kOptimal);
10521053

10531054
if (ci_test) {
10541055
h.clearSolver();
10551056
h.setOptionValue("mip_race_read_solutions", false);
10561057
REQUIRE(h.run() == HighsStatus::kOk);
1058+
REQUIRE(h.getModelStatus() == HighsModelStatus::kOptimal);
10571059
}
10581060
h.resetGlobalScheduler(true);
10591061
}

highs/mip/HighsMipSolver.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -699,22 +699,29 @@ void HighsMipSolver::run() {
699699

700700
void HighsMipSolver::cleanupSolve() {
701701
if (mipdata_->terminatorActive()) {
702-
if (!mipdata_->terminatorTerminated()) {
703-
// No other instance has terminated, so terminate it
702+
mipdata_->terminatorReport();
703+
if (mipdata_->terminatorTerminated()) {
704+
// Indicate that this instance has been interrupted
704705
highsLogUser(options_mip_->log_options, HighsLogType::kInfo,
705-
"instance%d: terminate %6.4f (%sMIP)\n",
706+
"instance%d: terminated %6.4f (%sMIP)\n",
706707
int(this->mipdata_->terminatorMyInstance()),
707708
this->timer_.read(),
708709
submip ? "sub-" : "");
709-
mipdata_->terminatorTerminate();
710-
} else {
711-
// Indicate that this instance has been interrupted
710+
modelstatus_ = HighsModelStatus::kHighsInterrupt;
711+
} else if (!submip) {
712+
// When sub-MIPs call cleanupSolve(), they generally don't have
713+
// a termination criterion for the whole MIP solver
714+
//
715+
// Possibly allow sub-MIPs to terminate if the time limit is
716+
// reached
717+
//
718+
// No other instance has terminated, so terminate
712719
highsLogUser(options_mip_->log_options, HighsLogType::kInfo,
713-
"instance%d: terminated %6.4f (%sMIP)\n",
720+
"instance%d: terminate %6.4f (%sMIP)\n",
714721
int(this->mipdata_->terminatorMyInstance()),
715722
this->timer_.read(),
716723
submip ? "sub-" : "");
717-
modelstatus_ = HighsModelStatus::kHighsInterrupt;
724+
mipdata_->terminatorTerminate();
718725
}
719726
mipdata_->terminatorReport();
720727
// Report on any active MIP race

0 commit comments

Comments
 (0)