Skip to main content
. 2019 Jul 13;19(14):3096. doi: 10.3390/s19143096
Algorithm 1. Conventional Particle Swarm Optimization for TSP
select swarm size and maximum iterations
define fitness function
preset acceleration coefficients (c1, c2) and inertia weight (w)
for each particle do
    initialize velocity and position
    evaluate initial fitness value
    record initial Pis and Pgs
end
while maximum iterations or minimum error criteria is not achieved do
    for each particle do
       calculate the new velocity using Equation (1)
       update the new position using Equation (2)
       evaluate new fitness function
       update Pis and Pgs
    end
end