# Algorithms

EvoLP provides some basic built-in algorithms to get you started. All algorithms are built for minimisation.

## Evolutionary Algorithms (EA)

The basic 1+1 EA starts with a vector individual and slowly finds its way to an optimum by only using mutation.

EvoLP.oneplusoneFunction
oneplusone(f, ind, k_max, M)
oneplusone(logger::Logbook, f, ind, k_max, M)

1+1 Evolutionary Algorithm.

Arguments

• f::Function: objective function to minimise.
• ind::AbstractVector: individual to start the evolution.
• k_max::Integer: number of iterations.
• M::Mutator: one of the available Mutator.

Returns a Result.

## Genetic Algorithms (GA)

In a GA a population of vector solutions is simulated, where individuals get selected, recombined, and mutated. The built-in implementation in EvoLP is a generational GA taken from Kochenderfer, M.J. and Wheeler, T.A. 2019, which means the whole population is replaced by its offspring at every iteration.

EvoLP.GAFunction
GA(f, pop, k_max, S, C, M)
GA(logbook::Logbook, f, population, k_max, S, C, M)
GA(notebooks::Vector{Logbook}, f, population, k_max, S, C, M)

Generational Genetic Algorithm.

Arguments

• f::Function: objective function to minimise.
• population::AbstractVector: a list of vector individuals.
• k_max::Integer: number of iterations.
• S::ParentSelector: one of the available ParentSelector.
• C::CrossoverMethod: one of the available CrossoverMethod.
• M::MutationMethod: one of the available MutationMethod.

Returns a Result.

## Particle Swarm Optimisation (PSO)

In PSO, individuals are particles with velocity and memory. At each iteration, a particle changes its velocity considering the neighbouring particles as well as the best position of the whole swarm.

The built-in implementation in EvoLP is taken from Kochenderfer, M.J. and Wheeler, T.A. 2019.

EvoLP.PSOFunction
PSO(f, population, k_max; w=1, c1=1, c2=1)
PSO(logger::Logbook, f, population, k_max; w=1, c1=1, c2=1)

Arguments

• f::Function: Objective function to minimise.
• population::Vector{Particle}: a list of Particle individuals.
• k_max::Integer: number of iterations.

Keywords

• w: inertia weight. Optional, by default 1.
• c1: cognitive coefficient (own's position). Optional, by default 1.
• c2: social coefficient (others' position). Optional, by default 1.

Returns a Result.