280 likes | 524 Views
4. A. B. C. 4. 3. 5. 5. s. G. 4. 3. F. D. E. 2. 4. Find a Path. Heuristically Informed Methods. Which node do I expand next? What information can I use to guide this decision? Hill Climbing Beam Search Best First Search. 4. A. B. C. 4. 3. 5. 5. s. G. 4. 3. F. D.
E N D
4 A B C 4 3 5 5 s G 4 3 F D E 2 4 Find a Path
Heuristically Informed Methods • Which node do I expand next? • What information can I use to guide this decision? • Hill Climbing • Beam Search • Best First Search
4 A B C 4 3 5 5 s G 4 3 F D E 2 4 Hill Climbing A B C 10.4 6.7 4 11.0 s G 8.9 3 6.9 F D E
Hill Climbing • Heuristic: Straight line distance to goal • Sort new paths, if any, by the estimated distances between their terminal nodes and the goal • Add the new paths to the FRONT of the Q
Hill Climbing Problems • Local optima • Uninformative landscape (plateaus) • Uninformed movement operator (ridge) • Consider parameter tuning • Thermostat, television, mountain climbing
Beam Search • BFS, but only the the best W (beam size) nodes at each level are expanded. • Beam search will only consider w nodes per level. No exponential explosion.
Best-First Search • Expand best next node • Resort the ENTIRE Q by heuristic after every expansion
Optimal Search • Finding the best path • Find all paths and choose the best • What’s the problem?
Branch and Bound • Extend the shortest partial path • When you find a path, you must extend all partial paths until their lengths are longer than the path you found, or you find a shorter path
B&B • Form a one-element queue containing the root node • Until the first path in the queue terminates at the goal node or the queue is empty • Remove the first path from the queue, create new paths by extending the first path to all the neighbors of the terminal node • Reject all new paths with loops • Add the remaining new paths, if any, to the queue • Sort the entire queue by path length with the least-cost paths in front • If the goal node is found, announce success; otherwise failure
Underestimates • In addition to partial path length, let us also use distance remaining • Distance remaining is an admissable heuristic • It always underestimates the true remaining distance. Why is this property important?
Underestimates help • E(total path length) = D(already travelled) + E(remaining distance) • What if your estimate is wrong? • Overestimate • Underestimate • Other
Underestimates • Overestimate: you could hide the optimal path • Underestimate: you will not miss finding the optimal path • Other: your mileage may vary
B&B with underestimates • Form a one-element queue containing the root node • Until the first path in the queue terminates at the goal node or the queue is empty • Remove the first path from the queue, create new paths by extending the first path to all the neighbors of the terminal node • Reject all new paths with loops • Add the remaining new paths, if any, to the queue • Sort the entire queue by the sum of the path length and a lower bound estimate of the cost remaining, with least cost paths in front. • If the goal node is found, announce success; otherwise failure
Dynamic Programming • Eliminate redundant paths that slow search efficiency • The dynamic programming principle • The best way through a particular, intermediate node is the best way to it, followed by the best way from it to the goal.
B&B with DP • Form a one-element queue containing the root node • Until the first path in the queue terminates at the goal node or the queue is empty • Remove the first path from the queue, create new paths by extending the first path to all the neighbors of the terminal node • Reject all new paths with loops • Add the remaining new paths, if any, to the queue • If two or more paths reach a common node, delete all those paths except the one that reaches the common node with the min cost • Sort the entire queue by the path length with least cost paths in front. • If the goal node is found, announce success; otherwise failure
A* Search • Branch and bound, with understimates, and using the dynamic programming principle
B&B + underestimates + DP • Form a one-element queue containing the root node • Until the first path in the queue terminates at the goal node or the queue is empty • Remove the first path from the queue, create new paths by extending the first path to all the neighbors of the terminal node • Reject all new paths with loops • Add the remaining new paths, if any, to the queue • If two or more paths reach a common node, delete all those paths except the one that reaches the common node with the min cost • Sort the entire queue by the sum of the path length and a lower-bound estimate of the cost remaining, with least cost paths in front. • If the goal node is found, announce success; otherwise failure
Game Trees • How do you represent a game situation in a search tree? • Minimax search • Alpha-Beta pruning • Tic-Tac-Toe, Chess
Game Tree Original board New boards New boards
Minimax search • Evaluation of board position summarized into a single number. • Positive numbers indicate favor to one player. • Negative numbers indicate favor to other player • Static evaluator evaluates board position, computes static evaluation score • Maximizing player, Minimizing player
Minimax Example Max Min Max 2 7 1 8
Minimax Procedure • If the limit of the search has been reached, compute the static value of the current position relative to the appropriate player. Report the result • Otherwise, if the level is a minimizing level, use MINIMAX on the children of the current position. Report the MINIMUM of the results • Otherwise, if the level is a maximizing level, use the MINIMAX on the children of the current position. Report the MAXIMUM of the results
Alpha-Beta with Minimax • If you have an idea that is truly bad, do not take the time to see how truly awful it is
Alpha-Beta Example Max Min Max 2 7
Big Alpha-Beta example • Figure 6.4
Heuristics for minimax • Progressive deepening • Heuristic continuation • Heuristic pruning
Alpha-Beta effect • Best case analysis • 2b ^d/2 - 1 if d is even • B^(d+1)/2 - b^(d-1)/2 – 1 if d is odd • Does not change exponential explosion