Skip to content

Commit

Permalink
highs_analysis_level default reset to zero
Browse files Browse the repository at this point in the history
  • Loading branch information
jajhall committed Nov 4, 2024
1 parent 9cb35ae commit cbf36ea
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 38 deletions.
10 changes: 4 additions & 6 deletions src/lp_data/HighsOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 4 additions & 2 deletions src/mip/HighsLpRelaxation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 0 additions & 1 deletion src/mip/HighsMipAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down
5 changes: 2 additions & 3 deletions src/mip/HighsMipSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions src/mip/HighsMipSolverData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,8 @@ void HighsMipSolverData::runSetup() {
}
}

if (mipsolver.numCol() == 0) addIncumbent(std::vector<double>(), 0, kSolutionSourceEmptyMip);
if (mipsolver.numCol() == 0)
addIncumbent(std::vector<double>(), 0, kSolutionSourceEmptyMip);

redcostfixing = HighsRedcostFixing();
pseudocost = HighsPseudocost(mipsolver);
Expand Down Expand Up @@ -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");
Expand Down
6 changes: 4 additions & 2 deletions src/mip/HighsMipSolverData.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,14 @@ struct HighsMipSolverData {
double percentageInactiveIntegers() const;
void performRestart();
bool checkSolution(const std::vector<double>& solution) const;
bool trySolution(const std::vector<double>& solution, const int solution_source = kSolutionSourceNone);
bool trySolution(const std::vector<double>& 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<double>& sol, double solobj, const int solution_source,
bool addIncumbent(const std::vector<double>& sol, double solobj,
const int solution_source,
const bool print_display_line = true);

const std::vector<double>& getSolution() const;
Expand Down
18 changes: 12 additions & 6 deletions src/mip/HighsPrimalHeuristics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/mip/HighsPrimalHeuristics.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ class HighsPrimalHeuristics {

void flushStatistics();

bool tryRoundedPoint(const std::vector<double>& point, const int solution_source);
bool tryRoundedPoint(const std::vector<double>& point,
const int solution_source);

bool linesearchRounding(const std::vector<double>& point1,
const std::vector<double>& point2, const int solution_source);
const std::vector<double>& point2,
const int solution_source);

void randomizedRounding(const std::vector<double>& relaxationsol);
};
Expand Down
9 changes: 6 additions & 3 deletions src/mip/HighsSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down
6 changes: 2 additions & 4 deletions src/presolve/HPresolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
17 changes: 10 additions & 7 deletions src/util/HighsTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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();
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit cbf36ea

Please sign in to comment.