title: Optimal way of filling 2 knapsacks?
body: <p>The dynamic programming algorithm to optimally fill a knapsack works well in the case of one knapsack. But is there an efficient known algorithm that will optimally fill 2 knapsacks (capacities can be unequal)? </p>
  
  <p>I have tried the following two approaches and neither of them is correct. </p>
  
  <ol>
  <li>First fill the first knapsack using the original DP algorithm to fill one knapsack and then fill the other knapsack.</li>
  <li>First fill a knapsack of size W1 + W2 and then split the solution into two solutions (where W1 and W2 are the capacities of the two knapsacks).</li>
  </ol>
  
  <p>Problem statement (see also <a href="http://en.wikipedia.org/wiki/Knapsack_problem" rel="noreferrer">Knapsack Problem</a> at Wikipedia): </p>
  
  <ol>
  <li><p>We have to fill the knapsack with a set of items (each item has a weight and a value) so as to maximize the value that we can get from the items while having a total weight less than or equal to the knapsack size. </p></li>
  <li><p>We cannot use an item multiple times. </p></li>
  <li>We cannot use a part of an item. We cannot take a fraction of an item. (Every item must be either fully included or not).</li>
  </ol>