gtopt::SDDPIterationResult struct

Result of a single SDDP iteration (forward + backward pass).

Public functions

auto effective_gap() const -> double noexcept
auto effective_upper_bound() const -> double noexcept

Public variables

double agreement_rewards
int apertures_dropped
double backward_pass_s
Wall-clock time in seconds for the backward pass (all scenes).
BoundaryGapDiagnostics boundary
bool converged
int cuts_added
Number of Benders cuts added this iteration.
bool feasibility_issue
double forward_pass_s
Wall-clock time in seconds for the forward pass (all scenes).
double gap
double gap_change
int infeasible_cuts_added
IterationIndex iteration_index
Iteration number (0-based).
double iteration_s
Total wall-clock time in seconds for this iteration.
double lower_bound
Lower bound (phase 0 obj including a).
std::vector<uint8_t> scene_feasible
std::vector<int> scene_iterations
std::vector<double> scene_lower_bounds
double scene_probability_lost
std::vector<double> scene_upper_bounds
Per-scene upper bounds (forward-pass costs). Size = num_scenes.
bool stationary_converged
bool statistical_converged
double upper_bound
double upper_bound_net

Function documentation

double gtopt::SDDPIterationResult::effective_gap() const noexcept

The gap the convergence tests read: the corrected gap (UB* − LB)/max(1,|UB*|) when boundary cuts are loaded (the raw gap is then biased by −E[Φ'(v_T)]), the raw gap otherwise.

double gtopt::SDDPIterationResult::effective_upper_bound() const noexcept

UB the convergence tests read: boundary.corrected_upper_bound when boundary cuts are loaded, the raw upper_bound otherwise.

Variable documentation

double gtopt::SDDPIterationResult::agreement_rewards

Objective contribution of the water-rights reward terms (positive uvalue, e.g. irrigation-agreement delivery values) folded into upper_bound, summed like it over feasible scenes. <= 0; 0 when no right is rewarded. See SystemLP::agreement_rewards_objective.

int gtopt::SDDPIterationResult::apertures_dropped

Backward-pass aperture solves dropped this iteration (infeasible, timed out or abandoned), summed over every (scene, phase) cell. The expected cut of each affected cell was renormalised over the remaining apertures, so the LB describes a rescaled distribution: an iteration with apertures_dropped > 0 never sets converged (issue #551). 0 without apertures.

BoundaryGapDiagnostics gtopt::SDDPIterationResult::boundary

Boundary-cut gap accounting (active == false without boundary cuts). See BoundaryGapDiagnostics.

bool gtopt::SDDPIterationResult::converged

True once a convergence criterion fired: ΔUB stationarity (when enabled), the primary gap test (only when stationarity is disabled — see SDDPOptions::stationarity_enabled), or the statistical CI test — and the iteration's backward pass dropped no aperture (apertures_dropped == 0).

bool gtopt::SDDPIterationResult::feasibility_issue

True if elastic filter was activated

double gtopt::SDDPIterationResult::gap

Relative gap: (UB - LB) / max(1, |UB|)

double gtopt::SDDPIterationResult::gap_change

Relative change in UB vs. stationary_window iterations ago:

gap_change = |UB[i] - UB[i - window]| / max(eps, |UB[i - window]|)

Under multi-cut / aperture-mode SDDP the cuts can over-tighten the master LB above the true optimum, producing a negative gap (LB > UB) that oscillates while the cut family is still being refined. The relative-Δgap stationarity test that previously drove this field was confounded by the LB drift (Δgap_relative explodes near gap = 0 because of the small denominator). UB is the unbiased Monte-Carlo estimate of the realised policy cost — it is what we are optimising — so stationarity of UB is the signal that actually says "the policy has stopped moving". Populated only when stationary_tol > 0 and enough iterations have elapsed; 1.0 otherwise (meaning "not yet checked / not applicable"), so the convergence test naturally skips early iters that do not yet have a usable look-back window.

int gtopt::SDDPIterationResult::infeasible_cuts_added

Number of successful elastic-filter solves this iteration. Each elastic-filter solve corresponds to an LP infeasibility event; in the backward pass these become Benders feasibility cuts.

std::vector<uint8_t> gtopt::SDDPIterationResult::scene_feasible

Per-scene feasibility flag (1 = feasible, 0 = infeasible). Mirror of ForwardPassOutcome::scene_feasible. Size = num_scenes when populated, empty otherwise (e.g. async mode where scenes complete out-of-order). Surfaces in the per-iteration headline as feasible=K/N so operators see the fraction of the original problem the bounds actually cover — UB / LB are computed only over feasible scenes (renormalising probability weights), so a low K/N means the gap reflects a sub-problem, not the original N-scene SDDP.

std::vector<int> gtopt::SDDPIterationResult::scene_iterations

Per-scene iteration at the time this result was computed. Populated only in async mode (max_async_spread > 0). Shows the iteration each scene had completed when this aggregate convergence check was triggered. Size = num_scenes when populated, empty otherwise.

std::vector<double> gtopt::SDDPIterationResult::scene_lower_bounds

Per-scene lower bounds (phase-0 objective values). Size = num_scenes.

double gtopt::SDDPIterationResult::scene_probability_lost

Total original probability mass of scenes that were marked infeasible this iteration. Computed as Σ_{infeasible i} p_orig_i / Σ_all p_orig_j so the value is always in [0, 1] regardless of how the user normalised the scenario probability_factors. Lets downstream tooling and solver-status JSON readers see "47 % of probability mass is missing from this iteration's bounds" without recomputing from scene_feasible. Stays 0 when every scene is feasible.

bool gtopt::SDDPIterationResult::stationary_converged

True when convergence was declared by the stationary-gap criterion (gap_change < stationary_tol) rather than the primary criterion.

bool gtopt::SDDPIterationResult::statistical_converged

True when convergence was declared by the statistical CI criterion (|UB - LB| <= z_{a/2} * s / sqrt(N)) rather than the primary criterion.

double gtopt::SDDPIterationResult::upper_bound

Upper bound (sum of actual phase costs)

double gtopt::SDDPIterationResult::upper_bound_net

upper_bound − agreement_rewards: the UB as a pure cost, without the agreement valuations.