Skip to content

Commit

Permalink
Added commented out code illustrating the vector of HighsMipSolver in…
Browse files Browse the repository at this point in the history
…stances I'd like to create
  • Loading branch information
jajhall committed Jan 29, 2025
1 parent b1a879b commit c4fb2d9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
36 changes: 24 additions & 12 deletions src/mip/HighsMipSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,22 +257,34 @@ void HighsMipSolver::run() {
while (master_search.hasNode()) {
const HighsInt use_mip_concurrency = options_mip_->mip_search_concurrency;
HighsSolution null_solution;
HighsMipSolver worker_solver(*callback_, *options_mip_, *model_,
null_solution, false, 0);
worker_solver.rootbasis = this->rootbasis;

// I'd like to do this, since it extends to multiple workers...
//
// std::vector<HighsMipSolver> worker_mipsolvers;
// worker_mipsolvers.push_back(HighsMipSolver{*callback_, *options_mip_,
// *model_,
// null_solution, false, 0});
// HighsMipSolver& worker_mipsolver = worker_mipsolvers[0];

// ... but currently can only do this
//
HighsMipSolver worker_mipsolver(*callback_, *options_mip_, *model_,
null_solution, false, 0);
worker_mipsolver.rootbasis = this->rootbasis;
HighsPseudocostInitialization pscostinit(mipdata_->pseudocost, 1);
worker_solver.pscostinit = &pscostinit;
worker_solver.clqtableinit = &mipdata_->cliquetable;
worker_solver.implicinit = &mipdata_->implications;
worker_solver.mipdata_ = decltype(mipdata_)(new HighsMipSolverData(*this));
worker_mipsolver.pscostinit = &pscostinit;
worker_mipsolver.clqtableinit = &mipdata_->cliquetable;
worker_mipsolver.implicinit = &mipdata_->implications;
worker_mipsolver.mipdata_ =
decltype(mipdata_)(new HighsMipSolverData(*this));

HighsSearch worker_search{worker_solver,
worker_solver.mipdata_->pseudocost};
HighsSearch worker_search{worker_mipsolver,
worker_mipsolver.mipdata_->pseudocost};

std::vector<HighsLpRelaxation> multiple_lp;
multiple_lp.push_back(HighsLpRelaxation{mipdata_->lp});
std::vector<HighsLpRelaxation> worker_lp;
worker_lp.push_back(HighsLpRelaxation{mipdata_->lp});

worker_search.setLpRelaxation(&multiple_lp[0]);
worker_search.setLpRelaxation(&worker_lp[0]);

// Lambda for combining limit_reached across searches
auto limitReached = [&]() -> bool {
Expand Down
2 changes: 1 addition & 1 deletion src/mip/HighsSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1997,7 +1997,7 @@ void HighsSearch::dive() {
printf(
"HighsMipSolver::run() evaluate_node_result == "
"HighsSearch::NodeResult::kSubOptimal\n");
assert(345 == 678);
// assert(345 == 678);
break;
}

Expand Down

0 comments on commit c4fb2d9

Please sign in to comment.