Knapsack problem/Unbounded/Python dynamic programming: Difference between revisions
Content added Content deleted
m (→DP, multiple size dimensions: (spelling)) |
|||
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 |
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 |
||