Genetic algorithms solution

To solve our knapsack 0-1 problem using a genetic algorithm, we created the 01-solve-knapsack.py Python program located at the following URL:

https://github.com/PacktPublishing/Hands-On-Genetic-Algorithms-with-Python/blob/master/Chapter04/01-solve-knapsack.py

As a reminder, the chromosome representation we decided to use here is a list of integers with the values of 0 or 1. This makes our problem, from the point of view of the genetic algorithm, similar to the OneMax problem we solved in the previous chapter. The genetic algorithm does not care what the chromosome represents (the phenotype)—a list of items to pack, some Boolean equation coefficients, or perhaps just some binary number—it is only concerned with ...

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.