Optimization.jl
Optimization.jl copied to clipboard
callback ignored for GalacticCMAEvolutionStrategy
Here's an MWE where the callback function is ignored for the CMAEvolutionStrategyOpt
solver:
using GalacticOptim
using GalacticCMAEvolutionStrategy
rosenbrock(x,p) = (p[1] - x[1])^2 + p[2] * (x[2] - x[1]^2)^2
x0 = zeros(2)
p = [1.0,100.0]
prob = OptimizationProblem(rosenbrock,x0,p)
function callback(x)
println("hello")
end
sol = solve(prob,CMAEvolutionStrategyOpt(); callback=callback)
My environment has
(galacticoptim) pkg> st
Status `~/julia-testing/galacticoptim/Project.toml`
[12fbe61e] GalacticCMAEvolutionStrategy v0.1.0
[a75be94c] GalacticOptim v3.2.1
Thanks, we should try to find a way to throw an error here since the package itself doesn't have a mechanism for us to put the callback into, or we can enclose it into the function.
This is now handled in the sanity checking system: https://github.com/SciML/Optimization.jl/blob/v3.10.0/lib/OptimizationCMAEvolutionStrategy/src/OptimizationCMAEvolutionStrategy.jl#L12