Skip to content

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

Merged
merged 10 commits into from
Aug 3, 2025
Merged

Add OPF benchmark #2739

merged 10 commits into from
Aug 3, 2025

Conversation

blegat
Copy link
Member

@blegat blegat commented Apr 26, 2025

No description provided.

Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need compat

perf/opf/opf.jl Outdated
@@ -0,0 +1,30 @@
ROSETTA_OPF_DIR = "/home/blegat/git/rosetta-opf"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use Downloads to download the file to a temp directory?

perf/opf/opf.jl Outdated
@@ -0,0 +1,30 @@
ROSETTA_OPF_DIR = "/home/blegat/git/rosetta-opf"
include(joinpath(ROSETTA_OPF_DIR, "jump.jl"))
model = opf_model(parse_data(joinpath(ROSETTA_OPF_DIR, "data/opf_warmup.m")))
Copy link
Member

Choose a reason for hiding this comment

The 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.

@odow
Copy link
Member

odow commented Apr 27, 2025

using Revise
import Ipopt
import JuMP
import MathOptInterface as MOI
import PGLib
import PowerModels

model = JuMP.direct_model(Ipopt.Optimizer())
pm = PowerModels.instantiate_model(
    PGLib.pglib("pglib_opf_case10000_goc"),
    PowerModels.ACPPowerModel,
    PowerModels.build_opf;
    jump_model = model,
);

ipopt = JuMP.backend(model)
x = MOI.get(ipopt, MOI.ListOfVariableIndices())
m, n = length(ipopt.nlp_model.constraints), length(x)

evaluator = MOI.Nonlinear.Evaluator(
    ipopt.nlp_model,
    MOI.Nonlinear.SparseReverseMode(),
    x,
)
MOI.initialize(evaluator, [:Grad, :Jac, :Hess])

H_struct = MOI.hessian_lagrangian_structure(evaluator)
H = zeros(length(H_struct))
mu = rand(m)
sigma = 0.0
x_v = rand(n)
@time MOI.eval_hessian_lagrangian(evaluator, H, x_v, sigma, mu)

@blegat blegat marked this pull request as ready for review May 5, 2025 19:12
@odow
Copy link
Member

odow commented Aug 3, 2025

I'll just merge this. There's little harm to it being in there, and it makes it easier to find than looking through old PRs.

@odow odow merged commit 5d2196c into master Aug 3, 2025
31 checks passed
@odow odow deleted the bl/nlp_bench branch August 3, 2025 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants