Two Dimensional Knapsack recursive function working *but* can't save combination of items

General explanation about knapsack problems Wikipedia - multidimensional knapsack problem

In my case 5 types of items, infinite number of items for each (name, weight, volume, value) :

("Item_1", 61, 61, 5) , ("Item_2", 46, 39, 29) , ("Item_3", 38, 38, 25) , ("Item_4", 44, 11, 69) , ("Item_5", 14, 29, 86)

And my bag with a max volume of 326 and max weight of 336.

My recursive function (WORKS GOOD):

public int put_in(Item[] items, int current_bag_volume, int current_bag_weight, List current_items_in_bag) {

if (items == null) return 0;

for (Item item : items) {

if (current_bag_volume + item.getVolume()...

Read More »

By: StackOverFlow - 5 days ago

Related Posts

  • Older News
  • Java exercise CHAINS StackOverFlow (2 days ago) - you're my last chance to year include. I know that for some of you that will be so easy problem. I have a list of exercise to make. I've made...