Module ml4opf.formulations.ed.model

Base class for EconomicDispatch proxy models

Classes

class EDModel

OPFModel for EconomicDispatch

Ancestors

Subclasses

Class variables

var problemEDProblem
var violationEDViolation

Methods

def evaluate_model(self, reduction: str | None = None, inner_reduction: str | None = None) ‑> dict[str, torch.Tensor]

Evaluate the model on the test data.

Args

reduction : str, optional
Reduction method for the metrics. Defaults to None. Must be one of "mean", "sum","max", "none". If specified, each value in the returned dictionary will be a scalar. Otherwise, they are arrays of shape (n_test_samples,)
inner_reduction : str, optional
Reduction method for turning metrics calculated per component to per sample. Defaults to None. Must be one of "mean", "sum","max", "none".

Returns

dict[str, Tensor]

Dictionary containing Tensor metrics of the model's performance.

pg_lower: Generator lower bound violation.

pg_upper: Generator upper bound violation.

pf_lower: Branch power flow lower bound violation.

pf_upper: Branch power flow upper bound violation.

p_balance: Power balance violation.

pg_mae: Mean absolute error of the real power generation.

obj_mape: Mean absolute percent error of the objective value.

Inherited members

class PerfectEDModel (problem: EDProblem)

Returns the ground truth, only works with test data.

Ancestors

Methods

def predict(self, pd: torch.Tensor) ‑> dict[str, torch.Tensor]

Return the ground truth. Only works for self.problem.test_data.

Inherited members