Solving the Knapsack Problem with an Evolutionary Algorithm in Python

 

We can solve various Knapsack problems using various evolutionary algorithms such as genetic ones. Of course, the solutions we get are not necessarily ideal, but in many situations we can be satisfied after some iterations of an evolutionary algorithm. Here I present an evolutionary algorithm in Python for solving this type of computational problems.

In this task, we should find a combination of items with maximum value and with its volume not greter than 50. Such optimization  is a tipical  NP-hard problem.

Leave a Reply

Your email address will not be published. Required fields are marked *