Knapsack as a dynamic programming problem

45 Views Asked by At

Ok so we are given the following linear programming problem:

$\max x_1 + 2x_2+2x_3+3x_4$

Subject to:

$2x_1 + 3x_2+x_3+2x_4 \le 4$

$1x_1 + 2x_2+ 3x_3+x_4 \le 4$

$x_1,x_2,x_3,x_4\in {0,1} $

My first thought is that this is an instance of the Knapsack 0-1 problem , but this 2nd constraint confuses me. From what i understand its like we have the weight of the items(for the 1st constraint) and in the 2nd constraint we have , lets say, the volume of every item , and that our backpack cannot contain more than 4 (happens to be the same as the weight).

Any ideas on how to approach this problem using dynamic programming?