diff --git a/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu b/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu index a3f6b4a3ba..2dd48ea3af 100644 --- a/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu +++ b/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu @@ -685,13 +685,6 @@ bool guided_ejection_search_t::run_lexicographic_search( k_max = 4; } - // As we fix the insertion we don't need to try k_max permutations of insertion for cvrptw - i_t n_blocks_lexico = (solution_ptr->get_num_orders() + solution_ptr->get_n_routes() - - solution_ptr->problem_ptr->order_info.depot_included_); - if constexpr (REQUEST == request_t::PDP) { - n_blocks_lexico *= max_neighbors(k_max); - } - size_t sh_size = 0; bool is_set = false; while (k_max > 1) { @@ -705,6 +698,14 @@ bool guided_ejection_search_t::run_lexicographic_search( } if (k_max == 1 || !is_set) { return false; } + + // Compute n_blocks_lexico after k_max is finalized by the while-loop above + i_t n_blocks_lexico = (solution_ptr->get_num_orders() + solution_ptr->get_n_routes() - + solution_ptr->problem_ptr->order_info.depot_included_); + if constexpr (REQUEST == request_t::PDP) { + n_blocks_lexico *= max_neighbors(k_max); + } + // Init global min before call to lexicographic const auto max = std::numeric_limits::max(); const i_t zero = 0;