There was a bug that was reported by Konstantinos E.
Parsopoulos about choosing the global best in every
iteration. This was partially fixed by the amendment in
line 165 of the alpha version . However, the bug still
remains in the beta version.
In line 121
A = repmat(Swarm(g,:), SwarmSize, 1);
should read as
A = repmat(Best, SwarmSize, 1);
This is because Swarm(g,:) would end up selecting the
particle for that iteration instead of the global best
throughout the history of iterations.