# General-Purpose Optimisation With the Self-Organising Migrating Algorithm

This package provides an R implementation of the Self-Organising Migrating Algorithm, a general-purpose, stochastic optimisation algorithm. The approach is similar to that of genetic algorithms, although it is based on the idea of a series of ``migrations'' by a fixed set of individuals, rather than the development of successive generations. It can be applied to any cost-minimisation problem with a bounded parameter space, and is robust to local minima.

The `soma` package provides an R implementation of the Self-Organising Migrating Algorithm, a general-purpose, stochastic optimisation algorithm developed originally by Ivan Zelinka.

The algorithm's approach is similar to that of genetic algorithms, although it is based on the idea of a series of "migrations" by a fixed set of individuals, rather than the development of successive generations. It can be applied to any cost-minimisation problem with a bounded parameter space, and is robust to local minima. Further details of the algorithm, and implementations for other languages, can be found at the SOMA home page. Only the "all-to-one" strategy is currently implemented in this package.

## Usage

The `soma()` function provides the R interface to the SOMA algorithm. It is called with a function to minimise, a list consisting of minimum and maximum bounds for each parameter, and an optional list of options. The cost function must take a numeric vector of parameters as its first argument, and return a numeric scalar representing the associated cost value.

As an example, consider the two-dimensional version of Rastrigin's function, which has many local minima, and a global minimum of zero at (0,0).

The function surface looks like this (image from Wikimedia Commons):

We can attempt to find the global minimum with the call

We can see from the informative output that on this run the best location has a cost function of `1.67e-05`, close to the true minimum value of zero. The location in search space is

Again, this is very close to the true location of (0,0). Finally, we can plot the progress of the optimisation, showing the best cost function value at each iteration:

We observe that there is an initial, rapid decrease in the cost function value of the "leader"—the individual with the lowest value—followed by further, smaller steps downwards towards zero as the algorithm progresses.

## Options

The supported options are as follows. The defaults are as recommended in the reference below.

Option name Description Default value
`pathLength` The distance towards the leader that individuals may migrate. A value of 1 corresponds to the leader's position itself, and values greater than one (recommended) allow for some overshoot. 3
`stepLength` The granularity at which potential steps are evaluated. It is recommended that the `pathLength` not be a whole multiple of this value. 0.11
`perturbationChance` The probability that individual parameters are changed on any given step. 0.1
`minAbsoluteSep` The smallest absolute difference between the maximum and minimum cost function values. If the difference falls below this minimum, the algorithm will terminate. 0
`minRelativeSep` The smallest relative difference between the maximum and minimum cost function values. If the difference falls below this minimum, the algorithm will terminate. 0.001
`nMigrations` The maximum number of migrations to complete. 20
`populationSize` The number of individuals in the population. It is recommended that this be somewhat larger than the number of parameters being optimised over, and it should not be less than 2. 10

## Reference

I. Zelinka (2004). SOMA - self-organizing migrating algorithm. In G.C. Onwubolu & B.V. Babu, eds, New optimization techniques in engineering. Volume 141 of "Studies in Fuzziness and Soft Computing", pp. 167-217. Springer.

# News

Significant changes to the soma package are laid out below for each release.

=================================================================================

VERSION 1.1.1

• A short README file has been added to the package.
• The LICENCE file is no longer needed and has been removed.

=================================================================================

VERSION 1.1.0

• A plot function has been added for "soma" objects, which shows the history of leader cost values during the optimisation.
• The length of the cost history should no longer exceed the maximum number of migrations specified.
• The package now has a formal namespace.

=================================================================================

VERSION 1.0.0

• First public release.

=================================================================================

# Reference manual

install.packages("soma")

1.1.1 by Jon Clayden, 7 years ago

https://github.com/jonclayden/soma/, http://www.ft.utb.cz/people/zelinka/soma/

Browse source code at https://github.com/cran/soma

Authors: Jon Clayden; based on the work of Ivan Zelinka

Documentation:   PDF Manual

Task views: Optimization and Mathematical Programming

GPL-2 license

Imports reportr

Imported by hybridEnsemble.

Suggested by MSCMT, RandomFields.

See at CRAN