Knapsack problem/Unbounded/Python dynamic programming: Difference between revisions

Content added Content deleted
Line 76: Line 76:


====DP, multiple size dimensions====
====DP, multiple size dimensions====
Our original problem has two dimensions to 'size': weight and volume. We can create a python size object, that kows how to enumerate itself over its given dimensions, as well as perform logical and simple mathematical operations. With the use of the Size object, a correct solution to the given unbounded knapsack problem can be found by the following proceedure:
Our original problem has two dimensions to 'size': weight and volume. We can create a python size object, that knows how to enumerate itself over its given dimensions, as well as perform logical and simple mathematical operations. With the use of the Size object, a correct solution to the given unbounded knapsack problem can be found by the following proceedure:
<lang python>from knapsack_sizer import makesize
<lang python>from knapsack_sizer import makesize