Skip to main content

Module intermediate

Module intermediate 

Source
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 ctx on construction, clears on drop. Used by the algorithm to scope visibility of live iterate state to one callback fire.
IntermediateContext
Snapshot stashed in TLS for the duration of one TNLP::intermediate_callback invocation.

Functions§

is_active
Whether a context is currently installed.
with_current
Read access to the currently installed context. Returns None outside the intermediate-callback window.