-
Notifications
You must be signed in to change notification settings - Fork 92
Add OPF benchmark #2739
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
base: master
Are you sure you want to change the base?
Add OPF benchmark #2739
Changes from 1 commit
45abf13
ce48631
ae37715
48f4d53
39222b5
a9fc510
87dd43e
70a961e
70018e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[deps] | ||
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" | ||
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9" | ||
JuMP = "4076af6c-e467-56ae-b986-b466b2749572" | ||
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" | ||
PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655" | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
ROSETTA_OPF_DIR = "/home/blegat/git/rosetta-opf" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use |
||
include(joinpath(ROSETTA_OPF_DIR, "jump.jl")) | ||
model = opf_model(parse_data(joinpath(ROSETTA_OPF_DIR, "data/opf_warmup.m"))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not useful to test this one. You really need a much larger file to stress test the code paths. |
||
import MathOptInterface as MOI | ||
JuMP.optimize!(model) | ||
ipopt = JuMP.unsafe_backend(model) | ||
ipopt.nlp_model | ||
ad = ipopt.nlp_data.evaluator | ||
x = ipopt.inner.x | ||
g = zeros(length(ipopt.nlp_data.constraint_bounds)) | ||
bench0(ad, x, g) | ||
bench1(ad, x, g) | ||
bench2(ad, x, g) | ||
|
||
function bench0(ad, x, y) | ||
@time MOI.eval_constraint(ad, g, x) | ||
end | ||
|
||
function bench1(ad, x, y) | ||
J = @time MOI.jacobian_structure(ad) | ||
V = zeros(length(J)) | ||
@time MOI.eval_constraint_jacobian(ad, V, x) | ||
end | ||
|
||
function bench2(ad, x, y) | ||
J = @time MOI.hessian_lagrangian_structure(ad) | ||
V = zeros(length(J)) | ||
σ = 1.0 | ||
@time MOI.eval_hessian_lagrangian(ad, V, x, σ, y) | ||
end |
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.
These need compat