Skip to content

Commit

Permalink
Added maximum sub-MIP depth statistic
Browse files Browse the repository at this point in the history
  • Loading branch information
jajhall committed Nov 4, 2024
1 parent 9f4e9e1 commit 9cb35ae
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/mip/HighsMipSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,21 @@ using std::fabs;

HighsMipSolver::HighsMipSolver(HighsCallback& callback,
const HighsOptions& options, const HighsLp& lp,
const HighsSolution& solution, bool submip)
const HighsSolution& solution, bool submip,
HighsInt submip_level)
: callback_(&callback),
options_mip_(&options),
model_(&lp),
orig_model_(&lp),
solution_objective_(kHighsInf),
submip(submip),
submip_level(submip_level),
rootbasis(nullptr),
pscostinit(nullptr),
clqtableinit(nullptr),
implicinit(nullptr) {
assert(!submip || submip_level > 0);
max_submip_level = 0;
if (solution.value_valid) {
// MIP solver doesn't check row residuals, but they should be OK
// so validate using assert
Expand Down Expand Up @@ -717,6 +721,7 @@ void HighsMipSolver::cleanupSolve() {
" %.2f (presolve)\n"
" %.2f (solve)\n"
" %.2f (postsolve)\n"
" Max sub-MIP depth %d\n"
" Nodes %llu\n"
" Repair LPs %llu (%llu feasible; %llu iterations)\n"
" LP iterations %llu (total)\n"
Expand All @@ -727,6 +732,7 @@ void HighsMipSolver::cleanupSolve() {
analysis_.mipTimerRead(kMipClockPresolve),
analysis_.mipTimerRead(kMipClockSolve),
analysis_.mipTimerRead(kMipClockPostsolve),
int(max_submip_level),
(long long unsigned)mipdata_->num_nodes,
(long long unsigned)mipdata_->total_repair_lp,
(long long unsigned)mipdata_->total_repair_lp_feasible,
Expand Down
4 changes: 3 additions & 1 deletion src/mip/HighsMipSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class HighsMipSolver {
std::vector<HighsObjectiveSolution> saved_objective_and_solution_;

bool submip;
HighsInt submip_level;
HighsInt max_submip_level;
const HighsBasis* rootbasis;
const HighsPseudocostInitialization* pscostinit;
const HighsCliqueTable* clqtableinit;
Expand Down Expand Up @@ -85,7 +87,7 @@ class HighsMipSolver {

HighsMipSolver(HighsCallback& callback, const HighsOptions& options,
const HighsLp& lp, const HighsSolution& solution,
bool submip = false);
bool submip = false, HighsInt submip_level = 0);

~HighsMipSolver();

Expand Down
7 changes: 4 additions & 3 deletions src/mip/HighsPrimalHeuristics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,16 @@ bool HighsPrimalHeuristics::solveSubMip(
solution.dual_valid = false;
// Create HighsMipSolver instance for sub-MIP
HighsMipSolver submipsolver(*mipsolver.callback_, submipoptions, submip,
solution, true);
solution, true, mipsolver.submip_level + 1);
submipsolver.rootbasis = &basis;
HighsPseudocostInitialization pscostinit(mipsolver.mipdata_->pseudocost, 1);
submipsolver.pscostinit = &pscostinit;
submipsolver.clqtableinit = &mipsolver.mipdata_->cliquetable;
submipsolver.implicinit = &mipsolver.mipdata_->implications;

// Solve the sub-MIP
submipsolver.run();

mipsolver.max_submip_level =
std::max(submipsolver.max_submip_level + 1, mipsolver.max_submip_level);
if (submipsolver.mipdata_) {
double numUnfixed = mipsolver.mipdata_->integral_cols.size() +
mipsolver.mipdata_->continuous_cols.size();
Expand Down

0 comments on commit 9cb35ae

Please sign in to comment.