Intelligent Systems II · TEE · read

Read the PSO equation and work three individual updates

4. Particle swarm optimization

First understand position, velocity and memory; then solve complete two-iteration minimisation examples.

First read the update in words

New velocity = retained old velocity + pull toward personal best + pull toward the group best. After finding that velocity, add it to the old position. You are calculating a movement, then applying it.

Swipe across the diagram to read its labels ↔
A negative difference pulls toward a best position on the left.
Diagram: A negative difference pulls toward a best position on the left.. Labels: Read the direction before multiplying the pull | Best = 1 | Current = 4 | difference = 1 − 4 = −3 | coefficient 0.5 → pull 0.5 × (−3) = −1.5 (left)
A negative difference pulls toward a best position on the left.

Example: current x=4 and personal best=1 gives the difference 1−4=−3. A coefficient of .5 gives personal pull .5×(−3)=−1.5. The negative sign says “move left”; it does not mean a negative probability. If current x=−2 and best=1, the difference is 1−(−2)=1+2=3, which pulls right.

In vi,jt, i chooses the particle, j chooses its coordinate, and t chooses the recorded iteration. For particle B, coordinate 2, iteration 0, look at row B and the second velocity entry in the initial table. The letters identify a stored number; they are not extra multiplication factors.

The velocity equation is three contributions added together

v_{i,j}^{t+1}=w v_{i,j}^{t}+c_1r_1(pbest_{i,j}^{t}-x_{i,j}^{t})+c_2r_2(gbest_j^{t}-x_{i,j}^{t})LaTeX: v_{i,j}^{t+1}=w v_{i,j}^{t}+c_1r_1(pbest_{i,j}^{t}-x_{i,j}^{t})+c_2r_2(gbest_j^{t}-x_{i,j}^{t})
x_{i,j}^{t+1}=x_{i,j}^{t}+v_{i,j}^{t+1}LaTeX: x_{i,j}^{t+1}=x_{i,j}^{t}+v_{i,j}^{t+1}
SymbolMeaning
iWhich particle
jWhich coordinate of that particle
t / t+1Before / after this iteration; these are labels, not powers
wInertia weight: how much old velocity is kept
c₁r₁Combined strength of the pull to personal best
c₂r₂Combined strength of the pull to global best
r₁,r₂Random factors, normally in [0,1]; use the values supplied in an exam

A best position to the left gives a negative difference and pulls left; a best position to the right gives a positive difference and pulls right. The multiplication sets the strength of each pull.

For one coordinate, x=4, v=0, pbest=4, gbest=2. With w=0.5, c₁=c₂=1 and r₁=r₂=0.5, find the next velocity and position. [3 marks · Practice]

Given

x=4, v=0, pbest=4, gbest=2; w=.5; c₁r₁=.5; c₂r₂=.5.

To find

New velocity followed by new position.

Formula and why it applies

Use the three-term velocity equation, then add the new velocity to x.

v_{new}=0.5v+0.5(pbest-x)+0.5(gbest-x)LaTeX: v_{new}=0.5v+0.5(pbest-x)+0.5(gbest-x)

Solution

Step 1. Inertia
0.5\times0=0LaTeX: 0.5\times0=0
Step 2. Personal pull
0.5(4-(4))=0LaTeX: 0.5(4-(4))=0
Step 3. Social pull
0.5(2-(4))=-1LaTeX: 0.5(2-(4))=-1
Step 4. New velocity
v_{new}=0+0+(-1)=-1LaTeX: v_{new}=0+0+(-1)=-1
Step 5. New position
x_{new}=4+(-1)=3LaTeX: x_{new}=4+(-1)=3
Final answer. vnew=-1; xnew=3.

For one coordinate, x=4, v=-2, pbest=3, gbest=1. With w=0.5, c₁=c₂=1 and r₁=r₂=0.5, find the next velocity and position. [3 marks · Practice]

Given

x=4, v=-2, pbest=3, gbest=1; w=.5; c₁r₁=.5; c₂r₂=.5.

To find

New velocity followed by new position.

Formula and why it applies

Use the three-term velocity equation, then add the new velocity to x.

v_{new}=0.5v+0.5(pbest-x)+0.5(gbest-x)LaTeX: v_{new}=0.5v+0.5(pbest-x)+0.5(gbest-x)

Solution

Step 1. Inertia
0.5\times(-2)=-1LaTeX: 0.5\times(-2)=-1
Step 2. Personal pull
0.5(3-(4))=-0.5LaTeX: 0.5(3-(4))=-0.5
Step 3. Social pull
0.5(1-(4))=-1.5LaTeX: 0.5(1-(4))=-1.5
Step 4. New velocity
v_{new}=(-1)+(-0.5)+(-1.5)=-3LaTeX: v_{new}=(-1)+(-0.5)+(-1.5)=-3
Step 5. New position
x_{new}=4+(-3)=1LaTeX: x_{new}=4+(-3)=1
Final answer. vnew=-3; xnew=1.

For one coordinate, x=-2, v=1, pbest=-1, gbest=1. With w=0.5, c₁=c₂=1 and r₁=r₂=0.5, find the next velocity and position. [3 marks · Practice]

Given

x=-2, v=1, pbest=-1, gbest=1; w=.5; c₁r₁=.5; c₂r₂=.5.

To find

New velocity followed by new position.

Formula and why it applies

Use the three-term velocity equation, then add the new velocity to x.

v_{new}=0.5v+0.5(pbest-x)+0.5(gbest-x)LaTeX: v_{new}=0.5v+0.5(pbest-x)+0.5(gbest-x)

Solution

Step 1. Inertia
0.5\times1=0.5LaTeX: 0.5\times1=0.5
Step 2. Personal pull
0.5(-1-(-2))=0.5LaTeX: 0.5(-1-(-2))=0.5
Step 3. Social pull
0.5(1-(-2))=1.5LaTeX: 0.5(1-(-2))=1.5
Step 4. New velocity
v_{new}=0.5+0.5+1.5=2.5LaTeX: v_{new}=0.5+0.5+1.5=2.5
Step 5. New position
x_{new}=(-2)+2.5=0.5LaTeX: x_{new}=(-2)+2.5=0.5
Final answer. vnew=2.5; xnew=0.5.

First-iteration shortcut: if pbest was just initialised to x, the personal difference is zero. This follows from the initialisation; it is not a permanent property of PSO. A gbest particle can still move because its inertia term can be nonzero.

Yaad rakho: Old speed ka hissa + apne best ki pull + group best ki pull; phir new speed ko position mein add.