Skip to content

Commit

Permalink
Merge pull request #698 from SciML/opf_fix
Browse files Browse the repository at this point in the history
Refactor and Fix Optimal Powerflow Benchmark
  • Loading branch information
ChrisRackauckas authored Sep 10, 2023
2 parents 50d2ff3 + 36121ee commit af96d44
Show file tree
Hide file tree
Showing 4 changed files with 906 additions and 378 deletions.
54 changes: 53 additions & 1 deletion benchmarks/OptimizationFrameworks/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.9.1"
manifest_format = "2.0"
project_hash = "5356efadf00ee4c7d5ece025a6be4d6b70be771b"
project_hash = "41446dc14eec22d904f52b0fba22212fba705517"

[[deps.ADNLPModels]]
deps = ["ColPack", "ForwardDiff", "LinearAlgebra", "NLPModels", "Requires", "ReverseDiff", "SparseArrays"]
Expand Down Expand Up @@ -244,6 +244,11 @@ git-tree-sha1 = "02d2316b7ffceff992f3096ae48c7829a8aa0638"
uuid = "b152e2b5-7a66-4b01-a709-34e65c35f657"
version = "0.1.3"

[[deps.ConcreteStructs]]
git-tree-sha1 = "f749037478283d372048690eb3b5f92a79432b34"
uuid = "2569d6c7-a4a2-43d3-a901-331e8e4be471"
version = "0.2.3"

[[deps.CondaPkg]]
deps = ["JSON3", "Markdown", "MicroMamba", "Pidfile", "Pkg", "TOML"]
git-tree-sha1 = "741146cf2ced5859faae76a84b541aa9af1a78bb"
Expand Down Expand Up @@ -283,6 +288,12 @@ git-tree-sha1 = "8da84edb865b0b5b0100c0666a9bc9a0b71c553c"
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
version = "1.15.0"

[[deps.DataFrames]]
deps = ["Compat", "DataAPI", "DataStructures", "Future", "InlineStrings", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrecompileTools", "PrettyTables", "Printf", "REPL", "Random", "Reexport", "SentinelArrays", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"]
git-tree-sha1 = "04c738083f29f86e62c8afc341f0967d8717bdb8"
uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
version = "1.6.1"

[[deps.DataStructures]]
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "cf25ccb972fec4e4817764d01c82386ae94f77b4"
Expand Down Expand Up @@ -558,6 +569,12 @@ git-tree-sha1 = "dc1e2eba1a98aa457b629fe1723d9078ecb74340"
uuid = "2030c09a-7f63-5d83-885d-db604e0e9cc0"
version = "0.7.7"

[[deps.InlineStrings]]
deps = ["Parsers"]
git-tree-sha1 = "9cc2baf75c6d09f9da536ddf58eb2f29dedaf461"
uuid = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48"
version = "1.4.0"

[[deps.IntegerMathUtils]]
git-tree-sha1 = "b8ffb903da9f7b8cf695a8bead8e01814aa24b30"
uuid = "18e54dd8-cb9d-406c-a71d-865a43cbb235"
Expand All @@ -579,6 +596,11 @@ git-tree-sha1 = "16c0cc91853084cb5f58a78bd209513900206ce6"
uuid = "8197267c-284f-5f27-9208-e0e47529a953"
version = "0.7.4"

[[deps.InvertedIndices]]
git-tree-sha1 = "0dc7b50b8d436461be01300fd8cd45aa0274b038"
uuid = "41ab1584-1d38-5bbf-9106-f11c6c58b48f"
version = "1.3.0"

[[deps.Ipopt]]
deps = ["Ipopt_jll", "LinearAlgebra", "MathOptInterface", "OpenBLAS32_jll", "PrecompileTools"]
git-tree-sha1 = "fdb3430a3b7b909bcb5abf9439d61450f49e3e2c"
Expand Down Expand Up @@ -1064,6 +1086,12 @@ git-tree-sha1 = "240d7170f5ffdb285f9427b92333c3463bf65bf6"
uuid = "1d0040c9-8b98-4ee7-8388-3f51789ca0ad"
version = "0.2.1"

[[deps.PooledArrays]]
deps = ["DataAPI", "Future"]
git-tree-sha1 = "a6062fe4063cdafe78f4a0a81cfffb89721b30e7"
uuid = "2dfb63ee-cc39-5dd5-95bd-886bf059d720"
version = "1.4.2"

[[deps.PositiveFactorizations]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "17275485f373e6673f7e7f97051f703ed5b15b20"
Expand Down Expand Up @@ -1098,6 +1126,12 @@ git-tree-sha1 = "7eb1686b4f04b82f96ed7a4ea5890a4f0c7a09f1"
uuid = "21216c6a-2e73-6563-6e65-726566657250"
version = "1.4.0"

[[deps.PrettyTables]]
deps = ["Crayons", "LaTeXStrings", "Markdown", "Printf", "Reexport", "StringManipulation", "Tables"]
git-tree-sha1 = "ee094908d720185ddbdc58dbe0c1cbe35453ec7a"
uuid = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
version = "2.2.7"

[[deps.Primes]]
deps = ["IntegerMathUtils"]
git-tree-sha1 = "4c9f306e5d6603ae203c2000dd460d81a5251489"
Expand Down Expand Up @@ -1251,6 +1285,12 @@ git-tree-sha1 = "30449ee12237627992a99d5e30ae63e4d78cd24a"
uuid = "6c6a2e73-6563-6170-7368-637461726353"
version = "1.2.0"

[[deps.SentinelArrays]]
deps = ["Dates", "Random"]
git-tree-sha1 = "04bdff0b09c65ff3e06a05e3eb7b120223da3d39"
uuid = "91c51154-3ec4-41a3-a24f-3f23e20d615c"
version = "1.4.0"

[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

Expand Down Expand Up @@ -1328,6 +1368,12 @@ weakdeps = ["ChainRulesCore"]
[deps.SpecialFunctions.extensions]
SpecialFunctionsChainRulesCoreExt = "ChainRulesCore"

[[deps.StableRNGs]]
deps = ["Random", "Test"]
git-tree-sha1 = "3be7d49667040add7ee151fefaf1f8c04c8c8276"
uuid = "860ef19b-820b-49d6-a774-d7a799459cd3"
version = "1.0.0"

[[deps.Static]]
deps = ["IfElse"]
git-tree-sha1 = "f295e0a1da4ca425659c57441bcb59abb035a4bc"
Expand Down Expand Up @@ -1400,6 +1446,12 @@ git-tree-sha1 = "f02eb61eb5c97b48c153861c72fbbfdddc607e06"
uuid = "7792a7ef-975c-4747-a70f-980b88e8d1da"
version = "0.4.17"

[[deps.StringManipulation]]
deps = ["PrecompileTools"]
git-tree-sha1 = "25ad9b0ccbc6cc63dfff1eb3f4bbb4d3e0d8a491"
uuid = "892a3eda-7b42-436c-8928-eab12a02cf0e"
version = "0.3.2"

[[deps.StructArrays]]
deps = ["Adapt", "DataAPI", "GPUArraysCore", "StaticArraysCore", "Tables"]
git-tree-sha1 = "521a0e828e98bb69042fec1809c1b5a680eb7389"
Expand Down
5 changes: 5 additions & 0 deletions benchmarks/OptimizationFrameworks/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[deps]
ADNLPModels = "54578032-b7ea-4c30-94aa-7cbd1cce6c9a"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
ConcreteStructs = "2569d6c7-a4a2-43d3-a901-331e8e4be471"
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Expand All @@ -12,7 +15,9 @@ Optim = "429524aa-4258-5aef-a3af-852621145aeb"
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
OptimizationMOI = "fd9f6733-72f4-499f-8506-86b2bdd0dea1"
PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"

[compat]
Expand Down
103 changes: 103 additions & 0 deletions benchmarks/OptimizationFrameworks/opf_data/pglib_opf_case3_lmbd.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% %%%%%
%%%% IEEE PES Power Grid Library - Optimal Power Flow - v23.07 %%%%%
%%%% (https://github.com/power-grid-lib/pglib-opf) %%%%%
%%%% Benchmark Group - Typical Operations %%%%%
%%%% 23 - July - 2023 %%%%%
%%%% %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The semidefinite relaxation of the OPF problem successfully solves
% this network with a value of 60 MVA for the line-flow limit on the line from
% bus 2 to bus 3. The semidefinite relaxation fails to give a physically
% meaningful solution to this network with a value of 50 MVA for the line-flow
% limit on this line. See the following publication for further details.
%
% Lesieutre, B.C. & Molzahn, D.K. & Borden, AR. & Demarco, C.L.,
% "Examining the Limits of the Application of Semidefinite Programming to Power Flow Problems",
% 49th Annual Allerton Conference on Communication, Control, and Computing (Allerton),
% September, 2011, pp. 1492-1499
%
% opt objective value: 5812.64 $/hr
%
% Bus Voltage Generation Load Lambda($/MVA-hr)
% # Mag(pu) Ang(deg) P (MW) Q (MVAr) P (MW) Q (MVAr) P Q
% ----- ------- -------- -------- -------- -------- -------- ------- -------
% 1 1.100 0.000* 148.07 54.70 110.00 40.00 37.575 -
% 2 0.926 7.259 170.01 -8.79 110.00 40.00 30.101 -
% 3 0.900 -17.267 0.00 -4.84 95.00 50.00 45.537 -
% -------- -------- -------- --------
% Total: 318.07 41.06 315.00 130.00
%
% Copyright (c) 2011 by The Institute of Electrical and Electronics Engineers (IEEE)
% Licensed under the Creative Commons Attribution 4.0
% International license, http://creativecommons.org/licenses/by/4.0/
%
% Contact M.E. Brennan ([email protected]) for inquries on further reuse of
% this dataset.
%
function mpc = pglib_opf_case3_lmbd
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 3 110.0 40.0 0.0 0.0 1 1.00000 0.00000 240.0 1 1.10000 0.90000;
2 2 110.0 40.0 0.0 0.0 1 1.00000 0.00000 240.0 1 1.10000 0.90000;
3 2 95.0 50.0 0.0 0.0 1 1.00000 0.00000 240.0 1 1.10000 0.90000;
];

%% generator data
% bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin
mpc.gen = [
1 1000.0 0.0 1000.0 -1000.0 1.0 100.0 1 2000.0 0.0;
2 1000.0 0.0 1000.0 -1000.0 1.0 100.0 1 2000.0 0.0;
3 0.0 0.0 1000.0 -1000.0 1.0 100.0 1 0.0 0.0;
];

%% generator cost data
% 2 startup shutdown n c(n-1) ... c0
mpc.gencost = [
2 0.0 0.0 3 0.110000 5.000000 0.000000;
2 0.0 0.0 3 0.085000 1.200000 0.000000;
2 0.0 0.0 3 0.000000 0.000000 0.000000;
];

%% branch data
% fbus tbus r x b rateA rateB rateC ratio angle status angmin angmax
mpc.branch = [
1 3 0.065 0.62 0.45 9000.0 9000.0 9000.0 0.0 0.0 1 -30.0 30.0;
3 2 0.025 0.75 0.7 50.0 50.0 50.0 0.0 0.0 1 -30.0 30.0;
1 2 0.042 0.9 0.3 9000.0 9000.0 9000.0 0.0 0.0 1 -30.0 30.0;
];

% INFO : === Translation Options ===
% INFO : Phase Angle Bound: 30.0 (deg.)
% INFO : Setting Flat Start
% INFO :
% INFO : === Generator Bounds Update Notes ===
% INFO :
% INFO : === Base KV Replacement Notes ===
% INFO :
% INFO : === Transformer Setting Replacement Notes ===
% INFO :
% INFO : === Line Capacity Monotonicity Notes ===
% INFO : Updated Thermal Rating: on line 1-3 : Rate B, Rate C - 0.0, 0.0 -> 9000.0, 9000.0
% INFO : Updated Thermal Rating: on line 3-2 : Rate B, Rate C - 0.0, 0.0 -> 50.0, 50.0
% INFO : Updated Thermal Rating: on line 1-2 : Rate B, Rate C - 0.0, 0.0 -> 9000.0, 9000.0
% INFO :
% INFO : === Voltage Setpoint Replacement Notes ===
% INFO : Bus 1 : V=1.0, theta=0.0 -> V=1.0, theta=0.0
% INFO : Bus 2 : V=1.0, theta=0.0 -> V=1.0, theta=0.0
% INFO : Bus 3 : V=1.0, theta=0.0 -> V=1.0, theta=0.0
% INFO :
% INFO : === Generator Setpoint Replacement Notes ===
% INFO : Gen at bus 1 : Pg=0.0, Qg=0.0 -> Pg=1000.0, Qg=0.0
% INFO : Gen at bus 1 : Vg=1.0 -> Vg=1.0
% INFO : Gen at bus 2 : Pg=0.0, Qg=0.0 -> Pg=1000.0, Qg=0.0
% INFO : Gen at bus 2 : Vg=1.0 -> Vg=1.0
% INFO : Gen at bus 3 : Pg=0.0, Qg=0.0 -> Pg=0.0, Qg=0.0
% INFO : Gen at bus 3 : Vg=1.0 -> Vg=1.0
% INFO :
% INFO : === Writing Matpower Case File Notes ===
Loading

0 comments on commit af96d44

Please sign in to comment.