Skip to main content

trellis_runner/
progress.rs

1/// Numerical signals emitted by a solver during execution.
2///
3/// `Progress` represents *algorithm-level observations*, not engine control flow.
4/// These signals are produced by a [`crate::Procedure`] and consumed by:
5/// - convergence tracking
6/// - policy evaluation
7/// - monitoring / logging systems
8#[derive(Clone, Debug)]
9pub enum Progress<F> {
10    /// Primary metric (loss, objective function, error estimate etc)
11    Measure(F),
12    Report {
13        measure: F,
14        diagnostics: ProgressDiagnostics<F>,
15    },
16    /// Signals that the algorithm is complete
17    ///
18    /// This is a semantic signal from the algorithm, distinct from policy decisions implemented
19    /// directly by the engine
20    Complete,
21}
22
23#[derive(Clone, Debug, Default)]
24pub struct ProgressDiagnostics<F> {
25    pub absolute_error: Option<F>,
26    pub relative_error: Option<F>,
27    pub gradient_norm: Option<F>,
28    pub step_size: Option<F>,
29}