-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Research idea] ForwardPass plugins #419
Comments
@andrewrosemberg does this seem reasonable? Is it easy to build the forward and backward models with the same state variables? |
I'm not sure how I missed this! This went to my spam email which makes me very sad. It looks great. I need to remember all the pitfalls I had implementing it the first time, but this seems to be in the right direction. I will try to post here all the important points I needed to check the last time. |
The first ones I remember (which @odow already mentions here):
|
This is really asking for a function to compute the convex relaxation of an arbitrary JuMP model. But that's a different ballpark. Instead of having separate models, we should really just have to subproblems within each node. |
A good way to get started is a function that implements Andrew's algorithm. Pseudo code would look like: nonconvex_model = SDDP.PolicyGraph(...)
convex_model = SDDP.PolicyGraph(...)
function train_nonconvex(nonconvex_model, convex_model)
while _ in 1:50
passes = SDDP.simulate(nonconvex_model, 100)
new_forward_pass = NewForwardPass(passes)
SDDP.train(convex_model, iteration_limit = 100, forward_pass = new_forward_pass)
copy_cuts_from_model(nonconvex_model, convex_model)
end
end For now, you could imagine that |
I had to check if the cuts were already in the model because the function How I did it: andrewrosemberg@895a5b9 I can help out if needed! @odow would it be ok to add such a check in |
We actually probably have enough code in the asynchronous stuff to make this work: SDDP.jl/src/plugins/parallel_schemes.jl Line 135 in a382ea9
SDDP.jl/src/plugins/parallel_schemes.jl Lines 167 to 187 in a382ea9
What about something like: nonconvex_model = SDDP.PolicyGraph(...)
convex_model = SDDP.PolicyGraph(...)
function train_nonconvex(nonconvex_model, convex_model)
has_converged = false
options = SDDP.Options(...TODO...)
while !has_converged
passes = SDDP.simulate(nonconvex_model, 1)
options.forward_pass = NewForwardPass(passes ... TODO...)
result = SDDP.iterate(convex_model, options)
has_converged = result.has_converged
SDDP.slave_update(nonconvex_model, result)
end
return
end |
Just to clarify: Or can we just: nonconvex_model = SDDP.PolicyGraph(...)
convex_model = SDDP.PolicyGraph(...)
function train_nonconvex(nonconvex_model, convex_model)
has_converged = false
options = SDDP.Options(...TODO...)
while !has_converged
options.forward_pass = NewForwardPass(nonconvex_model, 1)
result = SDDP.iteration(convex_model, options)
has_converged = result.has_converged
SDDP.slave_update(nonconvex_model, result)
end
return
end |
I guess I haven't really thought through the details. It's probable that it's a lot more work than I'm thinking. |
I will try it out and post here what I found. |
Here you go: #611 |
It only took us four years, but we got there... |
In #295, we introduced forwardness plugins. The motivation is for @andrewrosemberg's experiments with different network designs.
Why do we want different models
Transmission models are approximations of reality. If we train a model using a poor approximation, then we will obtain a poor policy.
The tricky thing is that we can solve the proper AC-OPF, but this is non-convex, so we can't use it in SDDP.jl.
What we really want to do is to simulate forward passes with the AC-OPF to obtain forward trajectories, and then refine the value functions on the backward pass using some convex approximation (e.g., DC with line losses).
It isn't sufficient to use DC on the forward pass because this will visit the "wrong" points in the state-space, and so the true AC simulation will be suboptimal.
Previous attempts
At present, it's easy to build-and-train a model using the same model on the forward and backward passes (e.g., NFA-NFA or DC-DC). However, you can't mix models, or use the nonlinear AC-OPF.
The previous code hacked around this https://github.com/andrewrosemberg/SDDP.jl/tree/forw_diff_back, but it's now well out-of-date.
Proposed solution
The ideal solution to this is for SDDP.jl to have some notion of a separate models on the forward and backward pass. However, this is a pretty niche request, and would lead to double the memory usage. I'm not going to do this.
Instead, we can leverage the forward pass plugins as follows.
This logic should be able to be encapsulated within a forward pass problem so that it appears pretty seamless.
Code
Here's a quick sketch of the possible implementation:
Pros and cons
The benefit of this approach is that it is simple.
The downsides are that:
The text was updated successfully, but these errors were encountered: