Module ml4opf.loss_functions.objective
Use the formulation objective as the loss function
Classes
class ObjectiveLoss (v: OPFViolation,
reduction: str | None = 'mean')-
ObjectiveLoss is the original objective of the OPF.
It takes as input the same arguments as the corresponding formulation's
objective
method, and returns the objective value.Initialize ObjectiveLoss module.
Args
v
:OPFViolation
- OPFViolation module.
reduction
:Optional[str]
- Reduction operation. Default: "mean".
Ancestors
- torch.nn.modules.module.Module
Class variables
var SUPPORTED_REDUCTIONS
Methods
def forward(self, *objective_args, **objective_kwargs) ‑> torch.Tensor
-
Compute the objective value for a batch of samples.