klamike commited on
Commit
d486fe0
·
verified ·
1 Parent(s): ff3227d

Convert dataset to Parquet (part 00012-of-00013) (#13)

Browse files

- Convert dataset to Parquet (part 00012-of-00013) (dc252bcb962c8dc58c6597f09ad1d2770e900001)
- Delete data file (0045d85342b97a7ec661eb3a705354bf806b1872)
- Delete loading script (d294d5094378796a96b783cabfea9d750cb4a155)
- Delete data file (bf45b902a59a310dbf506da7285aca276458766a)
- Delete data file (7c75ed38353b3f257039f0615f7c76ae018811db)
- Delete data file (ef01da989e0c21edf8208a9cdd8a705ec9b993a3)
- Delete data file (911de9f0125451fc728903f9785acdf101d3fd03)
- Delete data file (166ff92eba74f44b7c2eed81cfea3a53a1dce9f3)
- Delete data file (5ac961f10ae3d11c3f8c83df6bca5ccfe1dfab60)
- Delete data file (1907567df343ba959518200bbacc0204719398ac)
- Delete data file (294123ebe5c727daefe2f90d00cb80a6d9ebaca6)
- Delete data file (92efd5db870ea60d20dde333615632f4a47fb685)
- Delete data file (2b28ac7344c8ba8dfcf3a3b3d9f2d336f07c1b7e)
- Delete data file (95b8cc7126733821989649237c4a34d5e0bff7d4)
- Delete data file (36ee5a8d81fa3bf7ecb014b84bdf7b860ba7945d)
- Delete data file (d0de213e47d116ac1c5b36cb72643e29252f54fc)
- Delete data file (5e533e883abe9893cd758f2d0ccf816b2c8eeb08)
- Delete data file (f28370f023b3840126e79e177ff52e6282b05b08)
- Delete data file (bd25139eead066537897e3ae29ba66c37c6f5927)
- Delete data file (844ebd7b3406ba1f2ccab3cf643e4891595ee83b)
- Delete data file (5c65a6cbddfb2a6f8748a6f181b1cd2852413a2a)
- Delete data file (ca93077f3540e9f86c2bc43410b56186a5bf0d84)
- Delete data file (851c6f74db45e48184a010474bdff841d29231bb)
- Delete data file (060c5737e6e53aa916d659cce1bdea820fb73091)
- Delete data file (aa8f94630ecc13b967ed04e33a381eb44f319be2)
- Delete data file (3ca772834c6012ba5661eb0813bce7fd21b59e78)
- Delete data file (67d712cb6ce0050b6f13f7701051fb3dc0ae6df4)
- Delete data file (f991db3371f52f295e6b0f24e64d7ad070a3118d)
- Delete data file (c35c530d013db82fd266b42a6e9f3a1c92f02bf5)
- Delete data file (4dfe966d9c72a6c1cbc9c9de05491d074e2df198)
- Delete data file (8c03a722f3141095cf044f4cb8cf063848ccee28)
- Delete data file (bfb81d1db7c4ac561b0e33ec391f4a77f64a54da)
- Delete data file (9d38e029a3737ae98907a604cb750688d53b5fe1)
- Delete data file (d08fc0a285c5c5d64ae0e80b39fe75e3af2f556b)

infeasible/ACOPF/meta.h5.gz → 89_pegase/test-00115-of-00122.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b02d1c7334286d44a5e42fd0c000db6c3d9617b2f80b1c3c2dd2abd7693743bb
3
- size 4115998
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:80ff67d819659642903db6fa495cd3c323e275d7dceb51472facd399fd395e8d
3
+ size 82013792
case.json.gz → 89_pegase/test-00116-of-00122.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a7198c54efe773653c34abe4313518f1bf85ec97fc5743e11f8235cfcf77e64a
3
- size 109656
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d45a7fca4fe4b468ecfa4c376d97070ff58e1c1c1aecb5d88d8f720a5c5ae37
3
+ size 81991107
infeasible/DCOPF/meta.h5.gz → 89_pegase/test-00117-of-00122.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8e0f991370d042a83e13227e6a0e57f7fbc9b433c03304d1294b0bd6cc2730be
3
- size 3313593
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:82fa2ca39ab65cf49333e0c0f4ca95fb78f783d3d2027888c0e9fe209ab821d7
3
+ size 81996045
infeasible/DCOPF/dual.h5.gz → 89_pegase/test-00118-of-00122.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9d65eccf463ddb7ffdbc77287bc1a3ce51d3924a51480f82a45e5572f457e27c
3
- size 8557562
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b586d51c9584d1e41f2683413038579089d277e369efb118ab906ca610b6c7c9
3
+ size 82000903
89_pegase/test-00119-of-00122.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8a9e3ec87fac40ee258ea77aba7c6ceae331d60d175576031851ff32b4a6a26e
3
+ size 81999422
89_pegase/test-00120-of-00122.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:69ee2e852b626c12844b450c9945f8fde0236d4743be92526fe56de1fa2003d6
3
+ size 82002732
89_pegase/test-00121-of-00122.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:145e355283ee7d4f8dc6ed3923c9a1ba36e36bbf67083a2c6599b6fb2fa8e797
3
+ size 82009183
PGLearn-Small-89_pegase.py DELETED
@@ -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 = "89_pegase"
23
- SIZES = CaseSizes(n_bus=89, n_load=35, n_gen=12, n_branch=210)
24
- NUM_TRAIN = 704792
25
- NUM_TEST = 176198
26
- NUM_INFEASIBLE = 119010
27
-
28
- URL = "https://huggingface.co/datasets/PGLearn/PGLearn-Small-89_pegase"
29
- DESCRIPTION = """\
30
- The 89_pegase 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-89_pegase 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-89_pegase#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 PGLearnSmall89_pegaseConfig(hfd.BuilderConfig):
94
- """BuilderConfig for PGLearn-Small-89_pegase.
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(PGLearnSmall89_pegaseConfig, 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 PGLearnSmall89_pegase(hfd.ArrowBasedBuilder):
192
- """DatasetBuilder for PGLearn-Small-89_pegase.
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-89_pegase", 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 = PGLearnSmall89_pegaseConfig
208
- DEFAULT_CONFIG_NAME=CASENAME
209
- BUILDER_CONFIGS = [
210
- PGLearnSmall89_pegaseConfig(
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")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md CHANGED
@@ -285,11 +285,19 @@ dataset_info:
285
  dtype: float32
286
  splits:
287
  - name: train
288
- num_bytes: 242326342786
289
  num_examples: 704792
290
  - name: test
291
- num_bytes: 60581585697
292
  num_examples: 176198
293
- download_size: 30943378664
294
- dataset_size: 302907928483
 
 
 
 
 
 
 
 
295
  ---
 
285
  dtype: float32
286
  splits:
287
  - name: train
288
+ num_bytes: 242326342926
289
  num_examples: 704792
290
  - name: test
291
+ num_bytes: 60581585731
292
  num_examples: 176198
293
+ download_size: 50015169304
294
+ dataset_size: 302907928657
295
+ configs:
296
+ - config_name: 89_pegase
297
+ data_files:
298
+ - split: train
299
+ path: 89_pegase/train-*
300
+ - split: test
301
+ path: 89_pegase/test-*
302
+ default: true
303
  ---
config.toml DELETED
@@ -1,42 +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
-
14
- [OPF]
15
-
16
- [OPF.ACOPF]
17
- type = "ACOPF"
18
- solver.name = "Ipopt"
19
- solver.attributes.tol = 1e-6
20
- solver.attributes.linear_solver = "ma27"
21
-
22
- [OPF.DCOPF]
23
- # Formulation/solver options
24
- type = "DCOPF"
25
- solver.name = "HiGHS"
26
-
27
- [OPF.SOCOPF]
28
- type = "SOCOPF"
29
- solver.name = "Clarabel"
30
- # Tight tolerances
31
- solver.attributes.tol_gap_abs = 1e-6
32
- solver.attributes.tol_gap_rel = 1e-6
33
- solver.attributes.tol_feas = 1e-6
34
- solver.attributes.tol_infeas_rel = 1e-6
35
- solver.attributes.tol_ktratio = 1e-6
36
- # Reduced accuracy settings
37
- solver.attributes.reduced_tol_gap_abs = 1e-6
38
- solver.attributes.reduced_tol_gap_rel = 1e-6
39
- solver.attributes.reduced_tol_feas = 1e-6
40
- solver.attributes.reduced_tol_infeas_abs = 1e-6
41
- solver.attributes.reduced_tol_infeas_rel = 1e-6
42
- solver.attributes.reduced_tol_ktratio = 1e-6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
infeasible/ACOPF/dual.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:9315626b439d0bd6c3a0e1a70a08674dbad909dd8dd7696a534d73178727eeaf
3
- size 1159221440
 
 
 
 
infeasible/ACOPF/primal.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:e5ae4365915ce098d840ff810e05a4f72f75ce725a7da7ff7d6871f97af53132
3
- size 456800247
 
 
 
 
infeasible/DCOPF/primal.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:75197b1e0c87b8e8dc01ba409ade5fb7c04c5451207ff0c5d8065472ce1d8b93
3
- size 10930864
 
 
 
 
infeasible/SOCOPF/dual.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:2ec101df4996daaf77ff9babacbfd0a5e085f185ea157f17b5fc5acdc660b9ea
3
- size 2110230394
 
 
 
 
infeasible/SOCOPF/meta.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:6f062a8375fef20a50a97c21ba33187db81761708ef091581533c18c72fe7976
3
- size 3837588
 
 
 
 
infeasible/SOCOPF/primal.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:cccb359d095f3bf99b23936aa43f657327e5d15b9deae0e086e574a09a00b7d1
3
- size 51945166
 
 
 
 
infeasible/input.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:19eeed98ff84f6dd14291e8634c593b46d60a1bc3ac08b6e589fd5320a74ac5a
3
- size 30794460
 
 
 
 
test/ACOPF/dual.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:60fff4416db3a3bbc74295e2cae81bf989d19f33d6e1e099adf55cbb953cb55f
3
- size 1477772026
 
 
 
 
test/ACOPF/meta.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:d1fe9dab36dd9dea6056b7a1113fdd78a9bf5d989d578868f3c77f9df320440f
3
- size 5932054
 
 
 
 
test/ACOPF/primal.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:fb9df973bc485e8174622e354a348c138a36fc248610a8b428b4d250c0a4077b
3
- size 669938071
 
 
 
 
test/DCOPF/dual.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:85b7d7b492ad2e623a2de252c2dd063c723b4ecac5c958086ada578e7f773ed2
3
- size 10260830
 
 
 
 
test/DCOPF/meta.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:13d2767483923825043fe263d32a2a1d6f8d6fd3c9e0e685a983e8a043b438c0
3
- size 5728701
 
 
 
 
test/DCOPF/primal.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:359f682c9979352141b9340baacf38e7473b1dd8598e7fba4f582c49a893f385
3
- size 189842201
 
 
 
 
test/SOCOPF/dual.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:25a1525c37e346be7861b9d7539f7216a844ec0fbbb9da5eedbd0c9ff72cd631
3
- size 2901491086
 
 
 
 
test/SOCOPF/meta.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:6d52f2d80f016f94a42200100a572cacdd58323207fb25d28680559c6ff0de22
3
- size 5966333
 
 
 
 
test/SOCOPF/primal.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:e5bd2dc24cb60a2051d7589a49593682f2c430f9c6d6e3dbcfa175d338318f60
3
- size 876099927
 
 
 
 
test/input.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:595fc873138448bf910955975bb43d7e7b4d00d2be86f19e4449317a75fa0ee4
3
- size 45725305
 
 
 
 
train/ACOPF/dual.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:383ca7cd2334043b97dd481840c857703d28e8a7f235b34d92a72e8b47afd922
3
- size 5910998436
 
 
 
 
train/ACOPF/meta.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:fd88139db205afe1d7da28e15fc2be10886319030159671faf93e420634729be
3
- size 23663752
 
 
 
 
train/ACOPF/primal.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:3aff623513c7c9a063a539e9c9f0fac7f084e7d59eaf542076792222c7698fb6
3
- size 2679740981
 
 
 
 
train/DCOPF/dual.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:864f3b5de9b7e65087a82dd06400cd0d3bfa2a875e976436335d1569baf22cae
3
- size 40982747
 
 
 
 
train/DCOPF/meta.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:876ea4595be151a3e140afb8f8829f99bf9518b61db24f1b3c37f0fc4d274c01
3
- size 22835890
 
 
 
 
train/DCOPF/primal.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:91e58de30d8facdccd5971c17592d054b44a32209114c948746c2f1bc8113c32
3
- size 759351082
 
 
 
 
train/SOCOPF/dual.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:741b70b1771c78fea6fb6c5072e5761fc43ce0c667b9ecb889e984f9b2bef14a
3
- size 11605891425
 
 
 
 
train/SOCOPF/meta.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:96a2fbff2fa7d71aa861c0afa702bd6876e08c3ee497191fd8d23bf93e0c0a6a
3
- size 23796231
 
 
 
 
train/SOCOPF/primal.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:3d8378ee17b8af37c2334a4b1a0628fa11802ef9554da6d9fa3e3f32f1725593
3
- size 3504373882
 
 
 
 
train/input.h5.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:89baaf18cd9eaae7e1192f4920e4cc753ecb1d11d297090ce4a87973b51467a9
3
- size 182878048