Skip to content

Commit 2f57d56

Browse files
committed
Continue solve in release if stopping criteria has a bug
1 parent 9e74d50 commit 2f57d56

2 files changed

Lines changed: 23 additions & 14 deletions

File tree

highs/mip/HighsMipSolver.cpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -949,19 +949,27 @@ void HighsMipSolver::run() {
949949
}
950950
}
951951
assert(early_terminated_worker != -1);
952-
// Clear all buffered solve information from workers that are not
953-
// the earliest to terminate
954-
for (const HighsInt i : search_indices) {
955-
if (i == early_terminated_worker) continue;
956-
HighsMipWorker& worker = mipdata_->workers[i];
957-
worker.nodequeue.clear();
958-
worker.search_ptr_->resetStatistics();
959-
worker.resetHeurStats();
960-
worker.resetSepaStats();
961-
worker.solutions_.clear();
952+
if (early_terminated_worker == -1) {
953+
mipdata_->worker_lp_iterations_stop.store(
954+
std::numeric_limits<int64_t>::max(), std::memory_order_relaxed);
955+
for (const HighsInt i : search_indices) {
956+
mipdata_->workers[i].early_termination = false;
957+
}
958+
} else {
959+
// Clear all buffered solve information from workers that are not
960+
// the earliest to terminate
961+
for (const HighsInt i : search_indices) {
962+
if (i == early_terminated_worker) continue;
963+
HighsMipWorker& worker = mipdata_->workers[i];
964+
worker.nodequeue.clear();
965+
worker.search_ptr_->resetStatistics();
966+
worker.resetHeurStats();
967+
worker.resetSepaStats();
968+
worker.solutions_.clear();
969+
}
970+
search_indices.clear();
971+
search_indices.emplace_back(early_terminated_worker);
962972
}
963-
search_indices.clear();
964-
search_indices.emplace_back(early_terminated_worker);
965973
}
966974

967975
// Sync statistics, check infeasibility, and flush nodes from worker queues

highs/mip/HighsSearch.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,8 +1949,9 @@ bool HighsSearch::checkLocalLimits() const {
19491949
if (mipsolver.mipdata_->terminatorActive())
19501950
if (mipsolver.mipdata_->terminatorTerminated()) return true;
19511951

1952-
if (mipsolver.mipdata_->worker_lp_iterations_stop.load(
1953-
std::memory_order_relaxed) <= lpiterations) {
1952+
const int64_t stop = mipsolver.mipdata_->worker_lp_iterations_stop.load(
1953+
std::memory_order_relaxed);
1954+
if (stop <= lpiterations) {
19541955
return true;
19551956
}
19561957

0 commit comments

Comments
 (0)