The total size of the swarm. This equates to the total number of particles available for optimization. There is a considerable amount of theory as to the appropriate number to use here. Remember, as we stated before, no free lunch! Generally, a value of 20-40 seems to be the most widely acceptable. 20 is the default value:
The code is as follows:
for (int i = 0; i < SwarmSize; i++)
Swarm Size = 10:
3D Plot
Swarm Size = 3:
3D Plot