Particle Swarm Optimization - Algorithm

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 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. Maximization can be performed by considering the function h = -f instead.

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), where blo and bup are the lower and upper boundaries of the search-space.
    • Initialize the particle's best known position to its initial position: pixi
    • If (f(pi) < f(g)) update the swarm's best known position: gpi
    • Initialize the particle's velocity: vi ~ U(-|bup-blo|, |bup-blo|)
  • Until a termination criterion is met (e.g. number of iterations performed, or a solution with adequate objective function value is found), repeat:
    • 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: xixi + vi
      • If (f(xi) < f(pi)) do:
        • Update the particle's best known position: pixi
        • If (f(pi) < f(g)) update the swarm's best known position: gpi
  • Now g holds the best found solution.

The parameters ω, φp, and φg are selected by the practitioner and control the behaviour and efficacy of the PSO method, see below.

Read more about this topic:  Particle Swarm Optimization