@@ -283,7 +283,7 @@ void HighsMipSolver::run() {
283283 return limit_reached;
284284 };
285285
286- // Lambda checking whether to break out of search
286+ // Lambda checking whether to break out of search
287287 auto breakSearch = [&]() -> bool {
288288 bool break_search = false ;
289289 for (HighsInt iSearch = 0 ; iSearch < use_mip_concurrency; iSearch++) {
@@ -430,12 +430,12 @@ void HighsMipSolver::run() {
430430 if (!submip && mipdata_->num_nodes >= nextCheck) {
431431 auto nTreeRestarts = mipdata_->numRestarts - mipdata_->numRestartsRoot ;
432432 double currNodeEstim =
433- numNodesLastCheck - mipdata_->num_nodes_before_run +
434- (mipdata_->num_nodes - numNodesLastCheck) *
435- double (1.0 - mipdata_->pruned_treeweight ) /
436- std::max (
437- double (mipdata_->pruned_treeweight - treeweightLastCheck),
438- mipdata_->epsilon );
433+ numNodesLastCheck - mipdata_->num_nodes_before_run +
434+ (mipdata_->num_nodes - numNodesLastCheck) *
435+ double (1.0 - mipdata_->pruned_treeweight ) /
436+ std::max (
437+ double (mipdata_->pruned_treeweight - treeweightLastCheck),
438+ mipdata_->epsilon );
439439 // printf(
440440 // "nTreeRestarts: %d, numNodesThisRun: %ld, numNodesLastCheck: %ld,
441441 // " "currNodeEstim: %g, " "prunedTreeWeightDelta: %g,
@@ -452,56 +452,56 @@ void HighsMipSolver::run() {
452452 bool doRestart = false ;
453453
454454 double activeIntegerRatio =
455- 1.0 - mipdata_->percentageInactiveIntegers () / 100.0 ;
455+ 1.0 - mipdata_->percentageInactiveIntegers () / 100.0 ;
456456 activeIntegerRatio *= activeIntegerRatio;
457-
457+
458458 if (!doRestart) {
459- double gapReduction = 1.0 ;
460- if (mipdata_->upper_limit != kHighsInf ) {
461- double oldGap = upperLimLastCheck - lowerBoundLastCheck;
462- double newGap = mipdata_->upper_limit - mipdata_->lower_bound ;
463- gapReduction = oldGap / newGap;
464- }
465-
466- if (gapReduction < 1.0 + (0.05 / activeIntegerRatio) &&
467- currNodeEstim >=
468- activeIntegerRatio * 20 *
469- (mipdata_->num_nodes - mipdata_->num_nodes_before_run )) {
470- nextCheck = mipdata_->num_nodes + 100 ;
471- ++numHugeTreeEstim;
472- } else {
473- numHugeTreeEstim = 0 ;
474- treeweightLastCheck = double (mipdata_->pruned_treeweight );
475- numNodesLastCheck = mipdata_->num_nodes ;
476- upperLimLastCheck = mipdata_->upper_limit ;
477- lowerBoundLastCheck = mipdata_->lower_bound ;
478- }
479-
480- // Possibly prevent restart - necessary for debugging presolve
481- // errors: see #1553
482- if (options_mip_->mip_allow_restart ) {
483- int64_t minHugeTreeOffset =
484- (mipdata_->num_leaves - mipdata_->num_leaves_before_run ) / 1000 ;
485- int64_t minHugeTreeEstim = HighsIntegers::nearestInteger (
486- activeIntegerRatio * (10 + minHugeTreeOffset) *
487- std::pow (1.5 , nTreeRestarts));
488-
489- doRestart = numHugeTreeEstim >= minHugeTreeEstim;
490- } else {
491- doRestart = false ;
492- }
459+ double gapReduction = 1.0 ;
460+ if (mipdata_->upper_limit != kHighsInf ) {
461+ double oldGap = upperLimLastCheck - lowerBoundLastCheck;
462+ double newGap = mipdata_->upper_limit - mipdata_->lower_bound ;
463+ gapReduction = oldGap / newGap;
464+ }
465+
466+ if (gapReduction < 1.0 + (0.05 / activeIntegerRatio) &&
467+ currNodeEstim >=
468+ activeIntegerRatio * 20 *
469+ (mipdata_->num_nodes - mipdata_->num_nodes_before_run )) {
470+ nextCheck = mipdata_->num_nodes + 100 ;
471+ ++numHugeTreeEstim;
472+ } else {
473+ numHugeTreeEstim = 0 ;
474+ treeweightLastCheck = double (mipdata_->pruned_treeweight );
475+ numNodesLastCheck = mipdata_->num_nodes ;
476+ upperLimLastCheck = mipdata_->upper_limit ;
477+ lowerBoundLastCheck = mipdata_->lower_bound ;
478+ }
479+
480+ // Possibly prevent restart - necessary for debugging presolve
481+ // errors: see #1553
482+ if (options_mip_->mip_allow_restart ) {
483+ int64_t minHugeTreeOffset =
484+ (mipdata_->num_leaves - mipdata_->num_leaves_before_run ) / 1000 ;
485+ int64_t minHugeTreeEstim = HighsIntegers::nearestInteger (
486+ activeIntegerRatio * (10 + minHugeTreeOffset) *
487+ std::pow (1.5 , nTreeRestarts));
488+
489+ doRestart = numHugeTreeEstim >= minHugeTreeEstim;
490+ } else {
491+ doRestart = false ;
492+ }
493493 } else {
494- // count restart due to many fixings within the first 1000 nodes as
495- // root restart
496- ++mipdata_->numRestartsRoot ;
494+ // count restart due to many fixings within the first 1000 nodes as
495+ // root restart
496+ ++mipdata_->numRestartsRoot ;
497497 }
498-
498+
499499 if (doRestart) {
500- highsLogUser (options_mip_->log_options , HighsLogType::kInfo ,
501- " \n Restarting search from the root node\n " );
502- mipdata_->performRestart ();
503- analysis_.mipTimerStop (kMipClockSearch );
504- goto restart;
500+ highsLogUser (options_mip_->log_options , HighsLogType::kInfo ,
501+ " \n Restarting search from the root node\n " );
502+ mipdata_->performRestart ();
503+ analysis_.mipTimerStop (kMipClockSearch );
504+ goto restart;
505505 }
506506 } // if (!submip && mipdata_->num_nodes >= nextCheck))
507507
@@ -546,7 +546,7 @@ void HighsMipSolver::run() {
546546 printf (
547547 " HighsMipSolver::run() break on "
548548 " HighsModelStatus::kSolutionLimit\n " );
549- search.break_search_ = true ;
549+ search.break_search_ = true ;
550550 break ;
551551 }
552552 } else
@@ -591,15 +591,15 @@ void HighsMipSolver::run() {
591591 printf (
592592 " HighsMipSolver::run() break on "
593593 " mipdata_->domain.infeasible() - 1\n " );
594- search.break_search_ = true ;
594+ search.break_search_ = true ;
595595 break ;
596596 }
597597
598598 if (mipdata_->checkLimits ()) {
599599 limit_reached = true ;
600600 if (debug_logging)
601601 printf (" HighsMipSolver::run() break on limit_reached - 1\n " );
602- search.break_search_ = true ;
602+ search.break_search_ = true ;
603603 break ;
604604 }
605605
@@ -656,7 +656,7 @@ void HighsMipSolver::run() {
656656 printf (
657657 " HighsMipSolver::run() break on mipdata_->domain.infeasible() "
658658 " - 2\n " );
659- search.break_search_ = true ;
659+ search.break_search_ = true ;
660660 break ;
661661 }
662662
0 commit comments