Datasets:
Convert dataset to Parquet (part 00002-of-00003) (#3)
Browse files- Convert dataset to Parquet (part 00002-of-00003) (47703d2e0f39972b6ea57cf881b819e2b71ca0f6)
- Delete data file (31dc63eabe607afd1c2e650f2a12c24d777f7876)
- Delete loading script (1aa2104213615158713196c46ea5e5f6f9748529)
- Delete data file (7587058645123a5577ad0ef6095e186cdfc1b4f9)
- Delete data file (e5f0efc24ad15fa9aa0366f59aafd8e3e6464ec5)
- Delete data file (5d90251c524026693676998787d1f54fd542e2bf)
- Delete data file (e755535f9207ca9c8fcca483db8d83ad447d9c55)
- Delete data file (4bf2764348f6a5bcf76fa183935f69d4219a1b4d)
- Delete data file (ba7c0ef7e458e14fbdcce642283920e62446e93e)
- Delete data file (f8d5977070b13983116a4d3fdaa6defb1a159cf6)
- Delete data file (6795c75e43be1a7ca8dbfa07a3544e45bee0623f)
- Delete data file (0972248756a777b0af5e5b3d891b563528373764)
- Delete data file (36df9d65dc5c2189d69eb02d7b1a6a807428bbde)
- Delete data file (eda42c1d7df2923f914e467a2867b8f06de1e11c)
- Delete data file (071c4986fcb841b56af11a31b2deda88d555e4f7)
- Delete data file (c852e8ed72b6397e7e4bb8e7bdd2692039e73f79)
- Delete data file (d3d5f613911c42e068726995862294c8535e5f02)
- Delete data file (3ed49198ae16d44284a9c0246f982cf4f1654f90)
- Delete data file (da9c33a0bde23ec778d78cb93e1519900cc87e02)
- Delete data file (2f97d430dfbcb0ca81adb1257c59e68dcd894d02)
- Delete data file (3a99720d006125791eabbcd11c5eaf96a418071c)
- Delete data file (01d2909f2bebe317f56cdb40353e515bca691b3d)
- Delete data file (03d1ae8e6b59366143b9fea5931247d01d0b2e9f)
- Delete data file (d826fceb488865a942f9bfd8b7e93120e7ea48bd)
- Delete data file (2cc7994cba7a78000ae743e5165ce2ba78e25686)
- Delete data file (d33da84bd6c6e84cd9d3f7136b4a77cdc6db5306)
- Delete data file (8c51de57ab202b5a194ff1d8ad54608cc6c3e2f8)
- Delete data file (7e61f811e203c907f281875d1ea32465a53f9247)
- Delete data file (a0a41490ce1e0fdf4a817e1bd713540f3024412e)
- Delete data file (41d675b301f06ab28e43a4908a700de3c53badfa)
- Delete data file (8cf755441e74cf7f58468d008a3f2b69bd043adc)
- Delete data file (fc46a923f1e8731cc87a0adaa71977129584d1a0)
- Delete data file (2bc62d803f3c78a8a9626f7a4340336b4881fd2b)
- Delete data file (a6f11b13e926a9a691dbea7b8247811954dc6a3f)
- infeasible/ACOPF/meta.h5.gz → 30_ieee/test-00000-of-00030.parquet +2 -2
- case.json.gz → 30_ieee/test-00001-of-00030.parquet +2 -2
- infeasible/ACOPF/primal.h5.gz → 30_ieee/test-00002-of-00030.parquet +2 -2
- infeasible/ACOPF/dual.h5.gz → 30_ieee/test-00003-of-00030.parquet +2 -2
- 30_ieee/test-00004-of-00030.parquet +3 -0
- 30_ieee/test-00005-of-00030.parquet +3 -0
- 30_ieee/test-00006-of-00030.parquet +3 -0
- 30_ieee/test-00007-of-00030.parquet +3 -0
- 30_ieee/test-00008-of-00030.parquet +3 -0
- 30_ieee/test-00009-of-00030.parquet +3 -0
- 30_ieee/test-00010-of-00030.parquet +3 -0
- 30_ieee/test-00011-of-00030.parquet +3 -0
- 30_ieee/test-00012-of-00030.parquet +3 -0
- 30_ieee/test-00013-of-00030.parquet +3 -0
- 30_ieee/test-00014-of-00030.parquet +3 -0
- 30_ieee/test-00015-of-00030.parquet +3 -0
- 30_ieee/test-00016-of-00030.parquet +3 -0
- 30_ieee/test-00017-of-00030.parquet +3 -0
- 30_ieee/test-00018-of-00030.parquet +3 -0
- 30_ieee/test-00019-of-00030.parquet +3 -0
- 30_ieee/test-00020-of-00030.parquet +3 -0
- 30_ieee/test-00021-of-00030.parquet +3 -0
- 30_ieee/test-00022-of-00030.parquet +3 -0
- 30_ieee/test-00023-of-00030.parquet +3 -0
- 30_ieee/test-00024-of-00030.parquet +3 -0
- 30_ieee/test-00025-of-00030.parquet +3 -0
- 30_ieee/test-00026-of-00030.parquet +3 -0
- 30_ieee/test-00027-of-00030.parquet +3 -0
- 30_ieee/test-00028-of-00030.parquet +3 -0
- 30_ieee/test-00029-of-00030.parquet +3 -0
- 30_ieee/train-00100-of-00119.parquet +3 -0
- 30_ieee/train-00101-of-00119.parquet +3 -0
- 30_ieee/train-00102-of-00119.parquet +3 -0
- 30_ieee/train-00103-of-00119.parquet +3 -0
- 30_ieee/train-00104-of-00119.parquet +3 -0
- 30_ieee/train-00105-of-00119.parquet +3 -0
- 30_ieee/train-00106-of-00119.parquet +3 -0
- 30_ieee/train-00107-of-00119.parquet +3 -0
- 30_ieee/train-00108-of-00119.parquet +3 -0
- 30_ieee/train-00109-of-00119.parquet +3 -0
- 30_ieee/train-00110-of-00119.parquet +3 -0
- 30_ieee/train-00111-of-00119.parquet +3 -0
- 30_ieee/train-00112-of-00119.parquet +3 -0
- 30_ieee/train-00113-of-00119.parquet +3 -0
- 30_ieee/train-00114-of-00119.parquet +3 -0
- 30_ieee/train-00115-of-00119.parquet +3 -0
- 30_ieee/train-00116-of-00119.parquet +3 -0
- 30_ieee/train-00117-of-00119.parquet +3 -0
- 30_ieee/train-00118-of-00119.parquet +3 -0
- PGLearn-Small-30_ieee.py +0 -397
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8c68d288dd453d72417dbac767cf79ced1320876856c03853a4069f637cb1876
|
3 |
+
size 82966160
|
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:db996e7b3771d7b8a6c768e8f0f51a78e562e09f3c045a1926ac04701ccd9b09
|
3 |
+
size 82969249
|
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2314b5e85d4798f9b5bb7286a6ebeab632d6dece95cc1951e79d74cb4d6407ae
|
3 |
+
size 82963556
|
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:55b2fec1246115236e0edc75c7a6a95564eba3ac991e28bf2ee8ccbb1c492de6
|
3 |
+
size 82978609
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f8147222b8cba238d976defa42a6e91c60b200d4f0465b2a6d81e6f1754268c4
|
3 |
+
size 82961477
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cd4841e6e984333c52f3f9a27603281f4b34ee6c04aee939c9224ad67eb02c86
|
3 |
+
size 82976841
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:11b874b2f91ff5b779eefdebfe981493205f64d925eac306cd417304a6c402df
|
3 |
+
size 82968276
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:13813f44a856521a67e7365b900fa5a9c1488274a4bf2ef112590adad0297bf4
|
3 |
+
size 82968567
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ff05cd48d9411db934e32c90c39c6ab3451b7b4801d7d607cb19c7f582e075d8
|
3 |
+
size 82967211
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:067e8d2bb4987caa3484e1ce5fa108d4f43b1a2ab324087fb4f00c79c1b2cbdb
|
3 |
+
size 82964759
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:901110aaaa04c092b5d2d201bb328d645d8ea9779c3d9368099affa07181c8fb
|
3 |
+
size 82977013
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:302e668023d4a8f3f09dd16cfd814dfd205337ad064995bde52ab8ab3d64b34b
|
3 |
+
size 82968739
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2588773ea56ef6233780ec1f8ad30c4726640a7e3febd17b76713ac0b2437e65
|
3 |
+
size 82968617
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6f4410df2cb11ae489b59baf3adf3dca0422a70283c6c1aa8e26c3f4f90999cd
|
3 |
+
size 82972857
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c3fea0cf958e7d32c6a55110eb686dd37ae9f046bde610c19a24dae08778efc4
|
3 |
+
size 82972722
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:258290c86c21865db9ddaa6f50e2c1cb160399bc1d4ac70596d41c55844aef81
|
3 |
+
size 82971512
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5f2358041fac5ddf36ae5904c1b98c2c38b10f1b123835db13c12183e1b2c267
|
3 |
+
size 82975902
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e81e81dd90e641464db03aaa8b2b4070f3817caae3d226b1dec562d672d75517
|
3 |
+
size 82967610
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bf17a2738a18ba8dd6ab13c4090a0e8a4542f79ef9a6d5a9bcade6a1ecaca338
|
3 |
+
size 82970111
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cd3dfab4ea0b9a419946f428cee026ed60d3891def5e6bb36e50f68bd8c6e380
|
3 |
+
size 82975068
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3c68fe5c96565e4055f0d9dcad6bd7efdbc1e58d0b3c09616fa9da954ade4069
|
3 |
+
size 82970948
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3006b11696b4df694fa9606ab05e9143408e677825ccc49cbbd8f32c445314a7
|
3 |
+
size 82971115
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1ef4d93d2e5fcf42d386f69d9159c53a3a553232e36d1e6b39bb25ea11365feb
|
3 |
+
size 82967343
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7614bcbfda69d888de4e84fe182932f4acf0292f7c13df010706968ebc5816d9
|
3 |
+
size 82972218
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6fff700edecc09862d8515bfc0c97b543985051b397bd98f2ccae80e6b66b120
|
3 |
+
size 82976426
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bacc931782c82a07dd3a2e301c2694ef3943f6507618a84594a9b4f414fb9b78
|
3 |
+
size 82970641
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ab93905acd7c7f1ee1711bb277a3c08a725210d50f5411137491a01d23537732
|
3 |
+
size 82968940
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b1ad6c47ea57f6bb4c72c4593f6a7573528426c09b5ab5166fdee2f5090ea21d
|
3 |
+
size 82957989
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:77224a8b18415e7bcded1a5a4e725b3d1da1eb02eebde7973a0987eb95260459
|
3 |
+
size 82956175
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4a84056046ed719eccaea78a23f1cef78d3b2a83b718139202b7cb632d6beaa7
|
3 |
+
size 82953894
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4ef969a19fc296e91d505943a872edb225afc53c52a3d43ef61932785b9a7bca
|
3 |
+
size 83656831
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f217d8016572bcccb1449d128cd9b4ebe702a05bdc5520899bb99dd42eca346c
|
3 |
+
size 83656115
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0ccf2f946be55635fd7fbdf43b277cdd76d9f13b53d37505d8796c949721471e
|
3 |
+
size 83663301
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:772eb97eac50b08e1c7025215eb294113f4302be246ae99e863f52cb9d8634fd
|
3 |
+
size 83664324
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dfd8f281a066550f31c11dd20275c6b76440556afd2574d1210ad09d657271fb
|
3 |
+
size 83661518
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a318fbe2157b4b175eb0043f0b729eb16b38f2778a36d22145acbd7294291760
|
3 |
+
size 83661440
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c5dab53cf6c8ec520851e9384c2a6955226f49009633e2f241ec2ad25ead48d5
|
3 |
+
size 83665018
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:490f4b899d27c94646500a671a9cca241467a2c97b0dde4e8c8eaf5557d2953e
|
3 |
+
size 83666776
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1822b3c6fec5c084179644020e3827404e937cd94140f69862b8b9f44e38970f
|
3 |
+
size 83665168
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a83c7580af79bca2c2257abbc19cce1c11c332e6bdd8cc0c318dec5984cf32b8
|
3 |
+
size 83661855
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:db885afccfa17aacfb7a539c2b9810d5665fe9c187b6e0eb12054ace8b826aaf
|
3 |
+
size 83669681
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6767077628e3d4903ebdab0d60f4b1800983f813c8c5779348d41a705905d696
|
3 |
+
size 83665598
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1e390b3c3f89d0570575747dafdd4daf26cace858bf12cfdd162bcc01dc9d3fe
|
3 |
+
size 83668103
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:12723353d1328011292e7e45be62f812a5c07c8828d6c45e3840e3cc7a859fbf
|
3 |
+
size 83665087
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2cf5b9c3fe48416c5163748a7830f8c88735d8d74f3fa4406dd8e1fd0f123032
|
3 |
+
size 83657937
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c9a4f3b28c8b99d32efa63a371fb9c84c6a8ff7bbeb9db5ba340d472288e7f52
|
3 |
+
size 83658259
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7b0398e3a35381ceca25bd1d858697650ecfa8a693e5159f90b4f38d4e3fdc12
|
3 |
+
size 83663130
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b84a3e5e377af30a1e0645bca85b518dbe1afce4b05e25890a58fae5aaf0d10d
|
3 |
+
size 83669676
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b37c14829e767649f6ed220136bd1db196d97b8a72eaa84c4e6fa0b0aedf2bc3
|
3 |
+
size 83668277
|
@@ -1,397 +0,0 @@
|
|
1 |
-
from __future__ import annotations
|
2 |
-
from dataclasses import dataclass
|
3 |
-
from pathlib import Path
|
4 |
-
import json
|
5 |
-
import gzip
|
6 |
-
|
7 |
-
import datasets as hfd
|
8 |
-
import h5py
|
9 |
-
import pyarrow as pa
|
10 |
-
|
11 |
-
# ┌──────────────┐
|
12 |
-
# │ Metadata │
|
13 |
-
# └──────────────┘
|
14 |
-
|
15 |
-
@dataclass
|
16 |
-
class CaseSizes:
|
17 |
-
n_bus: int
|
18 |
-
n_load: int
|
19 |
-
n_gen: int
|
20 |
-
n_branch: int
|
21 |
-
|
22 |
-
CASENAME = "30_ieee"
|
23 |
-
SIZES = CaseSizes(n_bus=30, n_load=21, n_gen=6, n_branch=41)
|
24 |
-
NUM_TRAIN = 793067
|
25 |
-
NUM_TEST = 198267
|
26 |
-
NUM_INFEASIBLE = 8666
|
27 |
-
|
28 |
-
URL = "https://huggingface.co/datasets/PGLearn/PGLearn-Small-30_ieee"
|
29 |
-
DESCRIPTION = """\
|
30 |
-
The 30_ieee PGLearn optimal power flow dataset, part of the PGLearn-Small collection. \
|
31 |
-
"""
|
32 |
-
VERSION = hfd.Version("1.0.0")
|
33 |
-
DEFAULT_CONFIG_DESCRIPTION="""\
|
34 |
-
This configuration contains feasible input, metadata, primal solution, and dual solution data \
|
35 |
-
for the ACOPF, DCOPF, and SOCOPF formulations on the {case} system.
|
36 |
-
"""
|
37 |
-
USE_ML4OPF_WARNING = """
|
38 |
-
================================================================================================
|
39 |
-
Loading PGLearn-Small-30_ieee through the `datasets.load_dataset` function may be slow.
|
40 |
-
|
41 |
-
Consider using ML4OPF to directly convert to `torch.Tensor`; for more info see:
|
42 |
-
https://github.com/AI4OPT/ML4OPF?tab=readme-ov-file#manually-loading-data
|
43 |
-
|
44 |
-
Or, use `huggingface_hub.snapshot_download` and an HDF5 reader; for more info see:
|
45 |
-
https://huggingface.co/datasets/PGLearn/PGLearn-Small-30_ieee#downloading-individual-files
|
46 |
-
================================================================================================
|
47 |
-
"""
|
48 |
-
CITATION = """\
|
49 |
-
@article{klamkinpglearn,
|
50 |
-
title={{PGLearn - An Open-Source Learning Toolkit for Optimal Power Flow}},
|
51 |
-
author={Klamkin, Michael and Tanneau, Mathieu and Van Hentenryck, Pascal},
|
52 |
-
year={2025},
|
53 |
-
}\
|
54 |
-
"""
|
55 |
-
|
56 |
-
IS_COMPRESSED = True
|
57 |
-
|
58 |
-
# ┌──────────────────┐
|
59 |
-
# │ Formulations │
|
60 |
-
# └──────────────────┘
|
61 |
-
|
62 |
-
def acopf_features(sizes: CaseSizes, primal: bool, dual: bool, meta: bool):
|
63 |
-
features = {}
|
64 |
-
if primal: features.update(acopf_primal_features(sizes))
|
65 |
-
if dual: features.update(acopf_dual_features(sizes))
|
66 |
-
if meta: features.update({f"ACOPF/{k}": v for k, v in META_FEATURES.items()})
|
67 |
-
return features
|
68 |
-
|
69 |
-
def dcopf_features(sizes: CaseSizes, primal: bool, dual: bool, meta: bool):
|
70 |
-
features = {}
|
71 |
-
if primal: features.update(dcopf_primal_features(sizes))
|
72 |
-
if dual: features.update(dcopf_dual_features(sizes))
|
73 |
-
if meta: features.update({f"DCOPF/{k}": v for k, v in META_FEATURES.items()})
|
74 |
-
return features
|
75 |
-
|
76 |
-
def socopf_features(sizes: CaseSizes, primal: bool, dual: bool, meta: bool):
|
77 |
-
features = {}
|
78 |
-
if primal: features.update(socopf_primal_features(sizes))
|
79 |
-
if dual: features.update(socopf_dual_features(sizes))
|
80 |
-
if meta: features.update({f"SOCOPF/{k}": v for k, v in META_FEATURES.items()})
|
81 |
-
return features
|
82 |
-
|
83 |
-
FORMULATIONS_TO_FEATURES = {
|
84 |
-
"ACOPF": acopf_features,
|
85 |
-
"DCOPF": dcopf_features,
|
86 |
-
"SOCOPF": socopf_features,
|
87 |
-
}
|
88 |
-
|
89 |
-
# ┌───────────────────┐
|
90 |
-
# │ BuilderConfig │
|
91 |
-
# └───────────────────┘
|
92 |
-
|
93 |
-
class PGLearnSmall30_ieeeConfig(hfd.BuilderConfig):
|
94 |
-
"""BuilderConfig for PGLearn-Small-30_ieee.
|
95 |
-
By default, primal solution data, metadata, input, casejson, are included for the train and test splits.
|
96 |
-
|
97 |
-
To modify the default configuration, pass attributes of this class to `datasets.load_dataset`:
|
98 |
-
|
99 |
-
Attributes:
|
100 |
-
formulations (list[str]): The formulation(s) to include, e.g. ["ACOPF", "DCOPF"]
|
101 |
-
primal (bool, optional): Include primal solution data. Defaults to True.
|
102 |
-
dual (bool, optional): Include dual solution data. Defaults to False.
|
103 |
-
meta (bool, optional): Include metadata. Defaults to True.
|
104 |
-
input (bool, optional): Include input data. Defaults to True.
|
105 |
-
casejson (bool, optional): Include case.json data. Defaults to True.
|
106 |
-
train (bool, optional): Include training samples. Defaults to True.
|
107 |
-
test (bool, optional): Include testing samples. Defaults to True.
|
108 |
-
infeasible (bool, optional): Include infeasible samples. Defaults to False.
|
109 |
-
"""
|
110 |
-
def __init__(self,
|
111 |
-
formulations: list[str],
|
112 |
-
primal: bool=True, dual: bool=False, meta: bool=True, input: bool = True, casejson: bool=True,
|
113 |
-
train: bool=True, test: bool=True, infeasible: bool=False,
|
114 |
-
compressed: bool=IS_COMPRESSED, **kwargs
|
115 |
-
):
|
116 |
-
super(PGLearnSmall30_ieeeConfig, self).__init__(version=VERSION, **kwargs)
|
117 |
-
|
118 |
-
self.case = CASENAME
|
119 |
-
self.formulations = formulations
|
120 |
-
|
121 |
-
self.primal = primal
|
122 |
-
self.dual = dual
|
123 |
-
self.meta = meta
|
124 |
-
self.input = input
|
125 |
-
self.casejson = casejson
|
126 |
-
|
127 |
-
self.train = train
|
128 |
-
self.test = test
|
129 |
-
self.infeasible = infeasible
|
130 |
-
|
131 |
-
self.gz_ext = ".gz" if compressed else ""
|
132 |
-
|
133 |
-
@property
|
134 |
-
def size(self):
|
135 |
-
return SIZES
|
136 |
-
|
137 |
-
@property
|
138 |
-
def features(self):
|
139 |
-
features = {}
|
140 |
-
if self.casejson: features.update(case_features())
|
141 |
-
if self.input: features.update(input_features(SIZES))
|
142 |
-
for formulation in self.formulations:
|
143 |
-
features.update(FORMULATIONS_TO_FEATURES[formulation](SIZES, self.primal, self.dual, self.meta))
|
144 |
-
return hfd.Features(features)
|
145 |
-
|
146 |
-
@property
|
147 |
-
def splits(self):
|
148 |
-
splits: dict[hfd.Split, dict[str, str | int]] = {}
|
149 |
-
if self.train:
|
150 |
-
splits[hfd.Split.TRAIN] = {
|
151 |
-
"name": "train",
|
152 |
-
"num_examples": NUM_TRAIN
|
153 |
-
}
|
154 |
-
if self.test:
|
155 |
-
splits[hfd.Split.TEST] = {
|
156 |
-
"name": "test",
|
157 |
-
"num_examples": NUM_TEST
|
158 |
-
}
|
159 |
-
if self.infeasible:
|
160 |
-
splits[hfd.Split("infeasible")] = {
|
161 |
-
"name": "infeasible",
|
162 |
-
"num_examples": NUM_INFEASIBLE
|
163 |
-
}
|
164 |
-
return splits
|
165 |
-
|
166 |
-
@property
|
167 |
-
def urls(self):
|
168 |
-
urls: dict[str, None | str | list] = {
|
169 |
-
"case": None, "train": [], "test": [], "infeasible": [],
|
170 |
-
}
|
171 |
-
|
172 |
-
if self.casejson: urls["case"] = f"case.json" + self.gz_ext
|
173 |
-
|
174 |
-
split_names = []
|
175 |
-
if self.train: split_names.append("train")
|
176 |
-
if self.test: split_names.append("test")
|
177 |
-
if self.infeasible: split_names.append("infeasible")
|
178 |
-
|
179 |
-
for split in split_names:
|
180 |
-
if self.input: urls[split].append(f"{split}/input.h5" + self.gz_ext)
|
181 |
-
for formulation in self.formulations:
|
182 |
-
if self.primal: urls[split].append(f"{split}/{formulation}/primal.h5" + self.gz_ext)
|
183 |
-
if self.dual: urls[split].append(f"{split}/{formulation}/dual.h5" + self.gz_ext)
|
184 |
-
if self.meta: urls[split].append(f"{split}/{formulation}/meta.h5" + self.gz_ext)
|
185 |
-
return urls
|
186 |
-
|
187 |
-
# ┌────────────────────┐
|
188 |
-
# │ DatasetBuilder │
|
189 |
-
# └────────────────────┘
|
190 |
-
|
191 |
-
class PGLearnSmall30_ieee(hfd.ArrowBasedBuilder):
|
192 |
-
"""DatasetBuilder for PGLearn-Small-30_ieee.
|
193 |
-
The main interface is `datasets.load_dataset` with `trust_remote_code=True`, e.g.
|
194 |
-
|
195 |
-
```python
|
196 |
-
from datasets import load_dataset
|
197 |
-
ds = load_dataset("PGLearn/PGLearn-Small-30_ieee", trust_remote_code=True,
|
198 |
-
# modify the default configuration by passing kwargs
|
199 |
-
formulations=["DCOPF"],
|
200 |
-
dual=False,
|
201 |
-
meta=False,
|
202 |
-
)
|
203 |
-
```
|
204 |
-
"""
|
205 |
-
|
206 |
-
DEFAULT_WRITER_BATCH_SIZE = 10000
|
207 |
-
BUILDER_CONFIG_CLASS = PGLearnSmall30_ieeeConfig
|
208 |
-
DEFAULT_CONFIG_NAME=CASENAME
|
209 |
-
BUILDER_CONFIGS = [
|
210 |
-
PGLearnSmall30_ieeeConfig(
|
211 |
-
name=CASENAME, description=DEFAULT_CONFIG_DESCRIPTION.format(case=CASENAME),
|
212 |
-
formulations=list(FORMULATIONS_TO_FEATURES.keys()),
|
213 |
-
primal=True, dual=True, meta=True, input=True, casejson=True,
|
214 |
-
train=True, test=True, infeasible=False,
|
215 |
-
)
|
216 |
-
]
|
217 |
-
|
218 |
-
def _info(self):
|
219 |
-
return hfd.DatasetInfo(
|
220 |
-
features=self.config.features, splits=self.config.splits,
|
221 |
-
description=DESCRIPTION + self.config.description,
|
222 |
-
homepage=URL, citation=CITATION,
|
223 |
-
)
|
224 |
-
|
225 |
-
def _split_generators(self, dl_manager: hfd.DownloadManager):
|
226 |
-
hfd.logging.get_logger().warning(USE_ML4OPF_WARNING)
|
227 |
-
|
228 |
-
filepaths = dl_manager.download_and_extract(self.config.urls)
|
229 |
-
|
230 |
-
splits: list[hfd.SplitGenerator] = []
|
231 |
-
if self.config.train:
|
232 |
-
splits.append(hfd.SplitGenerator(
|
233 |
-
name=hfd.Split.TRAIN,
|
234 |
-
gen_kwargs=dict(case_file=filepaths["case"], data_files=tuple(filepaths["train"]), n_samples=NUM_TRAIN),
|
235 |
-
))
|
236 |
-
if self.config.test:
|
237 |
-
splits.append(hfd.SplitGenerator(
|
238 |
-
name=hfd.Split.TEST,
|
239 |
-
gen_kwargs=dict(case_file=filepaths["case"], data_files=tuple(filepaths["test"]), n_samples=NUM_TEST),
|
240 |
-
))
|
241 |
-
if self.config.infeasible:
|
242 |
-
splits.append(hfd.SplitGenerator(
|
243 |
-
name=hfd.Split("infeasible"),
|
244 |
-
gen_kwargs=dict(case_file=filepaths["case"], data_files=tuple(filepaths["infeasible"]), n_samples=NUM_INFEASIBLE),
|
245 |
-
))
|
246 |
-
return splits
|
247 |
-
|
248 |
-
def _generate_tables(self, case_file: str | None, data_files: tuple[hfd.utils.track.tracked_str], n_samples: int):
|
249 |
-
case_data: str | None = json.dumps(json.load(open_maybe_gzip(case_file))) if case_file is not None else None
|
250 |
-
|
251 |
-
opened_files = [open_maybe_gzip(file) for file in data_files]
|
252 |
-
data = {'/'.join(Path(df.get_origin()).parts[-2:]).split('.')[0]: h5py.File(of) for of, df in zip(opened_files, data_files)}
|
253 |
-
for k in list(data.keys()):
|
254 |
-
if "/input" in k: data[k.split("/", 1)[1]] = data.pop(k)
|
255 |
-
|
256 |
-
batch_size = self._writer_batch_size or self.DEFAULT_WRITER_BATCH_SIZE
|
257 |
-
for i in range(0, n_samples, batch_size):
|
258 |
-
effective_batch_size = min(batch_size, n_samples - i)
|
259 |
-
|
260 |
-
sample_data = {
|
261 |
-
f"{dk}/{k}":
|
262 |
-
hfd.features.features.numpy_to_pyarrow_listarray(v[i:i + effective_batch_size, ...])
|
263 |
-
for dk, d in data.items() for k, v in d.items() if f"{dk}/{k}" in self.config.features
|
264 |
-
}
|
265 |
-
|
266 |
-
if case_data is not None:
|
267 |
-
sample_data["case/json"] = pa.array([case_data] * effective_batch_size)
|
268 |
-
|
269 |
-
yield i, pa.Table.from_pydict(sample_data)
|
270 |
-
|
271 |
-
for f in opened_files:
|
272 |
-
f.close()
|
273 |
-
|
274 |
-
# ┌──────────────┐
|
275 |
-
# │ Features │
|
276 |
-
# └──────────────┘
|
277 |
-
|
278 |
-
FLOAT_TYPE = "float32"
|
279 |
-
INT_TYPE = "int64"
|
280 |
-
BOOL_TYPE = "bool"
|
281 |
-
STRING_TYPE = "string"
|
282 |
-
|
283 |
-
def case_features():
|
284 |
-
# FIXME: better way to share schema of case data -- need to treat jagged arrays
|
285 |
-
return {
|
286 |
-
"case/json": hfd.Value(STRING_TYPE),
|
287 |
-
}
|
288 |
-
|
289 |
-
META_FEATURES = {
|
290 |
-
"meta/seed": hfd.Value(dtype=INT_TYPE),
|
291 |
-
"meta/formulation": hfd.Value(dtype=STRING_TYPE),
|
292 |
-
"meta/primal_objective_value": hfd.Value(dtype=FLOAT_TYPE),
|
293 |
-
"meta/dual_objective_value": hfd.Value(dtype=FLOAT_TYPE),
|
294 |
-
"meta/primal_status": hfd.Value(dtype=STRING_TYPE),
|
295 |
-
"meta/dual_status": hfd.Value(dtype=STRING_TYPE),
|
296 |
-
"meta/termination_status": hfd.Value(dtype=STRING_TYPE),
|
297 |
-
"meta/build_time": hfd.Value(dtype=FLOAT_TYPE),
|
298 |
-
"meta/extract_time": hfd.Value(dtype=FLOAT_TYPE),
|
299 |
-
"meta/solve_time": hfd.Value(dtype=FLOAT_TYPE),
|
300 |
-
}
|
301 |
-
|
302 |
-
def input_features(sizes: CaseSizes):
|
303 |
-
return {
|
304 |
-
"input/pd": hfd.Sequence(length=sizes.n_load, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
305 |
-
"input/qd": hfd.Sequence(length=sizes.n_load, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
306 |
-
"input/gen_status": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=BOOL_TYPE)),
|
307 |
-
"input/branch_status": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=BOOL_TYPE)),
|
308 |
-
"input/seed": hfd.Value(dtype=INT_TYPE),
|
309 |
-
}
|
310 |
-
|
311 |
-
def acopf_primal_features(sizes: CaseSizes):
|
312 |
-
return {
|
313 |
-
"ACOPF/primal/vm": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
314 |
-
"ACOPF/primal/va": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
315 |
-
"ACOPF/primal/pg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
316 |
-
"ACOPF/primal/qg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
317 |
-
"ACOPF/primal/pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
318 |
-
"ACOPF/primal/pt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
319 |
-
"ACOPF/primal/qf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
320 |
-
"ACOPF/primal/qt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
321 |
-
}
|
322 |
-
def acopf_dual_features(sizes: CaseSizes):
|
323 |
-
return {
|
324 |
-
"ACOPF/dual/kcl_p": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
325 |
-
"ACOPF/dual/kcl_q": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
326 |
-
"ACOPF/dual/vm": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
327 |
-
"ACOPF/dual/pg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
328 |
-
"ACOPF/dual/qg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
329 |
-
"ACOPF/dual/ohm_pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
330 |
-
"ACOPF/dual/ohm_pt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
331 |
-
"ACOPF/dual/ohm_qf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
332 |
-
"ACOPF/dual/ohm_qt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
333 |
-
"ACOPF/dual/pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
334 |
-
"ACOPF/dual/pt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
335 |
-
"ACOPF/dual/qf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
336 |
-
"ACOPF/dual/qt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
337 |
-
"ACOPF/dual/va_diff": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
338 |
-
"ACOPF/dual/sm_fr": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
339 |
-
"ACOPF/dual/sm_to": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
340 |
-
"ACOPF/dual/slack_bus": hfd.Value(dtype=FLOAT_TYPE),
|
341 |
-
}
|
342 |
-
def dcopf_primal_features(sizes: CaseSizes):
|
343 |
-
return {
|
344 |
-
"DCOPF/primal/va": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
345 |
-
"DCOPF/primal/pg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
346 |
-
"DCOPF/primal/pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
347 |
-
}
|
348 |
-
def dcopf_dual_features(sizes: CaseSizes):
|
349 |
-
return {
|
350 |
-
"DCOPF/dual/kcl_p": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
351 |
-
"DCOPF/dual/pg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
352 |
-
"DCOPF/dual/ohm_pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
353 |
-
"DCOPF/dual/pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
354 |
-
"DCOPF/dual/va_diff": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
355 |
-
"DCOPF/dual/slack_bus": hfd.Value(dtype=FLOAT_TYPE),
|
356 |
-
}
|
357 |
-
def socopf_primal_features(sizes: CaseSizes):
|
358 |
-
return {
|
359 |
-
"SOCOPF/primal/w": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
360 |
-
"SOCOPF/primal/pg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
361 |
-
"SOCOPF/primal/qg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
362 |
-
"SOCOPF/primal/pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
363 |
-
"SOCOPF/primal/pt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
364 |
-
"SOCOPF/primal/qf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
365 |
-
"SOCOPF/primal/qt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
366 |
-
"SOCOPF/primal/wr": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
367 |
-
"SOCOPF/primal/wi": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
368 |
-
}
|
369 |
-
def socopf_dual_features(sizes: CaseSizes):
|
370 |
-
return {
|
371 |
-
"SOCOPF/dual/kcl_p": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
372 |
-
"SOCOPF/dual/kcl_q": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
373 |
-
"SOCOPF/dual/w": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
374 |
-
"SOCOPF/dual/pg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
375 |
-
"SOCOPF/dual/qg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
376 |
-
"SOCOPF/dual/ohm_pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
377 |
-
"SOCOPF/dual/ohm_pt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
378 |
-
"SOCOPF/dual/ohm_qf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
379 |
-
"SOCOPF/dual/ohm_qt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
380 |
-
"SOCOPF/dual/jabr": hfd.Array2D(shape=(sizes.n_branch, 4), dtype=FLOAT_TYPE),
|
381 |
-
"SOCOPF/dual/sm_fr": hfd.Array2D(shape=(sizes.n_branch, 3), dtype=FLOAT_TYPE),
|
382 |
-
"SOCOPF/dual/sm_to": hfd.Array2D(shape=(sizes.n_branch, 3), dtype=FLOAT_TYPE),
|
383 |
-
"SOCOPF/dual/va_diff": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
384 |
-
"SOCOPF/dual/wr": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
385 |
-
"SOCOPF/dual/wi": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
386 |
-
"SOCOPF/dual/pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
387 |
-
"SOCOPF/dual/pt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
388 |
-
"SOCOPF/dual/qf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
389 |
-
"SOCOPF/dual/qt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
390 |
-
}
|
391 |
-
|
392 |
-
# ┌───────────────┐
|
393 |
-
# │ Utilities │
|
394 |
-
# └───────────────┘
|
395 |
-
|
396 |
-
def open_maybe_gzip(path):
|
397 |
-
return gzip.open(path, "rb") if path.endswith(".gz") else open(path, "rb")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|