GCMAES.jl
GCMAES is a Julia package implementing the Gradient-based Covariance Matrix Adaptation Evolutionary Strategy, which can utilize the gradient information to speed up the optimization process.
Installation: OptimizationGCMAES.jl
To use this package, install the OptimizationGCMAES package:
import Pkg;
Pkg.add("OptimizationGCMAES");Global Optimizer
Without Constraint Equations
The GCMAES algorithm is called by GCMAESOpt() and the initial search variance is set as a keyword argument σ0 (default: σ0 = 0.2)
The method in GCMAES is performing global optimization on problems without constraint equations. However, lower and upper constraints set by lb and ub in the OptimizationProblem are required.
OptimizationGCMAES.GCMAESOpt — Type
GCMAESOpt()Optimizer wrapper for GCMAES.jl gradient-based covariance matrix adaptation.
Example
The Rosenbrock function can be optimized using the GCMAESOpt() without utilizing the gradient information as follows:
using OptimizationBase, OptimizationGCMAES
rosenbrock(x, p) = (p[1] - x[1])^2 + p[2] * (x[2] - x[1]^2)^2
x0 = zeros(2)
p = [1.0, 100.0]
f = OptimizationFunction(rosenbrock)
prob = OptimizationProblem(f, x0, p, lb = [-1.0, -1.0], ub = [1.0, 1.0])
sol = solve(prob, GCMAESOpt())retcode: Success
u: 2-element Vector{Float64}:
1.000000012637654
1.0000000287797859We can also utilize the gradient information of the optimization problem to aid the optimization as follows:
using ADTypes, ForwardDiff
f = OptimizationFunction(rosenbrock, ADTypes.AutoForwardDiff())
prob = OptimizationProblem(f, x0, p, lb = [-1.0, -1.0], ub = [1.0, 1.0])
sol = solve(prob, GCMAESOpt())retcode: Success
u: 2-element Vector{Float64}:
1.0000000021641313
1.0000000046078465