January 2020
Intermediate to advanced
346 pages
9h 8m
English
In many cases, the Toolbox class is used to customize existing functions from the tools module. The tools module contains numerous handy functions related to the genetic operations of selection, crossover, and mutation, as well as initialization utilities.
For example, the following code defines three aliases that will be later used as the genetic operators:
from deap import toolstoolbox.register("select", tools.selTournament, tournsize=3)toolbox.register("mate", tools.cxTwoPoint)toolbox.register("mutate", tools.mutFlipBit, indpb=0.02)
The three aliases are defined in detail as follows:
Read now
Unlock full access