informed search and exploration
play

Informed Search and Exploration Sections 3.5 and 3.6 Ch. 03 p.1/51 - PowerPoint PPT Presentation

Informed Search and Exploration Sections 3.5 and 3.6 Ch. 03 p.1/51 Outline Best-first search A search Heuristics, pattern databases IDA search (Recursive Best-First Search (RBFS), MA and SMA search) Ch. 03 p.2/51


  1. Informed Search and Exploration Sections 3.5 and 3.6 Ch. 03 – p.1/51

  2. Outline Best-first search A ∗ search Heuristics, pattern databases IDA ∗ search (Recursive Best-First Search (RBFS), MA ∗ and SMA ∗ search) Ch. 03 – p.2/51

  3. Best-first search Idea: use an evaluation function for each node The evaluation function is an estimate of “desirability” Expand the most desirable unexpanded node The desirability function comes from domain knowledge Implementation: The frontier is a queue sorted in decreasing order of desirability Special cases: greedy best first search A ∗ search Ch. 03 – p.3/51

  4. Romania with step costs in km Oradea 71 Neamt 87 Zerind 151 75 Iasi Arad 140 92 Sibiu Fagaras 99 118 Vaslui 80 Rimnicu Vilcea Timisoara 142 211 111 Pitesti Lugoj 97 70 98 Hirsova 85 146 Mehadia 101 Urziceni 86 75 138 Bucharest 120 Dobreta 90 Eforie Craiova Giurgiu Sample straight line distances to Bucharest: Arad : 366, Bucharest : 0, Sibiu : 253, Timisoara : 329. Ch. 03 – p.4/51

  5. Greedy best-first search Evaluation function h ( n ) ( h euristic) = estimate of cost from n to the closest goal E.g., h SLD ( n ) = straight-line distance from n to Bucharest Greedy best-first search expands the node that appears to be closest to goal Ch. 03 – p.5/51

  6. Greedy best-first search example Arad Ch. 03 – p.6/51

  7. After expanding Arad Arad 75 140 118 Sibiu Timisoara Zerind 253 329 374 Ch. 03 – p.7/51

  8. After expanding Sibiu Arad 75 140 118 Sibiu Timisoara Zerind 329 374 80 140 151 99 Arad Fagaras Oradea Rimnicu V. 366 176 380 193 Ch. 03 – p.8/51

  9. After expanding Fagaras Arad 75 140 118 Sibiu Timisoara Zerind 329 374 80 140 151 99 Arad Fagaras Oradea Rimnicu V. 366 380 193 99 211 Sibiu Bucharest 253 0 The goal Bucharest is found with a cost of 450. However, there is a better solution through Pitesti ( h = 417 ). Ch. 03 – p.9/51

  10. Properties of greedy best-first search Complete No — can get stuck in loops For example, going from Iasi to Fagaras, Iasi → Neamt → Iasi → Neamt → . . . Complete in finite space with repeated-state checking Time O ( b m ) , but a good heuristic can give dramatic improvement (more later) Space O ( b m ) —keeps all nodes in memory Optimal No (For example, the cost of the path found in the previous slide was 450. The path Arad, Sibiu, Rimnicu Vilcea, Pitesti, Bucharest has a cost of 140+80+97+101 = 418.) Ch. 03 – p.10/51

  11. A ∗ search Idea: avoid expanding paths that are already expensive Evaluation function f ( n ) = g ( n ) + h ( n ) g ( n ) = exact cost so far to reach n h ( n ) = estimated cost to goal from n f ( n ) = estimated total cost of path through n to goal A ∗ search uses an admissible heuristic i.e., h ( n ) ≤ h ∗ ( n ) where h ∗ ( n ) is the true cost from n . (Also require h ( n ) ≥ 0 , so h ( G ) = 0 for any goal G .) Straight line distance ( h SLD ( n ) ) is an admissible heuristic because never overestimates the actual road distance. Ch. 03 – p.11/51

  12. A ∗ search example Arad 366=0+366 Ch. 03 – p.12/51

  13. After expanding Arad Arad Sibiu Timisoara Zerind 393=140+253 447=118+329 449=75+374 Ch. 03 – p.13/51

  14. After expanding Sibiu Arad Sibiu Timisoara Zerind 447=118+329 449=75+374 Arad Fagaras Oradea Rimnicu V. 646=280+366 415=239+176 671=291+380 413=220+193 Ch. 03 – p.14/51

  15. After expanding Rimnicu Vilcea Arad Sibiu Timisoara Zerind 447=118+329 449=75+374 Arad Fagaras Oradea Rimnicu V. 646=280+366 415=239+176 671=291+380 Craiova Pitesti Sibiu 526=366+160 417=317+100 553=300+253 Ch. 03 – p.15/51

  16. After expanding Fagaras Arad Sibiu Timisoara Zerind 447=118+329 449=75+374 Arad Fagaras Oradea Rimnicu V. 646=280+366 671=291+380 Sibiu Bucharest Craiova Pitesti Sibiu 591=338+253 450=450+0 526=366+160 417=317+100 553=300+253 Remember that the goal test is performed when a node is selected for expansion, not when it is generated. Ch. 03 – p.16/51

  17. After expanding Pitesti Arad Sibiu Timisoara Zerind 447=118+329 449=75+374 Arad Fagaras Oradea Rimnicu V. 646=280+366 671=291+380 Sibiu Bucharest Craiova Pitesti Sibiu 591=338+253 450=450+0 526=366+160 553=300+253 Bucharest Craiova Rimnicu V. 418=418+0 615=455+160 607=414+193 Ch. 03 – p.17/51

  18. Optimality of A ∗ for trees Theorem: A ∗ search is optimal. Note that, A ∗ search uses an admissible heuristic by definition. Suppose some suboptimal goal G 2 has been generated and is in the queue. Let n be an unexpanded node on a shortest path to an optimal goal G 1 . Ch. 03 – p.18/51

  19. Optimality of A ∗ for trees (cont’d) start n G1 G2 f ( n ) = g ( n ) + h ( n ) by definition f ( G 1 ) = g ( G 1 ) because h is 0 at a goal f ( G 2 ) = g ( G 2 ) because h is 0 at a goal f ( n ) ≤ f ( G 1 ) because h is admissible (never overestimates) f ( G 1 ) < f ( G 2 ) because G 2 is suboptimal f ( n ) < f ( G 2 ) combine the above two Since f ( n ) < f ( G 2 ) , A ∗ will never select G 2 for expansion. Ch. 03 – p.19/51

  20. Progress of A ∗ with an inconsistent heuristic I g=0, h=6, f=6 2 2 g=2, h=2, f=4 g=2, h=5, f=7 1 2 g=4, h=1, f=5 g=3, h=1, f=4 4 g=7, h=0, f=7 g=8, h=0, f=8 G Note that h is admissible, it never overestimates. Ch. 03 – p.20/51

  21. Progress of A ∗ with an inconsistent heuristic I g=0, h=6, f=6 2 2 g=2, h=2, f=4 g=2, h=5, f=7 1 2 g=4, h=1, f=5 g=3, h=1, f=4 4 g=7, h=0, f=7 g=8, h=0, f=8 G The root node was expanded. Note that f decreased from 6 to 4. Ch. 03 – p.21/51

  22. Progress of A ∗ with an inconsistent heuristic I g=0, h=6, f=6 2 2 g=2, h=2, f=4 g=2, h=5, f=7 1 2 g=4, h=1, f=5 g=3, h=1, f=4 4 g=7, h=0, f=7 g=8, h=0, f=8 G The suboptimal path is being pursued. Ch. 03 – p.22/51

  23. Progress of A ∗ with an inconsistent heuristic I g=0, h=6, f=6 2 2 g=2, h=2, f=4 g=2, h=5, f=7 1 2 g=4, h=1, f=5 g=3, h=1, f=4 4 g=7, h=0, f=7 g=8, h=0, f=8 G Goal found, but we cannot stop until it is selected for expansion. Ch. 03 – p.23/51

  24. Progress of A ∗ with an inconsistent heuristic I g=0, h=6, f=6 2 2 g=2, h=2, f=4 g=2, h=5, f=7 1 2 g=4, h=1, f=5 g=3, h=1, f=4 4 g=7, h=0, f=7 g=8, h=0, f=8 G The node with f = 7 is selected for expansion. Ch. 03 – p.24/51

  25. Progress of A ∗ with an inconsistent heuristic I g=0, h=6, f=6 2 2 g=2, h=2, f=4 g=2, h=5, f=7 1 2 g=4, h=1, f=5 g=3, h=1, f=4 4 g=7, h=0, f=7 g=8, h=0, f=8 G The optimal path to the goal is found. Ch. 03 – p.25/51

  26. Consistency A heuristic is consistent if n h ( n ) ≤ c ( n, a, n ′ ) + h ( n ′ ) If h is consistent, we have c(n, a, n’) h(n) f ( n ′ ) g ( n ′ ) + h ( n ′ ) = n’ g ( n ) + c ( n, a, n ′ ) + h ( n ′ ) = h(n’) G g ( n ) + h ( n ) ≥ = f ( n ) I.e., f ( n ) is nondecreasing along any path. Ch. 03 – p.26/51

  27. Optimality of A ∗ for graphs Lemma: A ∗ expands nodes in order of increasing f value Gradually adds “ f -contours” of nodes (cf. breadth-first adds layers) Contour i has all nodes with f = f i , where f i < f i +1 With uniform-cost search (A* search with h(n)=0) the bands are “circular”. With a more accurate heuristic, the bands will stretch toward the goal and become more narrowly focused around the optimal path. Ch. 03 – p.27/51

  28. F-contours O N Z I A S 380 F V 400 T R P L H M U B 420 D E C G Ch. 03 – p.28/51

  29. Performance of A ∗ The absolute error of a heuristic is defined as ∆ ≡ h ∗ − h The relative error of a heuristic is defined as ǫ ≡ h ∗ − h h ∗ Complexity with constant step costs: O ( b ǫd ) Problem: there can be exponentially many states with f ( n ) < C ∗ even if the absolute error is bounded by a constant Ch. 03 – p.29/51

  30. Properties of A ∗ Complete Yes, unless there are infinitely many nodes with f ≤ f ( G ) Time Exponential in (relative error in h × length of solution) Space Keeps all nodes in memory Optimal Yes—cannot expand f i +1 until f i is finished A ∗ expands all nodes with f ( n ) < C ∗ A ∗ expands some nodes with f ( n ) = C ∗ A ∗ expands no nodes with f ( n ) > C ∗ Ch. 03 – p.30/51

  31. Admissible heuristics E.g., for the 8-puzzle: h 1 ( n ) = number of misplaced tiles h 2 ( n ) = total Manhattan distance (i.e., no. of squares from desired location of each tile) 7 2 4 1 2 5 6 3 4 5 8 3 1 6 7 8 Start State Goal State h 1 ( S ) = ?? h 2 ( S ) = ?? Ch. 03 – p.31/51

  32. Dominance If h 2 ( n ) ≥ h 1 ( n ) for all n (both admissible) then h 2 dominates h 1 and is better for search Typical search costs: d = 14 IDS = 3,473,941 nodes A ∗ ( h 1 ) = 539 nodes A ∗ ( h 2 ) = 113 nodes d = 24 IDS ≈ 54,000,000,000 nodes A ∗ ( h 1 ) = 39,135 nodes A ∗ ( h 2 ) = 1,641 nodes Ch. 03 – p.32/51

  33. Effect of Heuristic on Performance The effect is characterized by the effective branching factor ( b ∗ ) If the total number of nodes generated by A ∗ is N and the solution depth is d, then b is branching factor of a uniform tree, such that N + 1 = 1 + b + ( b ) 2 + + ( b ) d A well designed heuristic has a b close to 1. Ch. 03 – p.33/51

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend