Algorithm 1: Canonical PSO algorithm
1: Begin
2: Initialize number of particles and populations
3: Declare W, C1 and C2
4: Initialize Vinitialize(min) and Vinitialize(max)
5: Initialize Dmin and Dmax
6: Calculate Pbest and Gbest value for each particle
7: Do
8: For each particle
9: Calculate new velocity value, V(new)
10: Calculate new position, D(new)
11: Calculate Pbest (new)
12: Calculate Gbest (new)
13: While (stopping condition is reached)
14: End