Genetic algorithms solution

To solve the N-Queens problem using a genetic algorithm, we created the Python program 01-solve-n-queens.py, which is located at https://github.com/PacktPublishing/Hands-On-Genetic-Algorithms-with-Python/blob/master/Chapter05/01-solve-n-queens.py.

Since the solution representation we chose for this problem is a list (or an array) of indices, which is similar to the representation we used for the traveling salesman problem (TSP) and the vehicle routing problem (VRP) in Chapter 4, Combinatorial Optimization, we were able to utilize a similar genetic approach, just like we did there. In addition, we take advantage of elitism once more by reusing the elitist version that we created for DEAP's simple genetic flow.  ...

Get Hands-On Genetic Algorithms with Python now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.