Source code for evolutionary_optimization.fitness_functions.abstract_fitness_function

from abc import ABC, abstractmethod
from typing import Union

from evolutionary_optimization.phenotype.phenotype_model.abstract_phenotype import AbstractPhenotype


[docs]class AbstractFitnessFunction(ABC):
[docs] @abstractmethod def evaluate(self, phenotype: AbstractPhenotype) -> Union[float, int]: """This method will return the fitness score from a phenotype. Args: phenotype: instance of AbstractPhenotype being evaluated. Returns: Processed phenotype value depending on desired fitness function. """ pass