@@ -682,12 +682,13 @@ void LogFinalStatistics(SharedClasses* shared) {
682682 shared->logger ->FlushPendingThrottledLogs (/* ignore_rates=*/ true );
683683 SOLVER_LOG (shared->logger , " " );
684684
685- shared->stat_tables . Display (shared->logger );
685+ shared->stat_tables -> Display (shared->logger );
686686 shared->response ->DisplayImprovementStatistics ();
687687
688688 std::vector<std::vector<std::string>> table;
689689 table.push_back ({" Solution repositories" , " Added" , " Queried" , " Synchro" });
690690 table.push_back (shared->response ->SolutionsRepository ().TableLineStats ());
691+ table.push_back (shared->ls_hints ->TableLineStats ());
691692 if (shared->lp_solutions != nullptr ) {
692693 table.push_back (shared->lp_solutions ->TableLineStats ());
693694 }
@@ -914,35 +915,9 @@ class FullProblemSolver : public SubSolver {
914915 shared_->response ->first_solution_solvers_should_stop ());
915916 }
916917
917- if (shared->response != nullptr ) {
918- local_model_.Register <SharedResponseManager>(shared->response );
919- }
920-
921- if (shared->lp_solutions != nullptr ) {
922- local_model_.Register <SharedLPSolutionRepository>(
923- shared->lp_solutions .get ());
924- }
925-
926- if (shared->incomplete_solutions != nullptr ) {
927- local_model_.Register <SharedIncompleteSolutionManager>(
928- shared->incomplete_solutions .get ());
929- }
930-
931- if (shared->bounds != nullptr ) {
932- local_model_.Register <SharedBoundsManager>(shared->bounds .get ());
933- }
934-
935- if (shared->clauses != nullptr ) {
936- local_model_.Register <SharedClausesManager>(shared->clauses .get ());
937- }
938-
939- if (local_parameters.use_shared_tree_search ()) {
940- local_model_.Register <SharedTreeManager>(shared->shared_tree_manager );
941- }
942-
943918 // TODO(user): For now we do not count LNS statistics. We could easily
944919 // by registering the SharedStatistics class with LNS local model.
945- local_model_. Register <SharedStatistics>( shared_->stats );
920+ shared_->RegisterSharedClassesInLocalModel (&local_model_ );
946921
947922 // Setup the local logger, in multi-thread log_search_progress should be
948923 // false by default, but we might turn it on for debugging. It is on by
@@ -956,10 +931,10 @@ class FullProblemSolver : public SubSolver {
956931 CpSolverResponse response;
957932 shared_->response ->FillSolveStatsInResponse (&local_model_, &response);
958933 shared_->response ->AppendResponseToBeMerged (response);
959- shared_->stat_tables . AddTimingStat (*this );
960- shared_->stat_tables . AddLpStat (name (), &local_model_);
961- shared_->stat_tables . AddSearchStat (name (), &local_model_);
962- shared_->stat_tables . AddClausesStat (name (), &local_model_);
934+ shared_->stat_tables -> AddTimingStat (*this );
935+ shared_->stat_tables -> AddLpStat (name (), &local_model_);
936+ shared_->stat_tables -> AddSearchStat (name (), &local_model_);
937+ shared_->stat_tables -> AddClausesStat (name (), &local_model_);
963938 }
964939
965940 bool IsDone () override {
@@ -1104,30 +1079,11 @@ class FeasibilityPumpSolver : public SubSolver {
11041079 *(local_model_->GetOrCreate <SatParameters>()) = local_parameters;
11051080 shared_->time_limit ->UpdateLocalLimit (
11061081 local_model_->GetOrCreate <TimeLimit>());
1107-
1108- if (shared->response != nullptr ) {
1109- local_model_->Register <SharedResponseManager>(shared->response );
1110- }
1111-
1112- if (shared->lp_solutions != nullptr ) {
1113- local_model_->Register <SharedLPSolutionRepository>(
1114- shared->lp_solutions .get ());
1115- }
1116-
1117- if (shared->incomplete_solutions != nullptr ) {
1118- local_model_->Register <SharedIncompleteSolutionManager>(
1119- shared->incomplete_solutions .get ());
1120- }
1121-
1122- // Level zero variable bounds sharing.
1123- if (shared_->bounds != nullptr ) {
1124- RegisterVariableBoundsLevelZeroImport (
1125- shared_->model_proto , shared_->bounds .get (), local_model_.get ());
1126- }
1082+ shared_->RegisterSharedClassesInLocalModel (local_model_.get ());
11271083 }
11281084
11291085 ~FeasibilityPumpSolver () override {
1130- shared_->stat_tables . AddTimingStat (*this );
1086+ shared_->stat_tables -> AddTimingStat (*this );
11311087 }
11321088
11331089 bool IsDone () override { return shared_->SearchIsDone (); }
@@ -1216,8 +1172,8 @@ class LnsSolver : public SubSolver {
12161172 shared_(shared) {}
12171173
12181174 ~LnsSolver () override {
1219- shared_->stat_tables . AddTimingStat (*this );
1220- shared_->stat_tables . AddLnsStat (
1175+ shared_->stat_tables -> AddTimingStat (*this );
1176+ shared_->stat_tables -> AddLnsStat (
12211177 name (),
12221178 /* num_fully_solved_calls=*/ generator_->num_fully_solved_calls (),
12231179 /* num_calls=*/ generator_->num_calls (),
@@ -1654,6 +1610,7 @@ void SolveCpModelParallel(SharedClasses* shared, Model* global_model) {
16541610 " synchronization_agent" , [shared]() {
16551611 shared->response ->Synchronize ();
16561612 shared->response ->MutableSolutionsRepository ()->Synchronize ();
1613+ shared->ls_hints ->Synchronize ();
16571614 if (shared->bounds != nullptr ) {
16581615 shared->bounds ->Synchronize ();
16591616 }
@@ -1946,7 +1903,7 @@ void SolveCpModelParallel(SharedClasses* shared, Model* global_model) {
19461903
19471904 if (num_ls_default > 0 ) {
19481905 std::shared_ptr<SharedLsStates> states = std::make_shared<SharedLsStates>(
1949- ls_name, params, & shared->stat_tables );
1906+ ls_name, params, shared->stat_tables );
19501907 for (int i = 0 ; i < num_ls_default; ++i) {
19511908 SatParameters local_params = params;
19521909 local_params.set_random_seed (
@@ -1956,14 +1913,15 @@ void SolveCpModelParallel(SharedClasses* shared, Model* global_model) {
19561913 std::make_unique<FeasibilityJumpSolver>(
19571914 ls_name, SubSolver::INCOMPLETE, get_linear_model (),
19581915 local_params, states, shared->time_limit , shared->response ,
1959- shared->bounds .get (), shared->stats , &shared->stat_tables ));
1916+ shared->bounds .get (), shared->ls_hints , shared->stats ,
1917+ shared->stat_tables ));
19601918 }
19611919 }
19621920
19631921 if (num_ls_lin > 0 ) {
19641922 std::shared_ptr<SharedLsStates> lin_states =
19651923 std::make_shared<SharedLsStates>(lin_ls_name, params,
1966- & shared->stat_tables );
1924+ shared->stat_tables );
19671925 for (int i = 0 ; i < num_ls_lin; ++i) {
19681926 SatParameters local_params = params;
19691927 local_params.set_random_seed (
@@ -1973,7 +1931,8 @@ void SolveCpModelParallel(SharedClasses* shared, Model* global_model) {
19731931 std::make_unique<FeasibilityJumpSolver>(
19741932 lin_ls_name, SubSolver::INCOMPLETE, get_linear_model (),
19751933 local_params, lin_states, shared->time_limit , shared->response ,
1976- shared->bounds .get (), shared->stats , &shared->stat_tables ));
1934+ shared->bounds .get (), shared->ls_hints , shared->stats ,
1935+ shared->stat_tables ));
19771936 }
19781937 }
19791938 }
@@ -2011,13 +1970,13 @@ void SolveCpModelParallel(SharedClasses* shared, Model* global_model) {
20111970 if (local_params.feasibility_jump_linearization_level () == 0 ) {
20121971 if (fj_states == nullptr ) {
20131972 fj_states = std::make_shared<SharedLsStates>(
2014- local_params.name (), params, & shared->stat_tables );
1973+ local_params.name (), params, shared->stat_tables );
20151974 }
20161975 states = fj_states;
20171976 } else {
20181977 if (fj_lin_states == nullptr ) {
20191978 fj_lin_states = std::make_shared<SharedLsStates>(
2020- local_params.name (), params, & shared->stat_tables );
1979+ local_params.name (), params, shared->stat_tables );
20211980 }
20221981 states = fj_lin_states;
20231982 }
@@ -2026,8 +1985,8 @@ void SolveCpModelParallel(SharedClasses* shared, Model* global_model) {
20261985 std::make_unique<FeasibilityJumpSolver>(
20271986 local_params.name (), SubSolver::FIRST_SOLUTION,
20281987 get_linear_model (), local_params, states, shared->time_limit ,
2029- shared->response , shared->bounds .get (), shared->stats ,
2030- & shared->stat_tables ));
1988+ shared->response , shared->bounds .get (), shared->ls_hints ,
1989+ shared-> stats , shared->stat_tables ));
20311990 } else {
20321991 first_solution_full_subsolvers.push_back (
20331992 std::make_unique<FullProblemSolver>(
0 commit comments