AR(1) Inflow Model
Conditional inflow sampling for the SDDP backward pass, based on Kompendium 2 §5.4.7.
Problem
Standard SDDP samples inflow scenarios uniformly in the backward pass. This ignores week-to-week autocorrelation: in reality, wet weeks tend to follow wet weeks and dry weeks follow dry weeks. This persistence affects optimal storage decisions — a producer in a dry period should conserve more aggressively.
Discrete Markov Model
The inflow model discretises total system inflow into n_states levels (default 3: dry, medium, wet) using quantile boundaries from all historical data.
Transition matrix (estimated from consecutive weeks across all scenarios):
Dokka, 3 states:
dry → [0.85, 0.13, 0.02] 85% persistence in dry conditions
mid → [0.16, 0.63, 0.21] 63% persistence in medium
wet → [0.00, 0.23, 0.77] 77% persistence in wet conditionsConditional Backward Sampling
In the backward pass at stage t, instead of sampling uniformly:
- Classify the forward-pass inflow at stage t into a state (dry/medium/wet)
- Sample a scenario index from the pool of scenarios that were in the same state at stage t
- Use that scenario's inflow for the backward LP solve
This ensures that backward cuts are generated with inflows that are consistent with the current hydrological conditions, rather than averaging over all possible conditions.
Simplification
The inflow state is not added as a dimension in the cut library. Cuts remain indexed by (stage, price_state) only. The AR(1) model only affects which scenarios are sampled in the backward pass.
A full state-variable approach would index cuts by (stage, price_state, inflow_state), multiplying the cut library size by n_inflow_states. This is left for future work if the simplified approach proves insufficient.
Usage
julia --project=HydroRunner HydroRunner/bin/run_case.jl cases/dokka --inflow-ar1# Fit model from scenarios
model = fit_inflow_model(inflow_scenarios, 3; n_stages=52)
# Classify a scenario/stage
state = classify_inflow(model, inflow_scenarios, scen_idx, stage)
# Sample conditionally
new_scen_idx = sample_conditional_scenario(model, stage, state, rng)
# Pass to SDDP
result = solve_sddp(...; inflow_model=model)