CompositeObjective#

class hydromodpy.calibration.CompositeObjective(blocks, *, name='composite', transform='identity')[source]#

Bases: object

Weighted composite of several ScalarObjective blocks.

Each block is a (ScalarObjective, weight) tuple. evaluate() runs every block on the same SimulationOutput, optionally applies a per-block transform to the block total cost, then returns a single ObjectiveValue whose .total is the weighted sum of the transformed block totals and .components merges every block’s components. Weights are normalised so they sum to 1.0.

Parameters#

blocks

Iterable of (ScalarObjective, weight) tuples. Weights must be strictly positive and finite.

name

Optional label for the composite (default: "composite").

transform

One of "identity", "log", "inverse" (case-insensitive). Applied to each block’s cost before weighting. Default "identity".

Notes#

This class implements the Objective Protocol and can therefore be plugged directly into the calibration engine wherever a ScalarObjective would be accepted.

param blocks:

type blocks:

Iterable[tuple[Objective, float]]

param name:

type name:

str

param transform:

type transform:

str

property blocks: tuple[tuple[Objective, float], ...]#

Return blocks with their normalized weights (sum to 1.0).

property raw_weights: tuple[float, ...]#

Return weights as supplied (before normalisation).

Parameters: