Optimization.jl icon indicating copy to clipboard operation
Optimization.jl copied to clipboard

callback ignored for GalacticCMAEvolutionStrategy

Open ianfiske opened this issue 2 years ago • 1 comments

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

ianfiske avatar May 17 '22 19:05 ianfiske

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.

ChrisRackauckas avatar May 20 '22 04:05 ChrisRackauckas

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

ChrisRackauckas avatar Dec 12 '22 12:12 ChrisRackauckas