culebra.fitness_function.svc_optimization.C class¶
- class C(index: int | None = None)¶
Bases:
SVCScorerConstruct the fitness function.
- Parameters:
index (int) – Index of this objective when it is used for multi-objective fitness functions, optional
- Raises:
RuntimeError – If the number of objectives is not 1
TypeError – If index is not an integer number
ValueError – If index is not positive
Class methods¶
- classmethod C.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 C.index: int¶
Objective index.
- Return type:
- Setter:
Set a new index
- Parameters:
value (int) – The new index. If set to
None,_default_indexis chosen- Raises:
TypeError – If value is not an integer number
ValueError – If value is a negative number
- property C.obj_thresholds: list[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
Private properties¶
Methods¶
- C.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
- C.evaluate(sol: Solution, index: int | None = None, representatives: Sequence[Solution] | None = None) Fitness¶
Evaluate a solution.
- Parameters:
sol (Solution) – Solution to be evaluated.
index (int) – Index where sol should be inserted in the representatives sequence to form a complete solution for the problem. Only used by cooperative problems
representatives (Sequence[Solution]) – Representative solutions of each species being optimized. Only used by cooperative problems
- Returns:
The fitness for sol
- Return type:
- Raises:
ValueError – If sol is not evaluable

