Expand description
Interactive solver debugger — a “pdb for the interior-point loop”.
The main loop (crate::ipopt_alg::IpoptAlgorithm::optimize) fires
a DebugHook at well-defined checkpoints. A hook receives a
DebugCtx — a live, mutable view of the algorithm state — and
returns a DebugAction telling the loop whether to keep solving
or stop. This is the engine; the user-facing REPL / agent protocol
lives in the CLI (pounce --debug), which implements DebugHook.
Two design points make mutation safe:
DebugCtxholds cheapRcclones of the sameIpoptData/IpoptCqhandles the loop uses, so reads and writes go through the identicalRefCellpath — there is no shadow copy to drift.- Overwriting the iterate rebuilds a fresh [
IteratesVector] (viadeep_copy().freeze()), which mints a new vector tag. The CQ caches are tag-keyed (seeipopt_cq.rs), so a mutated iterate transparently invalidates every derived quantity — exactly as if the line search had produced the new point.
Checkpoints fire at the iteration top, the sub-iteration phases
(after_mu / after_search_dir / after_step), around restoration
entry/exit, and at termination. The same hook is shared
(Rc<RefCell<…>>) with the restoration inner IPM, so one debugger
steps both the outer and inner solves.
Structs§
- Debug
Ctx - Live, mutable view of solver state handed to a
DebugHook. - Iterate
Snapshot - A cheap, correct snapshot of the primal-dual state at one step.
- KktReport
- KKT-factorization report (see
DebugCtx::kkt). The inertia of a well-posed primal-dual system is(n_pos = n, n_neg = m, n_zero = 0); a mismatch (or nonzero regularization) is the classic signal that the step is being stabilized. - Residual
- One signed residual component at the current iterate: its space, its
index within that space, and its value. See
DebugCtx::constraint_residuals/DebugCtx::dual_residuals.
Enums§
- Checkpoint
- Where in the main loop a checkpoint fired.
- Debug
Action - What the algorithm should do after a
DebugHookreturns. - Resid
Kind - Which residual space a
Residualentry comes from.
Constants§
- BLOCK_
NAMES - The eight primal/dual blocks of an iterate, addressable by name.
- LIVE_
TOLERANCE_ OPTS - Solver options the debugger can apply in place at the next checkpoint:
the convergence-check tolerances
crate::conv_check’s policy re-reads each iteration. Anything not listed here is baked into a strategy at build time and needs aresolveto take effect.
Traits§
- Debug
Hook - A consumer that the main loop pauses at each checkpoint. The CLI’s REPL / agent driver is the production implementation.
Functions§
- is_
live_ tolerance - Whether
nameis a tolerance the debugger can hot-swap live (nextstep), as opposed to a structural option that needsresolve.