Particle Swarm Optimization (PSO): How Particles Update Positions and Velocities (with a Flocking Analogy)
Particle Swarm Optimization (PSO): How Particles Update Positions and Velocities (with a Flocking Analogy)
Particle Swarm Optimization keyword(PSO) keyworduses a swarm of particles to search for an optimum in a space of decision variables. Each particle “moves” through the search space by updating its keywordvelocity and keywordposition. The motion is guided by two memories: the particle’s own best position found so far (its keywordpbest) and the best position found by the entire swarm (its keywordgbest). In common form, PSO balances three effects: (i) inertia (continue moving as before), (ii) attraction to pbest (learn from self), and (iii) attraction to gbest (learn from the group).2
A simple birds-flocking analogy:
- Imagine each particle is a bird flying over terrain.
- The bird’s current keywordvelocity is how fast and in which direction it’s currently flying.
- The bird also “remembers” the best spot it has ever found (pbest).
- Birds can observe the best spot the flock has found so far (gbest).
- At each moment, the bird keeps some of its prior motion (inertia), then adjusts direction toward its own best and the flock’s best—while some randomness helps exploration and prevents the flock from getting stuck too early.2
Mermaid mental model:
Footnotes
-
Particle swarm optimization (PSO) overview and update equations — https://en.wikipedia.org/wiki/Particle_swarm_optimization - Defines velocity/position updates, inertia weight, and pbest/gbest concepts. ↩ ↩2
-
Standard PSO algorithm description and parameter roles — https://www.geeksforgeeks.org/particle-swarm-optimization/ - Explains PSO steps and interprets inertia/cognitive/social terms in the iteration process. ↩ ↩2
Particle Swarm Optimization (PSO) - How it Works
Core PSO update rules: positions and velocities
Let particle at iteration have:
- position vector (candidate solution),
- velocity vector (movement),
- personal best position ,
- global best position .
A widely used PSO update uses these equations (vector form):2
- Velocity update
- Position update
Where:
- is the inertia weight controlling how much the particle retains its current velocity.2
- and are acceleration coefficients controlling how strongly a particle is pulled toward and respectively.2
- and are random numbers in , typically sampled independently at each iteration (and usually per dimension), adding stochastic exploration.2
Key interpretation (ties to birds flocking)
- Inertia term : “Keep some of your previous flying direction and speed.”2
- Cognitive term : “Turn toward where you personally did best.”2
- Social term : “Also adjust toward where the flock did best.”2
Footnotes
-
Particle swarm optimization (PSO) overview and update equations — https://en.wikipedia.org/wiki/Particle_swarm_optimization - Defines velocity/position updates, inertia weight, and pbest/gbest concepts. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7
-
Standard PSO algorithm description and parameter roles — https://www.geeksforgeeks.org/particle-swarm-optimization/ - Explains PSO steps and interprets inertia/cognitive/social terms in the iteration process. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7
One PSO iteration (particle update loop)
- 1Step 1
Pick particles with random positions and velocities . Evaluate each particle’s fitness at its starting position.
- 2Step 2
For each particle, set . Track as the best across the swarm.
- 3Step 3
Compute using new random each iteration.
- 4Step 4
Move the particle: .
- 5Step 5
Compute the objective/fitness value at .
- 6Step 6
If the new position improves the particle, update . Then update to the best over all particles.
- 7Step 7
Stop after a fixed number of iterations, or when improvement becomes small, or when a target fitness is reached.
How each PSO term influences motion (conceptual contributions)
These are qualitative weights: higher magnitude typically causes stronger pull in that direction.
Pro Tip: Why the random numbers matter
The and terms make the cognitive and social pulls vary every iteration, which helps the swarm explore different regions instead of collapsing into a single trajectory too early.2
Footnotes
-
Particle swarm optimization (PSO) overview and update equations — https://en.wikipedia.org/wiki/Particle_swarm_optimization - Defines velocity/position updates, inertia weight, and pbest/gbest concepts. ↩
-
Standard PSO algorithm description and parameter roles — https://www.geeksforgeeks.org/particle-swarm-optimization/ - Explains PSO steps and interprets inertia/cognitive/social terms in the iteration process. ↩
Common implementation pitfall: update ordering
Be consistent about whether you use immediately for . The standard form shown here updates velocity first, then position using the new velocity: . Mixing vs can change behavior substantially.2
Footnotes
-
Particle swarm optimization (PSO) overview and update equations — https://en.wikipedia.org/wiki/Particle_swarm_optimization - Defines velocity/position updates, inertia weight, and pbest/gbest concepts. ↩
-
Standard PSO algorithm description and parameter roles — https://www.geeksforgeeks.org/particle-swarm-optimization/ - Explains PSO steps and interprets inertia/cognitive/social terms in the iteration process. ↩
A tiny numeric walk-through (1D) to make the updates tangible
Assume a 1D objective, so everything is scalars. At iteration for particle :
- current position:
- current velocity:
- personal best:
- global best:
- parameters: , ,
- random draws: ,
Velocity update
Position update
Interpretation in flocking terms: the particle had inertia (kept moving in its prior direction), but strong social pull toward (because is large and was large) made it turn more aggressively than the cognitive term.2
Footnotes
-
Particle swarm optimization (PSO) overview and update equations — https://en.wikipedia.org/wiki/Particle_swarm_optimization - Defines velocity/position updates, inertia weight, and pbest/gbest concepts. ↩
-
Standard PSO algorithm description and parameter roles — https://www.geeksforgeeks.org/particle-swarm-optimization/ - Explains PSO steps and interprets inertia/cognitive/social terms in the iteration process. ↩
Common PSO concepts (mapped to the flocking analogy)
PSO search cycle (repeated iterations)
Initialize
t = 0Random positions , velocities ; set and ."
Move
t → t+1 (repeat)Update using inertia + cognitive + social; then set ."
Remember
After movingEvaluate fitness; update and then ."
Termination
StopStop at max iterations or when improvements fall below a threshold."
PSO Quick Recall
Knowledge Check
In the standard PSO update, which term pulls a particle toward its own best position?