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) -> Number; fn objective(&self) -> Number; fn inf_pr(&self) -> Number; fn inf_du(&self) -> Number; fn complementarity(&self) -> Number; fn alpha(&self) -> (Number, Number); fn block_dims(&self) -> Vec<(&'static str, usize)>; fn block(&self, name: &str) -> Option<Vec<Number>>; fn delta_block(&self, name: &str) -> Option<Vec<Number>>; // Provided methods fn as_any(&self) -> Option<&dyn Any> { ... } fn as_any_mut(&mut self) -> Option<&mut dyn Any> { ... } fn status(&self) -> Option<&str> { ... } fn nlp_error(&self) -> Number { ... } fn bound_slack(&self, _which: &str) -> Option<Vec<Number>> { ... } fn regularization(&self) -> Number { ... } fn ls_count(&self) -> i32 { ... } fn kkt(&self) -> Option<KktReport> { ... } fn kkt_matrix(&self) -> Option<KktTriplets> { ... } fn kkt_l_factor(&self) -> Option<LFactor> { ... } 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: Number) -> Result<(), String> { ... } fn set_block(&mut self, _name: &str, _vals: &[Number]) -> Result<(), String> { ... } fn set_component( &mut self, name: &str, idx: usize, val: Number, ) -> Result<(), String> { ... } fn snapshot(&self) -> Option<Box<dyn IterSnapshot>> { ... } fn restore(&mut self, _snap: &dyn IterSnapshot) -> 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) -> Number

Current barrier parameter μ.

Source

fn objective(&self) -> Number

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

Source

fn inf_pr(&self) -> Number

Max-norm primal infeasibility.

Source

fn inf_du(&self) -> Number

Max-norm dual infeasibility.

Source

fn complementarity(&self) -> Number

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

Source

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

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<Number>>

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<Number>>

Read a named block of the most recent search direction.

Provided Methods§

Source

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

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>

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) -> Number

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<Number>>

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) -> Number

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<KktTriplets>

Assembled KKT matrix triplets for viz kkt, if captured.

Source

fn kkt_l_factor(&self) -> Option<LFactor>

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: Number) -> Result<(), String>

Overwrite the barrier parameter μ.

Source

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

Overwrite an entire named block of the current iterate.

Source

fn set_component( &mut self, name: &str, idx: usize, val: Number, ) -> 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) -> 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§