Commit b5d3924
Fix error when store_trace=true with OptimizationOptimJL
This commit fixes issue #990 where using `store_trace = true` with OptimizationOptimJL solvers (e.g., NelderMead) would throw an error "type Array has no field iteration".
The bug occurred because when `store_trace = true`, the trace passed to the callback is an Array of OptimizationState objects rather than a single OptimizationState. The fix uses the existing `decompose_trace` function to ensure we always get a single OptimizationState object before accessing its fields.
Changes:
- Updated both _cb callback functions in OptimizationOptimJL.jl to use decompose_trace
- Added tests to verify store_trace=true works with NelderMead, Fminbox(NelderMead), and BFGS
Fixes #990
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent def7553 commit b5d3924
File tree
2 files changed
+33
-8
lines changed- lib/OptimizationOptimJL
- src
- test
2 files changed
+33
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
| 143 | + | |
143 | 144 | | |
144 | | - | |
| 145 | + | |
145 | 146 | | |
146 | 147 | | |
147 | | - | |
| 148 | + | |
148 | 149 | | |
149 | 150 | | |
150 | 151 | | |
151 | | - | |
| 152 | + | |
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
| |||
257 | 258 | | |
258 | 259 | | |
259 | 260 | | |
260 | | - | |
| 261 | + | |
| 262 | + | |
261 | 263 | | |
262 | 264 | | |
263 | 265 | | |
264 | | - | |
| 266 | + | |
265 | 267 | | |
266 | 268 | | |
267 | | - | |
| 269 | + | |
268 | 270 | | |
269 | 271 | | |
270 | 272 | | |
271 | | - | |
| 273 | + | |
272 | 274 | | |
273 | 275 | | |
274 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
216 | 239 | | |
0 commit comments