Presentation is loading. Please wait.

Presentation is loading. Please wait.

Other partial solution strategies. Partial solution algorithms greedy  branch and bound  A*  divide and conquer  dynamic programming.

Similar presentations


Presentation on theme: "Other partial solution strategies. Partial solution algorithms greedy  branch and bound  A*  divide and conquer  dynamic programming."— Presentation transcript:

1 Other partial solution strategies

2 Partial solution algorithms greedy  branch and bound  A*  divide and conquer  dynamic programming

3 4 queens: separate row and column complete solutions possible pruning More in next slide set…

4 Branch and Bound  eliminate subtrees of possible solutions based on evaluation of partial solutions complete solutions

5 e.g., branch and bound TSP complete solutions current best solution distance 498 distance so far 519

6 Branch and Bound requirement  a bound on best solution possible from current partial solution (e.g., if distance so far is 519, total distance is >519)  ‘tight’ as possible  quick to calculate  a current best solution (e.g., 498)

7 Tight bounds  value of partial solution plus  estimate of value of remaining steps must be ‘optimistic estimate’ example: path so far:519 remainder of path: 0 (not tight) bounded estimate:519

8 Optimistic but Tight Bound optimistic tight Current best Actual values if calculated

9 Example - b&b for TSP  Estimate a lower bound for the path length: Fast to calculate Easy to revise ABCDE A712811 B710713 C1210912 D87910 E11131210

10 Example - b&b for TSP 1.Assume shortest edge to each city: (7+7+9+7+10) = 40 A B C D E 2.Assume two shortest edges to each: ((7+8)+(7+7)+(9+10)+(7+8)+(10+11))/2 = 7.5 + 7 + 9.5 + 7.5 + 10.5 = 42 Which is better? ABCDE A712811 B710713 C1210912 D87910 E11131210

11 Tight Bound Path so far 0 40 Path so far 11 44 Path so far 11+13 = 24 47 (7+7+9+7+10) = 40 ABCDE A712811 B710713 C1210912 D87910 E11131210 Best Path found 46

12 B&B algorithm  Depth first traversal of partial solution space - leaves are complete solutions  Subtrees are pruned below a partial solution that cannot be better than the current best solution

13 Partial solution algorithms greedy branch and bound  A*  divide and conquer  dynamic programming

14 A* algorithm - improved b&b  Ultimate partial solution search  Based on tree searching algorithms you already know - bfs, dfs  Two versions: Simple - used on trees Advanced - used on general graphs

15 general search algorithm for trees* algorithm search (startState, fitnessFn()) returns bestState openList = new StateCollection(); openList.insert(startState) bestState = null bestFitness = min // assuming maximum wanted while (notEmpty(openList) && resourcesAvailable) state = openList.get() fitness = fitnessFn(state) if (state is complete and fitness > bestFitness ) bestFitness = fitness bestState = state for all values k in domain of next variable nextState = state.include(k) openList.insert(nextState) return solutionState *For graphs, cycles are a problem

16 Versions of general search  Based on the openList collection class Breadth first search Depth first search (->branch and bound) Best first search (informed search)  Best first  A*

17 A CBD FEGHIJKLMNOP QR ST UVWXYZabcdefghij kl mn algorithm search (startState, fitnessFn()) returns bestState openList = new StateCollection(); openList.insert(startState) bestState = null bestFitness = min // assuming maximum wanted while (notEmpty(openList) && resourcesAvailable) state = openList.get() fitness = fitnessFn(state) if (state is complete and fitness > bestFitness ) bestFitness = fitness bestState = state for all values k in domain of next variable nextState = state.include(k) openList.insert(nextState) return solutionState

18 A*  Best first search with a heuristic fitness function: Admissible (never pessimistic) Tradeoff: Simplicity vs accuracy/tightness  The heuristic heuristic: “Reduced problem” strategy e.g., min path length in TSP


Download ppt "Other partial solution strategies. Partial solution algorithms greedy  branch and bound  A*  divide and conquer  dynamic programming."

Similar presentations


Ads by Google