Electric Power Distribution Handbook

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 41

Particle Swarm Optimization (PSO)

Technique and its Variant Binary PSO


(BPSO)
Presented by: Samia Abid
Student: MS(CS)

Supervised by: Dr. Nadeem Javaid


Associate Professor, Department of Computer Science,
COMSATS Institute of Information
Technology, 44000, Islamabad, Pakistan.
Outline
 Bio-inspired algorithms
 Why bio-inspired techniques.
 Taxonomy of bio-inspired techniques.
 What is swarm intelligence?
– Applications
 What is Particle Swarm Optimization (PSO)?
– How does it work?
– PSO algorithm.
– Algorithm example.
– Characteristics.
 BPSO
– How does it work?
– Energy optimization by BPSO.

2
Bio-inspired algorithms
 Bio-inspired algorithms are search methods that simulate the
natural biological evolution or the behaviour of biological entities
[1].
 Bio inspired algorithms has a wide range of applications covering all
most all areas including:
– Computer networks
– Security
– Robotics
– Bio medical engineering
– Control systems
– Parallel processing
– Data mining
– Power systems
– Production engineering and many more.

[1] Binitha, S., and S. Siva Sathya. "A survey of bio


inspired optimization algorithms." International Journal of
3
Soft Computing and Engineering 2, no. 2 (2012): 137-151.
Why Bio-inspired techniques?

 Optimization is a commonly encountered mathematical problem in


all engineering disciplines. It literally means finding the best
possible/desirable solution [1].
 Optimization problems are wide ranging and numerous.
 Optimization algorithms:
– Deterministic
– Stochastic in nature
 Former methods to solve optimization problems require enormous
computational efforts, which tend to fail as the problem size
increases.
 This is the motivation for employing bio inspired stochastic
optimization algorithms as computationally efficient alternatives to
deterministic approach.
4
Bio-inspired techniques
Bio-inspired
techniques

Swarm
Evolutionary Ecological
Intelligence

GA
GP PSO BBO
ES
ACO AWC
DE
ABC PS2O
PFA
BFA
GSO
FA
SFLA
FSA

Taxonomy of Bio-inspired techniques 5


Swarm Intelligence (SI)
 Algorithms inspired by the collective behavior of social insect
colonies and other animal societies are called swarm
intelligence algorithms .
 The expression was introduced by Gerardo Beni and Jing
Wang in 1989, in the context of cellular robotic systems [2].
 SI systems are typically made up of a population of simple
agents interacting locally with one another and with their
environment.
 Natural examples:
Ant colonies Bird flocking Animal herding
Bacteria growth Fish schooling.

[2] Yang, Xin-She, Zhihua Cui, Renbin Xiao, Amir Hossein Gandomi, and
Mehmet Karamanoglu, eds. Swarm intelligence and bio-inspired
computation: theory and applications. Newnes, 2013. 6
SI Applications
 U.S. Military is investigating swarm
techniques for controlling unmanned
vehicles.

 Home energy management in


Smart grid.

 NASA is investigating the use of


swarm technology for planetary
mapping.

7
6

PSO (1/2)
 First described in 1995 [2].
 By James Kennedy and Russel
C. Eberhert.
 Inspired by social behavior of
birds and fishes.

8
7

PSO (2/2)
 Combines self-experience with social experience.
 Population-based optimization.
 Find approximate solutions
of problems.
 Easy to implement.
 Few parameters to adjust.

[3] Pinto. “The Particle Swarm Optimization algorithm.interne:http://pa


ginas.fe.up.pt/~mac/ensino/docs/DS20102011/Presentations/
PopulationalMetaheuristics/PSO__AndryPinto_InesDomingues_LuisRocha
9
_HugoAlves_SusanaCruz.pptx,Jun. 27, 2013 [Jan. 31, 2017].
Concept (1/2)
 Similarly to genetic algorithm (GA), it is a population-based method.
 It represents the state of the algorithm by a population, which is
iteratively modified until a termination criterion is satisfied.
 Uses a number of particles that make a swarm moving around in
the search space looking for the best solution
 Each particle in search space adjusts its “flying” according to:
 its own flying experience
 the flying experience of other particles.

10
Concept (2/2)
 In PSO, each single solution is a "bird" in the search
space. We call it "particle".
 All the particles have fitness values which are evaluated
by the fitness function.
 All particles have velocities, which direct the flying of the
particles.
 The particles fly through the problem space by following
the current optimum particles.

11
How does it Work? (1/2)
 Initialized with a group of random particles [4].
 Searches for optimal by updating generations.
 Particles move through the solution space, and are evaluated
according to some fitness criterion.
 In every iteration, each particle is updated by following
“best” values.
– Pbest
– Gbest

[4] Clerc, Maurice. Particle swarm optimization.


Vol. 93. John Wiley & Sons, 2010. 12
How does it Work? (2/2)
Each particle tries to modify its current position and velocity according to
the distance between its current position and Pbest, and the distance
between its current position and gbest [3].
– Update particles’ velocities:
Vn  1  Vn  c1.rand1* ( Pbest, n  Pn)  c2.rand1* ( Pgbest , n  Pn)

– Move particles to their new positions:


Pn  1  Pn  Vn  1
Vn+1 Particle velocity at n+1th iteration C1 Acceleration factor related to gbest

C2 Acceleration factor related to lbest Rand1 Random number between 0 and 1

gbest gbest position of swarm Pbest Pbest position of swarm

Pn Current position of particle

13
PSO-Algorithm
• For each particle
– Initialize particle with random number
End
DO
– For each particle
• Calculate the fitness value
• If fitness values at time t is better than the its
previous best fitness value (Pbest) at time (t-1)
• Set current value as the new Pbest
END
– Choose the particle with the best fitness value of all
the particles as the gbest
– For each particle
• Update velocity
• Update position
– While maximum iterations not reached.

14
Algorithm-Example (1/8)

15
Algorithm-Example (2/8)

16
Algorithm-Example (3/8)

17
Algorithm-Example (4/8)

18
Algorithm-Example (5/8)

19
Algorithm-Example (6/8)

20
Algorithm-Example (7/8)

21
Algorithm-Example (8/8)

22
PSO Characteristics
 Pros [5]
– Simple implementation
– Suitable for concurrent processing
– Derivative free
– Very few algorithm parameters
– Very efficient global search algorithm

 Cons [5]
– Premature convergence in mid optimum points
– Slow convergence in refined search stage (weak local search ability)

[5] Kumar, Ashok, Brajesh Kumar Singh, and B. D. K.


Patro. "Particle Swarm Optimization: A Study of Variants
and Their Applications." International Journal of
23
Computer Applications 135, no. 5 (2016): 24-30.
BPSO
 PSO is a conventional algorithm
 Applicable for continuous problems.
 However, it cannot be applied to discrete problems directly.
 Aiming at the discrete problems, Kennedy and Eberhart
extended the PSO to BPSO in 1997 [5]
 It is a binary variant of PSO.

24
How does it work? (1/2)
 In BPSO, population has a set of particles.
 Each individual particle represents a binary decision.
 This decision can be represented by either YES/TRUE=1 or
NO/FALSE=0.
 All particles represent their positions through binary values
which are 0 or 1.
 Velocity is restricted within the range {0,1}

25
How does it work? (2/2)
 The velocity vector equation and position vector equation are
defined as [5]:
– velocity vector equation:
1
Vi (t  1) 
n
 vin ( t )
1 e
– position vector equation:

1 if r  Vi n
xin (t  1)  

0 otherwise

– r is the random number selected from a uniform distribution in [0, 1].

26
BPSO-Example 1 (1/4)

 As an example, let’s say that we are dealing with a


population of 5 bit binary particles and a population
of 4 particles.
1 0 1 0 1

0 1 0 1 1

1 1 1 0 0

Particle 2 0 1 1 0 1

 We are updating particle 2 (01011), bit 3(0)


27
BPSO-Example 1 (2/4)

 Furthermore, we will assume that the current


velocity of this bit to be a 1 is 0.25.
 Furthermore, assume that the best value of
this particle (to date) is 00100.
 And the best value of the whole population
(to date) is 01111.

28
BPSO-Example 1 (3/4)
v 23 (t  1)  0.25  Velocity of bit
x23 (t  1)  0  Position of bit
p 23  1  Pbest
Pg 3  1  gbest
c1  2.5
c2  1.5
vid (t )  vid (t  1)  c1 ( pid  xid (t  1))  c2 ( p gd  xid (t  1))
vid (t )  0.25  (0.25 )(1  0)  (1.5)(1  0)  4.43
1
f (v23 (t ))   4.43
 0.89
1 e

29
BPSO-Example 1 (4/4)

 Now, with the value for f, we generate a


random number.
 If the random number is less than f then bit x
becomes a 1 otherwise, it becomes a 0.

30
Energy Optimization by BPSO (1/10) [6]
No of Homes 1
No of Appliances 13
Timeslots 24 hours.

Appliances Power Rating Appliances Power Rating


(kW/h) (kW/h)

Lights 0.6 Coffee Maker (CM) 0.8


Fans 0.75 Washing Machine (CM) 0.78

Clothes Iron 1.5 Dish Washer (DW) 3.60


Microwave Oven 1.18 Cloth Dryer (CD) 4.40
Toaster 0.5 Air Conditioner (AC) 1.44
Refrigerator 0.73 Water Heater (WH) 4.45
Space Heater (SH) 1.50

[6]. Rahim, Sahar, Nadeem Javaid, Ashfaq Ahmad, Shahid Ahmed Khan, Zahoor Ali Khan, Nabil
Alrajeh, and Umar Qasim. "Exploiting heuristic algorithms to efficiently utilize energy management
controllers with renewable energy sources." Energy and Buildings 129 (2016): 452-470. 31
Energy Optimization by BPSO (2/10)

Appliances

Fixed Shiftable Elastic

LOT cannot be modified Can be shifted without Can be shifted to a


altering load profile. suitable time
(Not Shiftable)
(Uninterruptible) (Interruptible)

Lighting
Fan, Iron, Microwave over, Washing machine, Dish
Toaster, Cofee maker washer, Clothes dryer Air conditioner, water
heater, space heater

32
Energy Optimization by BPSO (3/10)

Parameters of shiftable appliances


Appliances Start time End time Waiting time
Washing 8 16 5
machine
Dish washer 7 12 5
Clothes dryer 6 18 5

Parameters of elastic appliances


Appliances Start time End time
Air conditioner 6 24
Water heater 6 24
Space heater 6 24

33
Energy Optimization by BPSO (4/10)

BPSO Parameters
Swarm size 200
Vmax (maximum velocity) 4 m/s
Vmin (minimum velocity) -4 m/s
Max iterations 600
C1 2
C2 2

34
Energy Optimization by BPSO (5/10)
Key terms corresponding to Smart grid optimization
PSO Role in HEM General use
Parameters
Particle A timeslot (One possible Possible solution in search area
solution)
swarm Set of possible solutions a set of particles

Dimension Number of appliances Search area

Fitness function Designed objective function with Objective function


constraints
Position Initialize vector for appliances Initialization point in search area
states randomly.
Velocity Probability of the bit to be 1. Randomly generated
(To turn on the appliance.)

Particle best Local best values for state array Evaluated fitness function
(Pbest) that satisfy objective function . answer
Global best Globally best solution that Evaluated fitness function
(Gbest) satisfy all constraints (A answer
timeslot)

35
Energy Optimization by BPSO (6/10)

• Step1:
– Initialize Particles with random number (randomly generate population)
– Set initial position of particles as Pbest.
Code to randomly generate population
for j=1:swarm
for i=1:n WM DW CD AC WH SP
if rand(1)>0.5 0 1 1 1 1 1
X=1;
1 1 1 0 0 0
else
X=0; 0 1 1 1 0 0
end :
x1(j,i)=X; :
end :
end
0 0 1 0 0 1

36
Energy Optimization by BPSO (7/10)

• Step 2:
– For Each Particle
WM DW CD AC WH SP Fitness
• Calculate the fitness
0 0 1 1 0 1 2.4894
Fitness Function:
1. function [FF]=obj(electricity_cost,
0 1 1 0 1 0 2.4916
power rating,x1,swarm,d) 0 1 1 1 0 0 2.4956
1. for i=1:swarm :
2. FF(i,1)=electricity_cost*x1(i,:)'; :
3. err=c_electricity_cost*x1(i,:)'-d; :
4. FF(i,1)=FF(i,1)+1000*abs(err); 0 1 0 1 1 0 2.4888
5. end

37
Energy Optimization by BPSO (8/10)

• Step 3:
– Choose the Timeslot (solution) with the best fitness value among all possible
solutions as the gbest.
0 1 0 1 1 0

WM DW CD AC WH SP Fitness
0 0 1 1 0 1 2.4894
0 1 1 0 1 0 2.4916
0 1 1 1 0 0 2.4956
Gbest solution
:
:
:
0 1 0 1 1 0 2.4888

38
Energy Optimization by BPSO (9/10)

• Step 4:
– For each Particle
• Update its velocity.
1
Vi n (t  1) 
vin (t )
1 e
• Update its position.

1 if r  Vi n
xin (t  1)  

0 otherwise
• Step 5:
– While maximum iterations not reached.
 Note: Repeat this process 24 times to get the most optimal solution
for each timeslot.

39
Energy Optimization by BPSO (10/10)
MATLAB CODE:
1. for i = 1:swarm
2. for j = 1:n
3. v(i,j) = v(i,j)+c1*rand(1)*(pbest(i,j)-x_BP(i,j))+c2*rand(1)*(gbestt_BP(1,j)-x_BP(i,j));
4. if ( (v(i,j) <= vmax) && (v(i,j)>=vmin) )
5. v(i,j) = v(i,j);
6. elseif ( v(i,j) < vmin )
7. v(i,j) = vmin;
8. elseif ( v(i,j) > vmax )
9. v(i,j) = vmax;
10. end
This shows the velocity of the
11. sig(i,j) = 1/(1+exp(-v(i,j)));
12. particle should stay in a limit
13. if rand(1) < sig(i,j)
14. x_BP(i,j) = 1; Apply sigmoidal function on
15. else
the velocity
16. x_BP(i,j) = 0;
17. end
18. end
19. end

40
Any questions?
41

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy