The short one max genetic algorithm example is very similar to one max example. The only difference is that it makes use of the algorithms module that implements some basic evolutionary algorithms. The initialization are the same so we will skip this phase. The algorithms impemented use specific functions from the toolbox, in this case evaluate(), mate(), mutate() and select() must be registered.
tools.register("evaluate", evalOneMax) tools.register("mate", toolbox.cxTwoPoints) tools.register("mutate", toolbox.mutFlipBit, indpb=0.05) tools.register("select", toolbox.selTournament, tournsize=3)
The toolbox is then passed to the algorithm and the algorithm uses the registered function.