Particle swarm optimization

In computational science, particle swarm optimization (PSO) is a computational method that optimizes a problem by iteratively trying to improve a candidate solution with regard to a given measure of quality.  It solves a problem by having a population of candidate solutions, here dubbed particles, and moving these particles around in the search-space according to simple mathematical formulae over the particle's position and velocity.  Each particle's movement is influenced by its local best known position, but is also guided toward the best known positions in the search-space, which are updated as better positions are found by other particles.  This is expected to move the swarm toward the best solutions. 

PSO is originally attributed to Kennedy, Eberhart and Shi and was first intended for simulating social behaviour, as a stylized representation of the movement of organisms in a bird flock or fish school.  The algorithm was simplified and it was observed to be performing optimization.  The book by Kennedy and Eberhart describes many philosophical aspects of PSO and swarm intelligence.  An extensive  survey of PSO applications is made by Poli.  Recently, a comprehensive review on theoretical and experimental works on PSO has been published by Bonyadi and Michalewicz. 

PSO is a metaheuristic as it makes few or no assumptions about the problem being optimized and can search very large spaces of candidate solutions.  However, metaheuristics such as PSO do not guarantee an optimal solution is ever found.  Also, PSO does not use the gradient of the problem being optimized, which means PSO does not require that the optimization problem be differentiable as is required by classic optimization methods such as gradient descent and quasi-newton methods. 

Algorithm 

A basic variant  of the PSO algorithm works by having a population (called a swarm) of candidate solutions (called particles).  These particles are moved around in the search-space according to a few simple formulae.  The movements of the particles are guided by their own best known position in the search-space as well as the entire swarm's best known position.  When improved positions are being discovered these will then come to guide the movements of the swarm.  The process is repeated and by doing so it is hoped, but not guaranteed, that a satisfactory solution will eventually be discovered. 

Formally, let f: ℝn → ℝ be the cost function which must be minimized.  The function takes a candidate solution as an argument in the form of a vector of real numbers and produces a real number as output which indicates the objective function value of the given candidate solution.  The gradient of f is not known.  The goal is to find a solution a for which f(a) ≤ f(b) for all b in the search-space, which would mean a is the global minimum. 

Let S be the number of particles in the swarm, each having a position xi ∈ ℝn in the search-space and a velocity vi ∈ ℝn.  Let pi be the best known position of particle i and let g be the best known position of the entire swarm.  A basic PSO algorithm is then:
 
 
  for each particle i = 1, ..., S do
    Initialize the particle's position with a uniformly distributed random vector: xi ~ U(blo, bup)
    Initialize the particle's best known position to its initial position: pi ← xi
    if f(pi) < f(g) then
        update the swarm's best known  position: g ← pi
    Initialize the particle's velocity: vi ~ U(-|bup-blo|, |bup-blo|)
 while a termination criterion is not met do:
    for each particle i = 1, ..., S do
       for each dimension d = 1, ..., n do
          Pick random numbers: rp, rg ~ U(0,1)
          Update the particle's velocity: vi,d ← ω vi,d + φp rp (pi,d-xi,d) + φg rg (gd-xi,d)
       Update the particle's position: xi ← xi + vi
       if f(xi) < f(pi) then
          Update the particle's best known position: pi ← xi
          if f(pi) < f(g) then
             Update the swarm's best known position: g ← pi
The values blo and bup represents the lower and upper boundaries of the search-space.  The termination criterion can be the number of iterations performed, or a solution where the adequate objective function value is found.  The parameters ω, φp, and φg are selected by the practitioner and control the behaviour and efficacy of the PSO method, see below. 

Parameter selection 

The choice of PSO parameters can have a large impact on optimization performance.  Selecting PSO parameters that yield good performance has therefore been the subject of much research. 

The PSO parameters can also be tuned by using another overlaying optimizer, a concept known as meta-optimization, or even fine-tuned during the optimization, e.g., by means of fuzzy logic. 

Parameters have also been tuned for various optimization scenarios. 

Neighbourhoods and topologies
The topology of the swarm defines the subset of particles with which each particle can exchange information.  The basic version of the algorithm uses the global topology as the swarm communication structure.  This topology allows all particles to communicate with all the other particles, thus the whole swarm share the same best position g from a single particle.  However, this approach might lead the swarm to be trapped into a local minimum, thus different topologies have been used to control the flow of information among particles.  For instance, in local topologies, particles only share information with a subset of particles.  This subset can be a geometrical one – for example "the m nearest particles" – or, more often, a social one, i.e. a set of particles that is not depending on any distance.  In such cases, the PSO variant is said to be local best (vs global best for the basic PSO). 

A commonly used swarm topology is the ring, in which each particle has just two neighbours, but there are many others.  The topology is not necessarily static.  In fact, since the topology is related to the diversity of communication of the particles, some efforts have been done to create adaptive topologies (SPSO, APSO, stochastic star, TRIBES, Cyber Swarm, and C-PSO). 

Inner workings 
There are several schools of thought as to why and how the PSO algorithm can perform optimization. 

A common belief amongst researchers is that the swarm behaviour varies between exploratory behaviour, that is, searching a broader region of the search-space, and exploitative behaviour, that is, a locally oriented search so as to get closer to a (possibly local) optimum.  This school of thought has been prevalent since the inception of PSO.  This school of thought contends that the PSO algorithm and its parameters must be chosen so as to properly balance between exploration and exploitation to avoid premature convergence to a local optimum yet still ensure a good rate of convergence to the optimum.  This belief is the precursor of many PSO variants, see below. 

Another school of thought is that the behaviour of a PSO swarm is not well understood in terms of how it affects actual optimization performance, especially for higher-dimensional search-spaces and optimization problems that may be discontinuous, noisy, and time-varying.  This school of thought merely tries to find PSO algorithms and parameters that cause good performance regardless of how the swarm behaviour can be interpreted in relation to e.g. exploration and exploitation.  Such studies have led to the simplification of the PSO algorithm, see below. 

Convergence 
In relation to PSO the word convergence typically refers to two different definitions:

 Convergence of the sequence of solutions (aka, stability analysis, converging) in which all particles have converged to a point in the search-space, which may or may not be the optimum,
 Convergence to a local optimum where all personal bests p or, alternatively, the swarm's best known position g, approaches a local optimum of the problem, regardless of how the swarm behaves. 

Convergence of the sequence of solutions has been investigated for PSO.  These analyses have resulted in guidelines for selecting PSO parameters that are believed to cause convergence to a point and prevent divergence of the swarm's particles (particles do not move unboundedly and will converge to somewhere).  However, the analyses were criticized by Pedersen for being oversimplified as they assume the swarm has only one particle, that it does not use stochastic variables and that the points of attraction, that is, the particle's best known position p and the swarm's best known position g, remain constant throughout the optimization process.  However, it was shown that these simplifications do not affect the boundaries found by these studies for parameter where the swarm is convergent.  Considerable effort has been made in recent years to weaken the modelling assumption utilized during the stability analysis of PSO , with the most recent generalized result applying to numerous PSO variants and utilized what was shown to be the minimal necessary modeling assumptions . 

Convergence to a local optimum has been analyzed for PSO in and.  It has been proven that PSO need some modification to guarantee to find a local optimum. 

This means that determining convergence capabilities of different PSO algorithms and parameters therefore still depends on empirical results.  One attempt at addressing this issue is the development of an "orthogonal learning" strategy for an improved use of the information already existing in the relationship between p and g, so as to form a leading converging exemplar and to be effective with any PSO topology.  The aims are to improve the performance of PSO overall, including faster global convergence, higher solution quality, and stronger robustness.  However, such studies do not provide theoretical evidence to actually prove their claims. 

Adaptive mechanisms 
Without the need for a trade-off between convergence ('exploitation') and divergence ('exploration'), an adaptive mechanism can be introduced.  Adaptive particle swarm optimization (APSO)  features better search efficiency than standard PSO.  APSO can perform global search over the entire search space with a higher convergence speed.  It enables automatic control of the inertia weight, acceleration coefficients, and other algorithmic parameters at the run time, thereby improving the search effectiveness and efficiency at the same time.  Also, APSO can act on the globally best particle to jump out of the likely local optima.  However, APSO will introduce new algorithm parameters, it does not introduce additional design or implementation complexity nonetheless. 

Variants 

Numerous variants of even a basic PSO algorithm are possible.  For example, there are different ways to initialize the particles and velocities (e.g. start with zero velocities instead), how to dampen the velocity, only update pi and g after the entire swarm has been updated, etc.  Some of these choices and their possible performance impact have been discussed in the literature. 

A series of standard implementations have been created by leading researchers, "intended for use both as a baseline for performance testing of improvements to the technique, as well as to represent PSO to the wider optimization community.  Having a well-known, strictly-defined standard algorithm provides a valuable point of comparison which can be used throughout the field of research to better test new advances."  The latest is Standard PSO 2011 (SPSO-2011). 

Hybridization 

New and more sophisticated PSO variants are also continually being introduced in an attempt to improve optimization performance.  There are certain trends in that research; one is to make a hybrid optimization method using PSO combined with other optimizers, e.g., combined PSO with biogeography-based optimization, and the incorporation of an effective learning method. 

Alleviate premature convergence
Another research trend is to try and alleviate premature convergence (that is, optimization stagnation), e.g. by reversing or perturbing the movement of the PSO particles, another approach to deal with premature convergence is the use of multiple swarms (multi-swarm optimization).  The multi-swarm approach can also be used to implement multi-objective optimization.  Finally, there are  developments in adapting the behavioural parameters of PSO during optimization. 

Simplifications 
Another school of thought is that PSO should be simplified as much as possible without impairing its performance; a general concept often referred to as Occam's razor.  Simplifying PSO was originally suggested by Kennedy and has been studied more extensively, where it appeared that optimization performance was improved, and the parameters were easier to tune and they performed more consistently across different optimization problems. 

Another argument in favour of simplifying PSO is that metaheuristics can only have their efficacy demonstrated empirically by doing computational experiments on a finite number of optimization problems.  This means a metaheuristic such as PSO cannot be proven correct and this increases the risk of making errors in its description and implementation.  A good example of this presented a promising variant of a genetic algorithm (another popular metaheuristic) but it was later found to be defective as it was strongly biased in its optimization search towards similar values for different dimensions in the search space, which happened to be the optimum of the benchmark problems considered.  This bias was because of a programming error, and has now been fixed. 

Initialization of velocities may require extra inputs.  The Bare Bones PSO variant has been proposed in 2003 by James Kennedy, and does not need to use velocity at all. 

Another simpler variant is the accelerated particle swarm optimization (APSO), which also does not need to use velocity and can speed up the convergence in many applications.  A simple demo code of APSO is available. 

Multi-objective optimization
PSO has also been applied to multi-objective problems, in which the objective function comparison takes pareto dominance into account when moving the PSO particles and non-dominated solutions are stored so as to approximate the pareto front. 

Binary, discrete, and combinatorial
As the PSO equations given above work on real numbers, a commonly used method to solve discrete problems is to map the discrete search space to a continuous domain, to apply a classical PSO, and then to demap the result.   Such a mapping can be very simple (for example by just using rounded values) or more sophisticated. 

However, it can be noted that the equations of movement make use of operators that perform four actions:
computing the difference of two positions.  The result is a velocity (more precisely a displacement)
multiplying a velocity by a numerical coefficient
adding two velocities
applying a velocity to a position

Usually a position and a velocity are represented by n real numbers, and  these operators are simply -, *, +, and again +.  But all these mathematical objects can be defined in a completely different way, in order to cope with binary problems (or more generally discrete ones), or even combinatorial ones.  One approach is to redefine the operators based on sets. 

See also 

 Artificial bee colony algorithm
 Bees algorithm
 Derivative-free optimization
 Multi-swarm optimization
 Particle filter
 Swarm intelligence
 Fish School Search
 Dispersive flies optimisation

References

External links

Particle Swarm Central is a repository for information on PSO.  Several source codes are freely available. 
A brief video of particle swarms optimizing three benchmark functions. 
Simulation of PSO convergence in a two-dimensional space (Matlab). 
Applications of PSO. 

Particle Swarm Optimization (see and listen to Lecture 27)
Links to PSO source code

Category:Metaheuristics
Category:Evolutionary algorithms