Skip to content

fitness

FitnessBase

Bases: HashableBaseModelIO

__call__

__call__(x: Iterable | dict, *args, **kwargs) -> float

Evaluate the fitness function.

create classmethod

create(
    fitness: Union["FitnessBase", Type["FitnessBase"], str, None] = None,
    **kwargs
) -> "FitnessBase"

Create a fitness object from the input.

PARAMETER DESCRIPTION
fitness

Custom fitness object or class or the full name of the class, by default None

TYPE: 'FitnessBase' | Type['FitnessBase'] | str DEFAULT: None

kwargs

Additional keyword arguments to pass to the fitness object

DEFAULT: {}

RETURNS DESCRIPTION
FitnessBase

The fitness object

evaluate

evaluate(
    results: Dict,
) -> Tuple[Dict[str, Dict[str, float]], Dict[str, Dict[str, float]]]

Evaluate the fitness function, return the fitness and weights

lineOption

lineOption(
    option: str,
    experiment_name: str,
    *,
    option_name: str = "line_{option}",
    experiment_option_name="line_experiment_{option}"
) -> Any

Get line options or experiment-specific line options.

match classmethod

match(name: str, pattern: str | List[str]) -> bool

Check if the name matches any of the given patterns.

parseOptimizeKeys

parseOptimizeKeys()

Parse the keys of the fitness function

run

run(
    x: Iterable | dict, *args, return_results: bool = False, **kwargs
) -> float | Tuple[float, Dict[str, Any]]

Evaluate the fitness function.

setup

setup(**kwargs) -> Self

Set up the arguments of the fitness function

simulate

simulate(x: Iterable | dict) -> Dict

Simulate the model and return the results as a dictionary of SVExporter objects. If the simulation fails, return False instead.