Skip to content

Commit

Permalink
MIP core profiling using fundamental clocks and being reported
Browse files Browse the repository at this point in the history
  • Loading branch information
jajhall committed Sep 25, 2024
1 parent bf78875 commit f321644
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 33 deletions.
42 changes: 20 additions & 22 deletions src/mip/HighsMipSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void HighsMipSolver::run() {
analysis_.timer_ = &this->timer_;
analysis_.setup(*orig_model_, *options_mip_);
}
analysis_.mipTimerStart(kMipClockTotal);
// analysis_.mipTimerStart(kMipClockTotal);

improving_solution_file_ = nullptr;
if (!submip && options_mip_->mip_improving_solution_file != "")
Expand Down Expand Up @@ -581,8 +581,7 @@ void HighsMipSolver::cleanupSolve() {

timer_.stop(timer_.postsolve_clock);
timer_.stop(timer_.total_clock);
analysis_.mipTimerStop(kMipClockTotal);
// analysis_.reportMipTimer();
analysis_.reportMipTimer();

std::string solutionstatus = "-";

Expand Down Expand Up @@ -649,25 +648,24 @@ void HighsMipSolver::cleanupSolve() {
" %.12g (row viol.)\n",
solution_objective_, bound_violation_, integrality_violation_,
row_violation_);
highsLogUser(options_mip_->log_options, HighsLogType::kInfo,
" Timing %.2f (total)\n"
" %.2f (presolve)\n"
" %.2f (solve)\n"
" %.2f (postsolve)\n"
" Nodes %llu\n"
" LP iterations %llu (total)\n"
" %llu (strong br.)\n"
" %llu (separation)\n"
" %llu (heuristics)\n",
timer_.read(timer_.total_clock),
timer_.read(timer_.presolve_clock),
timer_.read(timer_.solve_clock),
timer_.read(timer_.postsolve_clock),
(long long unsigned)mipdata_->num_nodes,
(long long unsigned)mipdata_->total_lp_iterations,
(long long unsigned)mipdata_->sb_lp_iterations,
(long long unsigned)mipdata_->sepa_lp_iterations,
(long long unsigned)mipdata_->heuristic_lp_iterations);
highsLogUser(
options_mip_->log_options, HighsLogType::kInfo,
" Timing %.2f (total)\n"
" %.2f (presolve)\n"
" %.2f (solve)\n"
" %.2f (postsolve)\n"
" Nodes %llu\n"
" LP iterations %llu (total)\n"
" %llu (strong br.)\n"
" %llu (separation)\n"
" %llu (heuristics)\n",
timer_.read(timer_.total_clock), timer_.read(timer_.presolve_clock),
timer_.read(timer_.solve_clock), timer_.read(timer_.postsolve_clock),
(long long unsigned)mipdata_->num_nodes,
(long long unsigned)mipdata_->total_lp_iterations,
(long long unsigned)mipdata_->sb_lp_iterations,
(long long unsigned)mipdata_->sepa_lp_iterations,
(long long unsigned)mipdata_->heuristic_lp_iterations);

assert(modelstatus_ != HighsModelStatus::kNotset);
}
Expand Down
16 changes: 6 additions & 10 deletions src/presolve/HPresolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4256,10 +4256,10 @@ HPresolve::Result HPresolve::presolve(HighsPostsolveStack& postsolve_stack) {
HighsInt numNonz = Avalue.size() - freeslots.size();
#ifndef NDEBUG
std::string time_str =
" " + std::to_string(this->timer->read(run_clock)) + "s";
" " + std::to_string(this->timer->readRunHighsClock()) + "s";
#else
std::string time_str =
" " + std::to_string(int(this->timer->read(run_clock))) + "s";
" " + std::to_string(int(this->timer->readRunHighsClock())) + "s";
#endif
highsLogUser(options->log_options, HighsLogType::kInfo,
"%" HIGHSINT_FORMAT " rows, %" HIGHSINT_FORMAT
Expand All @@ -4268,13 +4268,11 @@ HPresolve::Result HPresolve::presolve(HighsPostsolveStack& postsolve_stack) {
}
};

// Need to check for time-out in checkLimits. However, when
// presolve is called from the MIP solver timer->solve_clock is
// running, and when presolve is called before the LP solver, the
// HighsClock is running. So have to set run_clock accordingly.
// Need to check for time-out in checkLimits, so make sure that
// the timer is well defined, and that its total time clock is
// running
assert(this->timer);
assert(this->timer->runningRunHighsClock());
if (this->timer->runningRunHighsClock()) run_clock = timer->run_highs_clock;

HPRESOLVE_CHECKED_CALL(initialRowAndColPresolve(postsolve_stack));

Expand Down Expand Up @@ -4482,10 +4480,8 @@ HPresolve::Result HPresolve::checkLimits(HighsPostsolveStack& postsolve_stack) {

if ((numreductions & 1023u) == 0) {
assert(timer);
assert(run_clock >= 0);
if (timer->read(run_clock) >= options->time_limit) {
if (timer->readRunHighsClock() >= options->time_limit)
return Result::kStopped;
}
}
return numreductions >= reductionLimit ? Result::kStopped : Result::kOk;
}
Expand Down
1 change: 0 additions & 1 deletion src/presolve/HPresolve.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class HPresolve {
HighsTimer* timer;
HighsMipSolver* mipsolver = nullptr;
double primal_feastol;
HighsInt run_clock = -1;

// triplet storage
std::vector<double> Avalue;
Expand Down

0 comments on commit f321644

Please sign in to comment.