Hydroelectricity is the main renewable energy which is produced in France (over 10% of the country annual production). It provides a clean (no greenhouse gases emissions) and fast-usable energy that is cheap and substitutable for the thermal one. We address the question of the production management of cascade-interconnected dams by means of a finite-horizon Markov decision process. Solving such a problem is not straightforward since it displays a large size, so is likely to suffer from the curse of dimensionality. We handle it with a decomposition-coordination algorithm that we adapt by approximation to the stochastic case.
This pratical work will follow the lecture entitled Decomposition-coordination methods in stochastic optimal control (P. Carpentier). The computations will be performed using nsp and only nsp. In order to launch nsp write nsp & in a terminal. Type pwd to see the current repertory and then download the practical work material from the Internet to this repertory. Since we will use a three dimension dynamic programming algorithm, a part of the programming functions had to be written in C. Moreover, we have to load some scenarios datas. Thus, we will need a specific nsp toolbox called COURSES/stochdec. In order to load it, go to the stochdec repertory and type exec('loader.sce');.
Let time t vary in {0,...,T}. The following real valued random variables are defined on a probability space :
The dynamics of the dam reads:
| (1) |
When Xti + W ti + Z ti −U ti is greater than xi, the difference is spilled from dam i to dam i + 1 so that the upper bound constraint on dam i is directly handled by the dynamics. Therefore the total outflow from dam i to dam i + 1 is given by:
|
The bounds constraints are:
| (2) |
Each dam i ∈{2,…,N} receives from the dam i − 1 outflows gti−1 as inflows Zti and sends its own outflows into the dam i + 1 reservoir, at every t ∈{0,…,T}. With the notation Zt1 ≡ 0, this leads to the following coupling constraints:
| (3) |
We assume that the noise random variable Wt = (Wt1,W t2,W t3) are independent over time. The hydroelectric production obeys the following valorization mechanism for every dam:
|
|
We consider the expected value of the sum of every dam total gain as the problem criterion:
| (4) |
Note that this criterion is both time and space separable. The control U = (U0i,…,U T−1i) i must satisfy the non anticipativity constraint in the hazard-decision framework. So, Uti has to be measurable with respect to the noises up to time t:
| (5) |
The problem consists in minimizing the criterion (4) under the dynamics (1), the coupling (3), the bounds (2) and the measurability (5) constraints.
We will test algorithms on a valley composed of three cascade-interconnected dams over a T = 12 time steps period. The problem is of a discrete type and the dams share the following common characteristics:
The simulation part is based on 500 intakes scenarios.
Question 1 Execute the script answer-question1.sce which is stored in the directory COURSES/stochdec. This script will draw N simulation scenarios for the dam number 1. Take a look at the script and change it to draw the scenarios of the other dams.
The contents of the script answer-question1.sce is reproduced here:
The noises Wti are independent over time, so that the problem can be theoretically solved by stochastic dynamic programming (DP). Although, DP is prone to face the curse of dimensionality (the method is not numerically tractable as soon as the number of dams is larger than 5 ) you will first solve the three cascade interconnected dams problem by DP since it is numerically possible (as N = 3). Note that the discretization of the problem avoids us to use an interpolation scheme to implement the method.
Question 2 Running DP on the cascade of three connected dams is obtained using the function dp_run(). Then call the function dp_simu() as follows [cost, stocks, controls]=dp_simu() to obtain the expected cost and the stocks and the controls trajectories. Plot the stocks trajectories and show the optimal expected cost. Note that, for example, you will obtain the stocks evolution of dam 1 by using S1=stocks{1}.
Question 3 For the most sceptical of you, just try to beat the DP-computed strategy by building your own strategy ! ;) For example, you may want to multiply the optimal control mapping by a scalar γ ∈ [0,1] to get a new control U (you can use dp_getu(U) and dp_setu(U) to obtain or set the current used control table). Simulate the strategies obtained with your control strategy by using dadp_simu() and compare to what you had obtained before.
Question 4 You can also design your own strategy using function dp_f2u and simulate your strategy as seen in question3. How far is your solution expected cost from the optimal one?
In a few words, we decompose the three dimension dynamic state problem into three one dimension dynamic state problems. This is done by:
We aim at dualizing (3) and at solving the problem by using an Uzawa algorithm: at iteration k, the associated multiplier is a fixed ℱt-measurable random variable λti+1(k), and the term (under the expectation) induced by duality in the cost function is
|
It can be decomposed as
Finally, the following term is added to the cost of dam i
|
The main idea of the price decomposition of the problem is to see Zti as an independent control variable as shown in figures 3. As Uti does, Z ti has to observe the (3) constraint.
Then, we would like to solve the resulting N independent one-dam subproblems by DP1 ,
| (6) |
But, the presence of the random variables λti t=0,…,T−1(k) prevents to use dynamic programming in a straightforward manner since the random variables λti are not independent over time. The idea of DADP is to replace the multipliers λti(k) by their conditional expectations w.r.t. chosen information variable Yti, namely
|
Note that this is equivalent to replace the (3) constraint by 𝔼Zti − gti−1(…) Yti = 0.
In practice, Yti is a short-memory process that will enter the state variables of the
subproblems. In the sequel we will consider that Yti ≡ const, so that
ti(k) := 𝔼λ
ti(k).
Thus, the Uzawa algorithm reads:
|
|
|
Question 5 Run the script job.sce to see iterations of the DADP algorithm solving the three cascade interconnected dams problem. You should observe the multipliers expected values and the dual costs converging in about three thousand iterations. At the end of iterations you can obtain the optimal multipliers expected values using the function dadp_get_lambda(). Use this function to store this values in matrix OPT_LAMBDA by calling OPT_LAMBDA=dadp_get_lambda().
Question 6 Have a look at the Uzawa algorithm figure Figure 4. Implement your own gradient step process and make the gradient step size values vary to see how it affects the convergence of the algorithm. You can use the following program skeleton.
Question 7 Write your own dadp_coordination() function using the following code skeleton and then compare your code to the reference one.
Question 8 You can change the previous function dadp_coordination1 in order to get the deviations from the coupling constraints trajectories at the optimal multipliers expected values. Compute these values when at the optimal multipliers expected values that you have stored before.
The approximation Yti ≡ const is a relaxation of the problem (as the constraint is loosened). Thus, the strategies that we derive may not be feasible, even if the algorithm converges: we have to design a method to go back to a feasible strategy.
Once the algorithm has converged we have feedbacks laws that verify the constraint
|
But, this means that the physical constraint Zti = g ti−1…a.s. is not verified. Consequently one has to define an heuristic to turn this strategies into an admissible one.
We first note that the optimal control to apply along a given noise trajectory may be computed using the Bellman function. The way to do this is the following: suppose that you have the three dimension DP-computed Bellman function
Question 9 Use the simulation part of the previous coordination function to implement the simulation using the Bellman function you get by DP and compare it to the dp_simu() results.
We don’t have the three dimension Bellman function but we can construct an approximate Bellman’s value function for the global problem as the sum of the Bellman’s value function of each subproblem. Consequently we obtain a global admissible strategy by doing a one time step optimization of the global problem. More precisely if we write V ti(x ti) the Bellman’s function obtained for subproblem i when the DADP algorithm has converged, we define (xt) = ∑ i=1NV ti(x ti−1,x ti,x ti+1), with the convention that¡ x 0t = 0. Then the control we choose at time t when the cascade of dams is in the state xt and the wt is observed is the optimum of
|
This problem is global on the cascade but only done on one time-step, so numerically tractable.
Question 10 Apply the heuristic to the optimal strategy we computed using dadp_admissible() and simulate with [cost, stocks, controls]=dadp_simv(). Use the function which checked for the feasibility of the DADP computed strategy to see that the strategy is now feasible. Compare the results with those we get by the application of the exact optimal strategy.