Coding genetic algorithms using Distributed Evolutionary Algorithms in Python
Now that we understand how genetic algorithms work, let's try solving some problems with them. They have been used to solve NP-hard problems such as the traveling salesman problem. To make the task of generating a population, performing the crossover, and performing mutation operations easy, we will make use of Distributed Evolutionary Algorithms in Python (DEAP). It supports multiprocessing and we can use it for other evolutionary algorithms as well. You can download DEAP directly from PyPi using this:
pip install deap
It is compatible with Python 3.
To learn more about DEAP, you can refer to its GitHub repository (https://github.com/DEAP/deap) and its user's guide (http://deap.readthedocs.io/en/master/).
Guess the word
In this program, we use genetic algorithms to guess a word. The genetic algorithm will know the number of letters in the word and will guess those letters until it finds the right answer. We decide...