SciML / Optimization.jl

Mathematical Optimization in Julia. Local, global, gradient-based and derivative-free. Linear, Quadratic, Convex, Mixed-Integer, and Nonlinear Optimization in one simple, fast, and differentiable interface.
https://docs.sciml.ai/Optimization/stable/
MIT License
726 stars 83 forks source link

Evolutionary.ES() broken? #467

Closed StefanPofahl closed 1 year ago

StefanPofahl commented 1 year ago

I wonder if there is an example available how to use the function: Evolutionary.ES() The following example fails on both Julia_LTS and Julia v1.8.3:

using Optimization, OptimizationEvolutionary
rosenbrock_x(x) = (1.0 - x[1])^2 + 100.0 * (x[2] - x[1]^2)^2
rosenbrock  = (x, p) -> rosenbrock_x(x) # trick to handle functions with one parameter vector
x0          = zeros(2)
f           = OptimizationFunction(rosenbrock)
prob        = Optimization.OptimizationProblem(f, x0, SciMLBase.NullParameters(), lb = [-1.0, -1.0], ub = [1.0, 1.0])
sol_CMAES   = solve(prob, Evolutionary.CMAES(μ = 40, λ = 100))
sol_ES      = solve(prob, Evolutionary.ES(μ = 40, λ = 100))

Are there any ideas? Regards, Stefan

Vaibhavdixit02 commented 1 year ago

The issue seems to be that the default for recombination field in ES in Evolutionary.jl is the first function but the invocation of recombination passes a rng kwarg. If you use one of the suggested recombination strategies in https://github.com/wildart/Evolutionary.jl/blob/c55454d83cd31f936d1433d4d5e5c66807929866/docs/src/crossover.md#L15 like average it doesn't error. Though it doesn't seem to optimize even then but I haven't looked into that yet

Vaibhavdixit02 commented 1 year ago

Opened an issue for this in Evolutionary.jl