We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c86d383 commit 4f3719dCopy full SHA for 4f3719d
src/update.jl
@@ -3,9 +3,7 @@
3
function move!(state::ParticleSwarmState{T}, tuning::AbstractParticleSwarm) where {T}
4
rng, X, V = tuning.rng, state.X, state.V
5
w, c1, c2 = T(tuning.w), T(tuning.c1), T(tuning.c2)
6
- # Wrap rng in Ref for compatibility with Julia <= 1.3
7
- V .= w.*V .+ c1.*rand.(Ref(rng), T).*(state.pbest_X .- X) .+
8
- c2.*rand.(Ref(rng), T).*(state.gbest_X .- X)
+ @. V = w*V + c1*rand(rng, T)*(state.pbest_X - X) + c2*rand(rng, T)*(state.gbest_X - X)
9
X .+= V
10
for (r, idx) in zip(state.ranges, state.indices)
11
constrain!(r, view(X, :, idx))
0 commit comments