From cbf36eaad4c2da8451dfb6535cadc7fd44da3c31 Mon Sep 17 00:00:00 2001 From: JAJHall Date: Mon, 4 Nov 2024 12:02:06 +0000 Subject: [PATCH] highs_analysis_level default reset to zero --- src/lp_data/HighsOptions.h | 10 ++++------ src/mip/HighsLpRelaxation.cpp | 6 ++++-- src/mip/HighsMipAnalysis.cpp | 1 - src/mip/HighsMipSolver.cpp | 5 ++--- src/mip/HighsMipSolverData.cpp | 5 +++-- src/mip/HighsMipSolverData.h | 6 ++++-- src/mip/HighsPrimalHeuristics.cpp | 18 ++++++++++++------ src/mip/HighsPrimalHeuristics.h | 6 ++++-- src/mip/HighsSearch.cpp | 9 ++++++--- src/presolve/HPresolve.cpp | 6 ++---- src/util/HighsTimer.h | 17 ++++++++++------- 11 files changed, 51 insertions(+), 38 deletions(-) diff --git a/src/lp_data/HighsOptions.h b/src/lp_data/HighsOptions.h index 55e6a28afe..b6513c683a 100644 --- a/src/lp_data/HighsOptions.h +++ b/src/lp_data/HighsOptions.h @@ -742,12 +742,10 @@ class HighsOptions : public HighsOptionsStruct { kHighsDebugLevelMin, kHighsDebugLevelMax); records.push_back(record_int); - record_int = - new OptionRecordInt("highs_analysis_level", "Analysis level in HiGHS", - now_advanced, &highs_analysis_level, - kHighsAnalysisLevelMin, kHighsAnalysisLevelMipTime, - // kHighsAnalysisLevelMin, - kHighsAnalysisLevelMax); + record_int = new OptionRecordInt( + "highs_analysis_level", "Analysis level in HiGHS", now_advanced, + &highs_analysis_level, kHighsAnalysisLevelMin, kHighsAnalysisLevelMin, + kHighsAnalysisLevelMax); records.push_back(record_int); record_int = new OptionRecordInt( diff --git a/src/mip/HighsLpRelaxation.cpp b/src/mip/HighsLpRelaxation.cpp index 6e51ab4400..4288f99437 100644 --- a/src/mip/HighsLpRelaxation.cpp +++ b/src/mip/HighsLpRelaxation.cpp @@ -1174,7 +1174,8 @@ HighsLpRelaxation::Status HighsLpRelaxation::run(bool resolve_on_error) { "HighsLpRelaxation::run LP is unbounded with no basis, " "but not returning Status::kError\n"); if (info.primal_solution_status == kSolutionStatusFeasible) - mipsolver.mipdata_->trySolution(lpsolver.getSolution().col_value, kSolutionSourceUnbounded); + mipsolver.mipdata_->trySolution(lpsolver.getSolution().col_value, + kSolutionSourceUnbounded); return Status::kUnbounded; case HighsModelStatus::kUnknown: @@ -1394,7 +1395,8 @@ HighsLpRelaxation::Status HighsLpRelaxation::resolveLp(HighsDomain* domain) { for (HighsInt i = 0; i != mipsolver.numCol(); ++i) objsum += roundsol[i] * mipsolver.colCost(i); - mipsolver.mipdata_->addIncumbent(roundsol, double(objsum), kSolutionSourceSolveLp); + mipsolver.mipdata_->addIncumbent(roundsol, double(objsum), + kSolutionSourceSolveLp); objsum = 0; } diff --git a/src/mip/HighsMipAnalysis.cpp b/src/mip/HighsMipAnalysis.cpp index 90a8bdb043..0c668649d7 100644 --- a/src/mip/HighsMipAnalysis.cpp +++ b/src/mip/HighsMipAnalysis.cpp @@ -26,7 +26,6 @@ void HighsMipAnalysis::setup(const HighsLp& lp, const HighsOptions& options) { void HighsMipAnalysis::setupMipTime(const HighsOptions& options) { analyse_mip_time = kHighsAnalysisLevelMipTime & options.highs_analysis_level; - assert(analyse_mip_time); if (analyse_mip_time) { HighsTimerClock clock; clock.timer_pointer_ = timer_; diff --git a/src/mip/HighsMipSolver.cpp b/src/mip/HighsMipSolver.cpp index fb783044a9..4c46348b14 100644 --- a/src/mip/HighsMipSolver.cpp +++ b/src/mip/HighsMipSolver.cpp @@ -185,7 +185,7 @@ void HighsMipSolver::run() { // Sometimes the analytic centre calculation is not completed when // evaluateRootNode returns, so stop its clock if it's running if (analysis_.analyse_mip_time && - analysis_.mipTimerRunning(kMipClockIpmSolveLp)) + analysis_.mipTimerRunning(kMipClockIpmSolveLp)) analysis_.mipTimerStop(kMipClockIpmSolveLp); if (analysis_.analyse_mip_time & !submip) highsLogUser(options_mip_->log_options, HighsLogType::kInfo, @@ -732,8 +732,7 @@ void HighsMipSolver::cleanupSolve() { analysis_.mipTimerRead(kMipClockPresolve), analysis_.mipTimerRead(kMipClockSolve), analysis_.mipTimerRead(kMipClockPostsolve), - int(max_submip_level), - (long long unsigned)mipdata_->num_nodes, + 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, (long long unsigned)mipdata_->total_repair_lp_iterations, diff --git a/src/mip/HighsMipSolverData.cpp b/src/mip/HighsMipSolverData.cpp index 11a4ea9d14..4cd73949ab 100644 --- a/src/mip/HighsMipSolverData.cpp +++ b/src/mip/HighsMipSolverData.cpp @@ -548,7 +548,8 @@ void HighsMipSolverData::runSetup() { } } - if (mipsolver.numCol() == 0) addIncumbent(std::vector(), 0, kSolutionSourceEmptyMip); + if (mipsolver.numCol() == 0) + addIncumbent(std::vector(), 0, kSolutionSourceEmptyMip); redcostfixing = HighsRedcostFixing(); pseudocost = HighsPseudocost(mipsolver); @@ -2104,7 +2105,7 @@ bool HighsMipSolverData::checkLimits(int64_t nodeOffset) const { // printf("checkLimits: time = %g\n", time); if (options.time_limit < kHighsInf && mipsolver.timer_.read(mipsolver.timer_.total_clock) >= - options.time_limit) { + options.time_limit) { if (mipsolver.modelstatus_ == HighsModelStatus::kNotset) { highsLogDev(options.log_options, HighsLogType::kInfo, "Reached time limit\n"); diff --git a/src/mip/HighsMipSolverData.h b/src/mip/HighsMipSolverData.h index 99ad2c657a..c50ff5f1a2 100644 --- a/src/mip/HighsMipSolverData.h +++ b/src/mip/HighsMipSolverData.h @@ -232,12 +232,14 @@ struct HighsMipSolverData { double percentageInactiveIntegers() const; void performRestart(); bool checkSolution(const std::vector& solution) const; - bool trySolution(const std::vector& solution, const int solution_source = kSolutionSourceNone); + bool trySolution(const std::vector& solution, + const int solution_source = kSolutionSourceNone); bool rootSeparationRound(HighsSeparation& sepa, HighsInt& ncuts, HighsLpRelaxation::Status& status); HighsLpRelaxation::Status evaluateRootLp(); void evaluateRootNode(); - bool addIncumbent(const std::vector& sol, double solobj, const int solution_source, + bool addIncumbent(const std::vector& sol, double solobj, + const int solution_source, const bool print_display_line = true); const std::vector& getSolution() const; diff --git a/src/mip/HighsPrimalHeuristics.cpp b/src/mip/HighsPrimalHeuristics.cpp index 359b533402..4a306c09b8 100644 --- a/src/mip/HighsPrimalHeuristics.cpp +++ b/src/mip/HighsPrimalHeuristics.cpp @@ -176,7 +176,8 @@ bool HighsPrimalHeuristics::solveSubMip( HighsInt oldNumImprovingSols = mipsolver.mipdata_->numImprovingSols; if (submipsolver.modelstatus_ != HighsModelStatus::kInfeasible && !submipsolver.solution_.empty()) { - mipsolver.mipdata_->trySolution(submipsolver.solution_, kSolutionSourceSubMip); + mipsolver.mipdata_->trySolution(submipsolver.solution_, + kSolutionSourceSubMip); } if (mipsolver.mipdata_->numImprovingSols != oldNumImprovingSols) { @@ -1023,7 +1024,8 @@ void HighsPrimalHeuristics::randomizedRounding( lprelax.getLpSolver().getSolution().col_value, lprelax.getObjective(), kSolutionSourceRandomizedRounding); } else { - mipsolver.mipdata_->trySolution(localdom.col_lower_, kSolutionSourceRandomizedRounding); + mipsolver.mipdata_->trySolution(localdom.col_lower_, + kSolutionSourceRandomizedRounding); } } @@ -1100,7 +1102,8 @@ void HighsPrimalHeuristics::feasibilityPump() { if (havecycle) return; - if (linesearchRounding(lpsol, roundedsol, kSolutionSourceFeasibilityPump)) return; + if (linesearchRounding(lpsol, roundedsol, kSolutionSourceFeasibilityPump)) + return; if (lprelax.getNumLpIterations() >= 1000 + mipsolver.mipdata_->avgrootlpiters * 5) @@ -1139,13 +1142,16 @@ void HighsPrimalHeuristics::centralRounding() { if (!mipsolver.mipdata_->firstlpsol.empty()) linesearchRounding(mipsolver.mipdata_->firstlpsol, - mipsolver.mipdata_->analyticCenter, kSolutionSourceCentralRounding); + mipsolver.mipdata_->analyticCenter, + kSolutionSourceCentralRounding); else if (!mipsolver.mipdata_->rootlpsol.empty()) linesearchRounding(mipsolver.mipdata_->rootlpsol, - mipsolver.mipdata_->analyticCenter, kSolutionSourceCentralRounding); + mipsolver.mipdata_->analyticCenter, + kSolutionSourceCentralRounding); else linesearchRounding(mipsolver.mipdata_->analyticCenter, - mipsolver.mipdata_->analyticCenter, kSolutionSourceCentralRounding); + mipsolver.mipdata_->analyticCenter, + kSolutionSourceCentralRounding); } #if 0 diff --git a/src/mip/HighsPrimalHeuristics.h b/src/mip/HighsPrimalHeuristics.h index f5e41e29fa..87d404ec72 100644 --- a/src/mip/HighsPrimalHeuristics.h +++ b/src/mip/HighsPrimalHeuristics.h @@ -60,10 +60,12 @@ class HighsPrimalHeuristics { void flushStatistics(); - bool tryRoundedPoint(const std::vector& point, const int solution_source); + bool tryRoundedPoint(const std::vector& point, + const int solution_source); bool linesearchRounding(const std::vector& point1, - const std::vector& point2, const int solution_source); + const std::vector& point2, + const int solution_source); void randomizedRounding(const std::vector& relaxationsol); }; diff --git a/src/mip/HighsSearch.cpp b/src/mip/HighsSearch.cpp index 5a5485e2f1..fe32e772a9 100644 --- a/src/mip/HighsSearch.cpp +++ b/src/mip/HighsSearch.cpp @@ -599,7 +599,8 @@ HighsInt HighsSearch::selectBranchingCandidate(int64_t maxSbIters, double cutoffbnd = getCutoffBound(); mipsolver.mipdata_->addIncumbent( lp->getLpSolver().getSolution().col_value, solobj, - inheuristic ? kSolutionSourceHeuristic : kSolutionSourceBranching); + inheuristic ? kSolutionSourceHeuristic + : kSolutionSourceBranching); if (mipsolver.mipdata_->upper_limit < cutoffbnd) lp->setObjectiveLimit(mipsolver.mipdata_->upper_limit); @@ -732,7 +733,8 @@ HighsInt HighsSearch::selectBranchingCandidate(int64_t maxSbIters, double cutoffbnd = getCutoffBound(); mipsolver.mipdata_->addIncumbent( lp->getLpSolver().getSolution().col_value, solobj, - inheuristic ? kSolutionSourceHeuristic : kSolutionSourceBranching); + inheuristic ? kSolutionSourceHeuristic + : kSolutionSourceBranching); if (mipsolver.mipdata_->upper_limit < cutoffbnd) lp->setObjectiveLimit(mipsolver.mipdata_->upper_limit); @@ -1062,7 +1064,8 @@ HighsSearch::NodeResult HighsSearch::evaluateNode() { double cutoffbnd = getCutoffBound(); mipsolver.mipdata_->addIncumbent( lp->getLpSolver().getSolution().col_value, lp->getObjective(), - inheuristic ? kSolutionSourceHeuristic : kSolutionSourceEvaluateNode); + inheuristic ? kSolutionSourceHeuristic + : kSolutionSourceEvaluateNode); if (mipsolver.mipdata_->upper_limit < cutoffbnd) lp->setObjectiveLimit(mipsolver.mipdata_->upper_limit); diff --git a/src/presolve/HPresolve.cpp b/src/presolve/HPresolve.cpp index ac0599b98e..d588210a76 100644 --- a/src/presolve/HPresolve.cpp +++ b/src/presolve/HPresolve.cpp @@ -4141,8 +4141,7 @@ HPresolve::Result HPresolve::presolve(HighsPostsolveStack& postsolve_stack) { HighsInt numRow = model->num_row_ - numDeletedRows; HighsInt numNonz = Avalue.size() - freeslots.size(); // Only read the run time if it's to be printed - const double run_time = - options->output_flag ? this->timer->read() : 0; + const double run_time = options->output_flag ? this->timer->read() : 0; #ifndef NDEBUG std::string time_str = " " + std::to_string(run_time) + "s"; #else @@ -4325,8 +4324,7 @@ HPresolve::Result HPresolve::presolve(HighsPostsolveStack& postsolve_stack) { HPresolve::Result HPresolve::checkTimeLimit() { assert(timer); - if (options->time_limit < kHighsInf && - timer->read() >= options->time_limit) + if (options->time_limit < kHighsInf && timer->read() >= options->time_limit) return Result::kStopped; return Result::kOk; } diff --git a/src/util/HighsTimer.h b/src/util/HighsTimer.h index 4de2a62602..d6734e990e 100644 --- a/src/util/HighsTimer.h +++ b/src/util/HighsTimer.h @@ -145,7 +145,8 @@ class HighsTimer { // understand this better, for now don't assert that this clock // has stopped if (!clock_stopped) { - printf("Clock %d - %s - still running\n", int(i_clock), clock_names[i_clock].c_str()); + printf("Clock %d - %s - still running\n", int(i_clock), + clock_names[i_clock].c_str()); } assert(clock_stopped); } @@ -169,7 +170,8 @@ class HighsTimer { // -getWallTime() <= 0 const bool clock_stopped = clock_start[i_clock] > 0; if (clock_stopped) { - printf("Clock %d - %s - not running\n", int(i_clock), clock_names[i_clock].c_str()); + printf("Clock %d - %s - not running\n", int(i_clock), + clock_names[i_clock].c_str()); } assert(!clock_stopped); double wall_time = getWallTime(); @@ -180,7 +182,7 @@ class HighsTimer { // stopped when it's next started if (i_clock == check_clock) { printf("HighsTimer: stopping clock %d: %s\n", int(check_clock), - this->clock_names[check_clock].c_str()); + this->clock_names[check_clock].c_str()); } clock_start[i_clock] = wall_time; } @@ -217,9 +219,9 @@ class HighsTimer { assert(i_clock >= 0); assert(i_clock < num_clock); if (i_clock == check_clock) { - printf("HighsTimer: querying clock %d: %s - with start record %g\n", int(check_clock), - this->clock_names[check_clock].c_str(), - clock_start[i_clock]); + printf("HighsTimer: querying clock %d: %s - with start record %g\n", + int(check_clock), this->clock_names[check_clock].c_str(), + clock_start[i_clock]); } return clock_start[i_clock] < 0; } @@ -283,7 +285,8 @@ class HighsTimer { // getWallTime() >= 0 (or initialised to initial_clock_start > 0) const bool clock_stopped = clock_start[iClock] > 0; if (!clock_stopped) { - printf("Clock %d - %s - still running\n", int(iClock), clock_names[iClock].c_str()); + printf("Clock %d - %s - still running\n", int(iClock), + clock_names[iClock].c_str()); } assert(clock_stopped); sum_calls += clock_num_call[iClock];