Skip to content

Commit 6f888b3

Browse files
Merge pull request #903 from SciML/ChrisRackauckas-patch-1
Update ensemble.md to use standard API
2 parents 8f6bb3b + f3a7269 commit 6f888b3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

docs/src/tutorials/ensemble.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ prob = OptimizationProblem(optf, x0, [1.0, 100.0])
1919
2020
@show sol1.objective
2121
22-
ensembleprob = Optimization.EnsembleProblem(
23-
prob, [x0, x0 .+ rand(2), x0 .+ rand(2), x0 .+ rand(2)])
22+
x0s = [x0, x0 .+ rand(2), x0 .+ rand(2), x0 .+ rand(2)]
23+
function prob_func(prob, i, repeat)
24+
remake(prob, u0 = x0s[1])
25+
end
2426
27+
ensembleprob = Optimization.EnsembleProblem(prob; prob_func)
2528
@time sol = Optimization.solve(ensembleprob, OptimizationOptimJL.BFGS(),
2629
EnsembleThreads(), trajectories = 4, maxiters = 5)
2730
@show findmin(i -> sol[i].objective, 1:4)[1]

0 commit comments

Comments
 (0)