Skip to content

Commit ae37715

Browse files
committed
Add odow's bench
1 parent ce48631 commit ae37715

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

perf/opf/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
33
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
44
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
55
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
6+
PGLib = "07a8691f-3d11-4330-951b-3c50f98338be"
67
PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655"

perf/opf/opf2.jl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using Revise
2+
import Ipopt
3+
import JuMP
4+
import MathOptInterface as MOI
5+
import PGLib
6+
import PowerModels
7+
8+
model = JuMP.direct_model(Ipopt.Optimizer())
9+
pm = PowerModels.instantiate_model(
10+
PGLib.pglib("pglib_opf_case10000_goc"),
11+
PowerModels.ACPPowerModel,
12+
PowerModels.build_opf;
13+
jump_model = model,
14+
);
15+
16+
ipopt = JuMP.backend(model)
17+
x = MOI.get(ipopt, MOI.ListOfVariableIndices())
18+
m, n = length(ipopt.nlp_model.constraints), length(x)
19+
20+
evaluator = MOI.Nonlinear.Evaluator(
21+
ipopt.nlp_model,
22+
MOI.Nonlinear.SparseReverseMode(),
23+
x,
24+
)
25+
MOI.initialize(evaluator, [:Grad, :Jac, :Hess])
26+
27+
H_struct = MOI.hessian_lagrangian_structure(evaluator)
28+
H = zeros(length(H_struct))
29+
mu = rand(m)
30+
sigma = 0.0
31+
x_v = rand(n)
32+
@time MOI.eval_hessian_lagrangian(evaluator, H, x_v, sigma, mu)

0 commit comments

Comments
 (0)