pub enum TrainingEvent {
ForwardPassComplete {
iteration: u64,
scenarios: u32,
ub_mean: f64,
ub_std: f64,
elapsed_ms: u64,
},
ForwardSyncComplete {
iteration: u64,
global_ub_mean: f64,
global_ub_std: f64,
sync_time_ms: u64,
},
BackwardPassComplete {
iteration: u64,
cuts_generated: u32,
stages_processed: u32,
elapsed_ms: u64,
},
CutSyncComplete {
iteration: u64,
cuts_distributed: u32,
cuts_active: u32,
cuts_removed: u32,
sync_time_ms: u64,
},
CutSelectionComplete {
iteration: u64,
cuts_deactivated: u32,
stages_processed: u32,
selection_time_ms: u64,
allgatherv_time_ms: u64,
},
ConvergenceUpdate {
iteration: u64,
lower_bound: f64,
upper_bound: f64,
upper_bound_std: f64,
gap: f64,
rules_evaluated: Vec<StoppingRuleResult>,
},
CheckpointComplete {
iteration: u64,
checkpoint_path: String,
elapsed_ms: u64,
},
IterationSummary {
iteration: u64,
lower_bound: f64,
upper_bound: f64,
gap: f64,
wall_time_ms: u64,
iteration_time_ms: u64,
forward_ms: u64,
backward_ms: u64,
lp_solves: u64,
},
TrainingStarted {
case_name: String,
stages: u32,
hydros: u32,
thermals: u32,
ranks: u32,
threads_per_rank: u32,
timestamp: String,
},
TrainingFinished {
reason: String,
iterations: u64,
final_lb: f64,
final_ub: f64,
total_time_ms: u64,
total_cuts: u64,
},
SimulationProgress {
scenarios_complete: u32,
scenarios_total: u32,
elapsed_ms: u64,
mean_cost: f64,
std_cost: f64,
ci_95_half_width: f64,
},
SimulationFinished {
scenarios: u32,
output_dir: String,
elapsed_ms: u64,
},
}Expand description
Typed events emitted by an iterative optimization training loop and simulation runner.
The enum has 12 variants: 8 per-iteration events (one per lifecycle step) and 4 lifecycle events (emitted once per training or simulation run).
§Per-iteration events (steps 1–7 + 4a)
| Step | Variant | When emitted |
|---|---|---|
| 1 | Self::ForwardPassComplete | Local forward pass done |
| 2 | Self::ForwardSyncComplete | Global allreduce of bounds done |
| 3 | Self::BackwardPassComplete | Backward sweep done |
| 4 | Self::CutSyncComplete | Cut allgatherv done |
| 4a | Self::CutSelectionComplete | Cut selection done (conditional on should_run) |
| 5 | Self::ConvergenceUpdate | Stopping rules evaluated |
| 6 | Self::CheckpointComplete | Checkpoint written (conditional on checkpoint interval) |
| 7 | Self::IterationSummary | End-of-iteration aggregated summary |
§Lifecycle events
| Variant | When emitted |
|---|---|
Self::TrainingStarted | Training loop entry |
Self::TrainingFinished | Training loop exit |
Self::SimulationProgress | Simulation batch completion |
Self::SimulationFinished | Simulation completion |
Variants§
ForwardPassComplete
Step 1: Forward pass completed for this iteration on the local rank.
Fields
ForwardSyncComplete
Step 2: Forward synchronization (allreduce) completed.
Emitted after the global reduction of local bound estimates across all participating ranks.
Fields
BackwardPassComplete
Step 3: Backward pass completed for this iteration.
Emitted after the full backward sweep that generates new cuts for each stage.
Fields
CutSyncComplete
Step 4: Cut synchronization (allgatherv) completed.
Emitted after new cuts from all ranks have been gathered and distributed to every rank via allgatherv.
Fields
CutSelectionComplete
Step 4a: Cut selection completed.
Only emitted on iterations where cut selection runs (i.e., when
should_run(iteration) returns true). On non-selection iterations
this variant is skipped entirely.
Fields
ConvergenceUpdate
Step 5: Convergence check completed.
Emitted after all configured stopping rules have been evaluated for the current iteration. Contains the current bounds, gap, and per-rule results.
Fields
rules_evaluated: Vec<StoppingRuleResult>Evaluation result for each configured stopping rule.
CheckpointComplete
Step 6: Checkpoint written.
Only emitted when the checkpoint interval triggers (i.e., when
iteration % checkpoint_interval == 0). Not emitted on every iteration.
Fields
IterationSummary
Step 7: Full iteration summary with aggregated timings.
Emitted at the end of every iteration as the final per-iteration event. Contains all timing breakdowns for the completed iteration.
Fields
TrainingStarted
Emitted once when the training loop begins.
Carries run-level metadata describing the problem size and parallelism configuration for this training run.
Fields
TrainingFinished
Emitted once when the training loop exits (converged or limit reached).
Fields
SimulationProgress
Emitted periodically during policy simulation (not during training).
Consumers can use this to display a progress indicator during the simulation phase, including live cost statistics as scenarios complete.
Fields
mean_cost: f64Running mean of total scenario costs computed so far, in cost units.
Populated by the emitter after each batch of completed scenarios.
SimulationFinished
Emitted once when policy simulation completes.
Trait Implementations§
Source§impl Clone for TrainingEvent
impl Clone for TrainingEvent
Source§fn clone(&self) -> TrainingEvent
fn clone(&self) -> TrainingEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more