The social component pulls a particle toward the swarm’s best-known position. It gives the particle a group-oriented instinct: learn from the leader instead of relying only on personal discoveries. section 7.8
Its behavior depends mainly on the social constant:
- A larger social constant increases exploitation or convergence because particles favor the swarm’s best finding. section 7.8
- A random factor scales the social acceleration, preserving variation rather than making every particle move identically. section 7.8
- Low cognitive and high social influence creates trend followers that may collapse quickly around a local optimum. section 7.8
A tourist following the group
Imagine a tourist choosing where to go. Inertia says to keep moving, cognition says to revisit a personal favorite, and the social component says to move toward the swarm’s best-known destination. section 7.8
def calculate_social(self,
➥social_constant,
➥social_random,
➥swarm_best_position_x,
➥swarm_best_position_y,
➥particle_current_position_x,
➥particle_current_position_y):
social_acceleration =
➥self.calculate_acceleration(social_constant, social_random) #A
return (
social_acceleration *
➥(swarm_best_position_x - particle_current_position_x),
social_acceleration *
➥(swarm_best_position_y - particle_current_position_y), #B
)
The implementation computes social acceleration and applies it separately to each position coordinate using the difference between the swarm-best and current positions. section 7.8

