geneticengine.solutions.individual
Module Contents
Classes
Abstract base class for generic types. |
Attributes
- geneticengine.solutions.individual.G
- geneticengine.solutions.individual.P
- exception geneticengine.solutions.individual.IndividualNotEvaluatedException
Bases:
Exception
Common base class for all non-exit exceptions.
Initialize self. See help(type(self)) for accurate signature.
- class geneticengine.solutions.individual.Individual(genotype, representation, metadata=None)
-
Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
genotype (G)
representation (geneticengine.representations.api.Representation[G, P])
metadata (dict[str, Any])
- genotype: G
- representation: geneticengine.representations.api.Representation[G, P]
- phenotype: P | None
- fitness_store: weakref.WeakKeyDictionary[geneticengine.problems.Problem, geneticengine.problems.Fitness]
- metadata: dict[str, Any]
- get_phenotype()
- has_fitness(problem)
- Parameters:
problem (geneticengine.problems.Problem)
- Return type:
bool
- set_fitness(problem, fitness)
- Parameters:
problem (geneticengine.problems.Problem)
fitness (geneticengine.problems.Fitness)
- get_fitness(problem=None)
- Parameters:
problem (geneticengine.problems.Problem | None)
- Return type:
- ensure_fitness(problem)
- Parameters:
problem (geneticengine.problems.Problem)
- static key_function(problem)
- Parameters:
problem (geneticengine.problems.Problem)
- __str__()
Return str(self).
- Return type:
str