Professional Documents
Culture Documents
PSO
Outline
Hystorical note Recapitulation and terminology PSO
Origin Basics Terminology Flowchart and code Numerical experiments
Hystorical note
1995, IEEE Spectrum
Codenamed P6, the Intel Pentium Pro was released by Intel in November 1995 and contained 5.5 million transistors, was available in clock speeds of 150MHz to 200MHz, and was the first Intel processor that utilized the i686 architecture.
?
32=9 (9 sec.)! ! 102=100 (ca. 1,5 min) 33=27 (ca. 0,5 min)! ! 103=1.000 (ca. 15 min) 310=59.049 (ca. 16,5 hrs.)! ! 1010=... (ca. 317 yrs.)
No-free-lunch theorem
D. H. Wolpert and W.G. Macready, "No Free Lunch Theorems for Optimization," IEEE Transactions on Evolutionary Computation 1, pp. 67, 1997. any two optimization algorithms are equivalent when their performance is averaged across all possible problems BUT: we do not try to solve ALL possible problems, only a domain-specific subset !
5
Origins
J. Kennedy and R. Eberhart, "Particle Swarm Optimization, Proc. of IEEE International Conf. on Neural Networks IV, pp. 19421948, 1995.
Russel Ebenhart (Electrical Engineer) and James Kennedy (Social Psychologist) in 1995 (both U. Indiana, Purdue). Categories: Swarm Intelligence techniques and Evolutionary Algorithms for optimization. Inspired by the social behavior of birds, studied by Craig Reynolds (a biologist) in late 80s and early 90s. He derived a formula for representation of the flocking behavior of birds. This was later used in computer simulations of virtual birds, known as Boids. Ebenhart and Kennedy recognized the suitability of this technique for optimization
In ES population members derive from each other but do not exchange information, in PSO they do!
6
Basics
Main idea: Mimic bird flocking or fish schooling
Nature Birds or fish Explore the environment (3d) in search for food Exchange information by acoustical or optical means Algorithm Particles Explore objective space (Nd) in search for good function values Exchange information by sharing positions of promising locations
Basic models of flocking behavior are controlled by three simple rules: Separation - avoid crowding neighbors (short range repulsion) Alignment - steer towards average heading of neighbors Cohesion - steer towards average position of neighbors (long range attraction)
7
Terminology
Particles Velocities Personal best Global best
5 4 3 2 1
50 45 40 35 30
0 25 1 2 3 4 5 5 20 15 10 5
Particles: x i Velocities: v i Personal best positions ever: p i Global best position ever: g best
Flowchart
Alg. params.:
n w, c1, c2
For each particle:! 1) Evaluate tness f(xi)! 2) If new personal best set pi=xi ! For the whole population:! 1) Identify global best pg
! !
Convergence ?
Code
Matlab
1 clear all; close all; clc 2 %Function to be minimized 3 D=2; 4 objf=inline(4*x1^22.1*x1^4+(x1^6)/3+x1*x24*x2^2+4*x2^4,x1,x2); 5 objf=vectorize(objf); 6 %Initialization of PSO parameters 7 N=20; %population size (total function evaluations will be itmax*N) 8 itmax=30; 9 c1=1.05; c2=1.05; 10 wmax=1; wmin=0.3; %set to same value for constant w 11 w=linspace(wmax,wmin,itmax); %linear variation of w 12 %Problem and velocity bounds 13 a(1:N,1)=1.9; b(1:N,1)=1.9; %bounds on variable x1 14 a(1:N,2)=1.1; b(1:N,2)=1.1; %bounds on variable x2 15 d=(ba); 16 m=a; n=b; 17 q=(nm)/4; %initial velocities are 1/4 of parameter space size 18 %Random initialization of positions and velocities 19 x=a+d.*rand(N,D); 20 v=q.*rand(N,D); 21 %Evaluate objective for all particles 22 f=objf(x(:,1),x(:,2)); 23 %Find gbest and pbest (in this case coincides with x) 24 [fgbest,igbest]=min(f); 25 gbest=x(igbest,:); 26 pbest=x; fpbest=f; 27 %Iterate 28 for it=1:itmax; 29 %Update velocities and positions 30 v(1:N,1:D)=w(it)*v(1:N,1:D)+c1*rand*(pbest(1:N,1:D)x(1:N,1:D)) +c2*rand*(repmat(gbest,N,1)x(1:N,1:D)); 31 x(1:N,1:D)=x(1:N,1:D)+v(1:N,1:D); 32 %Evaluate objectives 33 f=objf(x(:,1),x(:,2)); 34 %Find gbest and pbest 35 [minf,iminf]=min(f); 36 if minf<= fgbest 37 fgbest=minf; gbest=x(iminf,:); 38 end 39 inewpb=find(f<=fpbest); 40 pbest(inewpb,:)=x(inewpb,:); fpbest(inewpb)=f(inewpb); 41 end %end loop on iterations 42 [gbest,fgbest]
10
Benchmark
Six hump camel back
160 140 200 150 120 100
5 6 5 4
f(x1,x2)
f(x1,x2)
100 50 0 50 2 1 0 1 x2 2 4 2 x1 2 0 4
3 2 1
80 60 40 20 0
0 1 2 1 0 1 x2
1 0.8 0.6 0.4 4
1 2 1 0 1 2 2 x1
11
What happens if
Inertia (1000 runs, |fopt-f*| )
w 1) 2) 3) 4) 5) 6) 7) 0,1 0,5 1,0 2,0 N. 20 20 20 20 Iter. Tot. Max. 30 30 30 30 30 30 30 600 8,4 E-01 600 8,2 E-02 600 2,4 E-01 600 1,0 E-00 600 1.5 E-02 600 6,9 E-04 600 5,0 E-03
a)
1.5 1 0.5 0 0.5 1 1.5
0.6 0.8 1
b)
1.5 1 0.5 0 0.5 1 1.5
Avg.
Min.
Std. Dev. 8,6 E-02 (b) 4,5 E-02 1,2 E-02 1,6 E-01 8,7 E-04 3,3 E-05 (a) 1,7 E-04
3,2 E-02 1,4 E-11 2,4 E-03 1,5 E-12 5,0 E-03 9,8 E-07 1,6 E-01 1,1 E-04 1,4 E-04 6,1 E-09 4,7 E-06 4,6 E-12 8,1 E-06 2,8 E-12
Case 6) has best worst case, best results on average, and is the most robust (lowest standard deviation) !
12
What happens if
Population size (1000 runs, |fopt-f*| )
N. 1) 2) 3) 4) 5) 40 30 20 10 5 Iter. 15 20 30 60 120 Tot. 600 600 600 600 600
0.2 0 0.2
0.7 0.65
0.6 0.55
1.5 0.5
Max. 2,2 E-03 1,4 E-02 2,1 E-02 8,2 E-01 9,9 E-01
Avg. 3,2 E-05 2,3 E-05 2,0 E-05 8,9 E-04 7,5 E-03
Min. 0.5 3,0 E-10 1,3 E-10 5,2 E-12 5,0 E-12 1,8 E-11
0.4
0.1
0.2
1,4 E-04 4,6 E-04 4,7 E-04 2,6 E-02 7,2 E-02
Small populations (red cross in figures) dont perform well. Cases 1), 2) and 3) work well. Case 3) will be used in the following.
13
What happens if
Cognitive component (1000 runs, |fopt-f*| )
c1 0,0 0,5 1,05 1,5 2,0 N. 20 20 20 20 20 Iter. 30 30 30 30 30 Tot. 600 600 600 600 600 Max. 6,9 E-03 1,9 E-02 2,5 E-01 8,6 E-01 6,2 E-02 Avg. 1,9 E-05 2,5 E-05 2,6 E-04 8,3 E-04 1,6 E-03 Min. 1,5 E-12 6,2 E-13 2,1 E-11 8,6 E-13 1,4 E-11 Std. Dev. 4,4 E-04 6,1 E-04 8,0 E-03 2,6 E-02 3,9 E-02
It seems that it would be better not to have the cognitive component at all (c1=0) but wait for next slide
14
What happens if
Social component (1000 runs, |fopt-f*| )
c2 0,0 0,5 1,05 1,5 2,0 N. 20 20 20 20 20 Iter. 30 30 30 30 30 Tot. 600 600 600 600 600 Max. 3,7 E-01 1,1 E-01 1,6 E-02 4,1 E-03 1,6 E-01 Avg. 1,5 E-02 2,2 E-03 2,3 E-04 2,1 E-05 4,0 E-04 Min. 2,2 E-07 4,5 E-09 1,1 E-10 2,5 E-11 3,4 E-11 Std. Dev. 3,2 E-02 3,9 E-03 5,3 E-04 2,0 E-04 5,5 E-03
The combined analysis of this and the preceeding table shows that c2 should be bigger than c1, but not too much
15
a1
a2
a3
b1
R.I.P.
b2
16
Conclusions
PSO algorithm basics introduced Ease of Matlab implementation shown Numerical experiments:
Inertia should be linearly decreasing between 1 and 0,3 Population size matters (N between 20 and 30) c2=c1+,with between 1 and 1,5
17