Skip to content

Commit

Permalink
Add Network Data Specifically for Julia JIT Warmup (#43)
Browse files Browse the repository at this point in the history
* add opf warmup case
* update the implementations to use opf_warmup instead of pglib_opf_case5_pjm
* add note about opf_warmup.m in readme
* Update runtests.jl

---------

Co-authored-by: Oscar Dowson <[email protected]>
  • Loading branch information
ccoffrin and odow authored Jan 27, 2024
1 parent 2376b01 commit 1287a0c
Show file tree
Hide file tree
Showing 17 changed files with 69 additions and 20 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ julia --project=. # Start Julia with the project e
julia> include("jump.jl") # Load the solve_opf function from one of the example files
julia> solve_opf("data/pglib_opf_case5_pjm.m") # Run the solve_opf function on a specific AC-OPF case file
```
Note that due to Julia's JIT, it is very likely that the first call to `solve_opf` will take significantly more time than the second call.

Note that due to Julia's JIT, it is very likely that the first call to `solve_opf` will take significantly more time than the second call. The case file `data/opf_warmup.m` can be used to remove the bulk of overheads related to Julia's JIT when collecting precise runtime data on one of the `solve_opf` functions.

## License

Expand Down
49 changes: 49 additions & 0 deletions data/opf_warmup.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
%
% This matpower case was developed as part of the rosetta-opf project.
%
% It is designed to be used for warming up the Julia JIT for solving similar
% AC-OPF porblems. This network data is designed to cover a wide range of
% model features in a minimal case file. It is not representative of a
% realistic power network.
%
%
function mpc = opf_warmup
mpc.version = '2';
mpc.baseMVA = 100.0;

%% bus data
% bus_i type Pd Qd Gs Bs area Vm Va baseKV zone Vmax Vmin
mpc.bus = [
1 1 150.0 98.0 0.1 10.0 1 1.00000 0.00000 230.0 1 1.10000 0.90000;
2 3 0.0 0.0 0.0 0.0 1 1.00000 0.00000 230.0 1 1.11000 0.91000;
3 2 200.0 -52.0 0.0 -15.0 1 1.00000 0.00000 230.0 1 1.12000 0.92000;
4 2 300.0 131.0 0.0 0.0 1 1.00000 0.00000 230.0 1 1.13000 0.93000;
];

%% generator data
% bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin
mpc.gen = [
3 20.0 0.0 30.0 -30.0 1.0 100.0 1 40.0 0.0;
3 85.0 0.0 127.5 -127.5 1.0 100.0 1 170.0 0.0;
4 100.0 0.0 150.0 -150.0 1.0 100.0 1 200.0 0.0;
2 300.0 0.0 450.0 -450.0 1.0 100.0 1 600.0 0.0;
];

%% generator cost data
% 2 startup shutdown n c(n-1) ... c0
mpc.gencost = [
2 0.0 0.0 3 1.00 5.00 0.00;
2 0.0 0.0 3 0.30 10.00 0.00;
2 0.0 0.0 3 0.00 30.00 0.00;
2 0.0 0.0 3 0.00 40.00 0.00;
];

%% branch data
% fbus tbus r x b rateA rateB rateC ratio angle status angmin angmax
mpc.branch = [
1 2 0.00281 0.0281 0.00712 400.0 400.0 400.0 1.1 0.0 1 -30.0 30.0;
2 3 0.00108 0.0108 0.01852 426.0 426.0 426.0 0.0 5.0 1 -30.0 30.0;
2 4 0.00297 0.0297 0.00674 240.0 240.0 240.0 0.0 0.0 1 -30.0 30.0;
3 4 0.00297 0.0297 0.00674 426.0 426.0 426.0 0.9 -5.0 1 -30.0 30.0;
];

2 changes: 1 addition & 1 deletion jump.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,5 @@ function solve_opf(file_name)
end

if isinteractive() == false
solve_opf("$(@__DIR__)/data/pglib_opf_case5_pjm.m")
solve_opf("$(@__DIR__)/data/opf_warmup.m")
end
2 changes: 1 addition & 1 deletion nlpmodels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -358,5 +358,5 @@ function solve_opf(file_name)
end

if isinteractive() == false
solve_opf("$(@__DIR__)/data/pglib_opf_case5_pjm.m")
solve_opf("$(@__DIR__)/data/opf_warmup.m")
end
2 changes: 1 addition & 1 deletion nonconvex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,5 @@ function solve_opf(file_name)
end

if isinteractive() == false
solve_opf("$(@__DIR__)/data/pglib_opf_case5_pjm.m")
solve_opf("$(@__DIR__)/data/opf_warmup.m")
end
2 changes: 1 addition & 1 deletion optim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -399,5 +399,5 @@ function solve_opf(file_name)
end

if isinteractive() == false
solve_opf("$(@__DIR__)/data/pglib_opf_case5_pjm.m")
solve_opf("$(@__DIR__)/data/opf_warmup.m")
end
2 changes: 1 addition & 1 deletion optimization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -374,5 +374,5 @@ function solve_opf(file_name)
end

if isinteractive() == false
solve_opf("$(@__DIR__)/data/pglib_opf_case5_pjm.m")
solve_opf("$(@__DIR__)/data/opf_warmup.m")
end
9 changes: 5 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ include("validator.jl")
]
include(joinpath(dirname(@__DIR__), "$framework.jl"))
@testset "$case" for case in [
"case5_pjm",
"case14_ieee",
"case24_ieee_rts",
"opf_warmup.m",
"pglib_opf_case5_pjm.m",
"pglib_opf_case14_ieee.m",
"pglib_opf_case24_ieee_rts.m",
]
test_case = joinpath(dirname(@__DIR__), "data/pglib_opf_$case.m")
test_case = joinpath(dirname(@__DIR__), "data", case)
result = solve_opf(test_case)
validate_result(test_case, result)
end
Expand Down
2 changes: 1 addition & 1 deletion variants/casadi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,5 @@ function solve_opf(file_name)
end

if isinteractive() == false
solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m")
solve_opf("$(@__DIR__)/../data/opf_warmup.m")
end
2 changes: 1 addition & 1 deletion variants/jump-nl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,5 @@ function solve_opf(file_name)
end

if isinteractive() == false
solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m")
solve_opf("$(@__DIR__)/../data/opf_warmup.m")
end
2 changes: 1 addition & 1 deletion variants/jump-polar-vectorized.jl
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,6 @@ function solve_opf(file_name)
end

if isinteractive() == false
solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m")
solve_opf("$(@__DIR__)/../data/opf_warmup.m")
end

2 changes: 1 addition & 1 deletion variants/jump-rectangular-complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,5 @@ function solve_opf(file_name)
end

if isinteractive() == false
solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m")
solve_opf("$(@__DIR__)/../data/opf_warmup.m")
end
2 changes: 1 addition & 1 deletion variants/jump-rectangular-real.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,5 @@ function solve_opf(file_name)
end

if isinteractive() == false
solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m")
solve_opf("$(@__DIR__)/../data/opf_warmup.m")
end
2 changes: 1 addition & 1 deletion variants/jump-symbolic-ad.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,5 @@ function solve_opf(file_name)
end

if isinteractive() == false
solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m")
solve_opf("$(@__DIR__)/../data/opf_warmup.m")
end
2 changes: 1 addition & 1 deletion variants/jump-traced.jl
Original file line number Diff line number Diff line change
Expand Up @@ -399,5 +399,5 @@ function solve_opf(file_name)
end

if isinteractive() == false
solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m")
solve_opf("$(@__DIR__)/../data/opf_warmup.m")
end
2 changes: 1 addition & 1 deletion variants/optimization-cs-asrd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,6 @@ function solve_opf(file_name)
end

if isinteractive() == false
solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m")
solve_opf("$(@__DIR__)/../data/opf_warmup.m")
end

2 changes: 1 addition & 1 deletion variants/pyomo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -259,5 +259,5 @@ function solve_opf(file_name)
end

if isinteractive() == false
solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m")
solve_opf("$(@__DIR__)/../data/opf_warmup.m")
end

0 comments on commit 1287a0c

Please sign in to comment.