culebra.fitness_func.MultiObjectiveFitnessFunction class¶
- class MultiObjectiveFitnessFunction(*objectives: tuple[SingleObjectiveFitnessFunction, ...])¶
Bases:
FitnessFunctionConstruct a multi-objective fitness function.
- Parameters:
objectives (tuple[SingleObjectiveFitnessFunction]) – Objectives for this fitness function
Class methods¶
- classmethod MultiObjectiveFitnessFunction.load(filename: str) Base¶
Load a serialized object from a file.
- Parameters:
filename (str) – The file name.
- Returns:
The loaded object
- Raises:
TypeError – If filename is not a valid file name
ValueError – If the filename extension is not
SERIALIZED_FILE_EXTENSION
Properties¶
- property MultiObjectiveFitnessFunction.obj_thresholds: tuple[float]¶
Objective similarity thresholds.
- Return type:
- Setter:
Set new thresholds.
- Parameters:
values (float | Sequence[float]) – The new values. If only a single value is provided, the same threshold will be used for all the objectives. Different thresholds can be provided in a
Sequence. If set toNone, all the thresholds are set to_default_similarity_threshold- Raises:
TypeError – If neither a real number nor a
Sequenceof real numbers is providedValueError – If any value is negative
ValueError – If the length of the thresholds sequence does not match the number of objectives
- property MultiObjectiveFitnessFunction.objectives: tuple[SingleObjectiveFitnessFunction]¶
Objectives to be optimized.
- Return type:
Private properties¶
Methods¶
- MultiObjectiveFitnessFunction.dump(filename: str) None¶
Serialize this object and save it to a file.
- Parameters:
filename (str) – The file name.
- Raises:
TypeError – If filename is not a valid file name
ValueError – If the filename extension is not
SERIALIZED_FILE_EXTENSION
- MultiObjectiveFitnessFunction.evaluate(sol: Solution, index: int | None = None, cooperators: Sequence[Solution | None] | None = None) tuple[float, ...]¶
Evaluate a solution.
Neither the solution nor its fitness should be modified.
Parameters cooperators and index are used only for cooperative evaluations
- Parameters:
- Returns:
The fitness for sol
- Return type:

