I assume that if I don’t change the problem in EnsembleProblem, the EnsembleSummary should produce the same plot as the original ODEProblem solution.
Simple example:
module test
using Plots, StatsPlots
using LinearAlgebra
using OrdinaryDiffEq
using SciMLExpectations
using Distributions
function f(u, p, t)
return [
u[2],
-1 * u[1] + u[3] * (1 - u[1]^2) * u[2],
0
]
end
tspan = (0.0, 2000.0)
u0 = [2.0, 0, 1000]
p = nothing
ref = ODEProblem(f, u0, tspan, p)
refsol = solve(ref, AutoTsit5(Rosenbrock23()))
display(plot(refsol, idxs=[1, 2], title="Van der Pol"))
prob_func(prob, i, repeat) = remake(prob,
p=nothing)
ensemble_prob = EnsembleProblem(ref, prob_func=prob_func)
ensemblesol = solve(ensemble_prob,
AutoTsit5(Rosenbrock23()),
EnsembleThreads(),
trajectories=3)
summ = EnsembleSummary(ensemblesol)
display(plot(summ, idxs=[1, 2], title="Ensemble"))
# there is no difference
for uu in ensemblesol.u
display(maximum(norm.(uu.u - refsol.u)))
end
end
The last loop confirms that the solutions are the same:
0.0
0.0
0.0
However, the plots are different:
What am I missing?