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§
Sourcefn checkpoint(&self) -> Checkpoint
fn checkpoint(&self) -> Checkpoint
Which checkpoint we are paused at.
Sourcefn complementarity(&self) -> Number
fn complementarity(&self) -> Number
Average complementarity — the IPM’s “distance from the central path” gauge; should track μ.
Sourcefn alpha(&self) -> (Number, Number)
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.
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>
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”.
Sourcefn as_any_mut(&mut self) -> Option<&mut dyn Any>
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).
Sourcefn status(&self) -> Option<&str>
fn status(&self) -> Option<&str>
Solve outcome, present only at Checkpoint::Terminated.
Sourcefn nlp_error(&self) -> Number
fn nlp_error(&self) -> Number
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<Number>>
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.
Sourcefn regularization(&self) -> Number
fn regularization(&self) -> Number
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<KktTriplets>
fn kkt_matrix(&self) -> Option<KktTriplets>
Assembled KKT matrix triplets for viz kkt, if captured.
Sourcefn kkt_l_factor(&self) -> Option<LFactor>
fn kkt_l_factor(&self) -> Option<LFactor>
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: &[Number]) -> Result<(), String>
fn set_block(&mut self, _name: &str, _vals: &[Number]) -> 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) -> bool
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).
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".