@@ -216,7 +216,7 @@ void diversity_manager_t<i_t, f_t>::add_user_given_solutions(
216216 cuopt_func_call (sol.test_variable_bounds (true ));
217217 CUOPT_LOG_INFO (" Adding initial solution success! feas %d objective %f excess %f" ,
218218 is_feasible,
219- sol.get_objective (),
219+ sol.get_user_objective (),
220220 sol.get_total_excess ());
221221 population.run_solution_callbacks (sol);
222222 initial_sol_vector.emplace_back (std::move (sol));
@@ -226,7 +226,7 @@ void diversity_manager_t<i_t, f_t>::add_user_given_solutions(
226226 Assignment size %lu \
227227 initial solution size %lu" ,
228228 sol.assignment .size (),
229- init_sol-> size ());
229+ init_sol_assignment. size ());
230230 }
231231 }
232232}
@@ -320,6 +320,9 @@ bool diversity_manager_t<i_t, f_t>::run_presolve(f_t time_limit)
320320 if (!check_bounds_sanity (*problem_ptr)) { return false ; }
321321 }
322322 stats.presolve_time = presolve_timer.elapsed_time ();
323+ lp_optimal_solution.resize (problem_ptr->n_variables , problem_ptr->handle_ptr ->get_stream ());
324+ problem_ptr->handle_ptr ->sync_stream ();
325+ cudaDeviceSynchronize ();
323326 return true ;
324327}
325328
@@ -392,7 +395,6 @@ solution_t<i_t, f_t> diversity_manager_t<i_t, f_t>::run_solver()
392395 cuopt::scope_guard ([&]() { stats.total_solve_time = timer.elapsed_time (); });
393396 // after every change to the problem, we should resize all the relevant vars
394397 // we need to encapsulate that to prevent repetitions
395- lp_optimal_solution.resize (problem_ptr->n_variables , problem_ptr->handle_ptr ->get_stream ());
396398 ls.resize_vectors (*problem_ptr, problem_ptr->handle_ptr );
397399 ls.lb_constraint_prop .temp_problem .setup (*problem_ptr);
398400 ls.lb_constraint_prop .bounds_update .setup (ls.lb_constraint_prop .temp_problem );
@@ -796,12 +798,14 @@ void diversity_manager_t<i_t, f_t>::set_simplex_solution(const std::vector<f_t>&
796798{
797799 CUOPT_LOG_DEBUG (" Setting simplex solution with objective %f" , objective);
798800 using sol_t = solution_t <i_t , f_t >;
801+ context.handle_ptr ->sync_stream ();
802+ RAFT_CUDA_TRY (cudaSetDevice (context.handle_ptr ->get_device ()));
799803 cuopt_func_call (sol_t new_sol (*problem_ptr));
804+ cuopt_assert (new_sol.assignment .size () == solution.size (), " Assignment size mismatch" );
800805 cuopt_func_call (new_sol.copy_new_assignment (solution));
801806 cuopt_func_call (new_sol.compute_feasibility ());
802807 cuopt_assert (integer_equal (new_sol.get_user_objective (), objective, 1e-3 ), " Objective mismatch" );
803808 std::lock_guard<std::mutex> lock (relaxed_solution_mutex);
804- RAFT_CUDA_TRY (cudaSetDevice (context.handle_ptr ->get_device ()));
805809 simplex_solution_exists = true ;
806810 global_concurrent_halt.store (1 , std::memory_order_release);
807811 // it is safe to use lp_optimal_solution while executing the copy operation
0 commit comments