Skip to content

Commit 74be9c7

Browse files
committed
Added data members for parallel search to HighsSearch.h and lambdas to gather them
1 parent 5479e92 commit 74be9c7

File tree

3 files changed

+43
-3
lines changed

3 files changed

+43
-3
lines changed

highs/lp_data/HighsOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ class HighsOptions : public HighsOptionsStruct {
877877

878878
record_bool = new OptionRecordBool(
879879
"timeless_log", "Suppression of time-based data in logging", true,
880-
&timeless_log, false);
880+
&timeless_log, true);//false);
881881
records.push_back(record_bool);
882882

883883
record_string = new OptionRecordString(kLogFileString, "Log file", advanced,

highs/mip/HighsMipSolver.cpp

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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 &&

highs/mip/HighsSearch.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ class HighsSearch {
7373
kOpen,
7474
};
7575

76+
// Data members for parallel search
77+
bool limit_reached_;
78+
bool performed_dive_;
79+
bool break_search_;
80+
HighsInt evaluate_node_global_max_recursion_level_;
81+
HighsInt evaluate_node_local_max_recursion_level_;
82+
7683
private:
7784
ChildSelectionRule childselrule;
7885

0 commit comments

Comments
 (0)