From b91f70e5f2d9f0fa7d4afd2a136fe91e3271b6d3 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 17 Mar 2026 16:24:14 -0500 Subject: [PATCH 1/2] fix --- .../lexicographic_search.cu | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu b/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu index a3f6b4a3ba..2b9a34e837 100644 --- a/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu +++ b/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu @@ -685,12 +685,9 @@ 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); - } + // Base number of insertion positions (used to compute grid size after k_max is fixed) + const i_t n_lexico_positions = (solution_ptr->get_num_orders() + solution_ptr->get_n_routes() - + solution_ptr->problem_ptr->order_info.depot_included_); size_t sh_size = 0; bool is_set = false; @@ -705,6 +702,16 @@ bool guided_ejection_search_t::run_lexicographic_search( } if (k_max == 1 || !is_set) { return false; } + + // Recompute block count with final k_max so kernel's blockIdx.x stays in valid range + // (kernel uses delivery_insertion_idx = blockIdx.x / n_lexico_positions, so we must launch + // exactly n_lexico_positions * max_neighbors(k_max) blocks for PDP). + i_t n_blocks_lexico = n_lexico_positions; + if constexpr (REQUEST == request_t::PDP) { + n_blocks_lexico *= max_neighbors(k_max); + } + if (n_blocks_lexico <= 0) { return false; } + // Init global min before call to lexicographic const auto max = std::numeric_limits::max(); const i_t zero = 0; From 27f087a65f29ae1de130c7c816ee5cf492b814bc Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Wed, 18 Mar 2026 11:12:21 -0500 Subject: [PATCH 2/2] fix --- .../ges/lexicographic_search/lexicographic_search.cu | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu b/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu index 2b9a34e837..2dd48ea3af 100644 --- a/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu +++ b/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu @@ -685,10 +685,6 @@ bool guided_ejection_search_t::run_lexicographic_search( k_max = 4; } - // Base number of insertion positions (used to compute grid size after k_max is fixed) - const i_t n_lexico_positions = (solution_ptr->get_num_orders() + solution_ptr->get_n_routes() - - solution_ptr->problem_ptr->order_info.depot_included_); - size_t sh_size = 0; bool is_set = false; while (k_max > 1) { @@ -703,14 +699,12 @@ bool guided_ejection_search_t::run_lexicographic_search( if (k_max == 1 || !is_set) { return false; } - // Recompute block count with final k_max so kernel's blockIdx.x stays in valid range - // (kernel uses delivery_insertion_idx = blockIdx.x / n_lexico_positions, so we must launch - // exactly n_lexico_positions * max_neighbors(k_max) blocks for PDP). - i_t n_blocks_lexico = n_lexico_positions; + // 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); } - if (n_blocks_lexico <= 0) { return false; } // Init global min before call to lexicographic const auto max = std::numeric_limits::max();