objective module
Define a class to hold optimisation objective with its ideal value.
- class Objective(name, weight, descriptor=None, ideal_value=None)[source]
Bases:
ABCHold an objective and methods to evaluate it.
- Parameters:
name (str) – A short string to describe the objective and access to it.
weight (float) – A scaling constant to set the weight of current objective.
descriptor (str | None, optional) – A longer string to explain the objective. The default is None.
ideal_value (float | tuple[float], optional) – The ideal value or range of values that we should tend to.
- abstract evaluate(simulation_output)[source]
Compute residue of this objective.
- Parameters:
simulation_output (SimulationOutput | float) – Object containing simulation results of the broken linac.
- Returns:
residue – Difference between current evaluation and ideal_value value for
self.name, scaled byself.weight.- Return type:
- __init__(name, weight, descriptor=None, ideal_value=None)
- _abc_impl = <_abc._abc_data object at 0x73dca6b606c0>