Skip to content

Commit

Permalink
correct CMAES default params
Browse files Browse the repository at this point in the history
  • Loading branch information
wildart committed Jul 9, 2020
1 parent 43098c3 commit 30d677f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/cmaes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@ struct CMAES{T} <: AbstractOptimizer
cₘ::T
wᵢ::Vector{T}

function CMAES(; μ::Int=15, λ::Int=2μ, mu::Int=μ, lambda::Int=2mu, weights::Vector{T}=zeros(lambda),
function CMAES(; μ::Int=15, λ::Int=2μ, mu::Int=μ, lambda::Int=0, weights::Vector{T}=zeros(lambda),
c_1::Real=NaN, c_c::Real=NaN, c_mu::Real=NaN, c_sigma::Real=NaN,
sigma0::Real=1, c_m::Real=1) where {T}
@assert c_m 1 "cₘ > 1"
if lambda == 0
lambda = μ == mu ? λ : 2*mu
weights = zeros(lambda)
end
@assert length(weights) == lambda "Number of weights must be $lambda"
new{T}(mu, lambda, c_1, c_c, c_mu, c_sigma, sigma0, c_m, weights)
end
end

population_size(method::CMAES) = method.μ
default_options(method::CMAES) = (iterations=1500, abstol=1e-15)
summary(m::CMAES) = "($(m.μ),$(m.λ))-CMA-ES"


mutable struct CMAESState{T,TI} <: AbstractOptimizerState
N::Int
μ_eff::T
Expand Down

0 comments on commit 30d677f

Please sign in to comment.