| Random initialization for velocity and position of particles
|
| 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 : |
| Calculate fitness of particle by Equations (1)–(4) |
|
|
| end for |
|
|
for iterations : |
| for each particle : |
| Update and
|
| Map the particle location to the position of the eligible cluster head candidates |
| Calculate the fitness of particles |
| if
|
| then
|
| if
|
| then
|
| end for
|
| end for |