diff --git a/src/ensemble.jl b/src/ensemble.jl new file mode 100644 index 000000000..9ef9da0b1 --- /dev/null +++ b/src/ensemble.jl @@ -0,0 +1,13 @@ +struct EnsembleOptimizationProblem{T1} <: SciMLBase.AbstractEnsembleProblem + prob::OptimizationProblem{iip, F, T1} where {iip, F} + u0s::Vector{T1} +end + +function SciMLBase.__init(prob::EnsembleOptimizationProblem{T}, args...; kwargs...) where {T <: OptimizationProblem} + probs = [remake(prob.prob, u0=u0; kwargs...) for u0 in prob.u0s] + return [SciMLBase.__init(prob, args...; kwargs...) for prob in probs] +end + +function SciMLBase.__solve(caches::Vector{OptimizationCache}, args...; kwargs...) + return [SciMLBase.__solve(cache, args...; kwargs...) for cache in caches] +end \ No newline at end of file