Skip to content

Commit

Permalink
init implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaibhavdixit02 committed Oct 27, 2023
1 parent 461d002 commit 4eef579
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/ensemble.jl
Original file line number Diff line number Diff line change
@@ -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]

Check warning on line 8 in src/ensemble.jl

View check run for this annotation

Codecov / codecov/patch

src/ensemble.jl#L6-L8

Added lines #L6 - L8 were not covered by tests
end

function SciMLBase.__solve(caches::Vector{OptimizationCache}, args...; kwargs...)
return [SciMLBase.__solve(cache, args...; kwargs...) for cache in caches]

Check warning on line 12 in src/ensemble.jl

View check run for this annotation

Codecov / codecov/patch

src/ensemble.jl#L11-L12

Added lines #L11 - L12 were not covered by tests
end

0 comments on commit 4eef579

Please sign in to comment.