Skip to content

Commit 862a4ef

Browse files
committed
docstrings
1 parent abaf9d2 commit 862a4ef

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

src/DynamicVehicleScheduling/DynamicVehicleScheduling.jl

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ $TYPEDFIELDS
5757
two_dimensional_features::Bool = false
5858
end
5959

60+
"""
61+
$TYPEDSIGNATURES
62+
63+
Generate a dataset for the dynamic vehicle scheduling benchmark.
64+
Returns a vector of [`DataSample`](@ref) objects, each containing an [`Instance`](@ref).
65+
The dataset is generated from pre-existing DVRPTW files.
66+
"""
6067
function Utils.generate_dataset(b::DynamicVehicleSchedulingBenchmark, dataset_size::Int=1)
6168
(; max_requests_per_epoch, Δ_dispatch, epoch_duration, two_dimensional_features) = b
6269
files = readdir(datadep"dvrptw"; join=true)
@@ -74,21 +81,45 @@ function Utils.generate_dataset(b::DynamicVehicleSchedulingBenchmark, dataset_si
7481
]
7582
end
7683

84+
"""
85+
$TYPEDSIGNATURES
86+
87+
Creates an environment from an [`Instance`](@ref) of the dynamic vehicle scheduling benchmark.
88+
The seed of the environment is randomly generated using the provided random number generator.
89+
"""
7790
function Utils.generate_environment(
7891
::DynamicVehicleSchedulingBenchmark, instance::Instance, rng::AbstractRNG; kwargs...
7992
)
8093
seed = rand(rng, 1:typemax(Int))
8194
return DVSPEnv(instance; seed)
8295
end
8396

97+
"""
98+
$TYPEDSIGNATURES
99+
100+
Returns a linear maximizer for the dynamic vehicle scheduling benchmark, of the form:
101+
θ ↦ argmax_{y} θᵀg(y) + h(y)
102+
"""
84103
function Utils.generate_maximizer(::DynamicVehicleSchedulingBenchmark)
85104
return LinearMaximizer(oracle; g, h)
86105
end
87106

107+
"""
108+
$TYPEDSIGNATURES
109+
110+
Generate a scenario for the dynamic vehicle scheduling benchmark.
111+
This is a wrapper around the generic scenario generation function.
112+
"""
88113
function Utils.generate_scenario(b::DynamicVehicleSchedulingBenchmark, args...; kwargs...)
89114
return Utils.generate_scenario(args...; kwargs...)
90115
end
91116

117+
"""
118+
$TYPEDSIGNATURES
119+
120+
Generate an anticipative solution for the dynamic vehicle scheduling benchmark.
121+
The solution is computed using the anticipative solver with the benchmark's feature configuration.
122+
"""
92123
function Utils.generate_anticipative_solution(
93124
b::DynamicVehicleSchedulingBenchmark, args...; kwargs...
94125
)
@@ -97,6 +128,14 @@ function Utils.generate_anticipative_solution(
97128
)
98129
end
99130

131+
"""
132+
$TYPEDSIGNATURES
133+
134+
Generate baseline policies for the dynamic vehicle scheduling benchmark.
135+
Returns a tuple containing:
136+
- `lazy`: A policy that dispatches vehicles only when they are ready
137+
- `greedy`: A policy that dispatches vehicles to the nearest customer
138+
"""
100139
function Utils.generate_policies(b::DynamicVehicleSchedulingBenchmark)
101140
lazy = Policy(
102141
"Lazy",
@@ -111,6 +150,13 @@ function Utils.generate_policies(b::DynamicVehicleSchedulingBenchmark)
111150
return (lazy, greedy)
112151
end
113152

153+
"""
154+
$TYPEDSIGNATURES
155+
156+
Generate a statistical model for the dynamic vehicle scheduling benchmark.
157+
The model is a simple linear chain with a single dense layer that maps features to a scalar output.
158+
The input dimension depends on whether two-dimensional features are used (2 features) or not (27 features).
159+
"""
114160
function Utils.generate_statistical_model(
115161
b::DynamicVehicleSchedulingBenchmark; seed=nothing
116162
)

0 commit comments

Comments
 (0)