odow / SDDP.jl

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

Constraint information log in SDDP #509

Closed Moon1193 closed 2 years ago

Moon1193 commented 2 years ago

Hi, We are modeling the optimization for a hydropower cascade system, and want to analyze how do the model constraints can contribute to or limit the solution flexibility, or how the constraints are considered in each iteration of model training. Is there any function in SDDP.jl that can help to extract this type of information? Some functions I knew so far (SDDP.write_log_to_csv, SDDP.write_cuts_to_file, SDDP.write_subproblem_to_file) do not provide much information related to this task.

odow commented 2 years ago

want to analyze how do the model constraints can contribute to or limit the solution flexibility, or how the constraints are considered in each iteration of model training

What do you mean by this? You want to know which constraints are binding? How do you want to work this out (in math)?

Moon1193 commented 2 years ago

Yes, like you said. I want to know which constraints are binding or nonbinding to the optimal solution. Not 100% sure how to work this out yet, but I am planning to examine the sensitivity of the optimal solution to changes in its parameters as reflected in the constraints' change.

odow commented 2 years ago

There is no support for this during the training. However, you can simulate this.

If you look at the docstring of SDDP.simulate, https://odow.github.io/SDDP.jl/stable/apireference/#SDDP.simulate, you can pass a custom recorder that stores the dual of a constraint. A constraint is nonbinding if the dual is zero.

I am planning to examine the sensitivity of the optimal solution to changes in its parameters as reflected in the constraints' change.

The dual of a constraint in the simulation gives you the change in the cost of that node plus the change in future cost as a function of a change in the right-hand side of the constraint.

You have to be a bit careful with words like "sensitivity" because of the stochastic behavior of training and simulation.

If you had a small number of right-hand side parameters to change, you could add them as state variables. Then their cuts would be the sensitivity information.

Moon1193 commented 2 years ago

Thanks for your clarification and suggestions. This is really helpful.

odow commented 2 years ago

Closing because this isn't a bug in SDDP.jl.