Skip to content

Commit d5a99db

Browse files
authored
fix: take plain parametric solver instead of its perturbed version as input of train_policy! (#24)
1 parent fa56383 commit d5a99db

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

src/algorithms/mirror_descent/mirror_descent.jl

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ $TYPEDSIGNATURES
8282
Train a DFLPolicy using the Mirror Descent algorithm on a provided training dataset.
8383
8484
When `imitation_start=true`, the first iteration is a pure imitation step using
85-
`anticipative_solver`; subsequent iterations are the mirror descent loop using
86-
`perturbed_anticipative_solver`.
85+
`anticipative_solver`. Subsequent iterations are the mirror descent loop.
8786
8887
# Arguments
8988
- `iterations=10`: total number of mirror descent iterations (includes the imitation step
@@ -101,7 +100,7 @@ function train_policy!(
101100
policy::DFLPolicy,
102101
train_dataset,
103102
anticipative_solver,
104-
perturbed_anticipative_solver;
103+
parametric_anticipative_solver;
105104
epochs=10,
106105
iterations=10,
107106
κ=1.0,
@@ -110,6 +109,15 @@ function train_policy!(
110109
imitation_start::Bool=true,
111110
is_minimization::Bool=true,
112111
)
112+
(; nb_samples, ε, threaded, seed) = algorithm.inner_algorithm
113+
perturbed_anticipative_solver = PerturbedAdditive(
114+
(θ; scenario, kwargs...) -> parametric_anticipative_solver(θ, scenario; kwargs...);
115+
ε=κ * ε,
116+
nb_samples=nb_samples,
117+
seed=seed,
118+
threaded=threaded,
119+
)
120+
113121
if imitation_start
114122
verbose && println("Imitation step")
115123
dataset = _augment_with_anticipative(train_dataset, anticipative_solver)
@@ -211,21 +219,12 @@ function train_policy(
211219
)
212220
policy = DFLPolicy(model, maximizer)
213221

214-
(; nb_samples, ε, threaded) = algorithm.inner_algorithm
215-
perturbed_anticipative_solver = PerturbedAdditive(
216-
(θ; scenario, kwargs...) -> parametric_anticipative_solver(θ, scenario; kwargs...);
217-
ε=κ * ε,
218-
nb_samples=nb_samples,
219-
seed=seed,
220-
threaded=threaded,
221-
)
222-
223222
histories_per_iteration = train_policy!(
224223
algorithm,
225224
policy,
226225
train_dataset,
227226
anticipative_solver,
228-
perturbed_anticipative_solver;
227+
parametric_anticipative_solver;
229228
epochs=epochs,
230229
iterations=iterations,
231230
κ=κ,

0 commit comments

Comments
 (0)