torch_geometric.datasets.OPFDataset
- class OPFDataset(root: str, split: Literal['train', 'val', 'test'] = 'train', case_name: Literal['pglib_opf_case14_ieee', 'pglib_opf_case30_ieee', 'pglib_opf_case57_ieee', 'pglib_opf_case118_ieee', 'pglib_opf_case500_goc', 'pglib_opf_case2000_goc', 'pglib_opf_case6470_rte', 'pglib_opf_case4661_sdetpglib_opf_case10000_goc', 'pglib_opf_case13659_pegase'] = 'pglib_opf_case14_ieee', num_groups: int = 20, topological_perturbations: bool = False, transform: Optional[Callable] = None, pre_transform: Optional[Callable] = None, pre_filter: Optional[Callable] = None, force_reload: bool = False)[source]
Bases:
InMemoryDataset
The heterogeneous OPF data from the “Large-scale Datasets for AC Optimal Power Flow with Topological Perturbations” paper.
OPFDataset
is a large-scale dataset of solved optimal power flow problems, derived from the pglib-opf dataset.The physical topology of the grid is represented by the
"bus"
node type, and the connecting AC lines and transformers. Additionally,"generator"
,"load"
, and"shunt"
nodes are connected to"bus"
nodes using a dedicated edge type each, e.g.,"generator_link"
.Edge direction corresponds to the properties of the line, e.g.,
b_fr
is the line charging susceptance at thefrom
(source/sender) bus.- Parameters:
root (str) – Root directory where the dataset should be saved.
split (str, optional) – If
"train"
, loads the training dataset. If"val"
, loads the validation dataset. If"test"
, loads the test dataset. (default:"train"
)case_name (str, optional) – The name of the original pglib-opf case. (default:
"pglib_opf_case14_ieee"
)num_groups (int, optional) – The dataset is divided into 20 groups with each group containing 15,000 samples. For large networks, this amount of data can be overwhelming. The
num_groups
parameters controls the amount of data being downloaded. Allowed values are[1, 20]
. (default:20
)topological_perturbations (bool, optional) – Whether to use the dataset with added topological perturbations. (default:
False
)transform (callable, optional) – A function/transform that takes in a
torch_geometric.data.HeteroData
object and returns a transformed version. The data object will be transformed before every access. (default:None
)pre_transform (callable, optional) – A function/transform that takes in a
torch_geometric.data.HeteroData
object and returns a transformed version. The data object will be transformed before being saved to disk. (default:None
)pre_filter (callable, optional) – A function that takes in a
torch_geometric.data.HeteroData
object and returns a boolean value, indicating whether the data object should be included in the final dataset. (default:None
)force_reload (bool, optional) – Whether to re-process the dataset. (default:
False
)