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§
Sourcefn checkpoint(&self) -> Checkpoint
fn checkpoint(&self) -> Checkpoint
Which checkpoint we are paused at.
Sourcefn complementarity(&self) -> f64
fn complementarity(&self) -> f64
Average complementarity — the IPM’s “distance from the central path” gauge; should track μ.
Sourcefn alpha(&self) -> (f64, f64)
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.
Sourcefn block_dims(&self) -> Vec<(&'static str, usize)>
fn block_dims(&self) -> Vec<(&'static str, usize)>
Dimensions of every named iterate block, in display order.
Provided Methods§
Sourcefn as_any(&self) -> Option<&(dyn Any + 'static)>
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”.
Sourcefn as_any_mut(&mut self) -> Option<&mut (dyn Any + 'static)>
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).
Sourcefn status(&self) -> Option<&str>
fn status(&self) -> Option<&str>
Solve outcome, present only at Checkpoint::Terminated.
Sourcefn nlp_error(&self) -> f64
fn nlp_error(&self) -> f64
A scalar convergence error driving termination (the NLP “nlp_error”).
NaN when the solver has no single such metric.
Sourcefn bound_slack(&self, _which: &str) -> Option<Vec<f64>>
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.
Sourcefn regularization(&self) -> f64
fn regularization(&self) -> f64
Regularization applied to the KKT system this iteration. NaN when
the solver does not expose one.
Sourcefn ls_count(&self) -> i32
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).
Sourcefn kkt(&self) -> Option<KktReport>
fn kkt(&self) -> Option<KktReport>
KKT-factorization inertia / regularization report, if available.
Sourcefn kkt_matrix(&self) -> Option<(i32, Vec<i32>, Vec<i32>, Vec<f64>)>
fn kkt_matrix(&self) -> Option<(i32, Vec<i32>, Vec<i32>, Vec<f64>)>
Assembled KKT matrix triplets for viz kkt, if captured.
Sourcefn kkt_l_factor(
&self,
) -> Option<(usize, Vec<usize>, Vec<i32>, Vec<i32>, Option<Vec<f64>>)>
fn kkt_l_factor( &self, ) -> Option<(usize, Vec<usize>, Vec<i32>, Vec<i32>, Option<Vec<f64>>)>
The LDLᵀ factor for viz L, if captured.
Sourcefn kkt_captured_iter(&self) -> Option<i32>
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.
Sourcefn request_l_factor(&mut self) -> bool
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.
Sourcefn request_kkt_matrix(&mut self) -> bool
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.
Sourcefn set_block(&mut self, _name: &str, _vals: &[f64]) -> Result<(), String>
fn set_block(&mut self, _name: &str, _vals: &[f64]) -> Result<(), String>
Overwrite an entire named block of the current iterate.
Sourcefn snapshot(&self) -> Option<Box<dyn IterSnapshot>>
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.
Sourcefn restore(&mut self, _snap: &(dyn IterSnapshot + 'static)) -> bool
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).
Sourcefn constraint_residuals(&self) -> Option<Vec<Residual>>
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).
Sourcefn dual_residuals(&self) -> Option<Vec<Residual>>
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§
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.