@@ -139,16 +139,17 @@ function SciMLBase.__solve(cache::OptimizationCache{
139139 error (" Use OptimizationFunction to pass the derivatives or automatically generate them with one of the autodiff backends" )
140140
141141 function _cb (trace)
142- metadata = decompose_trace (trace). metadata
142+ trace_state = decompose_trace (trace)
143+ metadata = trace_state. metadata
143144 θ = metadata[cache. opt isa Optim. NelderMead ? " centroid" : " x" ]
144- opt_state = Optimization. OptimizationState (iter = trace . iteration,
145+ opt_state = Optimization. OptimizationState (iter = trace_state . iteration,
145146 u = θ,
146147 p = cache. p,
147- objective = trace . value,
148+ objective = trace_state . value,
148149 grad = get (metadata, " g(x)" , nothing ),
149150 hess = get (metadata, " h(x)" , nothing ),
150151 original = trace)
151- cb_call = cache. callback (opt_state, trace . value)
152+ cb_call = cache. callback (opt_state, trace_state . value)
152153 if ! (cb_call isa Bool)
153154 error (" The callback should return a boolean `halt` for whether to stop the optimization process." )
154155 end
@@ -257,18 +258,19 @@ function SciMLBase.__solve(cache::OptimizationCache{
257258 local x, cur, state
258259
259260 function _cb (trace)
260- metadata = decompose_trace (trace). metadata
261+ trace_state = decompose_trace (trace)
262+ metadata = trace_state. metadata
261263 θ = ! (cache. opt isa Optim. SAMIN) && cache. opt. method == Optim. NelderMead () ?
262264 metadata[" centroid" ] :
263265 metadata[" x" ]
264- opt_state = Optimization. OptimizationState (iter = trace . iteration,
266+ opt_state = Optimization. OptimizationState (iter = trace_state . iteration,
265267 u = θ,
266268 p = cache. p,
267- objective = trace . value,
269+ objective = trace_state . value,
268270 grad = get (metadata, " g(x)" , nothing ),
269271 hess = get (metadata, " h(x)" , nothing ),
270272 original = trace)
271- cb_call = cache. callback (opt_state, trace . value)
273+ cb_call = cache. callback (opt_state, trace_state . value)
272274 if ! (cb_call isa Bool)
273275 error (" The callback should return a boolean `halt` for whether to stop the optimization process." )
274276 end
0 commit comments