Training course
    
Stochastic and Dynamic Optimization
for Optimal Energy Storage and Allocation

    

Michel De Lara1,
Cermics, École nationale des ponts et chaussées, IP Paris


Abstract:

The energy landscape is rapidly changing, with and increase of intermittent and variable power sources (wind, sun) and a penetration of storage (batteries), due to diminishing costs. With storage, one can better adjust supply and demand at all temporal scales. Adjustments take place in a series of temporally interconnected markets, from day ahead to real time. The optimal management of storage is delicate, due to variability (power sources, prices and volumes on markets), and to the temporal intricacies of markets and their structure. How to formulate mathematical optimization problems that take into account the variability of data? What are the proper formats to feed such data in optimization problems? What are optimization methods adapted to storage management problems? How to handle multiple stocks? How to handle risk in optimization problems? These are the type of questions addressed in this course. In half of the sessions, we provide both theoretical answers and numerical algorithms. In the other half of the sessions, we discuss the company problems, put them in a suitable mathematical form, and outline possible algorithms. The course is based on a 25 years long collaboration with energy companies on optimization.


In a deterministic optimization problem, the values of all parameters are supposed known. What happens when this is no longer the case (like power prices or market prices and volumes)? And when some values are revealed during the stages of decision? We present stochastic optimization, at the same time as a framework to formulate problems under uncertainty, and as methods to solve them numerically, according to the formulation. More precisely, we present

Since multistage stochastic optimization problems are usually too difficult to solve in a direct way, we then present advanced methods like the Stochastic Dual Dynamic Programming (SDDP) algorithm (used in commercial software in the world of the energy), which mixes stochastic dynamic programming and cutting plane algorithm. Finally, depending on time availability, we open up on risk measures.

Modeling exercises (and optional computer sessions in auto-training) tackle issues like optimal economic dispatch of energy production units, storage/delivery optimization problem to buffer an intermittent and variable source of energy, dam optimal management with stochastic water inflows, battery optimal management with renewable energy inputs.


Keywords: stochastic programming, scenario tree, Progressive Hedging, optimal stochastic control, stochastic dynamic programming, Stochastic Dual Dynamic Programming, risk.



Contents

pdf version of this document

1 Thursday 19 June 2025 (9h30-12h30)
One-stage stochastic programming

Speaker: Michel De Lara [9h00-12h30]

We outline one-stage stochastic programming by means of examples.

     slides (MDL)     (section Working out static examples)

Recommended reading: [SDR09, Chap. 1]

Key insight: the output of a stochastic optimization problem is the distribution of the values taken by the random cost/payoff; it is up to the decision-maker to choose between several distributions according to her/his aversion to risk.

Exercise (1h00)

We are doing a group blood test modeling exercise. We formulate a stochastic optimization problem consisting in minimizing the average number of tests depending on the size of the groups. We compare the optimal size obtained to the optimal group size solution of the robust optimization problem — consisting in minimizing the worst number of tests depending on the size of the groups. Finally, we compare the distributions of the number of tests depending on the size of the groups.

Lecture (1h00)

Recalls on probability calculus: probability space, probability, random variables, law of a random variable, mathematical expectation (linearity), indicator function (law, expectation), independence of random variables, almost-sure convergence and law of large numbers.

Recommended reading: [SDR09, Chap. 7, § 7.2], [Fel68]

Exercise (1h00)

We present, under the form of an exercise, an example of optimization problem under uncertainty: “the newsvendor problem”. The newsvendor must decide in the morning the (deterministic) number of newspapers that she/he will order. The demand for newspapers is random (with known probability distribution) and is revealed in the afternoon. We show how the optimal number of ordered newspapers depends on buying unitary cost, selling unitary price and demand probability distribution.

Optional computer session

The newsvendor problem (only the Section 1, The newsvendor problem (integer formulation))


2 Thursday 19 June 2025 (14h00-17h00)
Interactive session on cases of interest to the company


3 Friday 20 June 2025 (9h30-12h30)
From one-stage to two-stage stochastic linear programming

Speaker: Michel De Lara [9h30-10h45]

Exercises/Lecture (0h45)

We move from one-stage to two-stage stochastic programming, in the linear case.

We revisit the newsvendor problem in the case of a scenarios tree. More generally, we show how to go from a one-stage optimization problem — polyhedral deterministic without constraints — towards a two-stage stochastic optimization problem.

We extend the newsvendor problem into a two-stage inventory management problem. A company must order a product to satisfy a random request, but it can perform a second (costlier) order once the request is observed. We show how to go from a one-stage optimization problem — linear with constraints — towards a two-stage stochastic optimization problem with recourse variables.

Then, we present two-stage linear stochastic programs. We provide a sketch of a day-ahead market problem as a two stage stochastic optimization for determining energy reserves.

     Slides * (MDL)


Lecture (0h30)

We develop the two-stage stochastic programming, especially in the case of a finite probability space (scenarios).

Key insight: two-stage stochastic programming is especially suited to resolution by temporal decomposition method, L-shaped, based on duality in linear programming.

     Slides * (MDL)      Slides * (VL)


Speaker: Michel De Lara [11h15–12h30]

Lecture (1h15)

Background on optimization and convexity.


    Slides * (PC, MDL)


4 Friday 20 June (14h00-17h00)
Interactive session on cases of interest to the company


5 Monday 23 June 2025 (9h30-12h30)
Two-stage stochastic programming

Speaker: Michel De Lara [9h30-12h30]

Lecture (1h15)

Key insight: when a first decision is made before the realization of a random variable, and a second decision is made after, this is mathematically framed as a nonanticipativity constraint; scenario trees directly encode such constraint.

In addition to the first (deterministic) decision, we introduce the notion of recourse, or second (random) decision made after the realization of a random variable.


Lecture (1h15)

We show how the nonanticipativity constraint — that bears on the first (deterministic) decision — can be taken into account by indexing solutions

We present how to handle scenario decomposition by Lagrangian relaxation (scenario decomposition and Progressive Hedging [RW91]). We sandwich the optimal value of a two-stage stochastic program by those obtained by a myopic decision-maker (hardening information constraints, open loop solution) and by a clairvoyant decision-maker (relaxing information constraints, anticipative solution). We then discuss the extension from two to multiple stages (exponential growth in the number of stages).


Recommended reading: § 2.1, 2.2 et 2.3 de [SDR09, Chap. 2]

     Slides * (MDL)      Slides (VL)      Slides (JPC)


6 Monday 23 June 2025 (14h00-17h00)
Interactive session on cases of interest to the company


7 Tuesday 24 June 2025 (9h30-12h30)
Stochastic dynamic programming

Speaker: Michel De Lara [9h30-12h30]

Lecture (1h15)

We raise the difficulty to move from two-stage stochastic programming to the multistage case. We formulate multistage stochastic optimization problems in the formalism of so-called histories, and we introduce the Bellman operators. Dynamic programming turns the original pronblem into a sequence of interconnected single step optimization problems, giving Bellman functions. Then, the so-called greedy one-step lookahead algorithm provides an optimal solution.

We illustrate dynamical models of storage (battery models, dam models). We formulate multistage stochastic optimization problems in the formalism of optimal control, that is, with state, controls and noise processes. We describe the stochastic dynamic programming algorithm: Bellman cost-to-go functions, Bellman equation. When the noise process is white (that is, stagewise independent), we state that the so-called greedy one-step lookahead algorithm provides an optimal solution.

Finally, we discuss the curse of dimensionality, we present the quadratic case and modeling issues (delineating state and white noise)

Key insight: the existence of a state that contains sufficient information to make an optimal decision at each stage.

Recommended reading: [Ber00, Chap. 1]

     Slides (MDL)      Slides (JPC)      Slides (VL)


Exercise (0h45)

Optimal growth and reproduction of a plant.

     Slides * (MDL)


Lecture (0h30)

Stochastic optimal control with quadratic costs and linear dynamics, without constraints on the control.


Optional computer session

     Programming the stochastic dynamic programming algorithm


8 Tuesday 24 June 2025 (14h00-17h00)
Interactive session on cases of interest to the company


9 Wednesday 25 June 2025 (9h30-12h30)
Stochastic Dual Dynamic Programming (SDDP)

Speaker: Michel De Lara [9h30–12h30]

Lecture (1h15)

SDDP (Stochastic Dual Dynamic Programming) is an algorithm that stands at the intersection of dynamic programming with the L-Shaped method. Relying on hypothesis of linearity and convexity, SDDP builds up lower approximations of Bellman functions. This approach allows pushing the limits of the dimensionality curses. For this purpose,

  1. we recall definition and properties of the Bellman operators,
  2. we use duality results to obtain so-called cuts (whose slopes represent the usage values of water uses in the context of management of hydraulic stocks),
  3. finally, we present the SDDP algorithm.

     Slides * (VL)


Lecture (1h15)

Beyond mathematical expectation and worst case — as a form aggregation of uncertainties in an objective function — we present risk measures.

Examples: Sun´R, optimal purchase of crude oil.

     Slides * (MDL)


References

Ber00
D. P. Bertsekas.
Dynamic Programming and Optimal Control.
Athena Scientific, Belmont, Massachusetts, second edition, 2000.
Volumes 1 and 2.
CCCD15
P. Carpentier, J.-P. Chancelier, G. Cohen, and M. De Lara.
Stochastic Multi-Stage Optimization. At the Crossroads between Discrete Time Stochastic Control and Stochastic Programming.
Springer-Verlag, Berlin, 2015.
Fel68
W. Feller.
An Introduction to Probability Theory and its Applications, volume 1.
Wiley, New York, third edition, 1968.
RW91
R.T. Rockafellar and R. J-B. Wets.
Scenarios and policy aggregation in optimization under uncertainty.
Mathematics of operations research, 16(1):119–147, 1991.
SDR09
A. Shapiro, D. Dentcheva, and A. Ruszczynski.
Lectures on Stochastic Programming: Modeling and Theory.
The society for industrial and applied mathematics and the mathematical programming society, Philadelphia, USA, 2009.



Footnotes

... Lara1
michel.delara@enpc.fr