Skip to main content
. 2016 Jan 29;16(2):170. doi: 10.3390/s16020170
  Random initialization for velocity vi(0) and position xi(0) of particles i[1,2,,S]
  Map the particle location to position of the nodes according to the distances between the positions of each particle and the nodes
  for each particle i[1,2,,S]:
  Calculate fitness fi(0) of particle by Equations (1)–(4)
    Pi(0)fi(0)
end for
G(0)min{f1(0),f2(0),,fS(0)}
for iterations t[1,2,,MaxIter]:
  for each particle i[1,2,,S]:
    Update vi(t) and xi(t)
    Map the particle location to the position of the eligible cluster head candidates
    Calculate the fitness of particles
    if fi(t)<Pi(t)
      then Pi(t)fi(t)
    if Pi(t)<G(t)
      then G(t)Pi(t)
   end for
end for