Commit be6fbd2
Use the default OptimizationCache in OptimizationIpopt (#1257)
Replace the bespoke IpoptCache (copied from OptimizationMOI's
evaluator/cache split) with OptimizationBase's default OptimizationCache,
mirroring the structure of OptimizationMadNLP: the package now only
defines the optimizer struct, the SciMLBase traits, and
__solve(::OptimizationCache{<:IpoptOptimizer}), with the solver-specific
state (derivative buffers, sparsity, call counters) held by a transient
IpoptEvaluator built inside __solve. This removes the hand-rolled
__init, the ReInitCache delegation, the solution accessors, and the
dead MOI leftovers (int, obj_expr/cons_expr, discarded sys).
Behavior fixes that fell out of the refactor:
- MaxSense is now handled with Ipopt's obj_scaling_factor = -1 instead
of manually negating in the evaluators, fixing the sign of
sol.objective and of the value passed to user callbacks.
- The live cache.p is forwarded to the instantiated derivative closures
(guarded for AutoSymbolics/NoAD/parameterless paths), so
reinit!(cache; p = ...) no longer silently converges to the optimum
of the old parameters.
- requireshessian/requiresconshess/requireslagh are conditional on
hessian_approximation, so limited-memory runs skip second-order AD
entirely and pass eval_h = nothing; requireslagh was previously
missing and the unused cons_vjp is no longer generated (Ipopt's C API
has no vjp/jvp callbacks).
Test suite cleanup, cross-checked against the Ipopt repo:
- Fix the mistranslated MyNLP problem and the invented LuksanVlcek1
constraint bounds/starting point; pin their optima.
- The restoration phase test's constraints are mutually infeasible, so
assert ReturnCode.Infeasible instead of a vacuous guarded check.
- Make the warm-start test actually warm-start via reinit!, verify
print levels through Ipopt's output_file, make the option-priority
test discriminating, check the derivative checker's verdict, and
seed the stress-test RNGs.
- Add tests for the MaxSense objective sign, reinit! with new
parameters, and the limited-memory trait behavior.
- Prune redundant testsets (NLS, mixed-integer, non-smooth robust
optimization, dead complementarity block, duplicate verbose loop)
and drop the inaccurate "automatically translated" headers, keeping
EPL attribution on the genuinely Ipopt-derived problems.
MTK reinit! stays @test_broken: both the plain-vector and symbolic-map
forms are blocked upstream (ReInitCache field conversion and SciMLBase's
process_p_u0_symbolic fallback).
Claude-Session: https://claude.ai/code/session_01BTyNNDwaNrJFyNzN6XTqcn
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 3b0cff7 commit be6fbd2
9 files changed
Lines changed: 490 additions & 633 deletions
File tree
- lib/OptimizationIpopt
- src
- test
- qa
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
178 | | - | |
179 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
180 | 184 | | |
181 | 185 | | |
182 | 186 | | |
183 | 187 | | |
184 | 188 | | |
185 | 189 | | |
186 | | - | |
| 190 | + | |
187 | 191 | | |
188 | 192 | | |
189 | 193 | | |
190 | 194 | | |
191 | 195 | | |
192 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
193 | 200 | | |
194 | 201 | | |
195 | 202 | | |
| |||
199 | 206 | | |
200 | 207 | | |
201 | 208 | | |
202 | | - | |
| 209 | + | |
203 | 210 | | |
204 | 211 | | |
205 | 212 | | |
206 | | - | |
| 213 | + | |
207 | 214 | | |
208 | 215 | | |
209 | 216 | | |
210 | 217 | | |
211 | 218 | | |
212 | 219 | | |
213 | 220 | | |
214 | | - | |
| 221 | + | |
| 222 | + | |
215 | 223 | | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
222 | 237 | | |
223 | 238 | | |
224 | | - | |
| 239 | + | |
225 | 240 | | |
226 | 241 | | |
227 | 242 | | |
228 | | - | |
| 243 | + | |
229 | 244 | | |
230 | 245 | | |
231 | 246 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
236 | 258 | | |
237 | | - | |
238 | | - | |
| 259 | + | |
239 | 260 | | |
240 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
241 | 266 | | |
242 | 267 | | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | 268 | | |
247 | | - | |
| 269 | + | |
248 | 270 | | |
249 | 271 | | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
255 | 277 | | |
256 | 278 | | |
257 | 279 | | |
| |||
261 | 283 | | |
262 | 284 | | |
263 | 285 | | |
264 | | - | |
| 286 | + | |
265 | 287 | | |
266 | 288 | | |
267 | 289 | | |
268 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
269 | 301 | | |
270 | 302 | | |
271 | 303 | | |
| |||
285 | 317 | | |
286 | 318 | | |
287 | 319 | | |
| 320 | + | |
288 | 321 | | |
289 | 322 | | |
290 | 323 | | |
| |||
301 | 334 | | |
302 | 335 | | |
303 | 336 | | |
304 | | - | |
| 337 | + | |
305 | 338 | | |
306 | 339 | | |
307 | 340 | | |
| |||
352 | 385 | | |
353 | 386 | | |
354 | 387 | | |
355 | | - | |
| 388 | + | |
356 | 389 | | |
357 | 390 | | |
358 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
359 | 395 | | |
360 | | - | |
| 396 | + | |
361 | 397 | | |
362 | 398 | | |
363 | 399 | | |
364 | 400 | | |
365 | 401 | | |
366 | | - | |
| 402 | + | |
367 | 403 | | |
368 | | - | |
| 404 | + | |
| 405 | + | |
369 | 406 | | |
370 | 407 | | |
371 | 408 | | |
| |||
385 | 422 | | |
386 | 423 | | |
387 | 424 | | |
388 | | - | |
| 425 | + | |
| 426 | + | |
389 | 427 | | |
390 | 428 | | |
391 | 429 | | |
| |||
401 | 439 | | |
402 | 440 | | |
403 | 441 | | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | 442 | | |
0 commit comments