@@ -1331,8 +1331,10 @@ void HighsMipSolverData::performRestart() {
13311331 // changed offset_
13321332 runSetup ();
13331333 if (mipsolver.terminate ()) {
1334- printf (" HighsMipSolverData::performRestart() mipsolver.termination_status_ = %d\n " ,
1335- int (mipsolver.termination_status_ ));
1334+ printf (
1335+ " HighsMipSolverData::performRestart() mipsolver.termination_status_ = "
1336+ " %d\n " ,
1337+ int (mipsolver.termination_status_ ));
13361338 return ;
13371339 }
13381340
@@ -2387,7 +2389,7 @@ void HighsMipSolverData::evaluateRootNode() {
23872389 analysis.mipTimerStart (kMipClockPerformRestart );
23882390 performRestart ();
23892391 analysis.mipTimerStop (kMipClockPerformRestart );
2390- if (mipsolver.terminate ()) return ;
2392+ if (mipsolver.terminate ()) return ;
23912393 ++numRestartsRoot;
23922394 if (mipsolver.modelstatus_ == HighsModelStatus::kNotset ) {
23932395 clockOff (analysis);
@@ -2419,12 +2421,16 @@ bool HighsMipSolverData::checkLimits(int64_t nodeOffset) const {
24192421 const HighsOptions& options = *mipsolver.options_mip_ ;
24202422
24212423 // MIP race may have terminated
2422- if (!mipsolver.submip ) {
2424+ if (!mipsolver.submip && terminatorActive () ) {
24232425 highsLogUser (options.log_options , HighsLogType::kInfo ,
2424- " instance%d: terminated? %6.4f (MIP)\n " , int (this ->mipRaceMyInstance ()), this ->mipsolver .timer_ .read ());
2426+ " instance%d: terminated? %6.4f (MIP)\n " ,
2427+ int (this ->terminatorMyInstance ()),
2428+ this ->mipsolver .timer_ .read ());
24252429 if (this ->terminatorTerminated ()) {
24262430 highsLogUser (options.log_options , HighsLogType::kInfo ,
2427- " instance%d: terminated %6.4f (MIP)\n " , int (this ->mipRaceMyInstance ()), this ->mipsolver .timer_ .read ());
2431+ " instance%d: terminated %6.4f (MIP)\n " ,
2432+ int (this ->terminatorMyInstance ()),
2433+ this ->mipsolver .timer_ .read ());
24282434 return true ;
24292435 }
24302436 }
@@ -2698,12 +2704,6 @@ void HighsMipSolverData::queryExternalSolution(
26982704 }
26992705}
27002706
2701- HighsInt HighsMipSolverData::mipRaceMyInstance () const {
2702- assert (!mipsolver.submip );
2703- if (!mipsolver.mip_race_ .record ) return kNoThreadInstance ;
2704- return mipsolver.mip_race_ .my_instance ;
2705- }
2706-
27072707HighsInt HighsMipSolverData::mipRaceConcurrency () const {
27082708 assert (!mipsolver.submip );
27092709 if (!mipsolver.mip_race_ .record ) return 0 ;
@@ -2727,21 +2727,33 @@ HighsInt HighsMipSolverData::mipRaceNewSolution(const HighsInt instance,
27272727
27282728void HighsMipSolverData::mipRaceReport () const {
27292729 assert (!mipsolver.submip );
2730- if (mipsolver.terminator_ .record ) mipsolver.terminator_ .report (mipsolver.options_mip_ ->log_options );
2731- if (mipsolver.mip_race_ .record ) mipsolver.mip_race_ .report ();
2730+ if (mipsolver.mip_race_ .record ) mipsolver.mip_race_ .report ();
2731+ }
2732+
2733+ HighsInt HighsMipSolverData::terminatorConcurrency () const {
2734+ return mipsolver.terminator_ .num_instance ;
2735+ }
2736+
2737+ HighsInt HighsMipSolverData::terminatorMyInstance () const {
2738+ return mipsolver.terminator_ .my_instance ;
27322739}
27332740
27342741void HighsMipSolverData::terminatorTerminate () {
2735- assert (mipsolver. terminator_ . num_instance > 0 );
2742+ assert (terminatorActive () );
27362743 mipsolver.terminator_ .terminate ();
27372744}
27382745
27392746bool HighsMipSolverData::terminatorTerminated () const {
2740- if (this ->terminatorActive ())
2747+ if (this ->terminatorActive ())
27412748 mipsolver.termination_status_ = mipsolver.terminator_ .terminationStatus ();
27422749 return mipsolver.termination_status_ != HighsModelStatus::kNotset ;
27432750}
27442751
2752+ void HighsMipSolverData::terminatorReport () const {
2753+ if (this ->terminatorActive ())
2754+ mipsolver.terminator_ .report (mipsolver.options_mip_ ->log_options );
2755+ }
2756+
27452757static double possInfRelDiff (const double v0, const double v1,
27462758 const double den) {
27472759 double rel_diff;
@@ -2918,9 +2930,7 @@ HighsInt MipRaceIncumbent::read(const HighsInt last_incumbent_read,
29182930 : kMipRaceNoSolution ;
29192931}
29202932
2921- void MipRaceRecord::clear () {
2922- this ->incumbent .clear ();
2923- }
2933+ void MipRaceRecord::clear () { this ->incumbent .clear (); }
29242934
29252935void MipRaceRecord::initialise (const HighsInt mip_race_concurrency,
29262936 const HighsInt num_col) {
@@ -3022,14 +3032,15 @@ void HighsTerminator::clear() {
30223032 this ->record = nullptr ;
30233033}
30243034
3025- void HighsTerminator::initialise (HighsInt num_instance_,
3026- HighsInt my_instance_,
3027- HighsModelStatus* record_) {
3035+ void HighsTerminator::initialise (HighsInt num_instance_, HighsInt my_instance_,
3036+ HighsModelStatus* record_) {
30283037 this ->num_instance = num_instance_;
30293038 this ->my_instance = my_instance_;
30303039 this ->record = record_;
30313040}
30323041
3042+ HighsInt HighsTerminator::concurrency () const { return this ->num_instance ; }
3043+
30333044void HighsTerminator::terminate () {
30343045 assert (this ->record );
30353046 assert (this ->my_instance < this ->num_instance );
@@ -3047,9 +3058,8 @@ HighsModelStatus HighsTerminator::terminationStatus() const {
30473058
30483059void HighsTerminator::report (const HighsLogOptions log_options) const {
30493060 highsLogUser (log_options, HighsLogType::kInfo , " \n Terminator: " );
3050- for (HighsInt instance = 0 ; instance < this ->num_instance ; instance++)
3061+ for (HighsInt instance = 0 ; instance < this ->num_instance ; instance++)
30513062 highsLogUser (log_options, HighsLogType::kInfo , " %20d" ,
3052- int (this ->record [instance]));
3063+ int (this ->record [instance]));
30533064 highsLogUser (log_options, HighsLogType::kInfo , " \n " );
30543065}
3055-
0 commit comments