Professional Documents
Culture Documents
Stochastic Processess
Knapsack Problem
Branch and Bound
Kumara Dharaka, S.T., M.Sc.
Knapsack Problem using
Branch and Bound
2
Knapsack Problem
Pi 6 10 4 5 6 4
Wi 10 19 8 10 12 8
(Pi/Wi Pi+1/Wi+1)
• A feasible solution: X1 = 1, X2 = 1, X3 = 0, X4 = 0,
X5 = 0, X6 = 0
-(P1+P2) = -16 (upper bound)
Any solution higher than -16 can not be an optimal solution.
Knapsack Problem
How to find the lower
bound?
• Ans: by relaxing our restriction from Xi = 0
or 1 to 0 Xi 1 (knapsack problem)
The knapsack problem
• We can use the greedy method to find an optimal
solution for knapsack problem.
• For example, for the state of X1=1 and X2=1, we have
X1 = 1, X2 =1, X3 = (34-6-10)/8=5/8, X4 = 0, X5 = 0, X6
=0
-(P1+P2+5/8P3) = -18.5 (lower bound)
-18 is our lower bound. (We only consider integers,
since the benefits of a 0/1 knapsack problem will be
integers.)
How to expand the tree?
• By the best-first search scheme
• That is, by expanding the node with the best
lower bound. If two nodes have the same
lower bounds, expand the node with the
lower upper bound.
• Node 2 is terminated because its lower
bound is equal to the upper bound of node
14.
• Nodes 16, 18 and others are terminated
because the local lower bound is equal to
the local upper bound.
(lower bound optimal solution upper
bound)
Thank You