soma: The Self-Organising Migrating Algorithm

somaR Documentation

The Self-Organising Migrating Algorithm

Description

The Self-Organising Migrating Algorithm (SOMA) is 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.

Usage

soma(costFunction, bounds, options = list(), init = NULL, ...)

bounds(min, max)

## S3 method for class 'soma'
plot(x, y = NULL, add = FALSE, ...)

Arguments

costFunction

A cost function which takes a numeric vector of parameters as its first argument, and returns a numeric scalar representing the associated cost value.

bounds

A list with elements min and max, each a numeric vector giving the upper and lower bounds for each parameter, respectively.

options

A list of options for the SOMA algorithm itself, usually generated by functions like all2one.

init

An optional matrix giving the starting population's positions in parameter space, one per column. If omitted, initialisation is random (as is usual for SOMA), but specifying a starting state can be helpful when running the algorithm in stages or investigating the consistency of solutions.

...

Additional parameters to costFunction (for soma) or the default plotting method (for plot.soma).

min, max

Vectors of minimum and maximum bound values for each parameter to the costFunction.

x

An object of class "soma".

y

Ignored.

add

If TRUE, add to an existing plot canvas.

Value

A list of class "soma", containing the following elements.

leader

The index of the “leader”, the individual in the population with the lowest cost.

population

A matrix whose columns give the parameter values for each individual in the population at convergence.

cost

A vector giving the cost function values for each individual at convergence.

history

A vector giving the cost of the leader for each migration during the optimisation. This should be nonincreasing.

migrations

The number of migrations completed.

evaluations

The number of times the costFunction was evaluated.

A plot method is available for this class, which shows the history of leader cost values during the optimisation.

Author(s)

R implementation by Jon Clayden <code@clayden.org>.

References

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.

See Also

soma.options for setting options. optim implements other general-purpose optimisation methods.

Examples

# Rastrigin's function, which contains many local minima
rastrigin <- function (x) 10 * length(x) + sum(x^2 - 10 * cos(2*pi*x))

# Find the global minimum over the range -5 to 5 in each parameter
x <- soma(rastrigin, bounds(c(-5,-5), c(5,5)))

# Find the location of the leader - should be near the true minimum of c(0,0)
print(x$population[,x$leader])

# Plot the cost history of the leaders
plot(x)

soma documentation built on May 2, 2022, 9:06 a.m.

Related to soma in soma...