Skip to main content

DebugState

Trait DebugState 

Source
pub trait DebugState {
Show 31 methods // Required methods fn checkpoint(&self) -> Checkpoint; fn iter(&self) -> i32; fn mu(&self) -> f64; fn objective(&self) -> f64; fn inf_pr(&self) -> f64; fn inf_du(&self) -> f64; fn complementarity(&self) -> f64; fn alpha(&self) -> (f64, f64); fn block_dims(&self) -> Vec<(&'static str, usize)>; fn block(&self, name: &str) -> Option<Vec<f64>>; fn delta_block(&self, name: &str) -> Option<Vec<f64>>; // Provided methods fn as_any(&self) -> Option<&(dyn Any + 'static)> { ... } fn as_any_mut(&mut self) -> Option<&mut (dyn Any + 'static)> { ... } fn status(&self) -> Option<&str> { ... } fn nlp_error(&self) -> f64 { ... } fn bound_slack(&self, _which: &str) -> Option<Vec<f64>> { ... } fn regularization(&self) -> f64 { ... } fn ls_count(&self) -> i32 { ... } fn kkt(&self) -> Option<KktReport> { ... } fn kkt_matrix(&self) -> Option<(i32, Vec<i32>, Vec<i32>, Vec<f64>)> { ... } fn kkt_l_factor( &self, ) -> Option<(usize, Vec<usize>, Vec<i32>, Vec<i32>, Option<Vec<f64>>)> { ... } fn kkt_captured_iter(&self) -> Option<i32> { ... } fn request_l_factor(&mut self) -> bool { ... } fn request_kkt_matrix(&mut self) -> bool { ... } fn set_mu(&mut self, _mu: f64) -> Result<(), String> { ... } fn set_block(&mut self, _name: &str, _vals: &[f64]) -> Result<(), String> { ... } fn set_component( &mut self, name: &str, idx: usize, val: f64, ) -> Result<(), String> { ... } fn snapshot(&self) -> Option<Box<dyn IterSnapshot>> { ... } fn restore(&mut self, _snap: &(dyn IterSnapshot + 'static)) -> bool { ... } fn constraint_residuals(&self) -> Option<Vec<Residual>> { ... } fn dual_residuals(&self) -> Option<Vec<Residual>> { ... }
}
Expand description

A live view of solver state handed to a DebugHook at a checkpoint.

Required methods are the quantities every interior-point method has. The remaining methods carry solver-specific capabilities and default to “unsupported” (NaN / None / -1 / Err), so a solver overrides only the ones it can answer. set_* mutators likewise default to a descriptive Err for solvers that don’t support in-place edits.

Required Methods§

Source

fn checkpoint(&self) -> Checkpoint

Which checkpoint we are paused at.

Source

fn iter(&self) -> i32

Current outer iteration counter.

Source

fn mu(&self) -> f64

Current barrier parameter μ.

Source

fn objective(&self) -> f64

Objective at the current iterate (in the user’s original sense).

Source

fn inf_pr(&self) -> f64

Max-norm primal infeasibility.

Source

fn inf_du(&self) -> f64

Max-norm dual infeasibility.

Source

fn complementarity(&self) -> f64

Average complementarity — the IPM’s “distance from the central path” gauge; should track μ.

Source

fn alpha(&self) -> (f64, f64)

Accepted primal / dual step lengths (α_pr, α_du). A solver with a single symmetric step (e.g. HSDE) reports it in both slots.

Source

fn block_dims(&self) -> Vec<(&'static str, usize)>

Dimensions of every named iterate block, in display order.

Source

fn block(&self, name: &str) -> Option<Vec<f64>>

Read a named block of the current iterate as a flat f64 vec. None for an unknown name or before the iterate is set.

Source

fn delta_block(&self, name: &str) -> Option<Vec<f64>>

Read a named block of the most recent search direction.

Provided Methods§

Source

fn as_any(&self) -> Option<&(dyn Any + 'static)>

Downcast escape hatch for solver-specific REPL commands whose payload can’t live in this leaf crate (e.g. the NLP debugger’s rank diagnosis, model-name resolution, or full primal-dual warm resolve). A solver that supports those returns Some(self) so the REPL can downcast to its concrete state; the default None makes the command report “not supported for this solver”.

Source

fn as_any_mut(&mut self) -> Option<&mut (dyn Any + 'static)>

Mutable form of as_any, for commands that mutate solver-specific state (e.g. live-tolerance hot-swap).

Source

fn status(&self) -> Option<&str>

Solve outcome, present only at Checkpoint::Terminated.

Source

fn nlp_error(&self) -> f64

A scalar convergence error driving termination (the NLP “nlp_error”). NaN when the solver has no single such metric.

Source

fn bound_slack(&self, _which: &str) -> Option<Vec<f64>>

Slacks to a bound category (x_l / x_u / s_l / s_u) for the active-set view. None when the solver has no bound-slack notion.

Source

fn regularization(&self) -> f64

Regularization applied to the KKT system this iteration. NaN when the solver does not expose one.

Source

fn ls_count(&self) -> i32

Number of line-search trial points for the accepted step. -1 for solvers without a backtracking line search (e.g. the convex IPM, which takes a fraction-to-boundary step).

Source

fn kkt(&self) -> Option<KktReport>

KKT-factorization inertia / regularization report, if available.

Source

fn kkt_matrix(&self) -> Option<(i32, Vec<i32>, Vec<i32>, Vec<f64>)>

Assembled KKT matrix triplets for viz kkt, if captured.

Source

fn kkt_l_factor( &self, ) -> Option<(usize, Vec<usize>, Vec<i32>, Vec<i32>, Option<Vec<f64>>)>

The LDLᵀ factor for viz L, if captured.

Source

fn kkt_captured_iter(&self) -> Option<i32>

The iteration the currently-captured KKT matrix / factor came from (may be the previous iteration when paused at iter_start, the viz look-back). None when nothing is captured or unsupported.

Source

fn request_l_factor(&mut self) -> bool

Ask the solver to capture the LDLᵀ factor on later solves. Returns whether it is already available now.

Source

fn request_kkt_matrix(&mut self) -> bool

Ask the solver to assemble the KKT triplets on later solves. Returns whether they are already available now.

Source

fn set_mu(&mut self, _mu: f64) -> Result<(), String>

Overwrite the barrier parameter μ.

Source

fn set_block(&mut self, _name: &str, _vals: &[f64]) -> Result<(), String>

Overwrite an entire named block of the current iterate.

Source

fn set_component( &mut self, name: &str, idx: usize, val: f64, ) -> Result<(), String>

Overwrite a single component of a named block. Defaults to a read-modify-write through block / set_block.

Source

fn snapshot(&self) -> Option<Box<dyn IterSnapshot>>

Capture the current primal-dual state for a later restore. None when snapshots are unsupported or no iterate is set yet.

Source

fn restore(&mut self, _snap: &(dyn IterSnapshot + 'static)) -> bool

Restore a snapshot previously returned by snapshot. Returns whether the restore succeeded (false on unsupported, or a snapshot minted by a different solver).

Source

fn constraint_residuals(&self) -> Option<Vec<Residual>>

Per-constraint signed primal residuals at the current iterate (the components whose max-norm is inf_pr), for the print residuals command. None when the solver does not expose per-component residuals (the convex/conic and global solvers).

Source

fn dual_residuals(&self) -> Option<Vec<Residual>>

Per-variable signed dual (Lagrangian-gradient) residuals at the current iterate (the components whose max-norm is inf_du). None when unsupported.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl DebugState for DebugCtx

Expose the NLP solver’s DebugCtx through the shared DebugState surface, forwarding to its inherent accessors. The NLP solver supports the full surface, so every method is overridden.