Skip to content

Spiral Optimization

Introduction

The spiral optimization-algorithm is a population-based algorithm, in which a number of particles move in a spiral-like pattern to explore the search space and converge to the best known position as the spiral decays.

Example

from gradient_free_optimizers import SpiralOptimization

...

opt = SpiralOptimization(search_space, decay_rate=1.1)
opt.search(objective_function, n_iter=100)

About the implementation

The spiral optimization is very similar to the particle swarm optimization algorithm. Both algorithms are population based and imitate physics based movement by calculating n-dimensional vectors. The spiral optimization calculates the new position in the search space with the following equation:

\[ x_i (k+1) = x^* (k) r(k) R(\theta) (x_i(k)- x^*(k)) \]

where:

  • k => nth iteration
  • r => decay_rate
  • R => rotation matrix
  • \(x_i\) => current position
  • \(x^*\) => center position (known best position of all particles)

The rotation matrix used for n-dimensional optimization problems is defined as:

\[ R(\theta) = \left[ \begin{matrix} 0^{\top}_{n-1} & -1 \\ I_{n-1} & 0_{n-1} \end{matrix} \right] \]

Parameters

population

Size of the population for population-based optimization algorithms. A member of the population is called single optimizer, individual or particle depending on the type of algorithm. Each member of the population is a separate optimizer class with information about the positions and scores of the optimizer and all methods to perform the iteration and evaluation steps.

All population based optimizers in this package calculate the new positions one member at a time. So if the optimizer performs 10 iterations and has a population size of 10, then each member of the population would move once to a new position.

  • type: int
  • default: 10
  • typical range: 4 ... 25

decay_rate

The decay_rate is called \(r(k)\) in the spiral-optimization equation and is usually referred to as a step-size, but behaves more like a modification factor of the radius of the spiral movement of the particles in this implementation. This parameter of the spiral-optimization algorithm is a factor, that influences the radius of the particles during their spiral movement. Lower values accelerates the convergence of the particles to the best known position, while values above 1 eventually lead to a movement where the particles spiral away from each other.

  • type: float
  • default: 0.99
  • typical range: 0.85 ... 1.15