@@ -308,12 +308,45 @@ void HighsMipSolver::run() {
308308 // Initialize worker relaxations and mipworkers
309309 // todo lps and workers are still empty right now
310310
311- const int num_workers = 7 ;
312- for (int i = 0 ; i < 7 ; i++) {
311+ const HighsInt mip_search_concurrency = options_mip_->mip_search_concurrency ;
312+ const HighsInt num_worker = mip_search_concurrency - 1 ;
313+ for (int i = 0 ; i < num_worker; i++) {
313314 mipdata_->lps .push_back (HighsLpRelaxation (*this ));
314315 mipdata_->workers .emplace_back (*this , mipdata_->lps .back ());
315316 }
316317
318+ // Lambda for combining limit_reached across searches
319+ auto limitReached = [&]() -> bool {
320+ bool limit_reached = false ;
321+ for (HighsInt iSearch = 0 ; iSearch < mip_search_concurrency; iSearch++)
322+ limit_reached =
323+ limit_reached || mipdata_->workers [iSearch].search_ptr_ ->limit_reached_ ;
324+ return limit_reached;
325+ };
326+
327+ // Lambda checking whether to break out of search
328+ auto breakSearch = [&]() -> bool {
329+ bool break_search = false ;
330+ for (HighsInt iSearch = 0 ; iSearch < mip_search_concurrency; iSearch++)
331+ break_search =
332+ break_search || mipdata_->workers [iSearch].search_ptr_ ->break_search_ ;
333+ return break_search;
334+ };
335+
336+ // Lambda checking whether loop pass is to be skipped
337+ auto performedDive = [&](const HighsSearch& search,
338+ const HighsInt iSearch) -> bool {
339+ if (iSearch == 0 ) {
340+ assert (search.performed_dive_ );
341+ } else {
342+ assert (!search.performed_dive_ );
343+ }
344+ // Make sure that if a dive has been performed, we're not
345+ // continuing after breaking from the search
346+ if (search.performed_dive_ ) assert (!breakSearch ());
347+ return search.performed_dive_ ;
348+ };
349+
317350 while (search.hasNode ()) {
318351 // Possibly look for primal solution from the user
319352 if (!submip && callback_->user_callback &&
0 commit comments