GCMAESOpt() minimizes with the CMA-ES of GCMAES.jl, ported to R. Each
generation samples the population from the covariance matrix, moves the
mean to the weighted average of the best half and, when the problem has
a gradient, also evaluates the mean itself (the line search of GCMAES
along the negative gradient, which in a single process tries only the
step length zero). Termination follows GCMAES: flat fitness inflates
the step size, and the run stops on the conditions MaxIter, TolHistFun,
EqualFunVals, TolX, TolUpSigma, Stagnation, ConditionCov or TolFun,
with return code Success, or after the evaluation budget with
Failure.
Details
The problem needs bounds (lb and ub), as in OptimizationGCMAES,
although GCMAES only keeps them and searches the whole space. The
solve arguments are maxiters (generations; without it the budget is
1000 n^2 evaluations), maxtime (seconds) and sigma0, the initial
step size (0.2). Maximization (sense = MaxSense) is supported.
Examples
f <- function(x, p) (p[1] - x[1])^2
prob <- OptimizationProblem(f, 0, 1, lb = -10, ub = 10)
set.seed(1)
round(solve(prob, GCMAESOpt())$u, 4)
#> [1] 1