Single objective metaheuristics of Metaheuristics.jl
Source:R/optimization-metaheuristics-exports.R
metaheuristics_single.RdThe population based optimizers of Metaheuristics.jl that
OptimizationMetaheuristics makes available to solve(), ported to R.
They need box bounds (lb and ub) and use no derivatives.
Usage
ECA(
eta_max = 2,
K = 7L,
N = 0L,
N_init = N,
p_exploit = 0.95,
p_bin = 0.02,
p_cr = numeric(0),
epsilon = 0,
adaptive = FALSE,
resize_population = FALSE,
information = NULL,
options = NULL,
termination = NULL
)
DE(
N = 0L,
F = 0.7,
CR = 0.5,
CR_min = CR,
CR_max = CR,
F_min = F,
F_max = F,
strategy = "rand1",
information = NULL,
options = NULL,
termination = NULL
)
epsilonDE(
cp = 5,
N = 0L,
F = 0.7,
CR = 0.5,
CR_min = CR,
CR_max = CR,
F_min = F,
F_max = F,
strategy = "rand1",
information = NULL,
options = NULL,
termination = NULL
)
SHADE(N = 100L, information = NULL, options = NULL, termination = NULL)
RDEx(
population_size = 18L,
memory_size = 5L,
information = NULL,
options = NULL
)
PSO(
N = 0L,
C1 = 2,
C2 = 2,
omega = 0.8,
v = numeric(0),
flock = list(),
information = NULL,
options = NULL,
termination = NULL
)
ABC(
N = 50L,
Ne = (N + 1L)%/%2L,
No = (N + 1L)%/%2L,
limit = 10L,
information = NULL,
options = NULL,
termination = NULL
)
SA(
x_initial = numeric(0),
N = 500L,
tol_fun = 1e-04,
information = NULL,
options = NULL,
termination = NULL
)
WOA(N = 30L, information = NULL, options = NULL, termination = NULL)
CGSA(
N = 30L,
chValueInitial = 20,
chaosIndex = 8,
ElitistCheck = 1L,
Rpower = 1L,
Rnorm = 2L,
wMax = chValueInitial,
wMin = 1e-10,
X = matrix(0, 0, 0),
V = matrix(0, 0, 0),
fitness = numeric(0),
information = NULL,
options = NULL,
termination = NULL
)
CSO(
N = 400L,
phi = 0.1,
information = NULL,
options = NULL,
termination = NULL
)
GA(
N = 100L,
p_mutation = NULL,
p_crossover = NULL,
initializer = NULL,
selection = NULL,
crossover = NULL,
mutation = NULL,
environmental_selection = NULL,
information = NULL,
options = NULL,
termination = NULL
)
BRKGA(
num_elites = 20L,
num_mutants = 10L,
num_offsprings = 70L,
N = num_elites + num_mutants + num_offsprings,
bias = 0.7,
information = NULL,
options = NULL,
termination = NULL
)
MCCGA(
N = 100L,
maxsamples = 10000L,
mutation = 1/N,
use_local_search = TRUE,
information = NULL,
options = NULL,
termination = NULL
)Arguments
- eta_max, K, N_init, p_exploit, p_bin, p_cr, epsilon, adaptive, resize_population
Parameters of ECA: the step scale, the size of the neighborhood, the initial population, the exploitation share of the budget, the crossover probability, the crossover probabilities per coordinate, an unused tolerance, the adaptation of
p_crand the shrinking of the population.- N
Population size (
0lets the algorithm choose from the dimension).- information
Metaheuristics$Information(), the known optimum.- options
Metaheuristics$Options().- termination
A termination criterion of Metaheuristics (or a
Termination()of several).- F, CR, CR_min, CR_max, F_min, F_max, strategy
Parameters of DE: the step size, the crossover rate, the ranges they are drawn from in each iteration when the minimum is below the maximum, and the mutation strategy.
- cp
Exponent of the epsilon level control of
epsilonDE().- population_size, memory_size
Parameters of RDEx: the population per dimension and the size of the success memories.
- C1, C2, omega, v, flock
Parameters of PSO: the cognitive and social factors, the inertia, and the initial velocities and swarm (empty to start from rest).
- Ne, No, limit
Parameters of ABC: employed and onlooker bees and the trials before a bee becomes a scout.
- x_initial, tol_fun
Parameters of SA: the starting point (random when empty) and the tolerance of the acceptance rule;
Nis the number of moves per iteration.- chValueInitial, chaosIndex, ElitistCheck, Rpower, Rnorm, wMax, wMin, X, V, fitness
Parameters of CGSA: the chaotic map value and index (1 to 10), the elitism, the distance power and norm, the range of the chaotic term and the initial positions, velocities and fitness (empty for random).
- phi
Social factor of CSO.
- p_mutation, p_crossover
Probabilities of the bit operators of Metaheuristics.GA: when given (and
mutationorcrossoverisNULL)GA()usesBitFlipMutation(p = p_mutation)orUniformCrossover(p = p_crossover).- initializer, selection, crossover, mutation, environmental_selection
Operators of GA, made with the functions of Metaheuristics.
NULLgivesRandomInBounds(N),TournamentSelection(N = N),SBX(),PolynomialMutation()andElitistReplacement(), the operators Metaheuristics.jl chooses for a box search space.- num_elites, num_mutants, num_offsprings, bias
Parameters of BRKGA.
- maxsamples, use_local_search
Parameters of MCCGA: the samples of the initial probabilities and the final local search;
mutationis the step of the probabilities.
Value
An algorithm object for solve().
Details
ECA(): evolutionary centers algorithm.DE(): differential evolution (strategies"rand1","rand2","best1","randToBest1"and"best2").epsilonDE(): the epsilon constrained differential evolution (named with a Greek epsilon in Metaheuristics.jl).SHADE(): success history based adaptive differential evolution.RDEx(): the reconstructed differential evolution with elite based mutation and adaptive memories.PSO(): particle swarm optimization.ABC(): artificial bee colony.SA(): simulated annealing.WOA(): whale optimization algorithm.CGSA(): chaotic gravitational search algorithm.CSO(): competitive swarm optimizer.GA(): a genetic algorithm assembled from operators of Metaheuristics (initializer, selection, crossover, mutation and environmental selection);BRKGA()is the biased random key genetic algorithm built from them.MCCGA(): machine coded compact genetic algorithm, with a final Hooke and Jeeves search.
ECA, DE, epsilonDE, SHADE, PSO, SA, CSO, GA and BRKGA accept the
constraints of the problem (cons with lcons and ucons), which become
the inequality and equality constraints of Metaheuristics.jl and are
handled by its feasibility rules. The solve arguments map as in
OptimizationMetaheuristics: maxiters to the number of iterations,
maxtime to the time limit, abstol to f_tol; every field of
Metaheuristics$Options() can be given too, and use_initial = TRUE
seeds the population with u0. The random numbers are R's: call
set.seed() (or give seed) for reproducible runs.
Examples
rosen <- function(x, p) (p[1] - x[1])^2 + p[2] * (x[2] - x[1]^2)^2
prob <- OptimizationProblem(rosen, c(0, 0), c(1, 100), lb = c(-1, -1), ub = c(1, 1))
set.seed(1)
sol <- solve(prob, DE(), maxiters = 200)
round(sol$u, 2)
#> [1] 1 1
set.seed(1)
solve(prob, ECA(), maxiters = 100)$objective < 0.1
#> [1] TRUE