Pso PPT
Pso PPT
Contents
Introduction to Optimization
Particle Swarm Optimization
Illustration of Algorithm
Mathematical Interpretation
Example
Dataset Illustration
Introduction to Optimization
The optimization can be defined as a mechanism through which the maximum or minimum value of a
given function or process can be found.
Inspired from the nature social behavior and dynamic movements with communications of insects,
birds and fish.
Particle Swarm Optimization(PSO)
Uses a number of agents (particles) that constitute a
swarm moving around in the search space looking for the
best solution
Each particle adjusts its travelling speed dynamically corresponding to the flying
experiences of itself and its colleagues.
Y=F(x) = -x^2+5x+20
y=f(x)= -x^2+5x+20
1. If a particle’s current position is better than its previous best position, update it.
2. Determine the best particle (according to the particle’s previous best positions).
Contd..
Particle’s velocity
:
3. Social
• Makes the particle follow the best neighbors
Influence direction
Acceleration coefficients
• When , c1=c2=0 then all particles continue flying at their current speed until they hit the search space’s boundary.
Therefore, the velocity update equation is calculated as:
t 1
vij
t
vij
• When c1>0 and c2=0 , all particles are independent. The velocity update equation will be:
vij
t 1
vij
t
c1r1 j
t
P t
best ,i xij
t
• When c1>0 and c2=0 , all particles are attracted to a single point in the entire swarm and
the update velocity will become
vij
t 1
vij
t
c 2r 2 j
t
g best xij
t
• When c1=c2, all particles are attracted towards the average of pbest and gbest.
Contd…
Diversification: searches new solutions, finds the regions with potentially the
best solutions
In PSO:
Example:
Contd..
Contd..
Contd..
Flow chart of Algorithm
Mathematical Example and Interpretation
Fitness Function
De Jong Function
minF(x,y) = x^2+y^2
Where x and y are the dimensions of the problem. The surface and contour plot of the De Jong
function is given as:
Mathematical Example and Interpretation
Contd..
Rastrigin Function
D
t 1
( xi 10. cos(2. .xi )
The surface and contour plot of the De Jong function is given as:
Mathematical Example and Interpretation
Contd…
Banana Function
The surface and contour plot of the Rosenbrock function or 2nd De Jong function
Or valley or banana functions given as:
Mathematical Example and Interpretation
Example 1
f ( x) x 2 5 x 20
Using PSO algorithm. Use 9 particles with initial positions
x1 9.6, x2 6, x3 2.6, x4 1.1,
x5 0.6, x6 2.3, x7 2.8, x8 8.3, x9 10
Solution Choose the number of particles
x1 9.6, x2 6, x3 2.6, x4 1.1,
x5 0.6, x6 2.3, x7 2.8, x8 8.3, x9 10
Evaluate the objective function
v1 0, v1 v 2 , v3 , v 4 v5 v6 v7 v8 v9 0
0 0 0 0 0 0 0 0 0 0
Step 5: updating the velocities of the particle by considering the value of random
numbers r1 = 0.213, r2= 0.876, c1=c2=1, w=1.
Gbest 2.362
0.113, r2 0.706
2 2
r1
Contd..
Find the velocities of the particles :
Gbest 2.362
Step 5: by considering the random numbers in range (0,1) as
r1 0.178, r2 0.507
3 3
Find the velocities of the particles
Where x and y are the dimensions of the problem , the velocities of all the particles are
initialized to zero and inertia (W) = 0.3, and the value of the cognitive and social constants
are
C1= 2 and C2 =2. The initial best solutions of all the particles are set to 1000
P1 fitness value = 12 12 2
Mathematical Example and Interpretation
Example
Iteration 2nd:
Mathematical Example and Interpretation
Example
Iteration 3rd:
Mathematical Example and Interpretation
Example
Iteration 3rd:
Psuedocode
1. P=particle initialization();
2. For I =1 to max
3 for each particle p in P do
fp=f(p)
4. If fp is better than f(pbest)
pbest =p;
5. end
6. end
7. gbest = best p in P.
8. for each particle p in P do
9.
10.
11. end
12. end
DataSet
Advantages and Disadvantages of PSO
Advantages
Disadvantages