@@ -2672,9 +2672,7 @@ void HighsMipSolverData::queryExternalSolution(
26722672 std::vector<double > instance_solution;
26732673 for (HighsInt instance = 0 ; instance < mip_race.concurrency (); instance++) {
26742674 if (instance == mip_race.my_instance ) continue ;
2675- HighsInt read_incumbent = mip_race.newSolution (instance, instance_solution_objective_value, instance_solution);
2676- if (read_incumbent < 0 ) continue ;
2677- if (read_incumbent <= mip_race.last_incumbent_read [instance]) continue ;
2675+ if (!mip_race.newSolution (instance, instance_solution_objective_value, instance_solution)) continue ;
26782676 // Have read a new incumbent
26792677 std::vector<double > reduced_instance_solution;
26802678 reduced_instance_solution =
@@ -2881,10 +2879,12 @@ void MipRaceIncumbent::update(const double objective_,
28812879 assert (this ->start_write_incumbent == this ->finish_write_incumbent );
28822880}
28832881
2884- HighsInt MipRaceIncumbent::read (double & objective_,
2885- std::vector<double >& solution_) const {
2882+ HighsInt MipRaceIncumbent::read (const HighsInt last_incumbent_read,
2883+ double & objective_,
2884+ std::vector<double >& solution_) const {
28862885 const HighsInt start_write_incumbent = this ->start_write_incumbent ;
28872886 assert (this ->finish_write_incumbent <= start_write_incumbent);
2887+ if (start_write_incumbent < last_incumbent_read) return kMipRaceNoSolution ;
28882888 // If a write call has not completed, return failure
28892889 if (this ->finish_write_incumbent < start_write_incumbent) return kMipRaceNoSolution ;
28902890 // finish_write_incumbent = start_write_incumbent so start reading
@@ -2971,10 +2971,17 @@ void MipRace::update(const double objective,
29712971 this ->report ();
29722972}
29732973
2974- HighsInt MipRace::newSolution (const HighsInt instance, double objective,
2975- std::vector<double >& solution) const {
2974+ bool MipRace::newSolution (const HighsInt instance, double objective,
2975+ std::vector<double >& solution) {
29762976 assert (this ->record );
2977- return this ->record ->incumbent [instance].read (objective, solution);
2977+ HighsInt new_incumbent_read =
2978+ this ->record ->incumbent [instance].read (this ->last_incumbent_read [instance],
2979+ objective, solution);
2980+ if (new_incumbent_read != kMipRaceNoSolution ) {
2981+ this ->last_incumbent_read [instance] = new_incumbent_read;
2982+ return true ;
2983+ }
2984+ return false ;
29782985}
29792986
29802987void MipRace::terminate () {
@@ -2993,8 +3000,13 @@ void MipRace::report() const {
29933000 assert (this ->record );
29943001 this ->record ->report (this ->log_options );
29953002 highsLogUser (this ->log_options , HighsLogType::kInfo , " LastIncumbentRead: " );
2996- for (HighsInt instance = 0 ; instance < this ->concurrency (); instance++)
2997- highsLogUser (this ->log_options , HighsLogType::kInfo , " %20d" ,
2998- this ->last_incumbent_read [instance]);
3003+ for (HighsInt instance = 0 ; instance < this ->concurrency (); instance++) {
3004+ if (instance == this ->my_instance ) {
3005+ highsLogUser (this ->log_options , HighsLogType::kInfo , " %20s" , " " );
3006+ } else {
3007+ highsLogUser (this ->log_options , HighsLogType::kInfo , " %20d" ,
3008+ this ->last_incumbent_read [instance]);
3009+ }
3010+ }
29993011 highsLogUser (this ->log_options , HighsLogType::kInfo , " \n\n " );
30003012}
0 commit comments