SddpOptions struct
#include <gtopt/sddp_options.hpp>
SDDP-specific solver configuration parameters.
Groups all SDDP-related options into a single sub-object for clearer JSON organization. Field names omit the sddp_ prefix since they already live inside the sddp_options namespace.
All fields are optional — defaults are applied via PlanningOptionsLP.
Public static variables
- static std::size_t json_field_count
Public functions
- void merge(SddpOptions&& opts)
Public variables
- OptReal alpha_min
- Universal lower bound on the future-cost variable α [$].
- std::optional<ApertureChunkMode> aperture_chunk_mode
- How backward-pass apertures are grouped into work-pool tasks (
per_scene/per_aperture/chunked). - OptInt aperture_chunk_size
- Apertures per task for
aperture_chunk_mode = chunked(K). - OptBool aperture_cut_resolve
- Re-solve the source phase LP after installing each aperture backward cut, as an optimality check (default: false).
- OptName aperture_directory
- Directory for aperture-specific scenario data.
- OptBool aperture_drop_fcuts
- DEPRECATED, ignored. Was "drop feasibility cuts from aperture
clone replay"; no solver code has read it since it was re-added to the JSON contract (2026-05-12), and the backward pass never adds feasibility cuts. Still parsed so existing case JSONs load;
validate_planningwarns when it is set. - OptInt aperture_screen_count
- Number of dual-shared aperture cuts re-solved exactly under
aperture_solve_mode = screened. - OptBool aperture_seed_basis
- Seed each iteration's first backward aperture from the previous iteration's first-aperture simplex basis (dual warm start).
- OptName aperture_selection_mode
- Selection rule used by
num_aperturesto pick a subset from each phase'sPhase::apertureslist. - std::optional<ApertureSolveMode> aperture_solve_mode
- How each backward-pass aperture is solved and how its cut's coefficients are recovered (
cold/warm/reduced_cost/dual_shared/screened). - OptName aperture_system_file
- Global default aperture system for the SDDP backward pass.
- OptReal aperture_timeout
- Timeout in seconds for individual aperture LP solves in the SDDP backward pass.
- OptBool aperture_use_manual_clone
- Use the manual (load_flat) clone route for aperture clones instead of the backend's native
clone()(CPXcloneprob). - std::optional<Array<Uid>> apertures
- Aperture UIDs for the backward pass.
- OptBool api_enabled
- Enable the SDDP monitoring API (writes JSON status file each iteration; default: true).
- OptInt backward_max_fallbacks
- Maximum algorithm fallback attempts for backward-pass and aperture solves.
- OptBool backward_resolve_target
- Re-solve target phase t LP before extracting cut data (default: true).
- std::optional<SolverOptions> backward_solver_options
- Optional LP solver configuration for SDDP backward pass.
- std::optional<BasisCrossMode> basis_cross_mode
- Cross-pass simplex-basis warm-start reuse between the forward and backward SDDP passes.
- std::optional<BoundaryCutSharingMode> boundary_cut_sharing_mode
- How terminal/boundary cuts are shared across scenes on the terminal α — the terminal-phase analogue of
cut_sharing_mode. - OptName boundary_cuts_file
- CSV file with boundary (future-cost) cuts for the last phase.
- OptBool boundary_cuts_mean_shift
- Apply an α-rebase (mean-shift) to boundary cuts on load.
- std::optional<BoundaryCutsMode> boundary_cuts_mode
- How boundary cuts are loaded: noload, separated (default), or combined.
- OptInt boundary_max_iterations
- Maximum number of SDDP iterations to load from the boundary cuts file. Only cuts from the last N iterations (by
iterationcolumn, i.e. PLP's IPDNumIte) are loaded. 0 = load all (default). - OptReal convergence_confidence
- Confidence level for statistical convergence criterion (0-1).
- std::optional<ConvergenceMode> convergence_mode
- Convergence criterion mode selection.
- OptReal convergence_tol
- Relative gap tolerance for convergence (default: 1e-4).
- OptReal cut_coeff_eps
- Absolute tolerance for filtering numerically tiny Benders cut coefficients.
- OptName cut_directory
- Directory for Benders cut files (default:
"cuts"). - std::optional<CutDrainMode> cut_drain_mode
- How to drain in-flight cuts after the aggregate-convergence stop signal fires in
SDDPMethod::solve_async. - OptInt cut_prune_interval
- Iterations between cut pruning passes. Default: 10.
- std::optional<HotStartMode> cut_recovery_mode
- Cut persistence mode: none (default), keep, append, or replace. Controls whether to load cuts from a previous run and how to handle the combined output file on completion.
- std::optional<CutSharingMode> cut_sharing_mode
- Cut sharing mode: none (default), multicut, or markov (opt-in, experimental — requires
markov_states+markov_transition). The legacy expected/broadcast_mean, accumulate, and max modes were REMOVED 2026-07-08 (invalid —docs/formulation/sddp-cut-validity.md§7); their names now hard-error at JSON parse time. - OptName cuts_input_file
- File path for loading initial cuts (hot-start; empty = cold start).
- std::optional<ElasticFilterMode> elastic_mode
- Elastic filter mode: chinneck (default, alias "iis"), single_cut (alias "cut"), multi_cut, state_repair (alias "plp"), or farkas_recursive. See ElasticFilterMode in sddp_enums.hpp for semantics. Serialization emits the canonical "state_repair"; the legacy "plp" spelling still parses. The legacy "backpropagate" mode is no longer supported; it falls through to the default.
- OptReal elastic_penalty
- Penalty for elastic slack variables in feasibility. Default:
PlanningOptionsLP::default_sddp_elastic_penalty(seeplanning_options_lp.hpp). - OptReal fact_eps
- PLP FactEPS tolerance for
elastic_mode = state_repair(alias plp) andfarkas_recursive(default:PlanningOptionsLP::default_sddp_fact_eps= 1e-8). Single knob behind the ray-zero / dx-activation / emission-skip / RHS-margin tolerances of the PLP-exact builder, and the σ/ω zero-guard + RHS margin of the farkas_recursive builder. Ignored by every other mode. - OptInt fact_max_cycles
- PLP FactMXC cycle cap for
elastic_mode = state_repair(alias plp) andfarkas_recursive(default:PlanningOptionsLP::default_sddp_fact_max_cycles= 500). Maximum solve cycles per (scene, phase) LP within one forward pass; exceeding it declares the scene infeasible for the iteration. Ignored by every other mode. - OptBool fcut_log
- Write the PLP-style feasibility-cut debug log
gtopt_fcut.logto the resolvedlog_directory(default: false). The gtopt analogue of PLP'splpfact.log(FactDBL ≥ 1): one record per forward-pass infeasibility event with the emitted cut coefficients, RHS, and install / HOLGURAS / FAIL outcome, plus rollback events — for cross-tool cut comparison and debugging. Works with everyelastic_mode. CLI shorthand:--fcut-log. SeeFcutLogWriterinfcut_log.hpp. - OptBool forward_fail_stop
- Scene-level fail-stop forward pass (default: false, see
PlanningOptionsLP::default_sddp_forward_fail_stop). - OptBool forward_infeas_rollback
- Per-scene rollback on forward-pass infeasibility (default: true, see
PlanningOptionsLP::default_sddp_forward_infeas_rollback). - OptInt forward_max_fallbacks
- Maximum algorithm fallback attempts for forward-pass solves.
- std::optional<ForwardSamplingMode> forward_sampling_mode
- Forward-pass sampling mode: persistent (default) or resampled.
- std::optional<SolverOptions> forward_solver_options
- Optional LP solver configuration for SDDP forward pass.
- OptBool free_solver_scratch
- std::optional<IntegerCutsMode> integer_cuts_mode
- Integer-cut mode for backward-pass cells whose LP carries integer columns: none (default, legacy) or strengthened (LP-relaxation cut + one-MIP Lagrangian intercept — Zou, Ahmed & Sun 2019; see
IntegerCutsModeinsddp_enums.hppanddocs/analysis/investigations/sddp/sddip_integer_expansion_2026-07.md). Requires a MIP-capable solver backend (implied: LP-only backends refuse integer columns at load). Pure-LP cells are unaffected. - std::optional<LowMemoryMode> low_memory_mode
- OptName lp_debug_passes
- Comma-separated list of SDDP passes whose LP-debug dump is active. Honoured only when
PlanningOptions::lp_debug=true(the umbrella toggle). Empty / unset defaults to"forward,aperture"(legacy behaviour); set to"forward,backward,aperture"(or simply"all") to add the backward-pass tgt LP dump used during the off↔compress symmetry investigation. - std::optional<Array<int>> markov_states
- Scene → Markov-state assignment for
cut_sharing_mode = markov: one integer per scene (in scene order), each in[0, M)whereMis the transition matrix dimension. Static per scene (v1). Validated at SDDP setup; seedocs/formulation/sddp-markov.md§1. - std::optional<Array<double>> markov_transition
- Row-major M×M row-stochastic Markov transition matrix for
cut_sharing_mode = markov(Minferred from the array length, which must be a perfect square). Rows must sum to ≈ 1 (tolerance 1e-6) with non-negative entries. Seedocs/formulation/sddp-markov.md§1. - OptInt max_async_spread
- Maximum iteration spread between fastest and slowest scene when cut_sharing is none and multiple scenes exist.
- OptInt max_cuts_per_phase
- Maximum retained cuts per (scene, phase) LP. 0 = unlimited (default).
- OptInt max_iterations
- Maximum number of forward/backward iterations (default: 100).
- OptInt max_stored_cuts
- Maximum total stored cuts per scene (0 = unlimited). Default: 0.
- std::optional<CompressionCodec> memory_codec
- OptInt min_iterations
- Minimum iterations before declaring convergence (default: 2).
- std::optional<MissingCutVarMode> missing_cut_var_mode
- How to handle cuts referencing state variables not in the model.
- OptInt multi_cut_threshold
- Forward-pass infeasibility count threshold for switching from single_cut to multi_cut. Default:
PlanningOptionsLP::default_sddp_multi_cut_threshold(seeplanning_options_lp.hpp).0 = always multi_cut;< 0 = disabled. - OptInt num_apertures
- First-N selector applied to each phase's
Phase::apertures. - OptReal pool_cpu_factor
- SDDP work pool CPU over-commit factor. Multiplied by hardware_concurrency to set max pool threads. Default 4.0 — extra threads keep CPUs busy while others block on the clone mutex.
- OptReal pool_max_process_swap_mb
- Work-pool cap on process swap usage (VmSwap) in MB. Task dispatch is throttled while the process VmSwap is at/above this value AND still growing by more than
pool_swap_growth_mbper 5 s window, i.e. only while the process is actively being swapped out. A large but static VmSwap (cold pages parked on swap) never throttles. Applies to every work pool of the run (LP build, SDDP, monolithic, output). 0 = gate off. Default 2048. - OptReal pool_memory_limit_mb
- Process memory limit in MB for the SDDP work pool. When non-zero, the pool blocks task dispatch if process RSS exceeds this value. Accepts values parsed by parse_memory_size (e.g. 5G). 0 = no limit (default).
- OptReal pool_swap_growth_mb
- VmSwap growth (MB per 5 s window) above which the process counts as actively swapping for
pool_max_process_swap_mb. 0 = any net growth counts. Default 64. - OptReal prune_dual_threshold
- Dual threshold for inactive cut detection. Default: 1e-8.
- std::optional<RecoveryMode> recovery_mode
- Recovery mode: none (0), cuts (1), or full (2). Controls what is recovered from a previous run:
- OptBool release_after_alpha
- OptBool release_backends
- OptBool save_aperture_lp
- Save LP files for infeasible apertures to the log directory.
- OptBool save_per_iteration
- Save cuts after each iteration (default: true). When false, cuts are only saved at the end of the solve or on stop.
- OptReal scale_alpha
- Scale divisor for future cost variable α (default: 0 = auto).
- OptName sentinel_file
- Path to a sentinel file; if it exists, the solver stops gracefully after the current iteration (analogous to PLP's userstop).
- OptBool simulation_mode
- OptBool single_cut_storage
- Use single cut storage: store in per-scene vectors only. Default: false.
- std::optional<StateVariableLookupMode> state_variable_lookup_mode
- How update_lp elements obtain reservoir/battery volume between phases.
- OptReal stationary_gap_ceiling
- Signed gap ceiling for the stationary convergence stop.
- OptReal stationary_tol
- Tolerance for stationary-gap convergence criterion.
- OptInt stationary_window
- Number of iterations to look back when checking for a stationary gap. Used by both the standalone stationary criterion and the statistical+stationary criterion. Default: 10.
- OptInt terminal_failure_threshold
- Consecutive structural failures before terminal-skip kicks in.
- OptInt update_lp_skip
- Iterations to skip between update_lp dispatches. 0 = update every iteration (default). Applies to all volume-dependent LP element updates (seepage, discharge limit, production factor).
Variable documentation
static std::size_t gtopt:: SddpOptions:: json_field_count
Number of JSON-facing fields in this struct. MUST be bumped when a field is added, together with the THREE position-synced lists in json_sddp_options.hpp (constructor parameters, json_member_list, to_json_data tuple), the merge() below, the PlanningOptionsLP accessor, the planning_method.cpp copy line, and SDDP_OPTION_KEYS in scripts/gtopt_shared/options_meta.py (a schema-parity pytest enforces the Python side; a static_assert in json_sddp_options.hpp enforces the tuple against this count).
OptReal gtopt:: SddpOptions:: alpha_min
Universal lower bound on the future-cost variable α [$].
Unset (default): α is floored only by the cut-derived projection (apply_alpha_floor), which can be very negative when cuts carry steep state slopes over wide state ranges (e.g. capacity-expansion capainst with large capmax). Set to 0 when every stage cost is non-negative — the cost-to-go can then never be negative, and the floor stops early iterations from exploiting linear cut extrapolation (over-building against a negative α). Not valid with negative-cost elements or boundary_cuts_mean_shift.
std::optional<ApertureChunkMode> gtopt:: SddpOptions:: aperture_chunk_mode
How backward-pass apertures are grouped into work-pool tasks (per_scene / per_aperture / chunked).
Each task clones the phase LP once and solves its apertures in series on that clone; under aperture_solve_mode = warm (the effective default) every aperture after the first re-optimizes the resident basis (a few dual-simplex pivots) instead of a cold solve.
per_scene(default): one task per (scene, phase) holding all of its apertures — maximum warm-start reuse, one clone per cell, backward parallelism capped at the number of scenes. On the CEN y24 case (16 scenes × 16 apertures, CPLEX) the backward pass runs 7.7× faster thanper_aperture(2.5 vs 19.3 min/iteration) with identical bounds and peak memory.per_aperture: one task per aperture on a fresh clone, cold solve (the pre-2026-11 effective default).chunked:aperture_chunk_size = Kapertures per task; K unset →compute_auto_aperture_chunk_sizeformula.
Pairs with the per-phase aperture wetness sort applied by plp2gtopt (consecutive apertures have similar bounds → cheap warm re-solves).
Default: nullopt → per_scene (unless the legacy integer aperture_chunk_size selects another mode, see below). Resolved at SDDPMethod setup by resolve_aperture_chunk() (sddp_aperture.hpp).
OptInt gtopt:: SddpOptions:: aperture_chunk_size
Apertures per task for aperture_chunk_mode = chunked (K).
Only meaningful with aperture_chunk_mode = chunked; with per_scene / per_aperture a contradicting value is ignored with a warning.
Deprecated as a mode selector. When aperture_chunk_mode is unset the legacy integer encoding still selects the mode (with a deprecation warning):
- absent /
0("auto") →per_scene(the default; silent). -1→per_scene.1→per_aperture.K > 1→chunkedwith K.
Default: nullopt.
OptBool gtopt:: SddpOptions:: aperture_cut_resolve
Re-solve the source phase LP after installing each aperture backward cut, as an optimality check (default: false).
The aperture path builds the expected cut on α_{t-1} from the aperture clones and installs it on LP_{t-1}. Nothing downstream reads LP_{t-1}'s post-cut solution: the next backward step clones LP_{t-1} and seeds its apertures from the forward basis, and the next forward pass re-solves it anyway. The re-solve only guards against a numerically broken cut (non-optimal → revert the row and install the forward-data bcut instead). It costs one extra LP solve per (scene, phase) per iteration — a sizeable share of the backward pass on large cases — and PLP has no equivalent step. Set true to restore the check.
OptName gtopt:: SddpOptions:: aperture_directory
Directory for aperture-specific scenario data.
When present, scenarios referenced by Aperture::source_scenario are first looked up in this directory. If not found there, they fall back to the regular input_directory. This allows backward-pass apertures to use different affluent data than the forward-pass scenarios.
OptInt gtopt:: SddpOptions:: aperture_screen_count
Number of dual-shared aperture cuts re-solved exactly under aperture_solve_mode = screened.
After the representative solve and the dual-shared synthesis pass, the screened mode picks the N synthesized cuts with the largest absolute intercept correction |Σ max(d,0)Δl + Σ min(d,0)Δu| — the apertures whose shared support is loosest — and re-solves them exactly (warm dual simplex on the resident basis), replacing their synthesized cuts with exact ones. Ignored by every other mode.
Default: nullopt → default_sddp_aperture_screen_count (2, sddp_enums.hpp).
OptBool gtopt:: SddpOptions:: aperture_seed_basis
Seed each iteration's first backward aperture from the previous iteration's first-aperture simplex basis (dual warm start).
Orthogonal to aperture_solve_mode; acts for every basis-capable (vertex) mode — all modes except reduced_cost, which has no basis to capture. One basis per (scene, phase) cell is kept across iterations (PhaseStateInfo) — O(cells) memory, not O(cells × apertures). Same realization each iteration (the first aperture), so the only delta is the incoming state (a bound pin) plus appended cut rows; the captured basis is an exact dual-simplex seed and the gap shrinks as the policy converges. The within-chunk resident basis carries the remaining apertures (per_scene / chunked).
Default: nullopt → false (every first aperture solves cold, the legacy behaviour).
OptName gtopt:: SddpOptions:: aperture_selection_mode
Selection rule used by num_apertures to pick a subset from each phase's Phase::apertures list.
"head"(default): take the first N entries = the N wettest apertures per phase. Best when the level wants to concentrate on the wet tail (e.g. cascade L0 uninodal)."stride"/"interleave"/"spread": take N entries evenly spaced across the full ordered list (indicesi × total / N). Samples the full wetness spectrum — first pick is still wettest, last pick is near driest. Best for representative coverage."tail"/"last": take the last N entries = the N driest apertures per phase (mirror ofhead). Useful for value-function exploration of dry-tail scenarios.
Has no effect when num_apertures is absent or ≥ len(Phase::apertures). Each cascade level can override via its own sddp_options.
std::optional<ApertureSolveMode> gtopt:: SddpOptions:: aperture_solve_mode
How each backward-pass aperture is solved and how its cut's coefficients are recovered (cold / warm / reduced_cost / dual_shared / screened).
See ApertureSolveMode for the full per-mode rationale. Summary:
cold: independent cold barrier + crossover per aperture; cut coefficients are the exact vertex reduced costs. Byte-for-byte the legacy behaviour.warm(effective default — an unset option resolves towarminPlanningOptionsLP::sddp_aperture_solve_mode(), and plp2gtopt emits it explicitly): engages whenever a task holds more than one aperture (aperture_chunk_mode = per_scene, the default, orchunkedwith K > 1); the first aperture in a chunk seeds a basis (barrier + crossover) and every subsequent aperture re-optimizes it with a warm simplex solve (viaSolverOptions::advanced_basis→ CPLEXADVIND=1) instead of a fresh cold barrier. Aperture deltas (column bounds; equality-row RHS under AR inflows / profile elements) preserve dual feasibility, so the basis stays valid across apertures.reduced_cost: cold barrier WITHOUT crossover per aperture; the cut coefficients come straight from the interior-point reduced costs, filtered bycut_coeff_eps. Skips crossover on big LPs (~35% faster per aperture thancold).dual_shared(opt-in): solve only the highest-weight representative aperture; synthesize every other aperture's cut from the representative's vertex duals via the Infanger–Morton bound-delta correction (Lemma AP2,docs/formulation/sddp-cut-validity.md§6). Skips all non-representative re-solves — the remaining lever on backends without any warm-start path (e.g. cuOpt/PDLP; ledger F10).screened(opt-in):dual_shared, then theaperture_screen_countsynthesized cuts with the largest |intercept correction| are re-solved exactly on the resident basis.
Absent / nullopt resolves to warm.
OptName gtopt:: SddpOptions:: aperture_system_file
Global default aperture system for the SDDP backward pass.
Path to a Planning JSON whose .system (and its .options.model_options) replaces the regular forward system when solving apertures in the backward pass. This is the global tier of the resolution chain: Phase::aperture_system_file → CascadeLevel::aperture_system_file → this field → regular system.
The parent simulation is reused unchanged; the reduced system must keep the same reservoir/storage/α inter-phase state elements (matched by uid). Lets the backward pass solve a cheaper, simplified model (aggregated thermals, single-bus, no Kirchhoff) while the forward pass keeps full detail — the per-aperture cuts are averaged anyway, so the forward detail is largely lost after averaging.
OptReal gtopt:: SddpOptions:: aperture_timeout
Timeout in seconds for individual aperture LP solves in the SDDP backward pass.
When an aperture LP exceeds this time, it is treated as infeasible (skipped), a WARNING is logged, and the solver continues with the remaining apertures. Default 30 seconds. 0 = no timeout.
OptBool gtopt:: SddpOptions:: aperture_use_manual_clone
Use the manual (load_flat) clone route for aperture clones instead of the backend's native clone() (CPXcloneprob).
When true, solve_apertures_for_phase builds each aperture clone by replaying the source phase LP's stored FlatLinearProblem snapshot through load_flat() on a fresh LinearInterface. The manual route uses only env-local solver calls and does NOT acquire s_global_clone_mutex, so 80 aperture clones can be built simultaneously instead of one-at-a-time under the lock.
When false (default), the legacy native route is used — phase_li.clone(CloneKind::shallow) calls the backend's clone() (e.g. CPXcloneprob) under s_global_clone_mutex. That path is structurally serialised because the previous unguarded design crashed three CPLEX threads at the same instruction pointer (commit 1d7a05c1).
Pre-condition for true: the source phase LP must hold an uncompressed FlatLinearProblem snapshot — i.e. low_memory_mode = compress (or snapshot). The aperture pass already decompresses the source via DecompressionGuard (sddp_aperture_pass.cpp:390, 579), so this is satisfied for typical SDDP runs. When the pre-condition is not met, the call site falls back to the native route with a one-time WARN log.
Default: true (PlanningOptionsLP::sddp_aperture_use_manual_clone).
OptInt gtopt:: SddpOptions:: backward_max_fallbacks
Maximum algorithm fallback attempts for backward-pass and aperture solves.
Controls how many alternative algorithms the solver tries when a backward-pass or aperture LP returns non-optimal. Default: 0 (no fallback — fail immediately).
OptBool gtopt:: SddpOptions:: backward_resolve_target
Re-solve target phase t LP before extracting cut data (default: true).
When true (default), the backward pass at phase t re-solves LP_t at the forward-pass trial state v̂_{t-1} before building the cut for α_{t-1}. Cuts on α_t added earlier in the same backward pass — when this loop processed phase t+1 — are now reflected in z_t and the reduced costs, producing a textbook one-iter-tight Benders cut on α_{t-1}. The aperture-success path picks up the same in-pass cuts automatically because each aperture clone is forked from LP_t (with cut replay under both native CPXcloneprob and manual clone_from_flat routes).
When false, cuts use the forward-pass cached forward_full_obj_physical and StateVariable-mirrored reduced costs. Cheaper per iteration, but a fresh cut at phase T takes ≈ T iterations to fully ripple to phase 1.
Cost: one extra LP resolve per (scene, phase) per backward pass. On the large hydrothermal case scale (50 phases × 7 scenes ≈ 350 extra resolves per iter, ≈75 ms each) this is +26 s per iter — typically recovered by needing 5-10× fewer iterations to converge.
std::optional<SolverOptions> gtopt:: SddpOptions:: backward_solver_options
Optional LP solver configuration for SDDP backward pass.
When set, these options are merged with the global PlanningOptions::solver_options. Backward-pass-specific options take precedence over the global ones.
Typical use: use dual simplex for the backward pass.
std::optional<BasisCrossMode> gtopt:: SddpOptions:: basis_cross_mode
Cross-pass simplex-basis warm-start reuse between the forward and backward SDDP passes.
Generalizes aperture_seed_basis: in addition to the within-backward resident-basis chain, the forward-pass solve's basis can seed the backward dual/aperture solve of the same (scene, phase) and vice versa (a bidirectional cross cache in PhaseStateInfo). A cross basis is only a warm start — it cannot change the optimum or corrupt a cut — so every mode is correctness-neutral; it silently degrades to a cold solve on backends without basis save/restore (only CPLEX and HiGHS support it) and is gated off where the row structure is not tail-append compatible (e.g. aperture_system_file).
See BasisCrossMode. Default: nullopt → off (legacy behaviour).
std::optional<BoundaryCutSharingMode> gtopt:: SddpOptions:: boundary_cut_sharing_mode
How terminal/boundary cuts are shared across scenes on the terminal α — the terminal-phase analogue of cut_sharing_mode.
- per_scene (default): each scene's terminal α bounded only by its own scenario's boundary cuts (valid; pairs with cut_sharing none/multicut).
- shared: broadcast each boundary cut onto every scene's single terminal α (valid only when the post-horizon value is scenario-identical).
- multicut: N terminal α columns, cut s → varphi_s, priced at the M4 weight w_r = p_s (= 1/N under uniform probabilities; pairs with cut_sharing_mode=multicut). When unset, derived from the legacy
boundary_cuts_modescope: separated→per_scene, combined→shared; else per_scene. DEPRECATED alias ofFutureCost::sharing(honoured only for method = sddp / cascade); folded into the FutureCost element byresolve_future_cost_aliasesand then cleared.
OptName gtopt:: SddpOptions:: boundary_cuts_file
CSV file with boundary (future-cost) cuts for the last phase.
These are analogous to PLP's "planos de embalse" — external optimality cuts that approximate the expected future cost beyond the planning horizon. Each cut is of the form:
α ≥ rhs + Σ_i coeff_i · state_var_i
The CSV header row names the state variables (reservoir / battery); subsequent rows provide the cut name, iteration, scene UID, RHS, and gradient coefficients.
Format:
name,iteration,scene,rhs,Reservoir1,Reservoir2,... cut_001,1,1,-5000.0,0.25,0.75,...
The scene column contains the scene UID (matching the uid field in gtopt's scene_array). The solver maps column headers to the LP state-variable columns in the last phase and adds each cut as a lower-bound constraint on the future cost variable α. If empty, no boundary cuts are loaded. DEPRECATED alias of FutureCost::cuts_file (honoured only for method = sddp / cascade); folded into the FutureCost element by resolve_future_cost_aliases and then cleared.
OptBool gtopt:: SddpOptions:: boundary_cuts_mean_shift
Apply an α-rebase (mean-shift) to boundary cuts on load.
When enabled, for each scene the per-cut RHS is shifted so the scene's cut intercepts sum to zero, and the offset is carried via LinearInterface::add_obj_constant so get_obj_value() remains algebraically identical to the unshifted formulation.
The rewrite is mathematically exact: α' = α − c̄ where c̄ is the per-scene mean of installed cut RHSs (post-bc_discount). Cuts on disk round-trip cleanly (the shift is recomputed each load) and all get_obj_value() readers (SDDP bounds, cut intercepts, forward-pass costs) see the same physical value whether the shift is on or off.
Default: false — pre-existing tests assert against the on-disk RHS magnitudes, so the shift is opt-in for measurement / conditioning experiments. Enable to centre boundary cut RHSs around 0 (helps LP equilibration on cases where boundary cut intercepts dominate runtime cut intercepts by orders of magnitude). DEPRECATED alias of FutureCost::mean_shift (honoured only for method = sddp / cascade); folded into the FutureCost element by resolve_future_cost_aliases and then cleared.
std::optional<BoundaryCutsMode> gtopt:: SddpOptions:: boundary_cuts_mode
How boundary cuts are loaded: noload, separated (default), or combined.
- noload — do not load boundary cuts even if a file is given.
- separated — load cuts per scene (scene UID matching; default).
- combined — load all cuts into all scenes (broadcast). DEPRECATED alias of
FutureCost::mode(honoured only for method = sddp / cascade); folded into the FutureCost element byresolve_future_cost_aliasesand then cleared.
OptInt gtopt:: SddpOptions:: boundary_max_iterations
Maximum number of SDDP iterations to load from the boundary cuts file. Only cuts from the last N iterations (by iteration column, i.e. PLP's IPDNumIte) are loaded. 0 = load all (default).
DEPRECATED alias of FutureCost::iteration_limit (honoured only for method = sddp / cascade); folded into the FutureCost element by resolve_future_cost_aliases and then cleared.
OptReal gtopt:: SddpOptions:: convergence_confidence
Confidence level for statistical convergence criterion (0-1).
When > 0 and multiple scenes exist, convergence is checked via PLP-style confidence interval: UB - LB <= z_{α/2} * σ. Combined with stationary_tol, also handles the non-zero-gap case where the gap stabilises above the CI threshold.
Default: 0.95 (95% CI). Set to 0.0 to disable.
std::optional<ConvergenceMode> gtopt:: SddpOptions:: convergence_mode
Convergence criterion mode selection.
gap_only: deterministic gap test only.gap_stationary: gap + stationary gap detection.statistical: gap + stationary + CI (default, PLP-style).
The statistical mode degrades gracefully to gap_stationary when only one scene is present (no apertures / pure Benders).
OptReal gtopt:: SddpOptions:: cut_coeff_eps
Absolute tolerance for filtering numerically tiny Benders cut coefficients.
When constructing an optimality cut, any state-variable coefficient (reduced cost or row dual) whose absolute value is below this threshold is dropped — both the coefficient and its corresponding RHS adjustment are skipped. This removes solver numerical noise that would otherwise produce ill-conditioned cuts.
Inspired by PLP's OptiEPS mechanism (default 1e-8 there).
Default: 0.0 (no filtering — all coefficients are kept). Typical useful values: 1e-12 to 1e-8.
std::optional<CutDrainMode> gtopt:: SddpOptions:: cut_drain_mode
How to drain in-flight cuts after the aggregate-convergence stop signal fires in SDDPMethod::solve_async.
See CutDrainMode for the full rationale. Summary:
count— per-scene count snapshot; legacy asymmetric.iteration— filter bycut.iteration_index <= certified; symmetric, deterministic. Default.all— keep every cut; maximises retention, gives up run-to-run determinism.
OptBool gtopt:: SddpOptions:: forward_fail_stop
Scene-level fail-stop forward pass (default: false, see PlanningOptionsLP::default_sddp_forward_fail_stop).
When true (opt-in), an infeasible phase that produces a feasibility cut on its predecessor causes the scene's forward pass to stop immediately for the current iteration: the cut is installed on phase p-1, the scene is marked failed-this-iter, and control returns to the caller. The next iteration starts fresh from p1 with the newly accumulated cuts (preserved in the global cut store).
When false (default), the PLP-style backtracking forward pass runs: after installing the fcut on p-1, phase_idx is decremented and p-1 is re-solved under the new cut. If p-1 is still infeasible, a fresh fcut is installed on p-2 and the cascade continues — bounded by forward_max_attempts. Kept available for regression tests and academic fixtures that depend on the cascade dynamics.
OptBool gtopt:: SddpOptions:: forward_infeas_rollback
Per-scene rollback on forward-pass infeasibility (default: true, see PlanningOptionsLP::default_sddp_forward_infeas_rollback).
When true, a scene declared infeasible in the forward pass has every cut it has accumulated in the global cut store deleted from its LP cells and from m_cut_store_.scene_cuts()[scene] — both forward-pass feasibility cuts and earlier backward-pass optimality cuts go. The bad trajectory that produced any of them is no longer trusted, and the scene starts fresh next iteration with whatever cuts arrive from peers via cut sharing or their own backward-pass.
Stall guard: at iteration k+1's forward dispatch, a scene that failed at iteration k retries iff the global stored-cut count has grown since the failure. If every previously-failed scene is "stalled" (no new cuts arrived), the run aborts with a SolverError/no recovery path error to avoid an infinite loop on degenerate single-scene runs or all-scenes-failed iterations.
When false (opt-out): cuts persist across iterations even when the scene that produced them was declared infeasible — the legacy behaviour.
OptInt gtopt:: SddpOptions:: forward_max_fallbacks
Maximum algorithm fallback attempts for forward-pass solves.
Controls how many alternative algorithms the solver tries when a forward-pass LP returns non-optimal. Default: 2 (full cycle).
std::optional<ForwardSamplingMode> gtopt:: SddpOptions:: forward_sampling_mode
Forward-pass sampling mode: persistent (default) or resampled.
persistent keeps each scene-driver on its own scenario path (historical, byte-identical). resampled re-draws a probability-weighted scene realization at every phase boundary (deterministic in (iteration, scene, phase)) and applies it via the per-element update_aperture machinery (column-bound pins; the AR equality-row RHS under Flow.inflow_model), so the forward UB estimates the same stagewise-resampled process the cut_sharing_mode = multicut LB certifies. See ForwardSamplingMode in sddp_enums.hpp.
std::optional<SolverOptions> gtopt:: SddpOptions:: forward_solver_options
Optional LP solver configuration for SDDP forward pass.
When set, these options are merged with the global PlanningOptions::solver_options. Forward-pass-specific options take precedence over the global ones.
Typical use: use barrier for the forward pass (fresh solves) while using dual simplex for the backward pass (warm-started resolves).
OptBool gtopt:: SddpOptions:: free_solver_scratch
Free the CPLEX / Gurobi / MindOpt copy-out getter scratch after each solve under low_memory = off (false: keep it, the previous behaviour). Default: true.
std::optional<LowMemoryMode> gtopt:: SddpOptions:: low_memory_mode
Low memory mode: off or compress (default for SDDP/cascade). compress releases the solver backend after each per-(scene, phase) solve and keeps only the flat LP snapshot (optionally compressed via memory_codec), trading CPU time (reconstruction + decompression on the next touch) for significant memory savings on large problems.
(The former rebuild mode was removed 2026-05-13; the JSON aliases "rebuild" and "snapshot" now both parse to compress.)
When unset, PlanningOptionsLP::sddp_low_memory() resolves to compress for SDDP/cascade methods (the historical default was off). Pass --memory-saving off to restore the eager-resident behaviour.
OptName gtopt:: SddpOptions:: lp_debug_passes
Comma-separated list of SDDP passes whose LP-debug dump is active. Honoured only when PlanningOptions::lp_debug=true (the umbrella toggle). Empty / unset defaults to "forward,aperture" (legacy behaviour); set to "forward,backward,aperture" (or simply "all") to add the backward-pass tgt LP dump used during the off↔compress symmetry investigation.
Each pass writes via the shared LpDebugWriter to log_directory and respects the lp_debug_scene_min/max + lp_debug_phase_min/max filter window. Filenames follow sddp_file::debug_lp_fmt (forward), debug_backward_lp_fmt (backward), and debug_aperture_lp_fmt (aperture).
Recognised tokens (case-insensitive, comma-separated): forward, backward, aperture, all. Unknown tokens emit a one-time warning and are skipped.
Replaces the old --lp-dump-backward <dir> CLI flag and GTOPT_DUMP_BACKWARD_LP=<dir> env var (both still honoured as translation shims that set lp_debug=true, lp_debug_passes=backward, and log_directory=<dir>).
OptInt gtopt:: SddpOptions:: max_async_spread
Maximum iteration spread between fastest and slowest scene when cut_sharing is none and multiple scenes exist.
When > 0, the solver runs scenes asynchronously: each scene progresses through its own forward/backward iteration loop. The pool's SDDPTaskKey priority naturally schedules slower scenes first (lower iteration -> higher priority), self-regulating the spread.
0 = synchronous (current behavior, default).
std::optional<CompressionCodec> gtopt:: SddpOptions:: memory_codec
In-memory compression codec for low_memory level 2. Selects the algorithm used to compress the saved FlatLinearProblem. Default: auto (resolves to zstd level 1; set lz4 for the fastest decompress at a ~30% larger snapshot). Accepted values: "auto", "none", "lz4", "snappy", "zstd", "gzip".
std::optional<MissingCutVarMode> gtopt:: SddpOptions:: missing_cut_var_mode
How to handle cuts referencing state variables not in the model.
skip_coeff(default): drop the missing coefficient, load the cut.skip_cut: skip the entire cut if any missing variable has a non-zero coefficient. DEPRECATED alias ofFutureCost::missing_cut_var_mode(honoured only for method = sddp / cascade); folded into the FutureCost element byresolve_future_cost_aliasesand then cleared.
OptInt gtopt:: SddpOptions:: multi_cut_threshold
Forward-pass infeasibility count threshold for switching from single_cut to multi_cut. Default: PlanningOptionsLP::default_sddp_multi_cut_threshold (see planning_options_lp.hpp). 0 = always multi_cut; < 0 = disabled.
The counter is persistent: it accumulates across iterations and is not reset when a (scene, phase) solves feasibly. Switch fires when infeas_count >= threshold.
OptInt gtopt:: SddpOptions:: num_apertures
First-N selector applied to each phase's Phase::apertures.
- absent (nullopt) – no truncation; use the full per-phase list
0– no apertures (pure Benders, same asapertures=[])N > 0– takePhase::apertures.first(N)per phase
Designed to pair with the wettest-first sort applied to Phase::apertures by plp2gtopt: num_apertures = N picks the N wettest apertures per phase, without the writer having to materialise an explicit cross-phase UID whitelist.
Interaction with apertures: the two compose. apertures is the global UID whitelist for aperture_array lookup; truncation by num_apertures happens on Phase::apertures first, then each surviving UID is resolved against the (possibly whitelisted) aperture pool by build_effective_apertures. A UID truncated away by num_apertures is dropped before the whitelist check; a UID present after truncation but absent from the whitelist is dropped at lookup time.
Cascade levels: each CascadeLevelMethod can override num_apertures via the existing merge_opt path — e.g. L0 (uninodal) sets num_apertures = 4, L1 (transport) sets num_apertures = 8, L2 (full) leaves it absent (= all apertures per phase). No apertures whitelist is needed at any level.
std::optional<RecoveryMode> gtopt:: SddpOptions:: recovery_mode
Recovery mode: none (0), cuts (1), or full (2). Controls what is recovered from a previous run:
- none: no recovery (cold start).
- cuts: recover only Benders cuts.
- full: recover cuts + state variable solutions (default).
OptBool gtopt:: SddpOptions:: release_after_alpha
Release each low-memory backend right after alpha registration (false: keep it live until the post-initialisation sweep, the previous behaviour). Default: true.
OptBool gtopt:: SddpOptions:: release_backends
Under low_memory_mode = off, release each solver backend after its solve and rebuild it from an uncompressed flat-LP snapshot on the next visit, warm-starting from the saved basis (false: keep every LP live for the whole run, the previous default). Under compress backends are always released. Default: true.
OptBool gtopt:: SddpOptions:: save_aperture_lp
Save LP files for infeasible apertures to the log directory.
When true, each infeasible aperture clone is written as error_aperture_sc_<scene>_ph_<phase>_ap_<uid>.lp in the log directory. Useful for debugging but expensive in large cases. Default: false (disabled).
OptReal gtopt:: SddpOptions:: scale_alpha
Scale divisor for future cost variable α (default: 0 = auto).
The LP alpha variable is α_lp = α / scale_alpha, with an objective coefficient of scale_alpha so that the physical contribution is preserved. When 0 (default), auto-computed as max(var_scale) across all state variables — keeps α O(1) relative to the largest state variable in LP units.
OptBool gtopt:: SddpOptions:: simulation_mode
Run in simulation mode: no training iterations (max_iterations=0), forward-only evaluation of the policy from loaded cuts. No cuts are saved. Default: false.
std::optional<StateVariableLookupMode> gtopt:: SddpOptions:: state_variable_lookup_mode
How update_lp elements obtain reservoir/battery volume between phases.
Controls the fallback in StorageLP::physical_eini for nonlinear LP coefficient updates (seepage, production factor, discharge limit). Does NOT affect SDDP state-variable chaining or cut generation.
warm_start(default): volume from warm-start solution, recovered state file, or vini. No cross-phase lookup.cross_phase: volume from the previous phase's efin within the same forward pass.
OptReal gtopt:: SddpOptions:: stationary_gap_ceiling
Signed gap ceiling for the stationary convergence stop.
A ΔUB-stationary (or statistical + stationary) stop is accepted only while the signed relative gap is below this ceiling; a negative gap (cut overshoot) always passes. Above it the run keeps iterating up to max_iterations. The stationary stop also needs stationary_window iterations of the level's OWN with cuts (bounds seeded from a previous cascade level do not count).
Default: 0.02 (2 %). Set to 1.0 to disable the ceiling.
OptReal gtopt:: SddpOptions:: stationary_tol
Tolerance for stationary-gap convergence criterion.
When the relative change in the convergence gap over the last stationary_window iterations falls below this value, the gap is considered stationary (no longer improving). This triggers convergence in two situations:
- Standalone: gap is stationary → declare convergence even if gap > convergence_tol (non-zero gap accepted).
- Combined with convergence_confidence: when the CI test fails (gap > z*σ) but the gap is stationary → declare convergence (the non-zero gap has stabilised and further iterations won't help).
Formula (after min_iterations and stationary_window completed): gap_change = |gap[i] − gap[i − window]| / max(1e-10, gap[i − window]) if gap_change < stationary_tol → gap is stationary
Default: 0.01 (1%). Set to 0.0 to disable.
OptInt gtopt:: SddpOptions:: terminal_failure_threshold
Consecutive structural failures before terminal-skip kicks in.
After this many iterations of "elastic filter produced no feasibility cut" failures at the same scene, mark it terminal: skip its forward pass each iter until new cuts arrive globally. Default: 2. Set to 0 to disable.