Skip to content

Commit 39cac5a

Browse files
committed
bugfix
1 parent edaf383 commit 39cac5a

File tree

3 files changed

+7
-22
lines changed

3 files changed

+7
-22
lines changed

src/DynamicVehicleScheduling/DynamicVehicleScheduling.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ function Utils.generate_policies(b::DynamicVehicleSchedulingBenchmark)
111111
return (lazy, greedy)
112112
end
113113

114-
function Utils.generate_statistical_model(b::DynamicVehicleSchedulingBenchmark)
114+
function Utils.generate_statistical_model(
115+
b::DynamicVehicleSchedulingBenchmark; seed=nothing
116+
)
117+
Random.seed!(seed)
115118
return Chain(Dense((b.two_dimensional_features ? 2 : 14) => 1), vec)
116119
end
117120

src/DynamicVehicleScheduling/anticipative_solver.jl

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -165,25 +165,6 @@ function anticipative_solver(
165165
N = N + M
166166
index += 1
167167
end
168-
# epoch_indices = Vector{Int}[] # store global indices present at each epoch
169-
# N = 1 # current last index known in global indexing (= depot)
170-
# index = 1
171-
# indices = [1]
172-
# for epoch in 1:last_epoch(env)
173-
# M = length(scenario.indices[epoch]) # number of new customers in epoch
174-
# indices = vcat(indices, (N + 1):(N + M)) # add global indices of customers in epoch
175-
# push!(epoch_indices, copy(indices))
176-
# N = N + M
177-
# if epoch in T #
178-
# dispatched = vcat(epoch_routes[index]...)
179-
# index += 1
180-
# indices = setdiff(indices, dispatched)
181-
# end
182-
# end
183-
184-
# indices = vcat(1, scenario.indices...)
185-
# start_time = vcat(0.0, scenario.start_time...)
186-
# service_time = vcat(0.0, scenario.service_time...)
187168

188169
dataset = map(enumerate(T)) do (i, epoch)
189170
routes = epoch_routes[i]
@@ -215,14 +196,15 @@ function anticipative_solver(
215196
epoch_duration = env.instance.epoch_duration
216197
Δ_dispatch = env.instance.Δ_dispatch
217198
planning_start_time = (epoch - 1) * epoch_duration + Δ_dispatch
218-
if epoch == last_epoch
199+
if epoch == end_epoch
219200
# If we are in the last epoch, all requests must be dispatched
220201
is_must_dispatch[2:end] .= true
221202
else
222203
is_must_dispatch[2:end] .=
223204
planning_start_time .+ epoch_duration .+ @view(new_duration[1, 2:end]) .> new_start_time[2:end]
224205
end
225206
is_postponable[2:end] .= .!is_must_dispatch[2:end]
207+
# TODO: avoid code duplication with add_new_customers!
226208

227209
state = DVSPState(;
228210
state_instance=static_instance,

src/Utils/interface.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Generate a vector of environments for the given dynamic benchmark and dataset.
232232
"""
233233
function generate_environments(
234234
bench::AbstractDynamicBenchmark,
235-
dataset::Vector{<:DataSample};
235+
dataset::AbstractArray{<:DataSample};
236236
seed=nothing,
237237
rng=MersenneTwister(seed),
238238
kwargs...,

0 commit comments

Comments
 (0)