odow / SDDP.jl

A JuMP extension for Stochastic Dual Dynamic Programming
https://sddp.dev
Other
309 stars 61 forks source link

Cut matrices from a subproblem #520

Closed franciscogaluppo closed 2 years ago

franciscogaluppo commented 2 years ago

Hello,

Recently I was reading the original SDDP paper, "Multi-stage stochastic optimization applied to energy planning" by Pereira and Pinto, and some key aspects of it weren't clear to me, specially how to implement it. I would like to understand how did you do it.

Consider the two stage problem below: Captura de Tela 2022-05-04 às 11 59 38

The authors showed that we can rename the future cost as a function $\alpha$: Captura de Tela 2022-05-04 às 11 59 57

And ultimately, we can approximate this $\alpha$ function by using a set of vectors $\pi^i$ (the cuts): Captura de Tela 2022-05-04 às 12 01 02

The paper then shows how to find "good" vectors by iteratively proposing solutions and then finding its cuts, which is basically the whole algorithm.

The algorithm is clear and I understood it completely. What I don't understand is how to find $E_1$ and $b_2$, which are necessary for $\alpha$, given a stage-wise subproblem model. Consider this stage-wise hydro dispatch problem (I'm omitting constraints with the variable bounds and I missed $S_i$, meaning the spill, on eq 1): Captura de Tela 2022-05-04 às 12 14 46

The modelling is not in the same form (inequalities versus equalities) and I don't know which restrictions are part of $A_1$, $A_2$ and $E_1$. I don't even know what $x$ is, which I guess would be the reservoir levels, or maybe the concatenation of spill and outflow. I've used your code to implement the above model, which works greatly thank you, and it does those decisions automatically (finding the matrices), but how?

This step is not shown in the paper and is assumed as a given, but it is not clear to me. How do you find these matrices given a subproblem? I tried to study your code but I couldn't understand every step.

Thank you.

odow commented 2 years ago

How do you find these matrices given a subproblem? I tried to study your code but I couldn't understand every step.

We don't explicitly model those matrices. We actually use quite a different formulation to the original SDDP paper (which is quite stylized for simplicity). I don't think reading it will be informative for understanding how SDDP.jl is implemented or works.

If you want to model a problem, start here: https://odow.github.io/SDDP.jl/stable/tutorial/basic/01_first_steps/

If you want insight into the theory, start here: https://odow.github.io/SDDP.jl/stable/tutorial/theory/21_theory_intro/

(Okay, but I'll bite somewhat. The E and b matrices disappear because we introduce copies of the state variables and add a "fishing" constraint. Search "fishing" in the theory tutorial. The original formulation is misleading because it doesn't distinguish state and control variables, and it doesn't include variable bounds.)

franciscogaluppo commented 2 years ago

Thank you for your answer. The explicit use of the Kelley's cutting plane algorithm and the fishing constraint are much better than the notations used by the original paper.

In addition, I've just read your paper "The policy graph decomposition of multistage stochastic programming problems". Great work!