diff --git a/check/TestMipSolver.cpp b/check/TestMipSolver.cpp index cfbe1ffbf2..ecb3502316 100644 --- a/check/TestMipSolver.cpp +++ b/check/TestMipSolver.cpp @@ -679,16 +679,16 @@ TEST_CASE("IP-infeasible-unbounded", "[highs_test_mip_solver]") { highs.run(); HighsModelStatus required_model_status; if (k == 0) { - // Presolve off + // Presolve off if (l == 0) { - // MIP solver proves infeasiblilty + // MIP solver proves infeasiblilty required_model_status = HighsModelStatus::kInfeasible; } else { - // Relaxation is unbounded, but origin is feasible + // Relaxation is unbounded, but origin is feasible required_model_status = HighsModelStatus::kUnbounded; } } else { - // Presolve on, and identifies primal infeasible or unbounded + // Presolve on, and identifies primal infeasible or unbounded required_model_status = HighsModelStatus::kUnboundedOrInfeasible; } REQUIRE(highs.getModelStatus() == required_model_status); diff --git a/src/lp_data/HighsOptions.h b/src/lp_data/HighsOptions.h index dc4ef81266..e1051b9930 100644 --- a/src/lp_data/HighsOptions.h +++ b/src/lp_data/HighsOptions.h @@ -746,7 +746,8 @@ class HighsOptions : public HighsOptionsStruct { record_int = new OptionRecordInt( "highs_analysis_level", "Analysis level in HiGHS", now_advanced, - &highs_analysis_level, kHighsAnalysisLevelMin, kHighsAnalysisLevelMipTime, //kHighsAnalysisLevelMin, + &highs_analysis_level, kHighsAnalysisLevelMin, + kHighsAnalysisLevelMipTime, // kHighsAnalysisLevelMin, kHighsAnalysisLevelMax); records.push_back(record_int); diff --git a/src/mip/HighsMipAnalysis.cpp b/src/mip/HighsMipAnalysis.cpp index 1e22c1d618..6c748587d0 100644 --- a/src/mip/HighsMipAnalysis.cpp +++ b/src/mip/HighsMipAnalysis.cpp @@ -147,9 +147,9 @@ void HighsMipAnalysis::reportMipTimer() { mip_timer.reportMipLevel1Clock(mip_clocks); // mip_timer.reportMipSolveLpClock(mip_clocks); // mip_timer.reportMipPresolveClock(mip_clocks); - mip_timer.reportMipSearchClock(mip_clocks); - mip_timer.reportMipDiveClock(mip_clocks); - mip_timer.reportMipNodeSearchClock(mip_clocks); + mip_timer.reportMipSearchClock(mip_clocks); + mip_timer.reportMipDiveClock(mip_clocks); + mip_timer.reportMipNodeSearchClock(mip_clocks); // mip_timer.reportMipPrimalHeuristicsClock(mip_clocks); // mip_timer.reportMipEvaluateRootNodeClock(mip_clocks); // mip_timer.reportMipSeparationClock(mip_clocks); diff --git a/src/mip/HighsMipSolver.cpp b/src/mip/HighsMipSolver.cpp index f61a68dc34..05cd95df9d 100644 --- a/src/mip/HighsMipSolver.cpp +++ b/src/mip/HighsMipSolver.cpp @@ -248,7 +248,7 @@ void HighsMipSolver::run() { // Pops the node corresponding to lowerMin onto the search stack search.installNode(mipdata_->nodequeue.popBestBoundNode()); - + int64_t numStallNodes = 0; int64_t lastLbLeave = 0; int64_t numQueueLeaves = 0; @@ -263,7 +263,8 @@ void HighsMipSolver::run() { while (search.hasNode()) { if (!submip) { if (search_logging) { - printf("\nHighsMipSolver::run() Number of active nodes %d\n", int(mipdata_->nodequeue.numActiveNodes())); + printf("\nHighsMipSolver::run() Number of active nodes %d\n", + int(mipdata_->nodequeue.numActiveNodes())); } } analysis_.mipTimerStart(kMipClockPerformAging1); @@ -335,11 +336,12 @@ void HighsMipSolver::run() { ++mipdata_->num_leaves; - if (!submip) { - if (search_logging) { - // printf("HighsMipSolver::run() Dive nodes %5d; ", int(search.getNnodes())); - } - } + if (!submip) { + if (search_logging) { + // printf("HighsMipSolver::run() Dive nodes %5d; ", + //int(search.getNnodes())); + } + } search.flushStatistics(); } @@ -350,10 +352,11 @@ void HighsMipSolver::run() { HighsInt numPlungeNodes = mipdata_->num_nodes - plungestart; if (!submip) { - if (search_logging) { - const bool plunge_break = numPlungeNodes >= 100; - printf("plunge nodes%3d: break = %s\n", int(numPlungeNodes), highsBoolToString(plunge_break).c_str()); - } + if (search_logging) { + const bool plunge_break = numPlungeNodes >= 100; + printf("plunge nodes%3d: break = %s\n", int(numPlungeNodes), + highsBoolToString(plunge_break).c_str()); + } } if (numPlungeNodes >= 100) break; @@ -549,12 +552,13 @@ void HighsMipSolver::run() { assert(!search.hasNode()); if (!submip) { - if (search_logging) { - printf("HighsMipSolver::run() NodeSearch nodes %5d; numQueueLeaves %5d; " - "lastLbLeave %d; numQueueLeaves - lastLbLeave %d\n", - int(search.getNnodes()), int(numQueueLeaves), - int(lastLbLeave), int(numQueueLeaves-lastLbLeave)); - } + if (search_logging) { + printf( + "HighsMipSolver::run() NodeSearch nodes %5d; numQueueLeaves %5d; " + "lastLbLeave %d; numQueueLeaves - lastLbLeave %d\n", + int(search.getNnodes()), int(numQueueLeaves), int(lastLbLeave), + int(numQueueLeaves - lastLbLeave)); + } } if (numQueueLeaves - lastLbLeave >= 10) { search.installNode(mipdata_->nodequeue.popBestBoundNode()); @@ -590,21 +594,21 @@ void HighsMipSolver::run() { // new global information before we perform separation rounds for the node analysis_.mipTimerStart(kMipClockEvaluateNode1); const HighsSearch::NodeResult evaluate_node_result = - search.evaluateNode(); + search.evaluateNode(); analysis_.mipTimerStop(kMipClockEvaluateNode1); if (evaluate_node_result == HighsSearch::NodeResult::kSubOptimal) { - analysis_.mipTimerStart(kMipClockCurrentNodeToQueue); + analysis_.mipTimerStart(kMipClockCurrentNodeToQueue); search.currentNodeToQueue(mipdata_->nodequeue); - analysis_.mipTimerStop(kMipClockCurrentNodeToQueue); + analysis_.mipTimerStop(kMipClockCurrentNodeToQueue); } - + // if the node was pruned we remove it from the search and install the // next node from the queue analysis_.mipTimerStart(kMipClockNodePrunedLoop); if (search.currentNodePruned()) { - analysis_.mipTimerStart(kMipClockSearchBacktrack); + analysis_.mipTimerStart(kMipClockSearchBacktrack); search.backtrack(); - analysis_.mipTimerStop(kMipClockSearchBacktrack); + analysis_.mipTimerStop(kMipClockSearchBacktrack); ++mipdata_->num_leaves; ++mipdata_->num_nodes; search.flushStatistics(); @@ -626,7 +630,7 @@ void HighsMipSolver::run() { mipdata_->updatePrimalDualIntegral( prev_lower_bound, mipdata_->lower_bound, mipdata_->upper_bound, mipdata_->upper_bound); - analysis_.mipTimerStop(kMipClockNodePrunedLoop); + analysis_.mipTimerStop(kMipClockNodePrunedLoop); break; } @@ -635,7 +639,7 @@ void HighsMipSolver::run() { break; } - analysis_.mipTimerStart(kMipClockStoreBasis); + analysis_.mipTimerStart(kMipClockStoreBasis); double prev_lower_bound = mipdata_->lower_bound; mipdata_->lower_bound = std::min( @@ -663,9 +667,9 @@ void HighsMipSolver::run() { mipdata_->domain.clearChangedCols(); mipdata_->removeFixedIndices(); } - analysis_.mipTimerStop(kMipClockStoreBasis); + analysis_.mipTimerStop(kMipClockStoreBasis); - analysis_.mipTimerStop(kMipClockNodePrunedLoop); + analysis_.mipTimerStop(kMipClockNodePrunedLoop); continue; } analysis_.mipTimerStop(kMipClockNodePrunedLoop); @@ -677,9 +681,9 @@ void HighsMipSolver::run() { if (mipdata_->domain.infeasible()) { search.cutoffNode(); - analysis_.mipTimerStart(kMipClockOpenNodesToQueue1); + analysis_.mipTimerStart(kMipClockOpenNodesToQueue1); search.openNodesToQueue(mipdata_->nodequeue); - analysis_.mipTimerStop(kMipClockOpenNodesToQueue1); + analysis_.mipTimerStop(kMipClockOpenNodesToQueue1); mipdata_->nodequeue.clear(); mipdata_->pruned_treeweight = 1.0; diff --git a/src/mip/HighsSearch.h b/src/mip/HighsSearch.h index 55969bb31b..6fb2a2e2e1 100644 --- a/src/mip/HighsSearch.h +++ b/src/mip/HighsSearch.h @@ -240,7 +240,9 @@ class HighsSearch { void solveDepthFirst(int64_t maxbacktracks = 1); - HighsInt getNnodes() const { return nnodes; } // For parallel-tree-search study + HighsInt getNnodes() const { + return nnodes; + } // For parallel-tree-search study }; #endif diff --git a/src/mip/MipTimer.h b/src/mip/MipTimer.h index 72572d95b1..720ae66912 100644 --- a/src/mip/MipTimer.h +++ b/src/mip/MipTimer.h @@ -70,7 +70,7 @@ enum iClockMip { kMipClockNodeSearchSeparation, kMipClockStoreBasis, // kMipClock@, - + // Separation kMipClockSeparationRootSeparationRound, kMipClockSeparationFinishAnalyticCentreComputation, @@ -181,12 +181,17 @@ class MipTimer { timer_pointer->clock_def("Evaluate root LP - s."); // Node search - clock[kMipClockCurrentNodeToQueue] = timer_pointer->clock_def("Current node to queue"); - clock[kMipClockSearchBacktrack] = timer_pointer->clock_def("Search backtrack"); - clock[kMipClockNodePrunedLoop] = timer_pointer->clock_def("Pruned loop search"); - clock[kMipClockOpenNodesToQueue1] = timer_pointer->clock_def("Open nodes to queue 1"); + clock[kMipClockCurrentNodeToQueue] = + timer_pointer->clock_def("Current node to queue"); + clock[kMipClockSearchBacktrack] = + timer_pointer->clock_def("Search backtrack"); + clock[kMipClockNodePrunedLoop] = + timer_pointer->clock_def("Pruned loop search"); + clock[kMipClockOpenNodesToQueue1] = + timer_pointer->clock_def("Open nodes to queue 1"); clock[kMipClockEvaluateNode1] = timer_pointer->clock_def("Evaluate node 1"); - clock[kMipClockNodeSearchSeparation] = timer_pointer->clock_def("Node search separation"); + clock[kMipClockNodeSearchSeparation] = + timer_pointer->clock_def("Node search separation"); clock[kMipClockStoreBasis] = timer_pointer->clock_def("Store basis"); // clock[] = timer_pointer->clock_def(""); @@ -227,7 +232,7 @@ class MipTimer { const double tolerance_percent_report = tolerance_percent_report_ >= 0 ? tolerance_percent_report_ : 1e-8; return timer_pointer->reportOnTolerance( - grepStamp, clockList, ideal_sum_time, 0);//tolerance_percent_report); + grepStamp, clockList, ideal_sum_time, 0); // tolerance_percent_report); }; void csvMipClockList(const std::string model_name, @@ -301,7 +306,7 @@ class MipTimer { void reportMipSearchClock(const HighsTimerClock& mip_timer_clock) { const std::vector mip_clock_list{ kMipClockPerformAging1, kMipClockDive, - kMipClockOpenNodesToQueue0, kMipClockDomainPropgate, + kMipClockOpenNodesToQueue0, kMipClockDomainPropgate, kMipClockPruneInfeasibleNodes, kMipClockUpdateLocalDomain, kMipClockNodeSearch, // kMipClock@ @@ -312,10 +317,10 @@ class MipTimer { void reportMipDiveClock(const HighsTimerClock& mip_timer_clock) { const std::vector mip_clock_list{ - kMipClockEvaluateNode0, - kMipClockRandomizedRounding0, kMipClockRens, kMipClockRins, - kMipClockTheDive, - kMipClockBacktrackPlunge, kMipClockPerformAging2}; + kMipClockEvaluateNode0, kMipClockRandomizedRounding0, + kMipClockRens, kMipClockRins, + kMipClockTheDive, kMipClockBacktrackPlunge, + kMipClockPerformAging2}; reportMipClockList("MipDive_", mip_clock_list, mip_timer_clock, kMipClockDive, tolerance_percent_report); }; @@ -356,13 +361,10 @@ class MipTimer { void reportMipNodeSearchClock(const HighsTimerClock& mip_timer_clock) { const std::vector mip_clock_list{ - kMipClockCurrentNodeToQueue, - kMipClockNodePrunedLoop, - // kMipClockSearchBacktrack, - kMipClockOpenNodesToQueue1, - kMipClockEvaluateNode1, - kMipClockNodeSearchSeparation, - kMipClockStoreBasis}; + kMipClockCurrentNodeToQueue, kMipClockNodePrunedLoop, + // kMipClockSearchBacktrack, + kMipClockOpenNodesToQueue1, kMipClockEvaluateNode1, + kMipClockNodeSearchSeparation, kMipClockStoreBasis}; reportMipClockList("MipNodeSearch", mip_clock_list, mip_timer_clock, kMipClockNodeSearch); //, tolerance_percent_report); };