The 0/1 Knapsack Problem Solved by the Branch-and-Bound Strategy The 0/1 knapsack problem P1, P2, …, Pn (profit) W1,W2, …,Wn (weight) M (capacity) Positive integers n Maximize Pi X i i 1 n subject to Wi X i M Xi = 0 or 1, i =1, …, n. i 1 The problem is modified: n Minimize Pi X i i 1 5-2 e.g. n = 6, M = 34 i 1 2 3 4 5 6 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. 5-3 Relax the Restriction Relax our restriction from Xi = 0 or 1 to 0 Xi 1 (knapsack problem) n Let Pi X i be an optimal solution for 0/1 i 1 n knapsack problem and Pi X i be an optimal i 1 solution for knapsack problem. n Let Y= Pi X i , Y’ = i 1 Y’ Y 5-4 n Pi X i . i 1 Upper Bound and Lower Bound We can use the greedy method to find an optimal solution for knapsack problem: X1 = 1, X2 =1, X3 = 5/8, X4 = 0, X5 = 0, X6 =0 -(P1+P2+5/8P3) = -18.5 (lower bound) -18 is our lower bound. (only consider integers) -18 optimal solution -16 optimal solution: X1 = 1, X2 = 0, X3 = 0, X4 = 1, X5 = 1, X6 = 0 -(P1+P4+P5) = -17 5-5 U.B.=-16 L.B.=-18 0 X1=1 1 U.B.=-16 L.B.=-18 X3=1 5 X2=0 U.B.=-16 L.B.=-18 infeasible X5=1 9 X2=1 U.B.=-16 L.B.=-18 6 13 8 U.B.=-16 L.B.=-18 10 U.B.=-15 L.B.=-18 22 X5=0 U.B.=-16 L.B.=-18 X5=1 27 28 U.B.=-15 L.B.=-18 11 X6=0 infeasible infeasible 12 X6=1 U.B.=-16 L.B.=-16 29 30 infeasible U.B.=-16 L.B.=-18 24 X5=1 23 X6=1 U.B.=-14 L.B.=-14 17 X4=0 16 X6=1 U.B.=-16 L.B.=-16 19 U.B.=-16 L.B.=-16 U.B.=-17 X =0 5 L.B.=-18 18 26 infeasible U.B.=-17 L.B.=-18 X5=1 X6=0 25 15 U.B.=-16 L.B.=-18 U.B.=-15 L.B.=-15 U.B.=-17 L.B.=-18 X4=1 X5=0 X6=0 X6=1 14 X4=0 U.B.=-15 L.B.=-18 21 X5=0 infeasible X3=0 X4=1 X4=0 infeasible U.B.=-15 L.B.=-18 4 X3=0 X4=1 7 U.B.=-14 L.B.=-17 2 X2=1 3 X1=0 infeasible U.B.=-15 L.B.=-15 X6=0 20 U.B.=-17 L.B.=-17 A Job Scheduling Problem Solved by the Branch-and Boubd Approach Job Scheduling Job Scheduling A B F G C E D H I K L J T1 T2 T3 T4 T5 T6 T7 T8 T9 3 2 2 2 4 5 3 2 3 M N P O A Time Profile T1 T2 T3 T4 T5 T6 T7 T8 T9 3 2 2 2 4 5 3 2 3 This time profile indicates that at time t=1,only three precessors can be used Solution Part of a Solution Tree Rule1: Common Successors Effect A C D I E P J (C,D)分享同一個子結點,(E,P)也是相同的狀況 在可能解當中,(C,E)與(D,P)是相同的狀況 有相同子代和父代的連線,互換不受影響 Rule2 Internal Node First Strategy 第三種答案 選擇(B,E,P)展開之後會發現(C,D)(F,J)可以使用 Rule3:Maximizing the Number of Processed Job Rule4:Accumulated Idle Processors Strategy Accumulated Processors Effect The Experimental Result Conclude