Algorithm 1: PSO algorithm |
for each particle do |
initialize particle |
end for |
while target fitness or maximum epoch is not attained do |
for each particle do |
calculate fitness |
if current fitness value better than (pbest) then |
pbest = current fitness |
end if |
end for |
set gbest to the best one among all pbest |
for each particle do |
update velocity |
update position |
end for |
end while |