Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Branch and Bound Searching Strategies 2 Branch-and-bound strategy 2 mechanisms: A mechanism to generate branches A mechanism to generate a bound so.

Similar presentations


Presentation on theme: "1 Branch and Bound Searching Strategies 2 Branch-and-bound strategy 2 mechanisms: A mechanism to generate branches A mechanism to generate a bound so."— Presentation transcript:

1

2 1 Branch and Bound Searching Strategies

3 2 Branch-and-bound strategy 2 mechanisms: A mechanism to generate branches A mechanism to generate a bound so that many braches can be terminated.

4 3 Branch-and-bound strategy It is efficient in the average case because many branches can be terminated very early. Although it is usually very efficient, a very large tree may be generated in the worst case. Recall the NPC problem. (Many NPC problem can be solved by B&B efficiently in the average case; however, the worst case time complexity is still exponential.)

5 4 Personnel Assignment Problem A linearly ordered set of persons P={P 1, P 2, …, P n } where P 1 <P 2 < … <P n A partially ordered set of jobs J={J 1, J 2, …, J n } Suppose that P i and P j are assigned to jobs f(P i ) and f(P j ) respectively. If f(P i )  f(P j ), then P i  P j. Cost C ij is the cost of assigning P i to J j. We want to find a feasible assignment with the minimum cost. i.e. X ij = 1 if P i is assigned to J j X ij = 0 otherwise. Minimize  i,j C ij X ij

6 5 e.g. A partial ordering of jobs After topological sorting, one of the following topologically sorted sequences will be generated: One of feasible assignments: P 1 → J 1, P 2 → J 2, P 3 → J 3, P 4 → J 4 J1J1 J2J2 ↓ ↘ ↓ J3J3 J4J4 J1,J1,J2,J2,J3,J3,J4J4 J1,J1,J2,J2,J4,J4,J3J3 J1,J1,J3,J3,J2,J2,J4J4 J2,J2,J1,J1,J3,J3,J4J4 J2,J2,J1,J1,J4J4 J3J3

7 6 A Solution Tree All possible solutions can be represented by a solution tree. J1J1 J2J2 ↓ ↘ ↓ J3J3 J4J4

8 7 Cost matrix Jobs Persons 1234 129191712 232302628 332179 418131015 Cost Matrix Apply the best- first search scheme:

9 8 Cost matrix Jobs Persons 1234 129191712 232302628 332179 418131015 Reduced Cost Matrix Jobs Persons 1234 117450(-12) 26102(-26) 301546(-3) 48005(-10) (-3) Reduced cost matrix

10 9 A reduced cost matrix can be obtained: subtract a constant from each row and each column respectively such that each row and each column contains at least one zero. Total cost subtracted: 12+26+3+10+3 = 54 This is a lower bound of our solution.

11 10 Branch-and-Bound for the Personnel Assignment Problem Bounding of subsolutions: Jobs Persons 1234 117450 26102 301546 48005

12 11 The traveling salesperson optimization problem Given a graph, the TSP Optimization problem is to find a tour, starting from any vertex, visiting every other vertex and returning to the starting vertex, with minimal cost. It is NP-complete We try to avoid n! exhaustive search by the branch-and-bound technique. (Recall that O(n!)>O(2 n ).)

13 12 The traveling salesperson optimization problem E.g. A Cost Matrix for a Traveling Salesperson Problem. jiji 1234567 1∞3931333957 24∞7742211634 34517∞36162825 4399080∞56791 528468833∞2557 6388184692∞7 7442633278439∞

14 13 The basic idea There is a way to split the solution space (branch) There is a way to predict a lower bound for a class of solutions. There is also a way to find a upper bound of an optimal solution. If the lower bound of a solution exceeds the upper bound, this solution cannot be optimal and thus we should terminate the branching associated with this solution.

15 14 Splitting We split a solution into two groups: One group including a particular arc The other excluding the arc Each splitting incurs a lower bound and we shall traverse the searching tree with the “ lower ” lower bound.

16 15 The traveling salesperson optimization problem Reduced cost matrix: A Reduced Cost Matrix. jiji 1234567 1∞0901030654(-3) 20∞7338171230(-4) 3291∞200129(-16) 4328373∞49084(-7) 5321638∞032(-25) 6085154389∞4(-3) 7180715813∞(-26) reduced:84

17 16 Table 6-5 Another Reduced Cost Matrix. jiji 1234567 1∞083930650 20∞6637171226 3291∞190125 4328366∞49080 5321567∞028 608584289∞0 7180005813∞ (-7)(-1) (-4) The traveling salesperson optimization problem

18 17 Lower bound The total cost of 84+12=96 is subtracted. Thus, we know the lower bound of this TSP problem is 96.

19 18 Total cost reduced: 84+7+1+4 = 96 (lower bound) decision tree: The Highest Level of a Decision Tree. If we use arc 3-5 to split, the difference on the lower bounds is 17+1 = 18. The traveling salesperson optimization problem

20 19 For the right subtree A Reduced Cost Matrix if Arc 4-6 is Included. (We must set c6-4 to be  )

21 20 For the left subtree The cost matrix for all solution with arc 4-6: A Reduced Cost Matrix for that in Table 6-6. Total cost reduced: 96+3 = 99 (new lower bound) jiji 123457 1∞08393050 20∞66371726 3291∞1905 5018534∞25(-3) 60858∞890 71800058∞

22 21 Upper bound We follow the best-first search scheme and can obtain a feasible solution with cost C. C serves as an upper bound and many branchings may be terminated if their lower bounds exceed C.

23 22 Fig 6-26 A Branch-and-Bound Solution of a Traveling Salesperson Problem.

24 23 Preventing an arc In general, if paths i 1 -i 2 - … -i m and j 1 -j 2 - … -j n have already been included and a path from i m to j 1 is to be added, then path from j n to i 1 must be prevented (by assigning the cost of j n to i 1 to be  )

25 24 The 0/1 knapsack problem Positive integer P 1, P 2, …, P n (profit) W 1, W 2, …, W n (weight) M (capacity)

26 25 The 0/1 knapsack problem Fig. 6-27 The Branching Mechanism in the Branch-and-Bound Strategy to Solve 0/1 Knapsack Problem.

27 26 How to find the upper bound? Ans: by quickly finding a feasible solution: starting from the smallest available i, scanning towards the largest i ’ s until M is exceeded. The upper bound can be calculated.

28 27 The 0/1 knapsack problem E.g. n = 6, M = 34 A feasible solution: X 1 = 1, X 2 = 1, X 3 = 0, X 4 = 0, X 5 = 0, X 6 = 0 -(P 1 +P 2 ) = -16 (upper bound) Any solution higher than -16 can not be an optimal solution. i123456 PiPi 6104564 WiWi 19810128 (P i /W i  P i+1 /W i+1 )

29 28 How to find the lower bound? Ans: by relaxing our restriction from X i = 0 or 1 to 0  X i  1 (knapsack problem)

30 29 The knapsack problem We can use the greedy method to find an optimal solution for knapsack problem. For example, for the state of X 1 =1 and X 2 =1, we have X 1 = 1, X 2 =1, X 3 = (34-6-10)/8=5/8, X 4 = 0, X 5 = 0, X 6 =0 -(P 1 +P 2 +5/8P 3 ) = -18.5 (lower bound) -18 is our lower bound. (only consider integers)

31 30 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.

32 31 0/1 Knapsack Problem Solved by Branch-and-Bound Strategy

33 32 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)

34 33 The A * algorithm Used to solve optimization problems. Using the best-first strategy. If a feasible solution (goal node) is obtained, then it is optimal and we can stop. Estimated cost function of node n : f(n) f(n) = g(n) + h(n) g(n): cost from root to node n. h(n): estimated cost from node n to a goal node. h * (n): “ real ” cost from node n to a goal node. f*(n): “ real ” cost of node n h(n)  h*(n)  f(n) = g(n) + h(n)  g(n)+h * (n) = f * (n)

35 34 Reasoning Let t be the selected goal node. Let n denote a node already expanded. f(t)  f(n) f(t)  f(n)  f*(n) But one of f*(n) ’ s must be the optimal value (cost). Let f*(s) denote the value. We have f(t)  f*(s) ………… (a)

36 35 Reasoning Since t is a goal node, we have h(t)=0. Thus, f(t)=g(t)+h(t)=g(t). By Eq. (a), we have f(t)=g(t)  f*(s) Yet, f(t)=g(t) is the value of a feasible solution. Consequently, g(t) cannot be smaller than f*(s) by definition. This means that g(t)=f*(s).

37 36 The A * algorithm Stop iff the selected node is also a goal node Stop iff the selected node is also a goal node E.g. Fig. 6-36 A Graph to Illustrate A * Algorithm.

38 37 The A * algorithm Step 1.

39 38 The A * algorithm Step 2. Expand A

40 39 The A * algorithm Step 3. Expand C

41 40 The A * algorithm Step 4. Expand D

42 41 The A * algorithm Step 5. Expand B

43 42 The A * algorithm Step 6. Expand F

44 43 The A* Algorithm Can be considered as a special type of branch-and-bound algorithm.


Download ppt "1 Branch and Bound Searching Strategies 2 Branch-and-bound strategy 2 mechanisms: A mechanism to generate branches A mechanism to generate a bound so."

Similar presentations


Ads by Google