Skip to main content
. 2020 Oct 21;20(20):5961. doi: 10.3390/s20205961
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