Expand description
Per-iteration “intermediate” context shared with downstream
callers (notably the C-API inspector functions
GetIpoptCurrentIterate / GetIpoptCurrentViolations).
Mirrors upstream Ipopt’s OrigIpoptNLP::GetIpoptCurrent* flow: the
main loop installs a snapshot of the algorithm-side state into
thread-local storage immediately before invoking the user’s
intermediate callback, and clears it on return. Inspector functions
consult the TLS slot; outside the callback window every accessor
reports “not available”.
The snapshot is intentionally cheap to assemble — we stash Rc
handles to IpoptData, IpoptCq, and the algorithm-side IpoptNlp
rather than precomputing every field, so callers that read just one
quantity pay only for what they look at.
Structs§
- CtxGuard
- RAII guard — installs
ctxon construction, clears on drop. Used by the algorithm to scope visibility of live iterate state to one callback fire. - Intermediate
Context - Snapshot stashed in TLS for the duration of one
TNLP::intermediate_callbackinvocation. - User
Iterate - The materialised iterate of the user’s problem (full
n, fullm, originalgorder), and its window. Defined inpounce_nlp::live_iterateso the decorators that lift it one layer perintermediate_callbackforward — presolve’s above all — can reach it; re-exported here, where callers have always found it. - User
Iterate Guard - The materialised iterate of the user’s problem (full
n, fullm, originalgorder), and its window. Defined inpounce_nlp::live_iterateso the decorators that lift it one layer perintermediate_callbackforward — presolve’s above all — can reach it; re-exported here, where callers have always found it.
Functions§
- algorithm_
x_ bounds - The variable bounds
nlpiterates against — its livex_L/x_U, i.e. the declared box afterbound_relax_factorwidened it and any safe-slack adjustment moved it (upstreamIpoptNLP::x_L(), whatcurr_slack_x_Lis measured to) — in the shape of the TNLP it wraps (UserIterate::x_l_alg):±∞at a column with no such bound, and at a fixed variable the algorithm does not hold, its valuex[j]. - ipm_
user_ iterate - The interior-point iterate in the space of the TNLP the NLP wraps, by
the conversions
finalize_via_orig_nlpapplies to the final one, so the iterate read at the last fire is the solutionfinalize_solutionreports: - is_
active - Whether a context is currently installed.
- iterate_
scaling - The
IterateScalingof the problemnlpiterates on, in the shape of the TNLP it wraps — the objective factor and the per-rowc/dfactors, and which columns the algorithm holds (not a fixed variable, which upstream’sResortXreports at the TNLP’s own value). The per-variable factor is1here: aScalingTnlpsubstitutingx̃ = d ⊙ xmultiplies itsdin when it lifts the iterate. Both arms solve through the sameOrigIpoptNlp, so both read their scaling here. - user_
grad_ lag - The algorithm’s own
∇L(var-x, scaled:obj·∇f + J̃ᵀỹ − z̃_L + z̃_U, upstreamcurr_grad_lag_x) as the unscaled∇f + Jᵀλ − z_L + z_Uof the TNLPnlpwraps —÷ obj, the row factors cancelling inJ̃ᵀỹ— at full x,0at a column the algorithm does not hold (upstreamResortX(…, usefixedvals=false)). Its∇fandJare the ones the algorithm evaluated at the iterate, so this costs no evaluation. - with_
current - Read access to the currently installed context. Returns
Noneoutside the intermediate-callback window. - with_
current_ user_ iterate - The materialised iterate of the user’s problem (full
n, fullm, originalgorder), and its window. Defined inpounce_nlp::live_iterateso the decorators that lift it one layer perintermediate_callbackforward — presolve’s above all — can reach it; re-exported here, where callers have always found it.