This is a great classic of algorithm problems.
This problem requires finding a proficient way to select some objects with a certain value among many others. In order to put in the set as much total value as possible considering a maximum space allowed.
I resolved this problem with a brute force algorithm and a branch and bound one.
I then wrote both the pseudo-code and the python code in a pdf file that you can find in my repository here https://github.com/AndreaRubbi/Knapsack-implementation-Python/blob/master/Knapsack.pdf
The most efficient way of resolving this problem is, however, using a dynamic algorithm.
Yet, I didn't implement it so far. If anyone would like to see it, I could do it 'on-demand' let's say.
Hope you'll enjoy!
Nessun commento:
Posta un commento