41
Particle Swarm optimisation

Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

  • Upload
    others

  • View
    16

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

Particle Swarm optimisation

Page 2: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

WHAT IS A SWARM?

! A loosely structured collection of interacting agents !  Agents:

!  Individuals that belong to a group (but are not necessarily identical)

!  They contribute to and benefit from the group !  They can recognize, communicate, and/or interact with each

other

! The instinctive perception of swarms is a group of agents in motion – but that does not always have to be the case.

! A swarm is better understood if thought of as agents exhibiting a collective behavior

Page 3: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

WHY INSECTS?

!  Insects have a few hundred brain cells ! However, organized insects have been known for:

!  Architectural marvels !  Complex communication systems !  Resistance to hazards in nature

!  In the 1950�s E.O. Wilson observed: !  A single ant acts (almost) randomly – often leading to

its own demise !  A colony of ants provides food and protection for the

entire population

Page 4: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

4

! Many aspects of the collective activities of social insects, such as ants, are self-organizing

!  Complex group behavior emerges from the interactions of individuals who exhibit simple behaviors by themselves: finding food and building a nest

!  Self-organization come about from interactions based entirely on local information

IMPORTANT

INTRODUCTION

Page 5: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

Cooperation example

Page 6: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University28

Social Systems vs. Particle Swarms

Each particle has some knowledgeof how it performed in the past and uses it to determine where it isgoing to move to

Individual own experience

Each particle also has someknowledge of how other particlesaround itself performed and uses itto determine where it is going to move to

Social interactions

Increase or decrease in someattribute values of the particle

Forgetting and Learning

Swarm of particlesPopulation of individuals

Particles in spaceIndividual (minds)PS AlgorithmSocial-Psychology

Page 7: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

Particle Swarm Optimization

Particle Swarm Optimization (PSO) is a

• swarm-intelligence-based• approximate• nondeterministic

optimization technique.

Particle Swarm Optimization – p. 3

Page 8: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

Optimization Techniques

Optimization techniques find the parameters thatprovide the maximum (or minimum) value of atarget function.

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5−4

−3

−2

−1

0

1

2

3

4

Particle Swarm Optimization – p. 4

Page 9: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University2

Particle Swarm Optimization (PSO)

• Developed by Kennedy and Eberhart in 1995• A population based optimization technique inspired by

social behavior of bird flocking or fish schooling• Individual swarm members can profit from the discoveries

and previous experience of all other members of the school

Kennedy, J. and Eberhart, R.: Particle Swarm Optimization. Proceedingsof the Fourth IEEE International Conference on Neural Networks, Perth, Australia. IEEE Service Center 1942-1948, 1995.

Page 10: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

PSO Concepts

• The PSO algorithm maintains multiplepotential solutions at one time

• During each iteration of the algorithm, eachsolution is evaluated by an objective functionto determine its fitness

• Each solution is represented by a particle inthe fitness landscape (search space)

• The particles “fly” or “swarm” through thesearch space to find the maximum valuereturned by the objective function

Particle Swarm Optimization – p. 8

Page 11: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

Fitness Landscape

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5−4

−3

−2

−1

0

1

2

3

Solution

Fitness

Particles

Particle Swarm Optimization – p. 9

Page 12: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University6

• PSO consists of a swarm of particles• Each particle resides at a position in the search space• The fitness of each particle represents the quality of its position• The particles fly over the search space with a certain velocity• The velocity (both direction and speed) of each particle is influenced

by its own best position found so far and the best solution that was found so far by its neighbors

• Eventually the swarm will converge to optimal positions

PSO - General concept

Page 13: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

Particle Swarm optimisation

The basic idea ✔ Each particle is searching for the optimum ✔ Each particle is moving and hence has a

velocity. ✔ Each particle remembers the position it was

in where it had its best result so far (its personal best)

✔ But this would not be much good on its own; particles need help in figuring out where to search.

Page 14: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

Particle Swarm optimisation

The basic idea II ✔  The particles in the swarm co-operate. They

exchange information about what they’ve discovered in the places they have visited

✔  The co-operation is very simple. In basic PSO it is like this: –  A particle has a neighbourhood associated with it. –  A particle knows the fitnesses of those in its

neighbourhood, and uses the position of the one with best fitness.

–  This position is simply used to adjust the particle’s velocity

Page 15: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

Initialization. Positions and velocities

Page 16: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

Particle Swarm optimisation

What a particle does ✔ In each timestep, a particle has to move to a

new position. It does this by adjusting its velocity. –  The adjustment is essentially this: –  The current velocity PLUS –  A weighted random portion in the direction of its personal

best PLUS –  A weighted random portion in the direction of the

neighbourhood best. ✔ Having worked out a new velocity, its position is

simply its old position plus the new velocity.

Page 17: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

Neighbourhoods

geographicalsocial

Page 18: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

Neighbourhoods

Global

Page 19: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

Canonical PSO Algorithm

The PSO algorithm consists of just three steps:

1. Evaluate fitness of each particle2. Update individual and global bests3. Update velocity and position of each particle

These steps are repeated until some stoppingcondition is met.

Particle Swarm Optimization – p. 11

Page 20: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University7

Original PSO - Algorithm

• Randomly initialize particle positions and velocities• While not terminate

- For each particle i:- Evaluate fitness yi at current position xi- If yi is better than pbesti then update pbesti and pi- If yi is better than gbesti then update gbesti and gi

- For each particle- Update velocity vi and position xi using:

+←

−⊗+−⊗+←

iii

iiiiii

vxxxgφUxpφUvv

rrr

rrrrrrrr )(),()(),( 21 00

Page 21: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University8

Original PSO - NotationFor each particle i:- xi is a vector denoting its position and yi denotes its objective function

value- vi is the vector denoting its velocity- pi is the best position that it has found so far and pbesti denotes its

objective function score- gi is the best position that has been found so far in its neighborhood

and gbesti denotes the objective function value of gi

Velocity update:- U(0,ϕi) is a random vector uniformly distributed in [0,ϕϕϕϕi] generated at

each generation for each particle- ϕ1 and ϕ2 are the acceleration coefficients determining the scale of

the forces in the direction of pi and gi- ! denotes the element-wise multiplication operator

Page 22: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University9

Original PSO - Velocity update

MomentumThe force pulling the particle to continue its current direction

Cognitive componentThe force emerging from the tendency to return to its own best solution found so far

Social componentThe force emerging from the attraction of the best solution found so far in itsneighborhood

vi(t)

vi(t+1)xi(t) xi(t+1)

pi(t) gi(t)

U(0,ϕϕϕϕ1)!(pi-xi)

U(0,ϕϕϕϕ 2)!(gi-xi

)

)(),()(),( iiiiii xgφUxpφUvv rrrrrrrr−⊗+−⊗+← 21 00

Page 23: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University10

Neighborhoods

• Each particle has information about the personal best positions of (some of) the other particles in the swarm (its neighbors)

• The neighborhood of each particle is defines its communication structure (its social network)

• Two general types:– Geographical neighborhood topologies:

• Based on Euclidean proximity in the search space• Close to the real-world paradigm but computationally expensive

– Communication network topologies:• Pre-determined neighbors by means of connection graphs• Favored over geographical neighborhood because of better

convergence properties and less computation involved

Page 24: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University11

Neighborhood topologies

Geographical neighborhoods Communication network topologies

Ring (local best) Global best

Random graph Star

Page 25: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University12

More on neighborhood topologies

• Also considered were:– Clustering topologies (islands)– Dynamic topologies– …

• No clear way of saying which topology is the best• Exploration / exploitation

– Some neighborhood topologies are better for local search others for global search

– The lbest neighborhood topologies seems better for global search, gbest topologies seem better for local search

Page 26: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

The circular neighbourhood

Virtual circle

1

5

7

6 4

3

8 2 Particle 1’s 3-

neighbourhood

Page 27: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

Particles Adjust their positions according to a ``Psychosocial compromise’’ between what an individual is comfortable with, and what society reckons

Here I am!

The best perf. of my neighbours

My best perf.

x pg

pi

v

Page 28: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

Particle Swarm optimisation

Pseudocode http://www.swarmintelligence.org/tutorials.php

Equation (a) v[] = c0 *v[] + c1 * rand() * (pbest[] - present[]) + c2 * rand() * (gbest[] - present[])

(in the original method, c0=1, but many researchers now play with this parameter) Equation (b) present[] = present[] + v[]

Page 29: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University13

Synchronous versus asynchronousSynchronous updates:• Personal best and neighborhood bests updated separately

from position and velocity vectors• Slower feedback about best positions• Better for gbest PSO

Asynchronous updates:• New best positions updated after each particle position

update• Immediate feedback about best regions of the search

space• Better for lbest PSO

Page 30: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University14

Acceleration Coefficients

vi(t)

xi(t)

pi(t) gi(t)

ϕ1 = ϕ2 = 1 ϕ1 , ϕ2 > 1

• The boxes show the distribution of the random vectors of the attracting forces of the local best and global best

• The acceleration coefficients determine the scale distribution of the random cognitive component vector and the social component vector

vi(t)

xi(t)

pi(t) gi(t)

Page 31: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University15

Acceleration coefficients – useful insights

ϕ1>0, ϕ2=0 particles are independent hill-climbersϕ1=0, ϕ2>0 swarm is one stochastic hill-climberϕ1=ϕ2>0 particles are attracted to the average of pi and giϕ2>ϕ1 more beneficial for unimodal problemsϕ1>ϕ2 more beneficial for multimodal problemslow ϕ1, ϕ2 smooth particle trajectorieshigh ϕ1, ϕ2 more acceleration, abrupt movements

Adaptive acceleration coefficients have also been proposed. For example to have ϕ1 and ϕ2 decreased over time

Page 32: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University16

Original PSO - Problems• The acceleration coefficients should be set sufficiently high• Higher acceleration coefficients result in less stable

systems in which the velocity has a tendency to explode

• To fix this, the velocity vi is usually kept within the range[-vmax, vmax]

• However, limiting the velocity does not necessarily prevent particles from leaving the search space, nor does it help to guarantee convergence

v

t

Page 33: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

Particle Swarm optimisation

Pseudocode http://www.swarmintelligence.org/tutorials.php

Particles' velocities on each dimension are clamped to a maximum velocity Vmax. If the sum of accelerations would cause the velocity on that dimension to exceed Vmax, which is a parameter specified by the user. Then the velocity on that dimension is limited to Vmax.

Page 34: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University17

Inertia weighted PSO• An inertia weight ω was introduced to control the velocity explosion:

• If ω, ϕ1 and ϕ2 are set correctly, this update rule allows forconvergence without the use of vmax

• The inertia weight can be used to control the balance betweenexploration and exploitation:– ω ≥ 1: velocities increase over time, swarm diverges– 0 < ω < 1: particles decelerate, convergence depends ϕ1 and ϕ2

• Rule-of-thumb settings: ω = 0.7298 and ϕ1 = ϕ2 = 1.49618

)(),()(),( iiiiii xgφUxpφUvωv rrrrrrrr−⊗+−⊗+← 21 00

Shi, Y. Eberhart, R., 'A modified particle swarm optimizer', in EvolutionaryComputation Proceedings, 1998. IEEE World Congress on ComputationalIntelligence., The 1998 IEEE International Conference on , pp. 69-73 (1998).

Page 35: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University19

Time decreasing inertia weight

• Eberhart and Shi suggested to decrease ω over time (typically from 0.9 to 0.4) and thereby gradually changing from an exploration to exploitation

• Other schemes for a dynamically changing inertia weight are also possible and have also been triedEberhart, R. C. Shi, Y., 'Comparing inertia weights and constrictionfactors in particle swarm optimization', vol. 1, pp. 84-88 vol.1 (2000).

Page 36: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University20

Constricted coefficients PSO

• Take away some ‘guesswork’ for setting ω, ϕ1 and ϕ2• An elegant method for preventing explosion, ensuring

convergence and eliminating the parameter vmax• The constriction coefficient was introduced as:

With and

( ))(),0()(),0( 21 iiiiii xgUxpUvv rrrrrrrr−⊗+−⊗+⋅← φφχ

φφφχ

42

2 −+=421 >+= φφφ

Clerc, M. Kennedy, J., 'The particle swarm - explosion, stability, and convergence in a multidimensional complex space', EvolutionaryComputation, IEEE Transactions on , vol. 6, no. 1, 58-73 (2002).

Page 37: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University21

Fully informed particle swarms (FIPS)• Each particle is affected by all of its K neighbors• The velocity update in FIPS is:

• FIPS outperforms the canonical PSOs on most test-problems• The performance of FIPS is generally more dependant on the

neighborhood topology (global best neighborhood topology is recommended)

( ) ( )

=

⊗⋅= ∑

iii

inbr

Κ

niii

vxx

xp,φUΚ

vχvn

i

rrr

rrrrr

+

+=

-011

R. Mendes, J. Kennedy, and J. Neves, “The fully informed particle swarm:Simpler, maybe better,” IEEE Trans. Evol. Comput., vol. 8, pp.204–210, June 2004.

Page 38: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University22

Bare bones PSO

• Eliminate the velocity update of the particles (with all of its tricky parameter tuning)

• Move particles according to a probability distribution rather than through the addition of velocity

J. Kennedy. Bare bones particle swarms. In Proceedings of theIEEE Swarm Intelligence Symposium, pages 80-87, 2003.

vi(t)xi(t)

pi(t) gi(t)

xi(t)

pi(t) gi(t)

Page 39: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University23

Bare bones PSO

• Replace the particle update rule with a Gaussian distribution of mean (pi+gi) / 2 and standard deviation |pi-gi|

• The position update rule in the jth component of the ithparticle is:

with

• Works fairly well, but the Gaussian distribution does not seem to be the best probability distribution (also the Lévydistribution has been tried)

( )ijijijx σµ ,Ν=ijijij

ijijij

gp

gp

−=

+=

σ

µ2

Page 40: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University24

Binary / discrete PSO

• A simple modification to allow for discrete search spaces• Velocity remains continuous using the original update rule• Positions are updates using the velocity as a probability

threshold to determine whether the jth component of the ithparticle is a zero or a one

with )exp(11)(

ijij xxs

−+=

<

=otherwise0

)( if1 ijij

vsx

τ

J. Kennedy and R. Eberhart. A discrete binary version of the particle swarm algorithm.In Proceedings of the IEEE International Conference on Systems, Man and Cybernetics,4104-4108, IEEE Press, 1997

Page 41: Particle Swarm optimisation - Unict · Particle Swarm optimisation The basic idea II The particles in the swarm co-operate. They exchange information about what they’ve discovered

LIACS Natural Computing Group Leiden University30

Further readingGeneral Particle Swarm Optimization:• http://en.wikipedia.org/wiki/Particle_swarm_optimization• http://www.particleswarm.info/• http://www.engr.iupui.edu/~shi/Coference/psopap4.html

Reynolds’ Boids:• http://www.red3d.com/cwr/boids/

Simulation applications:• http://www.projectcomputing.com/resources/psovis/index.html• http://uk.geocities.com/markcsinclair/pso.html