January 2020
Intermediate to advanced
346 pages
9h 8m
English
The second common use of the creator tool in DEAP is defining the individuals that form the population for the genetic algorithm. As we saw in the previous chapters, the individuals in genetic algorithms are represented using a chromosome that can be manipulated by genetic operators. In DEAP, the Individual class is created by extending a base class that represents the chromosome. In addition, each individual instance in DEAP needs to contain its fitness function as an attribute.
To fulfill these two requirements, we utilize the creator to create the creator.Individual class, as shown in this example:
creator.create("Individual", list, fitness=creator.FitnessMax)
This line provides the following two effects: ...
Read now
Unlock full access