The particle swarm optimization algorithm starts with (npop) random solutions and iteratively tries to improve the candidate solutions based on the best experience of each candidate (particle(i).best.location) and the best global experience (globalbest.location). In each iteration, the best location for each particle (particle(i).best.location) and the best global location (globalbest.location) are updated and the velocities and locations of the particles are calculated based on them [1]}. The velocity is given by:
\(\begin{split}particle(i).velocity=w*particle(i).velocity+\\c1*rand(varsize).*(particle(i).best.location\\-particle(i).location)+c2*rand(varsize).*\\(globalbest.location-particle(i).location)\end{split}\) 
