Skip to main content

Module debug

Module debug 

Source
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:

  • DebugCtx holds cheap Rc clones of the same IpoptData / IpoptCq handles the loop uses, so reads and writes go through the identical RefCell path — there is no shadow copy to drift.
  • Overwriting the iterate rebuilds a fresh [IteratesVector] (via deep_copy().freeze()), which mints a new vector tag. The CQ caches are tag-keyed (see ipopt_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§

DebugCtx
Live, mutable view of solver state handed to a DebugHook.
IterateSnapshot
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.
DebugAction
What the algorithm should do after a DebugHook returns.
ResidKind
Which residual space a Residual entry 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 a resolve to take effect.

Traits§

DebugHook
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 name is a tolerance the debugger can hot-swap live (next step), as opposed to a structural option that needs resolve.