Skip to content

Commit a6f01b0

Browse files
committed
Fixup! hybrid cache in solve.jl
1 parent f528b3a commit a6f01b0

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/hybrid.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
result[i] = sol.u
66
end
77

8-
struct HybridPSOCache{TPc, TSp, TAlg}
9-
pso_cache::TPc
10-
start_points::TSp
11-
alg::TAlg
12-
end
13-
148
function SciMLBase.init(
159
prob::OptimizationProblem, opt::HybridPSO{Backend, LocalOpt}, args...;
1610
kwargs...) where {Backend, LocalOpt <: Union{LBFGS, BFGS}}
@@ -67,7 +61,6 @@ function SciMLBase.solve!(
6761
reltol = nothing,
6862
maxiters = 100, local_maxiters = 10, kwargs...) where {
6963
Backend, LocalOpt <: Union{LBFGS, BFGS}}
70-
7164
pso_cache = cache.pso_cache
7265

7366
sol_pso = solve!(pso_cache)

src/solve.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
function get_pos(particle)
22
return particle.position
33
end
4-
54
mutable struct PSOCache{TP, TAlg, TPart, TGbest}
65
prob::TP
76
alg::TAlg
87
particles::TPart
98
gbest::TGbest
109
end
10+
struct HybridPSOCache{TPc, TSp, TAlg}
11+
pso_cache::TPc
12+
start_points::TSp
13+
alg::TAlg
14+
end
1115

1216
function SciMLBase.init(
1317
prob::OptimizationProblem, opt::ParallelPSOKernel, args...; kwargs...)

0 commit comments

Comments
 (0)