Datasets:
Convert dataset to Parquet (#1)
Browse files- Convert dataset to Parquet (ce2249b49aac7e9309456a6b40e5d8d593223d4e)
- Delete loading script (d65438d53895c450f47523ff3d39ed9df9e9688d)
- Delete data file (f9f3217af735a15749c0a8841c15cd5bf43b2c2c)
- Delete data file (b4565e9e2b5ca0cbffd99336b0f109a919db1abe)
- Delete data file (b658b5832de575ccad1dd8c26208b930e5b22e7a)
- Delete data file (4abb96c385c2c28921093eeb56495e4166e6c459)
- Delete data file (f7424dc8606fc3eb61d360c1b826c49466caccd0)
- Delete data file (0117da09b0aea1c17c1903f6418d3509125f0c01)
- Delete data file (37c3cf87b46c4b2923b5aca1d72d2ebd62ef4ade)
- Delete data file (fe94847ec7261b330c23174f9f9ffe0c80100af0)
- Delete data file (d7034f83f56bd63ed861b6a2bcd411f35822d57b)
- Delete data file (eb3b4b50efad85b9997f819cf5607e06391f2002)
- Delete data file (5bfeb17943994f53246c0a7ad58ed2df29f09aa3)
- Delete data file (170a7de011508b2dc9a7fc4a8ee898959105407d)
- Delete data file (54136acda98c6b3e33182aa7d19ca1ffaaed4a46)
- Delete data file (8c738dd5032e4e1db436939de070dc99cd7d3d67)
- Delete data file (668da19b09211e3feb4705929de5cb64a2a46ce8)
- Delete data file (5c2b2efc1523d10b3b1d8e3e2ca926930b42fb72)
- Delete data file (3ea6995aa256938278894707773639e7bab98d29)
- Delete data file (30efac5114b828f192869fde545c7de28dde13f4)
- Delete data file (272d9c431eb743c66cfdf8c5342b4f55c96b0fce)
- Delete data file (4e1594196d9c28f244813080978491d7ee58ee82)
- Delete data file (02f7d0f3df3e08edfd4ab8ecad8788f92ee2bed9)
- Delete data file (f67d13bd2d02342655be5e2c51f2ce46c4466e83)
- Delete data file (9dc848e7aa5ea5fb25e5c7531c138c9a8f2832ca)
- Delete data file (3e267c986e6f53f970a9e90867d367712ec72099)
- Delete data file (a263a23924245739b1febffc334f0ebab6edd511)
- Delete data file (0cb000fc928b1dd9c2d3c51e22321d676f0d097c)
- Delete data file (fb6bbdb8ca0c021d464fd7bcb876e15289d969f8)
- Delete data file (f7a487f120fb2498d45b8e246c135817047ceb61)
- Delete data file (85ae00ca9ab9cda1dec9e458f1bf0bc5231209e0)
- Delete data file (24ee602d314bf3d404fc10ec1ef3dbc7d604b060)
- Delete data file (c3a28865bd76a97a4d2b9fc6e4bba612df61170c)
- Delete data file (5011058460fd91cfc31ce265294072231fb3cf06)
- infeasible/ACOPF/meta.h5.gz → 89_pegase-nminus1/test-00000-of-00008.parquet +2 -2
- case.json.gz → 89_pegase-nminus1/test-00001-of-00008.parquet +2 -2
- infeasible/ACOPF/primal.h5.gz → 89_pegase-nminus1/test-00002-of-00008.parquet +2 -2
- infeasible/ACOPF/dual.h5.gz → 89_pegase-nminus1/test-00003-of-00008.parquet +2 -2
- 89_pegase-nminus1/test-00004-of-00008.parquet +3 -0
- 89_pegase-nminus1/test-00005-of-00008.parquet +3 -0
- 89_pegase-nminus1/test-00006-of-00008.parquet +3 -0
- 89_pegase-nminus1/test-00007-of-00008.parquet +3 -0
- 89_pegase-nminus1/train-00000-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00001-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00002-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00003-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00004-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00005-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00006-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00007-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00008-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00009-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00010-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00011-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00012-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00013-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00014-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00015-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00016-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00017-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00018-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00019-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00020-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00021-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00022-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00023-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00024-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00025-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00026-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00027-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00028-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00029-of-00031.parquet +3 -0
- 89_pegase-nminus1/train-00030-of-00031.parquet +3 -0
- PGLearn-Small-89_pegase-nminus1.py +0 -427
- README.md +9 -1
- config.toml +0 -44
- infeasible/DCOPF/dual.h5.gz +0 -3
- infeasible/DCOPF/meta.h5.gz +0 -3
- infeasible/DCOPF/primal.h5.gz +0 -3
- infeasible/SOCOPF/dual.h5.gz +0 -3
- infeasible/SOCOPF/meta.h5.gz +0 -3
- infeasible/SOCOPF/primal.h5.gz +0 -3
- infeasible/input.h5.gz +0 -3
- test/ACOPF/dual.h5.gz +0 -3
@@ -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:6a1f7a7d8e27a2ea53b133dd97779bbead9622d0ec4d12ad0f6b5de9b97b1f1c
|
3 |
+
size 613045348
|
@@ -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:2aa9e6596e7bba0bbde850bdeb71c7a7099b8228b818229c62f20937f26f6307
|
3 |
+
size 613011760
|
@@ -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:ab0ac017473c9057a0dd6df5f747278ac81b5fe84b5dd3e0334c763d5bc87948
|
3 |
+
size 613018993
|
@@ -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:87c4a51c50d4d5811abd316014de0f5047778d2747e35e639f3cae926e389195
|
3 |
+
size 613032168
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e59de3991275c2be5f3dc0d178fe1471841ee94b487433d814bbf4379c334ea0
|
3 |
+
size 612995218
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fb364c9035308ef8051c79fe6b42d0785fbdabaf2fbceba73550939b5d427dfd
|
3 |
+
size 612988537
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:374871281335c0190258df15e62d8e95d8b03d01c86f80831dfc6f611b24fed5
|
3 |
+
size 613098074
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4543d2f21696a06be6965debb8e098bc97fbc5d6060479e7b577029a9da201e2
|
3 |
+
size 612998280
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:472e4569bbea7efc09eb2a4b3a88adb0f0b275b55395cae1ed00475fe8e9044c
|
3 |
+
size 632984369
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7b71eec978b98773b99d4eb9a933a6713a35de80823d0468a35884d38cec2362
|
3 |
+
size 633032729
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e17aa21a9be710029df44b676f38764c481f78bc43a7c6615766c0245942220a
|
3 |
+
size 633164280
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9d922ff6577742c759c2f347eb373dbfc07b766287b20a90299c8c97a9ef79b0
|
3 |
+
size 633131113
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d4f60978905d6bd33bcb45afa6bdac29b5a605bfe8868dda4adf288c4130fed6
|
3 |
+
size 633072531
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:887b2018e8e78dbe4532ba7d6829162fb9521322aa561c8cf9c40eccb9ef55c3
|
3 |
+
size 633122843
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6d57a3b1ae165df435f45583f154d481caf10aaa8a0bc3806a20e406d1caea8b
|
3 |
+
size 633097269
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1e5bc444e50777f46aa05aaee6984ca31eb380c40d6e1c5dfd7f3659569d7956
|
3 |
+
size 633085130
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:213e6f31ada305566f69c023dc4215339974aa72b84a7b80bb6d894cacfd66c4
|
3 |
+
size 633097358
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d240255dc0b2714c26a6e0875cb6b4cfadb8adca5f5c1cb0792018c03f16e553
|
3 |
+
size 633080069
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2cc029b5784639341cd251cb70edaa732ff50b681970bd8685ae3afd82ecc7c8
|
3 |
+
size 633048374
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:946d448c43679eec3fe72eda265beef80840bf70c5de999e229c173a8cbbc7bb
|
3 |
+
size 633123554
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bac0d790b5b0a2007e3dccd5f1bfe987a6d77df0244f3c4ef76b8190617c0cfe
|
3 |
+
size 633124425
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:de081597c56480eba632921ffb044160845bb99986989e9da7e480d051f85250
|
3 |
+
size 633004187
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:297b87f402cbc6a459e1a4bf334c8152dc48a697362e0c199089c1a2330b1c16
|
3 |
+
size 633097084
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a5cb0f59ccc96a5cbc77f792c83b04c507245343b93d0ed0d4005228935db90a
|
3 |
+
size 633150190
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bcd34344d65e0a3164a1365797f65b916e4fcf3f33e0255944cb8e86154c10d3
|
3 |
+
size 633047040
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8f5aa36fedf87768d71e1daf6b47dd8f751e35e200b4c3564b2631ec1ba65939
|
3 |
+
size 633097453
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8d4bfbbe2bdeba8b1f12888a9b86635661ef4bd996ee2b3aafa941a364cd5a74
|
3 |
+
size 633029397
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:728760de477370a07f22df832b1ca188430d865d3ca9c135738ca4151ac8aa52
|
3 |
+
size 633120544
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2d74f7b0b40661c969519efe6956f46fca5bee93eaa1feb6847bb3b09587c4d2
|
3 |
+
size 632990000
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b389823b60a769b038f2910b9206ed408074960ebf445d5c9df1579cf2641df3
|
3 |
+
size 633055576
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:43629912c1fc92d69d04cf0db53250361a390bb5907fa26ca17a483b116efe94
|
3 |
+
size 633032933
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8582683067c0265343f8465f94c273bfe3b21cccdffd5b3ea2147ef442f2f6fa
|
3 |
+
size 633103703
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8c4661a825434323bc557475556a434c4676fa3de4e59f57778ab8f330061469
|
3 |
+
size 633031685
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6c3c729bde1a69cd382bab6872f796e2bedfdf4ec39e976c82ae57e281bebe81
|
3 |
+
size 633045858
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d6699ae4c3d9e85c6d5a003a5f8352018dd0a2acdef8c8462cc17e5604512013
|
3 |
+
size 633070381
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1f6c8d4ea003c1900afe43f3eebb571c910c8c992d54bd5819ffd8b6bfbb6831
|
3 |
+
size 633087445
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7ca947d01b08e02575682f7eb4c187d0a91453856c03c7207a0e35dbd09cdd94
|
3 |
+
size 633027614
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c7aa0d4c1f34654c065f729e5182271993492ed267390b62e7e4bb670922f9ca
|
3 |
+
size 632978607
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dd97f43104be7f247d781ea1423e69bc497b78d5c94908fd70adf5dd5d2f2c56
|
3 |
+
size 633040092
|
@@ -1,427 +0,0 @@
|
|
1 |
-
from __future__ import annotations
|
2 |
-
from dataclasses import dataclass
|
3 |
-
from pathlib import Path
|
4 |
-
import json
|
5 |
-
import shutil
|
6 |
-
|
7 |
-
import datasets as hfd
|
8 |
-
import h5py
|
9 |
-
import pgzip as gzip
|
10 |
-
import pyarrow as pa
|
11 |
-
|
12 |
-
# ┌──────────────┐
|
13 |
-
# │ Metadata │
|
14 |
-
# └──────────────┘
|
15 |
-
|
16 |
-
@dataclass
|
17 |
-
class CaseSizes:
|
18 |
-
n_bus: int
|
19 |
-
n_load: int
|
20 |
-
n_gen: int
|
21 |
-
n_branch: int
|
22 |
-
|
23 |
-
CASENAME = "89_pegase-nminus1"
|
24 |
-
SIZES = CaseSizes(n_bus=89, n_load=35, n_gen=12, n_branch=210)
|
25 |
-
NUM_TRAIN = 347720
|
26 |
-
NUM_TEST = 86930
|
27 |
-
NUM_INFEASIBLE = 65350
|
28 |
-
SPLITFILES = {}
|
29 |
-
|
30 |
-
URL = "https://huggingface.co/datasets/PGLearn/PGLearn-Small-89_pegase-nminus1"
|
31 |
-
DESCRIPTION = """\
|
32 |
-
The 89_pegase-nminus1 PGLearn optimal power flow dataset, part of the PGLearn-Small collection. \
|
33 |
-
"""
|
34 |
-
VERSION = hfd.Version("1.0.0")
|
35 |
-
DEFAULT_CONFIG_DESCRIPTION="""\
|
36 |
-
This configuration contains feasible input, primal solution, and dual solution data \
|
37 |
-
for the ACOPF and DCOPF formulations on the {case} system. For case data, \
|
38 |
-
download the case.json.gz file from the `script` branch of the repository. \
|
39 |
-
https://huggingface.co/datasets/PGLearn/PGLearn-Small-89_pegase-nminus1/blob/script/case.json.gz
|
40 |
-
"""
|
41 |
-
USE_ML4OPF_WARNING = """
|
42 |
-
================================================================================================
|
43 |
-
Loading PGLearn-Small-89_pegase-nminus1 through the `datasets.load_dataset` function may be slow.
|
44 |
-
|
45 |
-
Consider using ML4OPF to directly convert to `torch.Tensor`; for more info see:
|
46 |
-
https://github.com/AI4OPT/ML4OPF?tab=readme-ov-file#manually-loading-data
|
47 |
-
|
48 |
-
Or, use `huggingface_hub.snapshot_download` and an HDF5 reader; for more info see:
|
49 |
-
https://huggingface.co/datasets/PGLearn/PGLearn-Small-89_pegase-nminus1#downloading-individual-files
|
50 |
-
================================================================================================
|
51 |
-
"""
|
52 |
-
CITATION = """\
|
53 |
-
@article{klamkinpglearn,
|
54 |
-
title={{PGLearn - An Open-Source Learning Toolkit for Optimal Power Flow}},
|
55 |
-
author={Klamkin, Michael and Tanneau, Mathieu and Van Hentenryck, Pascal},
|
56 |
-
year={2025},
|
57 |
-
}\
|
58 |
-
"""
|
59 |
-
|
60 |
-
IS_COMPRESSED = True
|
61 |
-
|
62 |
-
# ┌──────────────────┐
|
63 |
-
# │ Formulations │
|
64 |
-
# └──────────────────┘
|
65 |
-
|
66 |
-
def acopf_features(sizes: CaseSizes, primal: bool, dual: bool, meta: bool):
|
67 |
-
features = {}
|
68 |
-
if primal: features.update(acopf_primal_features(sizes))
|
69 |
-
if dual: features.update(acopf_dual_features(sizes))
|
70 |
-
if meta: features.update({f"ACOPF/{k}": v for k, v in META_FEATURES.items()})
|
71 |
-
return features
|
72 |
-
|
73 |
-
def dcopf_features(sizes: CaseSizes, primal: bool, dual: bool, meta: bool):
|
74 |
-
features = {}
|
75 |
-
if primal: features.update(dcopf_primal_features(sizes))
|
76 |
-
if dual: features.update(dcopf_dual_features(sizes))
|
77 |
-
if meta: features.update({f"DCOPF/{k}": v for k, v in META_FEATURES.items()})
|
78 |
-
return features
|
79 |
-
|
80 |
-
def socopf_features(sizes: CaseSizes, primal: bool, dual: bool, meta: bool):
|
81 |
-
features = {}
|
82 |
-
if primal: features.update(socopf_primal_features(sizes))
|
83 |
-
if dual: features.update(socopf_dual_features(sizes))
|
84 |
-
if meta: features.update({f"SOCOPF/{k}": v for k, v in META_FEATURES.items()})
|
85 |
-
return features
|
86 |
-
|
87 |
-
FORMULATIONS_TO_FEATURES = {
|
88 |
-
"ACOPF": acopf_features,
|
89 |
-
"DCOPF": dcopf_features,
|
90 |
-
"SOCOPF": socopf_features,
|
91 |
-
}
|
92 |
-
|
93 |
-
# ┌───────────────────┐
|
94 |
-
# │ BuilderConfig │
|
95 |
-
# └───────────────────┘
|
96 |
-
|
97 |
-
class PGLearnSmall89_pegaseNminus1Config(hfd.BuilderConfig):
|
98 |
-
"""BuilderConfig for PGLearn-Small-89_pegase-nminus1.
|
99 |
-
By default, primal solution data, metadata, input, casejson, are included for the train and test splits.
|
100 |
-
|
101 |
-
To modify the default configuration, pass attributes of this class to `datasets.load_dataset`:
|
102 |
-
|
103 |
-
Attributes:
|
104 |
-
formulations (list[str]): The formulation(s) to include, e.g. ["ACOPF", "DCOPF"]
|
105 |
-
primal (bool, optional): Include primal solution data. Defaults to True.
|
106 |
-
dual (bool, optional): Include dual solution data. Defaults to False.
|
107 |
-
meta (bool, optional): Include metadata. Defaults to True.
|
108 |
-
input (bool, optional): Include input data. Defaults to True.
|
109 |
-
casejson (bool, optional): Include case.json data. Defaults to True.
|
110 |
-
train (bool, optional): Include training samples. Defaults to True.
|
111 |
-
test (bool, optional): Include testing samples. Defaults to True.
|
112 |
-
infeasible (bool, optional): Include infeasible samples. Defaults to False.
|
113 |
-
"""
|
114 |
-
def __init__(self,
|
115 |
-
formulations: list[str],
|
116 |
-
primal: bool=True, dual: bool=False, meta: bool=True, input: bool = True, casejson: bool=True,
|
117 |
-
train: bool=True, test: bool=True, infeasible: bool=False,
|
118 |
-
compressed: bool=IS_COMPRESSED, **kwargs
|
119 |
-
):
|
120 |
-
super(PGLearnSmall89_pegaseNminus1Config, self).__init__(version=VERSION, **kwargs)
|
121 |
-
|
122 |
-
self.case = CASENAME
|
123 |
-
self.formulations = formulations
|
124 |
-
|
125 |
-
self.primal = primal
|
126 |
-
self.dual = dual
|
127 |
-
self.meta = meta
|
128 |
-
self.input = input
|
129 |
-
self.casejson = casejson
|
130 |
-
|
131 |
-
self.train = train
|
132 |
-
self.test = test
|
133 |
-
self.infeasible = infeasible
|
134 |
-
|
135 |
-
self.gz_ext = ".gz" if compressed else ""
|
136 |
-
|
137 |
-
@property
|
138 |
-
def size(self):
|
139 |
-
return SIZES
|
140 |
-
|
141 |
-
@property
|
142 |
-
def features(self):
|
143 |
-
features = {}
|
144 |
-
if self.casejson: features.update(case_features())
|
145 |
-
if self.input: features.update(input_features(SIZES))
|
146 |
-
for formulation in self.formulations:
|
147 |
-
features.update(FORMULATIONS_TO_FEATURES[formulation](SIZES, self.primal, self.dual, self.meta))
|
148 |
-
return hfd.Features(features)
|
149 |
-
|
150 |
-
@property
|
151 |
-
def splits(self):
|
152 |
-
splits: dict[hfd.Split, dict[str, str | int]] = {}
|
153 |
-
if self.train:
|
154 |
-
splits[hfd.Split.TRAIN] = {
|
155 |
-
"name": "train",
|
156 |
-
"num_examples": NUM_TRAIN
|
157 |
-
}
|
158 |
-
if self.test:
|
159 |
-
splits[hfd.Split.TEST] = {
|
160 |
-
"name": "test",
|
161 |
-
"num_examples": NUM_TEST
|
162 |
-
}
|
163 |
-
if self.infeasible:
|
164 |
-
splits[hfd.Split("infeasible")] = {
|
165 |
-
"name": "infeasible",
|
166 |
-
"num_examples": NUM_INFEASIBLE
|
167 |
-
}
|
168 |
-
return splits
|
169 |
-
|
170 |
-
@property
|
171 |
-
def urls(self):
|
172 |
-
urls: dict[str, None | str | list] = {
|
173 |
-
"case": None, "train": [], "test": [], "infeasible": [],
|
174 |
-
}
|
175 |
-
|
176 |
-
if self.casejson:
|
177 |
-
urls["case"] = f"case.json" + self.gz_ext
|
178 |
-
else:
|
179 |
-
urls.pop("case")
|
180 |
-
|
181 |
-
split_names = []
|
182 |
-
if self.train: split_names.append("train")
|
183 |
-
if self.test: split_names.append("test")
|
184 |
-
if self.infeasible: split_names.append("infeasible")
|
185 |
-
|
186 |
-
for split in split_names:
|
187 |
-
if self.input: urls[split].append(f"{split}/input.h5" + self.gz_ext)
|
188 |
-
for formulation in self.formulations:
|
189 |
-
if self.primal:
|
190 |
-
filename = f"{split}/{formulation}/primal.h5" + self.gz_ext
|
191 |
-
if filename in SPLITFILES: urls[split].append(SPLITFILES[filename])
|
192 |
-
else: urls[split].append(filename)
|
193 |
-
if self.dual:
|
194 |
-
filename = f"{split}/{formulation}/dual.h5" + self.gz_ext
|
195 |
-
if filename in SPLITFILES: urls[split].append(SPLITFILES[filename])
|
196 |
-
else: urls[split].append(filename)
|
197 |
-
if self.meta:
|
198 |
-
filename = f"{split}/{formulation}/meta.h5" + self.gz_ext
|
199 |
-
if filename in SPLITFILES: urls[split].append(SPLITFILES[filename])
|
200 |
-
else: urls[split].append(filename)
|
201 |
-
return urls
|
202 |
-
|
203 |
-
# ┌────────────────────┐
|
204 |
-
# │ DatasetBuilder │
|
205 |
-
# └────────────────────┘
|
206 |
-
|
207 |
-
class PGLearnSmall89_pegaseNminus1(hfd.ArrowBasedBuilder):
|
208 |
-
"""DatasetBuilder for PGLearn-Small-89_pegase-nminus1.
|
209 |
-
The main interface is `datasets.load_dataset` with `trust_remote_code=True`, e.g.
|
210 |
-
|
211 |
-
```python
|
212 |
-
from datasets import load_dataset
|
213 |
-
ds = load_dataset("PGLearn/PGLearn-Small-89_pegase-nminus1", trust_remote_code=True,
|
214 |
-
# modify the default configuration by passing kwargs
|
215 |
-
formulations=["DCOPF"],
|
216 |
-
dual=False,
|
217 |
-
meta=False,
|
218 |
-
)
|
219 |
-
```
|
220 |
-
"""
|
221 |
-
|
222 |
-
DEFAULT_WRITER_BATCH_SIZE = 10000
|
223 |
-
BUILDER_CONFIG_CLASS = PGLearnSmall89_pegaseNminus1Config
|
224 |
-
DEFAULT_CONFIG_NAME=CASENAME
|
225 |
-
BUILDER_CONFIGS = [
|
226 |
-
PGLearnSmall89_pegaseNminus1Config(
|
227 |
-
name=CASENAME, description=DEFAULT_CONFIG_DESCRIPTION.format(case=CASENAME),
|
228 |
-
formulations=list(FORMULATIONS_TO_FEATURES.keys()),
|
229 |
-
primal=True, dual=True, meta=True, input=True, casejson=False,
|
230 |
-
train=True, test=True, infeasible=False,
|
231 |
-
)
|
232 |
-
]
|
233 |
-
|
234 |
-
def _info(self):
|
235 |
-
return hfd.DatasetInfo(
|
236 |
-
features=self.config.features, splits=self.config.splits,
|
237 |
-
description=DESCRIPTION + self.config.description,
|
238 |
-
homepage=URL, citation=CITATION,
|
239 |
-
)
|
240 |
-
|
241 |
-
def _split_generators(self, dl_manager: hfd.DownloadManager):
|
242 |
-
hfd.logging.get_logger().warning(USE_ML4OPF_WARNING)
|
243 |
-
|
244 |
-
filepaths = dl_manager.download_and_extract(self.config.urls)
|
245 |
-
|
246 |
-
splits: list[hfd.SplitGenerator] = []
|
247 |
-
if self.config.train:
|
248 |
-
splits.append(hfd.SplitGenerator(
|
249 |
-
name=hfd.Split.TRAIN,
|
250 |
-
gen_kwargs=dict(case_file=filepaths.get("case", None), data_files=tuple(filepaths["train"]), n_samples=NUM_TRAIN),
|
251 |
-
))
|
252 |
-
if self.config.test:
|
253 |
-
splits.append(hfd.SplitGenerator(
|
254 |
-
name=hfd.Split.TEST,
|
255 |
-
gen_kwargs=dict(case_file=filepaths.get("case", None), data_files=tuple(filepaths["test"]), n_samples=NUM_TEST),
|
256 |
-
))
|
257 |
-
if self.config.infeasible:
|
258 |
-
splits.append(hfd.SplitGenerator(
|
259 |
-
name=hfd.Split("infeasible"),
|
260 |
-
gen_kwargs=dict(case_file=filepaths.get("case", None), data_files=tuple(filepaths["infeasible"]), n_samples=NUM_INFEASIBLE),
|
261 |
-
))
|
262 |
-
return splits
|
263 |
-
|
264 |
-
def _generate_tables(self, case_file: str | None, data_files: tuple[hfd.utils.track.tracked_str | list[hfd.utils.track.tracked_str]], n_samples: int):
|
265 |
-
case_data: str | None = json.dumps(json.load(open_maybe_gzip_cat(case_file))) if case_file is not None else None
|
266 |
-
data: dict[str, h5py.File] = {}
|
267 |
-
for file in data_files:
|
268 |
-
v = h5py.File(open_maybe_gzip_cat(file), "r")
|
269 |
-
if isinstance(file, list):
|
270 |
-
k = "/".join(Path(file[0].get_origin()).parts[-3:-1]).split(".")[0]
|
271 |
-
else:
|
272 |
-
k = "/".join(Path(file.get_origin()).parts[-2:]).split(".")[0]
|
273 |
-
data[k] = v
|
274 |
-
for k in list(data.keys()):
|
275 |
-
if "/input" in k: data[k.split("/", 1)[1]] = data.pop(k)
|
276 |
-
|
277 |
-
batch_size = self._writer_batch_size or self.DEFAULT_WRITER_BATCH_SIZE
|
278 |
-
for i in range(0, n_samples, batch_size):
|
279 |
-
effective_batch_size = min(batch_size, n_samples - i)
|
280 |
-
|
281 |
-
sample_data = {
|
282 |
-
f"{dk}/{k}":
|
283 |
-
hfd.features.features.numpy_to_pyarrow_listarray(v[i:i + effective_batch_size, ...])
|
284 |
-
for dk, d in data.items() for k, v in d.items() if f"{dk}/{k}" in self.config.features
|
285 |
-
}
|
286 |
-
|
287 |
-
if case_data is not None:
|
288 |
-
sample_data["case/json"] = pa.array([case_data] * effective_batch_size)
|
289 |
-
|
290 |
-
yield i, pa.Table.from_pydict(sample_data)
|
291 |
-
|
292 |
-
for f in data.values():
|
293 |
-
f.close()
|
294 |
-
|
295 |
-
# ┌──────────────┐
|
296 |
-
# │ Features │
|
297 |
-
# └──────────────┘
|
298 |
-
|
299 |
-
FLOAT_TYPE = "float32"
|
300 |
-
INT_TYPE = "int64"
|
301 |
-
BOOL_TYPE = "bool"
|
302 |
-
STRING_TYPE = "string"
|
303 |
-
|
304 |
-
def case_features():
|
305 |
-
# FIXME: better way to share schema of case data -- need to treat jagged arrays
|
306 |
-
return {
|
307 |
-
"case/json": hfd.Value(STRING_TYPE),
|
308 |
-
}
|
309 |
-
|
310 |
-
META_FEATURES = {
|
311 |
-
"meta/seed": hfd.Value(dtype=INT_TYPE),
|
312 |
-
"meta/formulation": hfd.Value(dtype=STRING_TYPE),
|
313 |
-
"meta/primal_objective_value": hfd.Value(dtype=FLOAT_TYPE),
|
314 |
-
"meta/dual_objective_value": hfd.Value(dtype=FLOAT_TYPE),
|
315 |
-
"meta/primal_status": hfd.Value(dtype=STRING_TYPE),
|
316 |
-
"meta/dual_status": hfd.Value(dtype=STRING_TYPE),
|
317 |
-
"meta/termination_status": hfd.Value(dtype=STRING_TYPE),
|
318 |
-
"meta/build_time": hfd.Value(dtype=FLOAT_TYPE),
|
319 |
-
"meta/extract_time": hfd.Value(dtype=FLOAT_TYPE),
|
320 |
-
"meta/solve_time": hfd.Value(dtype=FLOAT_TYPE),
|
321 |
-
}
|
322 |
-
|
323 |
-
def input_features(sizes: CaseSizes):
|
324 |
-
return {
|
325 |
-
"input/pd": hfd.Sequence(length=sizes.n_load, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
326 |
-
"input/qd": hfd.Sequence(length=sizes.n_load, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
327 |
-
"input/gen_status": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=BOOL_TYPE)),
|
328 |
-
"input/branch_status": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=BOOL_TYPE)),
|
329 |
-
"input/seed": hfd.Value(dtype=INT_TYPE),
|
330 |
-
}
|
331 |
-
|
332 |
-
def acopf_primal_features(sizes: CaseSizes):
|
333 |
-
return {
|
334 |
-
"ACOPF/primal/vm": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
335 |
-
"ACOPF/primal/va": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
336 |
-
"ACOPF/primal/pg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
337 |
-
"ACOPF/primal/qg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
338 |
-
"ACOPF/primal/pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
339 |
-
"ACOPF/primal/pt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
340 |
-
"ACOPF/primal/qf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
341 |
-
"ACOPF/primal/qt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
342 |
-
}
|
343 |
-
def acopf_dual_features(sizes: CaseSizes):
|
344 |
-
return {
|
345 |
-
"ACOPF/dual/kcl_p": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
346 |
-
"ACOPF/dual/kcl_q": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
347 |
-
"ACOPF/dual/vm": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
348 |
-
"ACOPF/dual/pg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
349 |
-
"ACOPF/dual/qg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
350 |
-
"ACOPF/dual/ohm_pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
351 |
-
"ACOPF/dual/ohm_pt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
352 |
-
"ACOPF/dual/ohm_qf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
353 |
-
"ACOPF/dual/ohm_qt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
354 |
-
"ACOPF/dual/pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
355 |
-
"ACOPF/dual/pt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
356 |
-
"ACOPF/dual/qf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
357 |
-
"ACOPF/dual/qt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
358 |
-
"ACOPF/dual/va_diff": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
359 |
-
"ACOPF/dual/sm_fr": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
360 |
-
"ACOPF/dual/sm_to": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
361 |
-
"ACOPF/dual/slack_bus": hfd.Value(dtype=FLOAT_TYPE),
|
362 |
-
}
|
363 |
-
def dcopf_primal_features(sizes: CaseSizes):
|
364 |
-
return {
|
365 |
-
"DCOPF/primal/va": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
366 |
-
"DCOPF/primal/pg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
367 |
-
"DCOPF/primal/pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
368 |
-
}
|
369 |
-
def dcopf_dual_features(sizes: CaseSizes):
|
370 |
-
return {
|
371 |
-
"DCOPF/dual/kcl_p": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
372 |
-
"DCOPF/dual/pg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
373 |
-
"DCOPF/dual/ohm_pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
374 |
-
"DCOPF/dual/pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
375 |
-
"DCOPF/dual/va_diff": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
376 |
-
"DCOPF/dual/slack_bus": hfd.Value(dtype=FLOAT_TYPE),
|
377 |
-
}
|
378 |
-
def socopf_primal_features(sizes: CaseSizes):
|
379 |
-
return {
|
380 |
-
"SOCOPF/primal/w": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
381 |
-
"SOCOPF/primal/pg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
382 |
-
"SOCOPF/primal/qg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
383 |
-
"SOCOPF/primal/pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
384 |
-
"SOCOPF/primal/pt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
385 |
-
"SOCOPF/primal/qf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
386 |
-
"SOCOPF/primal/qt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
387 |
-
"SOCOPF/primal/wr": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
388 |
-
"SOCOPF/primal/wi": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
389 |
-
}
|
390 |
-
def socopf_dual_features(sizes: CaseSizes):
|
391 |
-
return {
|
392 |
-
"SOCOPF/dual/kcl_p": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
393 |
-
"SOCOPF/dual/kcl_q": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
394 |
-
"SOCOPF/dual/w": hfd.Sequence(length=sizes.n_bus, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
395 |
-
"SOCOPF/dual/pg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
396 |
-
"SOCOPF/dual/qg": hfd.Sequence(length=sizes.n_gen, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
397 |
-
"SOCOPF/dual/ohm_pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
398 |
-
"SOCOPF/dual/ohm_pt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
399 |
-
"SOCOPF/dual/ohm_qf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
400 |
-
"SOCOPF/dual/ohm_qt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
401 |
-
"SOCOPF/dual/jabr": hfd.Array2D(shape=(sizes.n_branch, 4), dtype=FLOAT_TYPE),
|
402 |
-
"SOCOPF/dual/sm_fr": hfd.Array2D(shape=(sizes.n_branch, 3), dtype=FLOAT_TYPE),
|
403 |
-
"SOCOPF/dual/sm_to": hfd.Array2D(shape=(sizes.n_branch, 3), dtype=FLOAT_TYPE),
|
404 |
-
"SOCOPF/dual/va_diff": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
405 |
-
"SOCOPF/dual/wr": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
406 |
-
"SOCOPF/dual/wi": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
407 |
-
"SOCOPF/dual/pf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
408 |
-
"SOCOPF/dual/pt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
409 |
-
"SOCOPF/dual/qf": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
410 |
-
"SOCOPF/dual/qt": hfd.Sequence(length=sizes.n_branch, feature=hfd.Value(dtype=FLOAT_TYPE)),
|
411 |
-
}
|
412 |
-
|
413 |
-
# ┌──���────────────┐
|
414 |
-
# │ Utilities │
|
415 |
-
# └───────────────┘
|
416 |
-
|
417 |
-
def open_maybe_gzip_cat(path: str | list):
|
418 |
-
if isinstance(path, list):
|
419 |
-
dest = Path(path[0]).parent.with_suffix(".h5")
|
420 |
-
if not dest.exists():
|
421 |
-
with open(dest, "wb") as dest_f:
|
422 |
-
for piece in path:
|
423 |
-
with open(piece, "rb") as piece_f:
|
424 |
-
shutil.copyfileobj(piece_f, dest_f)
|
425 |
-
shutil.rmtree(Path(piece).parent)
|
426 |
-
path = dest.as_posix()
|
427 |
-
return gzip.open(path, "rb") if path.endswith(".gz") else open(path, "rb")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -288,6 +288,14 @@ dataset_info:
|
|
288 |
- name: test
|
289 |
num_bytes: 3798471548
|
290 |
num_examples: 86930
|
291 |
-
download_size:
|
292 |
dataset_size: 18992357738
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
---
|
|
|
288 |
- name: test
|
289 |
num_bytes: 3798471548
|
290 |
num_examples: 86930
|
291 |
+
download_size: 24529362211
|
292 |
dataset_size: 18992357738
|
293 |
+
configs:
|
294 |
+
- config_name: 89_pegase-nminus1
|
295 |
+
data_files:
|
296 |
+
- split: train
|
297 |
+
path: 89_pegase-nminus1/train-*
|
298 |
+
- split: test
|
299 |
+
path: 89_pegase-nminus1/test-*
|
300 |
+
default: true
|
301 |
---
|
@@ -1,44 +0,0 @@
|
|
1 |
-
# Name of the reference PGLib case. Must be a valid PGLib case name.
|
2 |
-
pglib_case = "pglib_opf_case89_pegase"
|
3 |
-
floating_point_type = "Float32"
|
4 |
-
|
5 |
-
[sampler]
|
6 |
-
# data sampler options
|
7 |
-
[sampler.load]
|
8 |
-
noise_type = "ScaledUniform"
|
9 |
-
l = 0.6 # Lower bound of base load factor
|
10 |
-
u = 1.0 # Upper bound of base load factor
|
11 |
-
sigma = 0.20 # Relative (multiplicative) noise level.
|
12 |
-
|
13 |
-
[sampler.status]
|
14 |
-
type = "Nminus1"
|
15 |
-
|
16 |
-
[OPF]
|
17 |
-
|
18 |
-
[OPF.ACOPF]
|
19 |
-
type = "ACOPF"
|
20 |
-
solver.name = "Ipopt"
|
21 |
-
solver.attributes.tol = 1e-6
|
22 |
-
solver.attributes.linear_solver = "ma27"
|
23 |
-
|
24 |
-
[OPF.DCOPF]
|
25 |
-
# Formulation/solver options
|
26 |
-
type = "DCOPF"
|
27 |
-
solver.name = "HiGHS"
|
28 |
-
|
29 |
-
[OPF.SOCOPF]
|
30 |
-
type = "SOCOPF"
|
31 |
-
solver.name = "Clarabel"
|
32 |
-
# Tight tolerances
|
33 |
-
solver.attributes.tol_gap_abs = 1e-6
|
34 |
-
solver.attributes.tol_gap_rel = 1e-6
|
35 |
-
solver.attributes.tol_feas = 1e-6
|
36 |
-
solver.attributes.tol_infeas_rel = 1e-6
|
37 |
-
solver.attributes.tol_ktratio = 1e-6
|
38 |
-
# Reduced accuracy settings
|
39 |
-
solver.attributes.reduced_tol_gap_abs = 1e-6
|
40 |
-
solver.attributes.reduced_tol_gap_rel = 1e-6
|
41 |
-
solver.attributes.reduced_tol_feas = 1e-6
|
42 |
-
solver.attributes.reduced_tol_infeas_abs = 1e-6
|
43 |
-
solver.attributes.reduced_tol_infeas_rel = 1e-6
|
44 |
-
solver.attributes.reduced_tol_ktratio = 1e-6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:e75d0f4cc5d0726d34a0f30c1a0f3f81f089efd567a884241c3bd3a0c2d934ea
|
3 |
-
size 10321298
|
|
|
|
|
|
|
|
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:0fff4ac7c1964d02ae6253280e2ff6186ac0d8fb4d6092696346531b65b6966c
|
3 |
-
size 1809504
|
|
|
|
|
|
|
|
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:49e7b4a12f270afe0396accf41c898c36160bd6f1303f27c1582905c8984cbde
|
3 |
-
size 6046361
|
|
|
|
|
|
|
|
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:c325cd5bf8f7c7cbcd51334930101d8f8df757ab6a9f30d4db0c73c097c413c0
|
3 |
-
size 1157637948
|
|
|
|
|
|
|
|
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:d87706422c66c3815f1ae95c5a81c7ae7065830da21c47ddd5c6a8d176a43ac6
|
3 |
-
size 2119575
|
|
|
|
|
|
|
|
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:05417f99cc99d53f2d137549d284466b8dc1bb5e8aed125d8cb9a29b17b7ff51
|
3 |
-
size 43412271
|
|
|
|
|
|
|
|
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:ea5ffa68663c7b62b181277f1e68c858ef7e5197439b68076f15b70cd857a941
|
3 |
-
size 17045789
|
|
|
|
|
|
|
|
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:ce44c001c56fd028d0330b97945c1e3e0f185e31ebc43af30d7dcaea78c6176e
|
3 |
-
size 729742977
|
|
|
|
|
|
|
|