Skip to content

Commit

Permalink
Merge pull request #691 from jonathanfischer97/master
Browse files Browse the repository at this point in the history
Fixed issue #683: error when `store_trace=true` in OptimizationEvolutionary.jl
  • Loading branch information
ChrisRackauckas authored Feb 2, 2024
2 parents d879158 + 661bcf5 commit a2ed16c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function SciMLBase.__solve(cache::OptimizationCache{
u = curr_u,
objective = x[1],
original = trace)
cb_call = cache.callback(opt_state, trace.value...)
cb_call = cache.callback(opt_state, decompose_trace(trace).value...)
if !(cb_call isa Bool)
error("The callback should return a boolean `halt` for whether to stop the optimization process.")
end
Expand Down
3 changes: 3 additions & 0 deletions lib/OptimizationEvolutionary/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,7 @@ Random.seed!(1234)
return false
end
sol = solve(prob, CMAES= 40, λ = 100), callback = cb, maxiters = 100)

#test that `store_trace=true` works now. Threw ""type Array has no field value" before.
solve(prob, CMAES= 40, λ = 100), store_trace = true)
end

0 comments on commit a2ed16c

Please sign in to comment.