Skip to content

Commit 8a31680

Browse files
committed
cleaned up noise from MIP Solving report
1 parent 22aebcf commit 8a31680

File tree

7 files changed

+57
-47
lines changed

7 files changed

+57
-47
lines changed

check/TestPresolve.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,4 +838,3 @@ TEST_CASE("presolve-egout-ac", "[highs_test_presolve]") {
838838

839839
h.resetGlobalScheduler(true);
840840
}
841-

highs/lp_data/Highs.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,8 @@ HighsStatus Highs::presolve() {
874874
}
875875

876876
bool using_reduced_lp = false;
877-
reportPresolveReductions(log_options, model_presolve_status_, model_.lp_, presolve_.getReducedProblem());
877+
reportPresolveReductions(log_options, model_presolve_status_, model_.lp_,
878+
presolve_.getReducedProblem());
878879
switch (model_presolve_status_) {
879880
case HighsPresolveStatus::kNotPresolved: {
880881
// Shouldn't happen
@@ -929,8 +930,7 @@ HighsStatus Highs::presolve() {
929930
presolved_model_.lp_.setMatrixDimensions();
930931
}
931932

932-
highsLogUser(log_options, HighsLogType::kInfo,
933-
"Presolve status: %s\n",
933+
highsLogUser(log_options, HighsLogType::kInfo, "Presolve status: %s\n",
934934
presolveStatusToString(model_presolve_status_).c_str());
935935
return returnFromHighs(return_status);
936936
}
@@ -1403,8 +1403,8 @@ HighsStatus Highs::optimizeModel() {
14031403
// if PDLP is used to clean up after postsolve
14041404
HighsInt presolved_lp_pdlp_iteration_count = 0;
14051405
// Log the presolve reductions
1406-
reportPresolveReductions(log_options, model_presolve_status_,
1407-
incumbent_lp, presolve_.getReducedProblem());
1406+
reportPresolveReductions(log_options, model_presolve_status_, incumbent_lp,
1407+
presolve_.getReducedProblem());
14081408
switch (model_presolve_status_) {
14091409
case HighsPresolveStatus::kNotPresolved: {
14101410
ekk_instance_.lp_name_ = "Original LP";

highs/lp_data/HighsLpUtils.cpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2959,21 +2959,21 @@ bool isMatrixDataNull(const HighsLogOptions& log_options,
29592959
}
29602960

29612961
void reportPresolveReductions(const HighsLogOptions& log_options,
2962-
HighsPresolveStatus presolve_status,
2963-
const HighsLp& lp,
2964-
const HighsLp& presolved_lp) {
2962+
HighsPresolveStatus presolve_status,
2963+
const HighsLp& lp, const HighsLp& presolved_lp) {
29652964
const HighsInt num_col_from = lp.num_col_;
29662965
const HighsInt num_row_from = lp.num_row_;
29672966
const HighsInt num_nz_from = lp.a_matrix_.numNz();
29682967
HighsInt num_col_to = 0;
29692968
HighsInt num_row_to = 0;
29702969
HighsInt num_nz_to = 0;
29712970
std::string message = "";
2972-
2971+
29732972
switch (presolve_status) {
2974-
case HighsPresolveStatus::kNotPresolved:
2973+
case HighsPresolveStatus::kNotPresolved:
29752974
case HighsPresolveStatus::kInfeasible:
2976-
case HighsPresolveStatus::kUnboundedOrInfeasible: return;
2975+
case HighsPresolveStatus::kUnboundedOrInfeasible:
2976+
return;
29772977
case HighsPresolveStatus::kNotReduced: {
29782978
num_col_to = num_col_from;
29792979
num_row_to = num_row_from;
@@ -2986,7 +2986,8 @@ void reportPresolveReductions(const HighsLogOptions& log_options,
29862986
num_col_to = presolved_lp.num_col_;
29872987
num_row_to = presolved_lp.num_row_;
29882988
num_nz_to = presolved_lp.a_matrix_.numNz();
2989-
message = presolve_status == HighsPresolveStatus::kTimeout ? "- Timeout" : "";
2989+
message =
2990+
presolve_status == HighsPresolveStatus::kTimeout ? "- Timeout" : "";
29902991
break;
29912992
}
29922993
case HighsPresolveStatus::kReducedToEmpty: {
@@ -3008,14 +3009,15 @@ void reportPresolveReductions(const HighsLogOptions& log_options,
30083009
delta_nz = -delta_nz;
30093010
nz_sign_char = '+';
30103011
}
3011-
highsLogUser(
3012-
log_options, HighsLogType::kInfo,
3013-
"Presolve reductions: rows %" HIGHSINT_FORMAT "(-%" HIGHSINT_FORMAT
3014-
"); columns %" HIGHSINT_FORMAT "(-%" HIGHSINT_FORMAT
3015-
"); "
3016-
"nonzeros %" HIGHSINT_FORMAT "(%c%" HIGHSINT_FORMAT ") %s\n",
3017-
num_row_to, (num_row_from - num_row_to), num_col_to,
3018-
(num_col_from - num_col_to), num_nz_to, nz_sign_char, delta_nz, message.c_str());
3012+
highsLogUser(log_options, HighsLogType::kInfo,
3013+
"Presolve reductions: rows %" HIGHSINT_FORMAT
3014+
"(-%" HIGHSINT_FORMAT "); columns %" HIGHSINT_FORMAT
3015+
"(-%" HIGHSINT_FORMAT
3016+
"); "
3017+
"nonzeros %" HIGHSINT_FORMAT "(%c%" HIGHSINT_FORMAT ") %s\n",
3018+
num_row_to, (num_row_from - num_row_to), num_col_to,
3019+
(num_col_from - num_col_to), num_nz_to, nz_sign_char, delta_nz,
3020+
message.c_str());
30193021
}
30203022

30213023
bool isLessInfeasibleDSECandidate(const HighsLogOptions& log_options,

highs/lp_data/HighsLpUtils.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,8 @@ bool isMatrixDataNull(const HighsLogOptions& log_options,
260260
const double* usr_matrix_value);
261261

262262
void reportPresolveReductions(const HighsLogOptions& log_options,
263-
HighsPresolveStatus presolve_status,
264-
const HighsLp& lp,
265-
const HighsLp& presolved_lp);
263+
HighsPresolveStatus presolve_status,
264+
const HighsLp& lp, const HighsLp& presolved_lp);
266265

267266
bool isLessInfeasibleDSECandidate(const HighsLogOptions& log_options,
268267
const HighsLp& lp);

highs/mip/HighsMipSolver.cpp

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void HighsMipSolver::run() {
9696
mipdata_->runMipPresolve(options_mip_->presolve_reduction_limit);
9797
analysis_.mipTimerStop(kMipClockRunPresolve);
9898
analysis_.mipTimerStop(kMipClockPresolve);
99-
99+
100100
if (analysis_.analyse_mip_time && !submip)
101101
highsLogUser(options_mip_->log_options, HighsLogType::kInfo,
102102
"MIP-Timing: %11.2g - completed presolve\n", timer_.read());
@@ -832,27 +832,37 @@ void HighsMipSolver::cleanupSolve() {
832832
" %.12g (row viol.)\n",
833833
solution_objective_, bound_violation_, integrality_violation_,
834834
row_violation_);
835-
if (!timeless_log)
835+
if (!timeless_log) {
836836
highsLogUser(options_mip_->log_options, HighsLogType::kInfo,
837-
" Timing %.2f (total)\n"
838-
" %.2f (presolve)\n"
839-
" %.2f (solve)\n"
840-
" %.2f (postsolve)\n",
841-
timer_.read(), analysis_.mipTimerRead(kMipClockPresolve),
842-
analysis_.mipTimerRead(kMipClockSolve),
843-
analysis_.mipTimerRead(kMipClockPostsolve));
837+
" Timing %.2f\n", timer_.read());
838+
if (analysis_.analyse_mip_time)
839+
highsLogUser(options_mip_->log_options, HighsLogType::kInfo,
840+
" %.2f (presolve)\n"
841+
" %.2f (solve)\n"
842+
" %.2f (postsolve)\n",
843+
analysis_.mipTimerRead(kMipClockPresolve),
844+
analysis_.mipTimerRead(kMipClockSolve),
845+
analysis_.mipTimerRead(kMipClockPostsolve));
846+
}
844847
highsLogUser(options_mip_->log_options, HighsLogType::kInfo,
845848
" Max sub-MIP depth %d\n"
846-
" Nodes %llu\n"
847-
" Repair LPs %llu (%llu feasible; %llu iterations)\n"
848-
" LP iterations %llu (total)\n"
849+
" Nodes %llu\n",
850+
int(max_submip_level), (long long unsigned)mipdata_->num_nodes);
851+
if (mipdata_->total_repair_lp) {
852+
highsLogUser(options_mip_->log_options, HighsLogType::kInfo,
853+
" Repair LPs %llu (%llu feasible; %llu iterations)\n",
854+
(long long unsigned)mipdata_->total_repair_lp,
855+
(long long unsigned)mipdata_->total_repair_lp_feasible,
856+
(long long unsigned)mipdata_->total_repair_lp_iterations);
857+
} else {
858+
highsLogUser(options_mip_->log_options, HighsLogType::kInfo,
859+
" Repair LPs 0\n");
860+
}
861+
highsLogUser(options_mip_->log_options, HighsLogType::kInfo,
862+
" LP iterations %llu\n"
849863
" %llu (strong br.)\n"
850864
" %llu (separation)\n"
851865
" %llu (heuristics)\n",
852-
int(max_submip_level), (long long unsigned)mipdata_->num_nodes,
853-
(long long unsigned)mipdata_->total_repair_lp,
854-
(long long unsigned)mipdata_->total_repair_lp_feasible,
855-
(long long unsigned)mipdata_->total_repair_lp_iterations,
856866
(long long unsigned)mipdata_->total_lp_iterations,
857867
(long long unsigned)mipdata_->sb_lp_iterations,
858868
(long long unsigned)mipdata_->sepa_lp_iterations,

highs/mip/HighsMipSolverData.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,8 @@ void HighsMipSolverData::init() {
692692
dispfreq = 100;
693693
}
694694

695-
void HighsMipSolverData::runMipPresolve(const HighsInt presolve_reduction_limit) {
695+
void HighsMipSolverData::runMipPresolve(
696+
const HighsInt presolve_reduction_limit) {
696697
mipsolver.timer_.start(mipsolver.timer_.presolve_clock);
697698
presolve::HPresolve presolve;
698699
if (!presolve.okSetInput(mipsolver, presolve_reduction_limit)) {
@@ -704,10 +705,8 @@ void HighsMipSolverData::runMipPresolve(const HighsInt presolve_reduction_limit)
704705
}
705706
mipsolver.timer_.stop(mipsolver.timer_.presolve_clock);
706707

707-
reportPresolveReductions(mipsolver.options_mip_->log_options,
708-
presolve_status,
709-
*mipsolver.orig_model_,
710-
*mipsolver.model_);
708+
reportPresolveReductions(mipsolver.options_mip_->log_options, presolve_status,
709+
*mipsolver.orig_model_, *mipsolver.model_);
711710
}
712711

713712
void HighsMipSolverData::runSetup() {

highs/presolve/HPresolve.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4881,7 +4881,7 @@ HighsModelStatus HPresolve::run(HighsPostsolveStack& postsolve_stack) {
48814881
// An LP with no columns must have no rows, unless the reduction
48824882
// limit has been reached. As exposed when studying 2326
48834883
const bool num_row_ok = model->num_row_ == 0 ||
4884-
postsolve_stack.numReductions() >= reductionLimit;
4884+
postsolve_stack.numReductions() >= reductionLimit;
48854885
assert(num_row_ok);
48864886
if (!num_row_ok) {
48874887
presolve_status_ = HighsPresolveStatus::kNotPresolved;
@@ -4891,7 +4891,8 @@ HighsModelStatus HPresolve::run(HighsPostsolveStack& postsolve_stack) {
48914891
presolve_status_ = HighsPresolveStatus::kReducedToEmpty;
48924892
// Make sure that zero row activity from the columnless model is
48934893
// consistent with the bounds
4894-
return zeroRowActivityFeasible() ? HighsModelStatus::kOptimal : HighsModelStatus::kInfeasible;
4894+
return zeroRowActivityFeasible() ? HighsModelStatus::kOptimal
4895+
: HighsModelStatus::kInfeasible;
48954896
} else if (postsolve_stack.numReductions() > 0) {
48964897
// Reductions performed
48974898
presolve_status_ = HighsPresolveStatus::kReduced;

0 commit comments

Comments
 (0)