0

So the problem I have is the following : there is a set of N categories of objects, in each category there are M objects, each with a specified value and weight. We have to pick one object from each category so that the weight is <= some given capacity W, and the value is maximum. The task has to be solved using the branch and bounds method. I struggle to understand how is this method supposed to work in this situation. Could you please explain it to me?

Miyavistka
  • 23
  • 3
  • That's a bit too broad. You need to take a stab at it first, and post your code if you're still having trouble. – Tom Karzes Nov 06 '17 at 11:24
  • That's the problem - I'm not sure I understand how this method is supposed to work in this situation – Miyavistka Nov 06 '17 at 11:32
  • so your question has nothing to do with python in particular... – hoefling Nov 06 '17 at 11:53
  • Use the power of google and look at https://en.wikipedia.org/wiki/Branch_and_bound and maybe this gives some insight: http://compalg.inf.elte.hu/~tony/Oktatas/SecondExpert/Chapter24-Branch-6April.pdf – Gijs Den Hollander Nov 06 '17 at 15:04
  • This is the multiple choice knapsack problem solved in the 70s by Sinha and Zoltners. [Here](http://pubsonline.informs.org/doi/abs/10.1287/opre.27.3.503?journalCode=opre) is the original reference. If you google around you will find some more stuff. – Ioannis Nov 07 '17 at 11:48

1 Answers1

1

A short example of what the algorithm should do.

lets say you have 4 items [(weight, value)]= [(3, 5),(8, 10),(1, 2),(4, 5)]. First sort them on there value per weight = [(1, 2),(12, 20),(4, 5),(9, 10)] and the maximum weight is 16.

starting from the first item make a tree where you either ad or drop a item. At each level in the tree calculate weight, the value and the value which is still left in the three. If the value left + value in a branch is less than maximum value you find, then you close that branch. You also close a branch if the weight is more than aloud.

Below a schematic representation of how it should work.

                                       (value)         (0)
                                       (weight)        (0)
                                       (value left)    (37)
                                                add          drop 
     (1,2)                                   <-------       ------>      
                                     (2)                                   (0)
                                     (1)                                   (0)
                                     (35)                                  (35)
     (20,12)            ---------------------------------------------------------------
                        (22)                    (2)               (20)              (0)
                        (13)                    (1)               (12)              (0)
                        (15)                   *(15)              (15)             *(15)
     (4,5)        -----------------------------------------------------------------------
                  (27)        (22)                          (25)         (20)
                  (17)        (13)                          (16)         (12)
                **(10)        (10)                          (10)         (10)
     (9,10)     ---------------------------------------------------------------------------
                            (31) (20)                    (35)   (25)   (30) (20)  
                            (22) (13)                    (25)   (16)   (21) (12) 
                          **(0)  (0)                   **(0)    (0)  **(0)  (0) 
                                                                win

* branch is closed due to that the value+value left< then maximum value in the tree

** branch is closed due to that the weight is more than the aloud weight.

The benefit of this method is that you reduce computations compared to a brute force method. By starting which items which have the highest value per weight, its very likely that you close of branches quickly and reduce computation time.

hopefully this helps