gtopt::SolverStats struct

Per-LP counters tracking backend activity over the lifetime of the LP.

Public functions

auto avg_ncols() const -> double noexcept
auto avg_nrows() const -> double noexcept
auto operator+=(const SolverStats& rhs) -> SolverStats& noexcept
auto operator-=(const SolverStats& rhs) -> SolverStats& noexcept
void reset() noexcept
auto total_backend_solves() const -> std::size_t noexcept
auto total_solve_calls() const -> std::size_t noexcept

Public variables

double bwd_add_row_s
double bwd_cut_build_s
double bwd_kappa_s
double bwd_lp_rebuild_s
double bwd_resolve_s
std::size_t bwd_step_count
Number of backward-pass cut-installation steps that landed on this LP.
double bwd_store_cut_s
std::size_t crossover_solves
std::size_t dual_infeasible
Subset of infeasible_count classified as dual-infeasible.
double efin_deficit
std::size_t fallback_solves
std::size_t infeasible_count
Solves that returned non-optimal even after the fallback cycle.
std::size_t initial_solve_calls
Top-level initial_solve() invocations (excludes fallback retries).
std::size_t load_problem_calls
double max_kappa
std::size_t primal_infeasible
Subset of infeasible_count classified as primal-infeasible.
std::size_t resolve_calls
double soft_emin_deficit
std::size_t total_ncols
std::size_t total_nrows
Sum of row counts observed at each top-level solve.
double total_solve_ticks
double total_solve_time_s
double unserved_demand
double unserved_flow

Friends

auto operator+(SolverStats lhs, const SolverStats& rhs) -> SolverStats noexcept

Function documentation

SolverStats& gtopt::SolverStats::operator-=(const SolverStats& rhs) noexcept

Subtract a snapshot of counters — used to obtain per-iteration deltas from two consecutive snapshots of the same aggregated SolverStats. max_kappa is copied from rhs (not differenced) because "max seen so far" has no meaningful subtraction; the delta snapshot holds the post-iteration max, which monotonically grows.

Variable documentation

double gtopt::SolverStats::bwd_add_row_s

Time spent in LinearInterface::add_row(cut) — this is the single-row CPLEX addRow (or equivalent) and the row-name bookkeeping that accompanies it.

double gtopt::SolverStats::bwd_cut_build_s

Time spent constructing the cut row (build_benders_cut, rescale_benders_cut, filter_cut_coefficients). Pure CPU on the calling thread.

double gtopt::SolverStats::bwd_kappa_s

Time spent in SDDPMethod::update_max_kappa — dominated by the backend get_kappa() call (CPLEX CPXgetdblquality(CPX_KAPPA), HiGHS basis-condition query).

double gtopt::SolverStats::bwd_lp_rebuild_s

Time spent in SystemLP::ensure_lp_built() before the cut is added (snapshot/compress reload; 0 under low_memory_mode=off).

double gtopt::SolverStats::bwd_resolve_s

Time spent in the post-cut LinearInterface::resolve() (simplex warm-start after adding the new row). Distinct from the existing total_solve_time_s, which covers every initial_solve/resolve invocation on the LP, so the two overlap intentionally; diffing this in isolation shows the per-iteration backward-resolve cost.

double gtopt::SolverStats::bwd_store_cut_s

Time spent pushing the new StoredCut onto the per-scene vector (SDDPCutManager::store_cut).

std::size_t gtopt::SolverStats::crossover_solves

Lazy-crossover re-solves triggered by ensure_duals() after a barrier-without-crossover solve.

double gtopt::SolverStats::efin_deficit

Σ over (scenario, last-stage-of-last-phase, reservoir) of prob × Storage.efin_slack, units hm³. Reflects the terminal- volume shortfall below efin when efin_cost is configured.

std::size_t gtopt::SolverStats::fallback_solves

Internal retries inside the algorithm-fallback loop (non-optimal primary attempts that triggered a secondary algorithm).

std::size_t gtopt::SolverStats::load_problem_calls

Number of times LinearInterface::load_flat() invoked the plugin's load_problem(). Exactly 1 per (scene, phase) when low_memory_mode == off; typically iterations × phases when a low-memory mode is active (backend rebuilt before every solve).

double gtopt::SolverStats::max_kappa

Largest kappa observed across every solve on this LP. Stays at -1.0 when the backend never reports a valid condition number.

std::size_t gtopt::SolverStats::resolve_calls

Top-level resolve() invocations (excludes fallback retries and the lazy-crossover re-solve performed by ensure_duals()).

double gtopt::SolverStats::soft_emin_deficit

Σ over (scenario, stage, reservoir) of prob × Storage.soft_emin, units hm³. Reflects volume below the per-stage soft minimum (soft_emin configured on Reservoir/Battery).

std::size_t gtopt::SolverStats::total_ncols

Sum of column counts observed at each top-level solve (one sample per initial_solve() / resolve()). Divide by total_solve_calls() to recover the average LP size. Tracking the sum instead of the average makes cross-LP aggregation a simple +=.

double gtopt::SolverStats::total_solve_ticks

Deterministic solver work (backend SolveEffort::ticks, e.g. CPLEX deterministic ticks) accumulated across every initial_solve() / resolve() on this LP. When the backend reports native ticks this is load-independent — unlike total_solve_time_s it does not vary with machine contention — so it is the right measure for comparing algorithmic effort (e.g. feasibility-cut modes). IMPORTANT: backends without a native tick count (CLP/CBC) fall back to wall seconds here, which are NOT load-independent; interpret this as deterministic ticks only when the active backend is known to report them (CPLEX/HiGHS).

double gtopt::SolverStats::total_solve_time_s

Wall-clock seconds spent inside m_backend_->initial_solve() / resolve() (accumulated across every attempt, including fallbacks and crossover). Excludes LP build and output time.

double gtopt::SolverStats::unserved_demand

Σ over (scenario, stage, block) of prob × duration × Demand.fail, units MWh. Reflects load shed volume the LP could not avoid this iteration.

double gtopt::SolverStats::unserved_flow

Σ over (scenario, stage, block, right) of prob × duration × FlowRight.fail × 3600/1e6, units hm³. Reflects irrigation/agreement flow that the LP could not deliver.