
159Guided Random Search Methods
TABLE 5.7
Algorithm for Particle Swarm Optimization
Step 1: Initialize i
max
, w
1
, ϕ
1
, ϕ
2
, n (population size), x
i,min
, and x
i,max
.
Step 2: Initialize the starting position and velocities of the variables as
x
i,k
= x
i,min
+ (x
i,max
− x
i,min
)u
i
k = 1 ⋯ n
v
i,k
= 0
Step 3: Compute p
i,k
= f(x
i,k
) k = 1 ⋯ n
Step 4: Compute pbest
i,k
= p
i,k
and gbest
i
= minimum(pbest
i,k
)
The location of pbest
k
and gbest is given by p
xik
and g
ix
.
Step 5: Update velocity
v
i+1,k
= w
1
v
i,k
+ ϕ
1
(p
xik
− x
i,k
)u
i
+ ϕ
2
(g
ix
− x
i,k
)u
i
Step 6: Update position x
i+1,k
= x
i,k
+ v
i+1,k
Step 7: Update tness p
i+1,k
= f(x
i+1,k
)
Step 8: If p
i+1,k
< pbest
i,k
then ...