@@ -21,13 +21,14 @@ function retrieve_routes_anticipative(
2121 current_task = task
2222 while current_task != 1 # < nb_tasks
2323 push! (route, current_task)
24- local next_task
24+ next_task = - 1
2525 for i in 1 : nb_tasks
2626 if isapprox (y[current_task, i, t], 1 ; atol= 0.1 )
2727 next_task = i
2828 break
2929 end
3030 end
31+ @assert next_task != - 1 " No next task found from task $current_task at epoch $t "
3132 current_task = next_task
3233 end
3334 push! (routes[i], route)
@@ -92,14 +93,14 @@ function anticipative_solver(
9293 job_indices = 2 : nb_nodes
9394 epoch_indices = T
9495
95- @variable (model, y[i = 1 : nb_nodes, j = 1 : nb_nodes, t = epoch_indices]; binary= true )
96+ @variable (model, y[i= 1 : nb_nodes, j= 1 : nb_nodes, t= epoch_indices]; binary= true )
9697
9798 @objective (
9899 model,
99100 Max,
100101 sum (
101- - duration[i, j] * y[i, j, t] for
102- i in 1 : nb_nodes, j in 1 : nb_nodes, t in epoch_indices
102+ - duration[i, j] * y[i, j, t] for i in 1 : nb_nodes, j in 1 : nb_nodes,
103+ t in epoch_indices
103104 )
104105 )
105106
@@ -171,12 +172,14 @@ function anticipative_solver(
171172 routes = epoch_routes[i]
172173 epoch_customers = epoch_indices[i]
173174
174- y_true = VSPSolution (
175- Vector{Int}[
176- map (idx -> findfirst (== (idx), epoch_customers), route) for route in routes
177- ];
178- max_index= length (epoch_customers),
179- ). edge_matrix
175+ y_true =
176+ VSPSolution (
177+ Vector{Int}[
178+ map (idx -> findfirst (== (idx), epoch_customers), route) for
179+ route in routes
180+ ];
181+ max_index= length (epoch_customers),
182+ ). edge_matrix
180183
181184 location_indices = customer_index[epoch_customers]
182185 new_coordinates = env. instance. static_instance. coordinate[location_indices]
@@ -200,8 +203,7 @@ function anticipative_solver(
200203 is_must_dispatch[2 : end ] .= true
201204 else
202205 is_must_dispatch[2 : end ] .=
203- planning_start_time .+ epoch_duration .+ @view (new_duration[1 , 2 : end ]) .>
204- new_start_time[2 : end ]
206+ planning_start_time .+ epoch_duration .+ @view (new_duration[1 , 2 : end ]) .> new_start_time[2 : end ]
205207 end
206208 is_postponable[2 : end ] .= .! is_must_dispatch[2 : end ]
207209 # TODO : avoid code duplication with add_new_customers!
@@ -222,7 +224,7 @@ function anticipative_solver(
222224 compute_features (state, env. instance)
223225 end
224226
225- return DataSample (; info = (; state, reward), y = y_true, x )
227+ return DataSample (; y = y_true, x, state, reward )
226228 end
227229
228230 return obj, dataset
0 commit comments