-
Book Overview & Buying
-
Table Of Contents
Hands-On Genetic Algorithms with Python - Second Edition
By :
The DEAP framework comes with several built-in evolutionary algorithms provided by the algorithms module. One of them, eaSimple, implements the genetic algorithm flow we have been using, and can replace most of the code we had in the main method. Other useful DEAP objects, Statistics and Logbook, can be used for statistics gathering and printing, as we will soon see.
The program described in this section implements the same solution to the OneMax problem as the program discussed in the previous section but with less code. The only differences can be found in the main method. We will describe these differences in the following code snippets.
The complete program can be found here: https://github.com/PacktPublishing/Hands-On-Genetic-Algorithms-with-Python-Second-Edition/blob/main/chapter_03/02_OneMax_short.py.
The first change we will make is in the way statistics are being gathered. To this end, we will now take advantage of...