Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cpp/src/routing/local_search/sliding_tsp.cu
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ __global__ void execute_sliding_moves_tsp(
s_route.copy_from(route);
__syncthreads();

s_route.copy_to_tsp_route(sol.problem.order_info.depot_included);
Comment thread
rg20 marked this conversation as resolved.
s_route.copy_to_tsp_route();

__shared__ i_t sh_overlaps;

Expand Down Expand Up @@ -471,7 +471,7 @@ void compute_cumulative_distances(solution_t<i_t, f_t, REQUEST>& sol,
n_temp_storage_bytes,
distances_ptr,
distances_ptr,
n_nodes + 1,
n_nodes + 2,
sol.sol_handle->get_stream());

if (n_temp_storage_bytes > 0) {
Expand All @@ -484,7 +484,7 @@ void compute_cumulative_distances(solution_t<i_t, f_t, REQUEST>& sol,
temp_storage_bytes,
distances_ptr,
distances_ptr,
n_nodes + 1,
n_nodes + 2,
sol.sol_handle->get_stream());
}

Expand All @@ -504,7 +504,7 @@ bool local_search_t<i_t, f_t, REQUEST>::perform_sliding_tsp(
sol.compute_max_active();
moved_regions_.resize(sol.get_n_routes() * sol.get_max_active_nodes_for_all_routes(),
sol.sol_handle->get_stream());
auto n_nodes = sol.get_num_orders();
auto n_nodes = sol.problem_ptr->order_info.get_num_depot_excluded_orders();
size_t temp_storage_bytes = 0;
resize_temp_storage<i_t, f_t, REQUEST>(sol, move_candidates, n_nodes, temp_storage_bytes);

Expand Down
11 changes: 6 additions & 5 deletions cpp/src/routing/route/route.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,11 @@ class route_t {
return get_node(*n_nodes).time_dim.forward_feasible(this->vehicle_info());
}

DI void copy_to_tsp_route(bool depot_included)
DI void copy_to_tsp_route()
{
dimensions.requests.tsp_requests.start = get_node(0).node_info();
dimensions.requests.tsp_requests.end = get_node(*n_nodes).node_info();

for (i_t tid = threadIdx.x; tid < *n_nodes; tid += blockDim.x) {
if (get_node(tid).node_info().is_depot()) { continue; }
dimensions.requests.tsp_requests.pred[get_node(tid).node_info().node()] =
Expand All @@ -257,10 +258,10 @@ class route_t {
get_node(tid + 1).node_info();
}

if (depot_included) {
dimensions.requests.tsp_requests.pred[0] = get_node(*n_nodes - 1).node_info();
dimensions.requests.tsp_requests.succ[0] = get_node(1).node_info();
}
dimensions.requests.tsp_requests.pred[dimensions.requests.tsp_requests.end.node()] =
get_node(*n_nodes - 1).node_info();
dimensions.requests.tsp_requests.succ[dimensions.requests.tsp_requests.start.node()] =
get_node(1).node_info();
}

// insert a single node to the route
Expand Down