Toy Four-Reservoir SDDP Walkthrough
Purpose
Section titled “Purpose”This chapter extends the single-reservoir walkthrough in Toy Single-Reservoir Walkthrough to a four-reservoir, four-bus system, still using a 0-order (seasonal-sampling) inflow model. The chapter demonstrates two phenomena that the single-reservoir case cannot exhibit:
- Multi-dimensional cuts. The cut becomes a hyperplane with one storage coefficient per reservoir; the optimiser must balance releases across plants by reading the per-storage reduced cost of each pinned incoming-storage column.
- Per-bus dispatch with independent supply. Each bus carries its own demand and is served by its local hydro and a local thermal; the LP solves the regional dispatches simultaneously inside one stage problem.
Cobre ships an actual reference case at examples/4ree/ modelling the
four-region Brazilian interconnected system (SUDESTE, SUL, NORDESTE,
NORTE) with 24 monthly stages, 126 thermals, and two transmission
lines (SUDESTE–SUL and SUDESTE–NORDESTE). The shipped case has no
inter-reservoir cascade coupling (each region’s reservoir is
independent), no spatial inflow correlation, and uses a constant
hydro productivity model. This walkthrough preserves those
properties but replaces the production-scale numbers with
hand-traceable values: 4 stages, 3 openings, one thermal per bus, no
transmission. This walkthrough is a pedagogical caricature, not a
reproduction of the shipped case.
The chapter does not cover transmission, cascade coupling, the FPHA production model, an infinite-horizon cyclic policy, multi-resolution coupling, or risk measures. Those topics are addressed in the chapters cited in section 8.
1. The Case in One Picture
Section titled “1. The Case in One Picture”The system has four buses, each with one local hydro (productivity 1.0), one local thermal, and one local demand block. The four reservoirs are independent — no cascade coupling. There is no transmission between buses in this walkthrough; each bus self-balances dispatch from its local resources.
graph LR
A1["Inflow a₁<br/>(0-order)"] --> H1["H1<br/>cap 100"]
A2["Inflow a₂<br/>(0-order)"] --> H2["H2<br/>cap 100"]
A3["Inflow a₃<br/>(0-order)"] --> H3["H3<br/>cap 80"]
A4["Inflow a₄<br/>(0-order)"] --> H4["H4<br/>cap 80"]
H1 --> B1["Bus 1<br/>D = 25"]
H2 --> B2["Bus 2<br/>D = 20"]
H3 --> B3["Bus 3<br/>D = 15"]
H4 --> B4["Bus 4<br/>D = 12"]
T1["Thermal₁<br/>cost 50"] --> B1
T2["Thermal₂<br/>cost 50"] --> B2
T3["Thermal₃<br/>cost 50"] --> B3
T4["Thermal₄<br/>cost 50"] --> B4
Per-hydro parameters:
| Hydro | Bus | Productivity | ||||
|---|---|---|---|---|---|---|
| H1 | B1 | 100 | 30 | 15 | 5 | 1.0 |
| H2 | B2 | 100 | 30 | 12 | 4 | 1.0 |
| H3 | B3 | 80 | 20 | 10 | 3 | 1.0 |
| H4 | B4 | 80 | 20 | 8 | 3 | 1.0 |
Per-bus demand:
| Bus | |
|---|---|
| B1 | 25 |
| B2 | 20 |
| B3 | 15 |
| B4 | 12 |
System-level parameters:
| Parameter | Symbol | Value |
|---|---|---|
| Stages | 4 | |
| Openings per stage | 3 | |
| Thermal marginal cost | 50 $/MWh | |
| Deficit cost | 1000 $/MWh | |
| Discount factor | 1.0 |
Each bus’s demand exceeds its local hydro mean inflow (, , , ), so reservoirs deplete over the four-stage horizon and thermal generation appears in later stages.
2. Stage LP for This Case
Section titled “2. Stage LP for This Case”The stage- LP is assembled from the general formulation in LP Formulation, specialised to four hydros, four buses with one local thermal each, four storage state variables, and 0-order inflow (no AR-lag state).
Objective (minimise current-stage cost plus future cost):
Per-bus load balance (each bus self-balances, no transmission):
where is the local hydro generation at bus .
Hydro generation (constant productivity at all four plants):
Water balances (each reservoir is independent — no cascade):
(For this walkthrough : one m³/s of turbining per stage withdraws one hm³.)
Incoming-storage pinning (the reduced cost of each pinned column becomes the cut coefficient):
Bounds: ; ; .
Future cost variable : as in the single-reservoir case, the terminal stage carries no cuts; cuts of the form are added by the backward pass to earlier stages’ LPs. With four reservoirs the cut is now a 4-coefficient hyperplane in storage state space, with each reflecting that storage at hydro reduces future cost.
Note again the absence of any AR-lag state: 0-order inflow has no memory, so storage is the entire state vector.
3. The 0-Order Inflow Model with Four Hydros
Section titled “3. The 0-Order Inflow Model with Four Hydros”Each hydro samples its own inflow independently from a normal distribution with hydro-specific seasonal mean and standard deviation:
with hydro-specific from the parameter table in
section 1. The innovations are independent across hydros — there
is no correlation.json file in the actual examples/4ree/ case, and
this walkthrough preserves that property.
If a correlation.json file were supplied, the spatial structure
between innovations would be applied via the spectral
factorisation with — see
PAR Inflow Model section 8 for the
multivariate case. For this walkthrough the four innovations are
drawn independently.
The three openings used in the backward pass correspond to a single shared applied uniformly to all four hydros (a simplifying choice — in the production code each hydro draws its own and the joint distribution lives over a larger sample-tree). Each opening has equal probability .
4. Iteration 1 — Forward Pass
Section titled “4. Iteration 1 — Forward Pass”The forward pass samples one trajectory using for every stage, so each hydro receives its mean inflow at every stage. With free at zero (no cuts in iteration 1), the LP minimises the per-bus thermal and deficit costs at each stage.
Because at the initial state every bus has enough hydro plus storage to meet demand from hydro alone, stages 1–3 carry zero cost. Stage 4 runs water-short on three of the four buses.
Stage 1 — incoming storage , inflows . At every bus, (demand met from hydro); end-of-stage storage:
Stage cost: (no thermal, no deficit).
Stage 2 — . Same pattern: each bus meets demand from hydro; storage decreases by :
Stage cost: .
Stage 3 — . Bus 1 reaches a knife edge: water available ; the LP turbines all available water and ends with . Other buses still have surplus.
Stage cost: .
Stage 4 — , inflows . Now three buses go water-short:
| Bus | Avail. | ||||||
|---|---|---|---|---|---|---|---|
| B1 | 0 | 15 | 15 | 25 | 15 | 10 | 0 |
| B2 | 6 | 12 | 18 | 20 | 18 | 2 | 0 |
| B3 | 5 | 10 | 15 | 15 | 15 | 0 | 0 |
| B4 | 8 | 8 | 16 | 12 | 12 | 0 | 0 |
Stage 4 cost: .
Trajectory upper-bound estimate: .
5. Iteration 1 — Backward Pass
Section titled “5. Iteration 1 — Backward Pass”The backward pass walks stages . At each stage it pins the incoming storage to the trial point from the forward pass, evaluates all three openings, reads the four pinned-column reduced costs, and aggregates into a 4-coefficient cut. The mechanics follow Cut Management sections 2–3, generalised from one storage coefficient (single-reservoir case) to four (this case).
Stage 4 (terminal)
Section titled “Stage 4 (terminal)”Trial point: . Inflows under the three shared openings (all four hydros move together with ):
| Opening | |||||
|---|---|---|---|---|---|
| 10 | 8 | 7 | 5 | ||
| 15 | 12 | 10 | 8 | ||
| 20 | 16 | 13 | 11 |
For each opening, each bus solves its local dispatch independently (no transmission, no at the terminal stage):
(dry):
| Bus | Avail. | Stage cost | ||||
|---|---|---|---|---|---|---|
| B1 | 10 | 25 | 10 | 15 | 750 | |
| B2 | 14 | 20 | 14 | 6 | 300 | |
| B3 | 12 | 15 | 12 | 3 | 150 | |
| B4 | 13 | 12 | 12 | 0 | 0 |
.
The storage cut coefficient at each bus — the reduced cost of the pinned incoming-storage column — follows the single-reservoir logic: water-limited buses with thermal active have ; buses where demand is met by hydro alone have .
(mean):
| Bus | Avail. | Stage cost | ||||
|---|---|---|---|---|---|---|
| B1 | 15 | 25 | 15 | 10 | 500 | |
| B2 | 18 | 20 | 18 | 2 | 100 | |
| B3 | 15 | 15 | 15 | 0 | 0 | |
| B4 | 16 | 12 | 12 | 0 | 0 |
. B3 is at a knife edge ( avail.); the walkthrough takes the basis returning (extra storage flows to terminal which has zero value).
(wet):
| Bus | Avail. | Stage cost | ||||
|---|---|---|---|---|---|---|
| B1 | 20 | 25 | 20 | 5 | 250 | |
| B2 | 22 | 20 | 20 | 0 | 0 | |
| B3 | 18 | 15 | 15 | 0 | 0 | |
| B4 | 19 | 12 | 12 | 0 | 0 |
.
Per-opening intercepts :
| Opening | |||
|---|---|---|---|
(The signs flip because and the formula subtracts a negative-times-positive product.)
Aggregation ():
| Hydro | |
|---|---|
| H1 | |
| H2 | |
| H3 | |
| H4 |
Cut added to stage 3’s LP:
Sanity check. At , the cut evaluates to
The probability-weighted expected stage-4 cost at the trial is . The cut is tight at the trial point, as required for cut validity. ✓
The four storage coefficients rank by how much each reservoir reduces expected future cost. H1 is the most valuable: thermal at B1 was active in all three openings, so an extra unit at H1 saves in every scenario and the average is . H4 has zero coefficient: B4 was thermal-free in every opening, so storage at H4 has no marginal value at this trial point.
Stages 3, 2 and 1
Section titled “Stages 3, 2 and 1”The same procedure repeats at the earlier stages, with the cut from the next stage active in the LP. At each stage:
- Pin the incoming storage vector (column bounds).
- Solve all three opening LPs with the next-stage cut active.
- Read four pinned-column reduced costs per opening (one per reservoir).
- Compute per-opening intercepts via .
- Aggregate by probability-weighted averaging into one 5-coefficient cut (intercept plus four storage slopes).
- Add the cut to the previous stage’s LP.
By the end of the backward pass, stages 1 through 3 each carry one cut; stage 4 has none.
6. The Cut as a 4-D Hyperplane
Section titled “6. The Cut as a 4-D Hyperplane”The fundamental change from the single-reservoir case is the dimensionality of the cut. Each cut is now a hyperplane in 4-dimensional storage state space:
Several practical consequences follow:
Per-reservoir marginal water value. The four slopes at the iteration-1 stage-3 cut — , , , — encode where storage matters most at the visited trial point. The optimiser at stage 3 sees these slopes and preferentially holds water at H1 (highest marginal value) and releases water at H4 (zero marginal value) when both choices are available.
Cut tightness is local, not global. The cut is a tangent hyperplane at the trial point only; far from the trial point the hyperplane is a loose lower bound on the true value function. The forward pass spreads trial points across the storage state space as iterations progress, and each new trial point produces a cut that tightens the approximation in its neighbourhood. The pointwise maximum over many such hyperplanes converges to the convex value function.
Per-bus thermal regime drives slope structure. A bus whose thermal is always idle (B4 in this trial) gets ; the corresponding reservoir’s storage has no marginal value at the visited state. As subsequent iterations sample trial points where B4 also runs short, that reservoir’s slope becomes negative in those cuts, and the cumulative cut pool eventually covers the region where every reservoir’s storage carries a non-zero marginal value.
7. Convergence on This Case
Section titled “7. Convergence on This Case”The relative gap
narrows as cuts accumulate. Convergence is faster than for one reservoir because the four-reservoir cuts contain four times as much information per iteration, but the state space being explored is also larger; the practical iteration counts depend on the demand-to-inflow ratios, the reservoir capacities, and the variance of the inflows. The stopping rule fires when the gap falls below the configured tolerance or the iteration limit is reached — see Stopping Rules for the available criteria.
8. What This Example Does Not Show
Section titled “8. What This Example Does Not Show”The toy walkthrough above keeps to four reservoirs at four buses with no transmission. It does not cover:
- Transmission networks: the actual
examples/4ree/case has two transmission lines (SUDESTE–SUL, SUDESTE–NORDESTE) that allow cheap thermal at one bus to serve another. With transmission, the load balance becomes a network constraint and the per-bus thermal share depends on line capacities and exchange costs. The cut structure does not change — still one storage coefficient per reservoir — but the per-opening LPs are no longer separable across buses. - Cascade coupling: in branched cascades, downstream reservoirs receive upstream releases via a water-balance term ; the storage cut coefficient at upstream plants then carries the expected downstream value of released water. See System Elements for cascade topology and Cut Management for how cascade sensitivities propagate through the pinned-column reduced cost.
- FPHA production model: nonlinear head-dependent productivity approximated by piecewise-linear hyperplanes; one of the planes binds at the optimum and contributes to the storage cut coefficient. See Hydro Production Models.
- Spatial inflow correlation: when a
correlation.jsonfile is supplied, the per-hydro innovations are drawn from a correlated multivariate normal via spectral factorisation. See PAR Inflow Model section 8. - Autoregressive inflow memory: a PAR(p) model with adds one lag state variable per hydro per lag and one AR-lag cut coefficient per lag; the cut becomes a hyperplane in storage and lag state space.
- Risk measures: CVaR weighting that shifts cut aggregation probabilities away from uniform toward worst scenarios, raising cut intercepts and slopes in the dry direction. See Risk Measures.
- Cyclic policy graphs: the four-stage horizon terminates without a cut linking back to stage 1. Cyclic-mode SDDP uses periodic policy graphs where the last stage’s cuts feed into the first stage. See Horizon Modes.
- Multi-resolution coupling: weekly intra-stage blocks embedded in a monthly horizon, with policy transfer between resolutions. See Multi-Resolution Studies.
Cross-References
Section titled “Cross-References”- Toy Single-Reservoir Walkthrough — Single-reservoir baseline; core SDDP loop, 0-order inflow, forward/backward/cut in the simplest setting
- LP Formulation — Complete stage LP, column and row layout, column-bound state pinning, reduced-cost extraction
- System Elements — Hydro plant element, cascade topology (not exercised here), water-balance convention, FPHA overview
- Hydro Production Models — Constant-productivity (used here) and FPHA hyperplane fitting; impact on Benders cut coefficients
- PAR Inflow Model — Inflow model definition; the degenerate case (white noise) used here; spatial correlation factorisation for multivariate cases
- Cut Management — Dual extraction, per-opening intercepts, single-cut aggregation; sign convention
- Risk Measures — CVaR definition, EAVaR convex combination, risk-adjusted aggregation weights
- Horizon Modes — Finite vs cyclic policy graphs and the season-indexed cut pool