-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
[WIP] [docs] Complex number AC Optimal Power Flow tutorial #3382
Conversation
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## master #3382 +/- ##
=======================================
Coverage 98.06% 98.07%
=======================================
Files 34 34
Lines 4922 4928 +6
=======================================
+ Hits 4827 4833 +6
Misses 95 95 ☔ View full report in Codecov by Sentry. |
# following question: what is the most cost-effective operation of electricity | ||
# generators while meeting constraints on the safe limits of network components? | ||
|
||
# We will use the 9 _bus_ network test case `case9mod` to explore this problem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In there, it seems "case9mod" is some standard name but it's only where from. Is it coming from some benchmarking suite ?
# Even before solving, we can substitute the lower bound on each generator's real power range | ||
# (all 10, as it turns out in this case) | ||
|
||
objval_basic_lb = value(lower_bound, objective_function(model)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unclear why this is a lower bound since you have quadratic terms
I think your choice of putting it in conic is good. |
Thanks @blegat for the review. Could you see if the latest commit addresses your comments? |
# The techniques of *convex relaxations* can also be used to improve on our | ||
# current best lower bound: | ||
|
||
## println("Objective value (better lower bound): $(objval_better_lb)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the plan to add this section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Still to do.
I made a few formatting changes. Perhaps this would be better in the application section? https://github.com/jump-dev/JuMP.jl/tree/master/docs/src/tutorials/applications |
|
||
# The purpose of this tutorial is to highlight JuMP's ability to directly | ||
# formulate problems involving complex-valued decision variables and complex | ||
# matrix cones such as the [`HermitianPSDCone`](@ref) object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: add an SDP relaxation so this sentence is true.
Yes, that seems reasonable since it cuts across a few areas and is fairly technical in places. |
|
||
Y = | ||
A * SparseArrays.spdiagm(1 ./ z) * A' + | ||
SparseArrays.spdiagm(LinearAlgebra.diag(A * SparseArrays.spdiagm(y_sh) * A')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@odow I agree with this formatting but the computer says no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I think the formatter must be changing its mind. I didn't change this. Just ran the formatter locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a formatting file I'm not seeing by just running
JuliaFormatter.format_file("./docs/src/tutorials/conic/optimal_power_flow.jl", verbose=true)
from the ./JuMP/
dir?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No that should work. Maybe we have different versions of JuliaFormatter. Otherwise break it up a bit so there aren't so many nested calls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that would help readability anyway.
@jd-foster, I've sent you an invite to join This will give you write permission to push to the |
Thoughts on taking Hypatia as a dependency in the docs environment? It worked well for the hardest SDP example here while SCS seems to struggle, at least on the default settings. |
Potentially Clarabel? I used it in #3385 for higher precision. |
Closing in favor of #3395 |
Still plenty to add and fix here, but the first pass at #3363 .
It currently is a nonlinear AC-OPF formulation, but the idea is to add to it the original intent, SDP relaxation of AC-OPF using
HermitianPSDCone
. Not sure whether it should be underconic
ornonlinear
...