Particle swarm optimization example with animations.
Simple PSO that creates swarm and drones and searches the smallest value from the function.
code has banana function and schwefel function for testing purposes.
In the starting position all the particles are spread across the field. All particles start as blue particles and turn to red over time. Blue particles are searching in their close vicinity and red particles move towards swarm’s best position and look for better position there.
In image2, particles have turned to red and started moving towards the swarm’s best position (white +).
In image3, all particles have reached the swarm’s best position and look for even better position there until earlystopping stops the search or iterations have reached the maximum.