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.
In OptimizationEvolutionary.jl, the _cb(trace) function call encounters an error when the store_trace=true keyword argument is passed via the user-facing API.
function _cb(trace)
...
cb_call = cache.callback(opt_state, trace.value...)
...
end
The trace argument can be either an OptimizationTrace or OptimizationTraceRecord, where the former is an array of the latter, and only the latter has a value field.
When store_trace=true is passed, an OptimizationTrace instead of an OptimizationTraceRecord is passed to _cb.
This causes an error when trace.value... is referenced on line 93.
trace should first be passed through decompose_trace, as is done on line 87 and 89 within the very same function. Like this:
function _cb(trace)
...
cb_call = cache.callback(opt_state, decompose_trace(trace).value...)
...
end
Expected behavior
trace should first be decomposed in case it's an OptimizationTrace, so that the value field of the latest trace can be accessed.
Describe the bug π
In
OptimizationEvolutionary.jl
, the_cb(trace)
function call encounters an error when thestore_trace=true
keyword argument is passed via the user-facing API.trace
argument can be either anOptimizationTrace
orOptimizationTraceRecord
, where the former is an array of the latter, and only the latter has avalue
field.OptimizationTrace
instead of anOptimizationTraceRecord
is passed to_cb
.trace.value...
is referenced on line 93.trace
should first be passed throughdecompose_trace
, as is done on line 87 and 89 within the very same function. Like this:Expected behavior
trace
should first be decomposed in case it's anOptimizationTrace
, so that thevalue
field of the latest trace can be accessed.Minimal Reproducible Example π
Error & Stacktrace β οΈ
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
Add any other context about the problem here.