individual module¶
This module defines the Individual class.
This module defines the Individual class, used to create inidividuals. It defines the methods allowed on individuals, including the mutations and evaluation of individuals.
-
class
individual.
Individual
(individual_genotype: Dict[str, Tuple[type, List[Union[int, float]]]], constraint: str = 'Soft')[source]¶ Bases:
object
The Individual class, used to define the individuals of a population.
Defines an individual in a population, performs the mutations and evaluations of individuals.
-
copy
() → individual.Individual[source]¶ Returns a deepcopy of the individual.
-
evaluate
(optimization_func: Callable = <function Individual.<lambda>>, fitness: Callable = <function Individual.<lambda>>) → Union[int, float][source]¶ Evaluates the performance of an individual on the task to optimize.
- Parameters
optimization_func (Callable) – The problem to optimize. This can be
defined or can be one of the test functions. (manually) –
fitness (Callable) – The fitness function to use to optimize the task. For example, this can be a minimization problem (fitness=minimize). This can be manually defined or can be one of the test functions.
- Returns
The individual’s score on the optimization task.
- Return type
score (float)
-