chapter4
play

Chapter4 Informed Search and Exploration 2 20070322 chap4 1 - PDF document

Tree Search (Reviewed, Fig. 3.9) Chapter4 Informed Search and Exploration 2 20070322 chap4 1 20070322 chap4 Best-First Search Search Strategies An instance of the general Tree Search. A search strategy is defined by


  1. Tree Search (Reviewed, Fig. 3.9) Chapter4 Informed Search and Exploration 2 20070322 chap4 1 20070322 chap4 Best-First Search Search Strategies • An instance of the general Tree Search. • A search strategy is defined by • A node is selected for expansion based on picking the order of node expansion an evaluation function , f(n), • Uninformed Search Strategies i.e. an estimate of “desirablity“ ⇒ Expand most desirable unexpanded node. - By systematically generating new states and testing against the goal. • Can be implemented via a priority queue that will • Informed (Heuristic) Search maintain the fringe in ascending order of f -values. Strategies - By using problem-specific knowledge • Best-first search is venerable but inaccurate. to find solutions more efficiently. 3 4 20070322 chap4 20070322 chap4 Best-First Search (cont.-2) Best-First Search (cont.-1) • Heuristic search uses problem-specific knowledge: • Heuristic function evaluation function. h(n) = estimated cost of the cheapest path • Choose the seemingly -best node based on some from node n to a goal node . ( h(n) = 0, for a goal node) estimate of the cost of the corresponding solution. • Need estimate of the cost to a goal • Special cases e.g. Depth of the current node - Greedy Best-First Search (or Greedy Search) Sum of the distances so far Minimizing estimated cost from the node to reach a goal Euclidean distance to goal etc . Expanding the node that appears to be closest to goal - A* Search Minimizing the total estimated solution cost • Heuristics: rules of thumb ( 概測法 ) Avoid expanding paths that are already expensive • Goal: to find solutions more efficiently 5 6 20070322 chap4 20070322 chap4 1

  2. Heuristics Heuristics (cont.) • A heuristic algorithm • Heuristic is derived from heuriskein in Greek, improves the average-case performance, meaning “to find” or “to discover” does not necessarily improve the worst-case performance. • The term heuristics is often used to describe rules of thumb ( 經驗法則 ) or advice • Not all heuristic functions are beneficial. that are generally effective, but are not guaranteed - The time spent evaluating the heuristic function in order to to work in every case. select a node for expansion must be recovered by a corresponding reduction in the size of the search space • In the context of search, a heuristic is a function that explored . takes a state as an argument - Useful heuristics should be computationally inexpensive! and returns a number that is an estimate of the merit of the state with respect to the goal. 7 8 20070322 chap4 20070322 chap4 Greedy Best-First Search Romania with step costs in km Straight-line distances to Bucharest • Heuristic function : h ( n ) = estimated best cost to goal from n h ( n ) = 0 if n is a goal e.g. h SLD ( n ) = straight-line distance for route-finding Function GREEDY-SEARCH( problem ) return a solution or failure return BEST-FIRST-SEARCH( problem, h ) 9 10 20070322 chap4 20070322 chap4 Greedy Best-First Search Example Greedy Best-First Search Example (cont.-1) • The first expansion step produces: • Assume that we want to use greedy search Sibiu, Timisoara and Zerind to solve the problem of travelling from Arad to Bucharest. • Greedy best-first will select Sibiu • The initial state=Arad 11 12 20070322 chap4 20070322 chap4 2

  3. Greedy Best-First Search Example (cont.-2) Greedy Best-First Search Example (cont.-3) • If Sibiu is expanded we get: • If Fagaras is expanded we get: Arad, Fagaras, Oradea and Rimnicu Vilcea Sibiu and Bucharest • Greedy best-first search will select: Fagaras • Goal reached !! • Yet not optimal (see Arad → Sibiu → Rimnicu Vilcea → Pitesti ) 13 14 20070322 chap4 20070322 chap4 Analysis of Greedy Search Analysis of Greedy Search (cont.) Complete?? Optimal?? No (same as depth-first search) No (start down an infinite path and never return to try other possibilities) (e.g. from Arad to Bucharest) Arad → Sibiu → Fagaras → Bucharest (e.g. from Iasi to Fagaras) (450=140+99+211, is not shortest) - Susceptible to false starts Arad → Sibiu → Rim → Pitesti → Bucharest Iasi → Neamt (dead end) (418=140+80+97+101) - No Repeated states Checking Iasi → Neamt → Iasi → Neamt → Iasi → ….. (oscillation) Time?? (like depth-first search) - worst: O ( b m ), but a good heuristic can give dramatic improvement m : the maximum depth of the search space Space?? O ( b m ): keep all nodes in memory 15 16 20070322 chap4 20070322 chap4 A* Search Admissible Heuristic function A*-SEARCH( problem ) returns a solution or failure • A* search uses an admissible heuristic return BEST-FIRST-SEARCH( problem, g+h) i.e. h(n) ≤ h * (n) where h * (n) is the true cost from n (Also h(n) ≥ 0 , so h(G) = 0 for any goal G ) • To minimizing the total estimated solution cost • Evaluation function: f(n) = estimated cost of the cheapest solution • Theorem: through n to goal If h(n) is admissible, A* using tree-search is optimal . = g(n) + h(n) g(n) = cost so far to reach n • It is both complete and optimal if h never h(n) = estimated cost from n to the goal overestimates the cost to the goal. 17 18 20070322 chap4 20070322 chap4 3

  4. A* Search Example A* Search Example (cont.-1) • Expand Arrad and determine f(n) for each node • Find Bucharest starting at Arad f(Sibiu)=c(Arad,Sibiu)+h(Sibiu)=140+253=393 f(Arad) = c(??,Arad)+h(Arad)=0+366=366 f(Timisoara)=c(Arad,Timisoara)+h(Timisoara)=118+329=447 f(Zerind)=c(Arad,Zerind)+h(Zerind)=75+374=449 • Best choice is Sibiu 19 20 20070322 chap4 20070322 chap4 A* Search Example (cont.-2) A* Search Example (cont.-3) • Expand Sibiu and determine f(n) for each node f(Arad)=c(Sibiu,Arad)+h(Arad)=280+366=646 • Expand Rimnicu Vilcea and determine f(n) for each node f(Fagaras)=c(Sibiu,Fagaras)+h(Fagaras)=239+179=415 f(Craiova)=c(Rimnicu Vilcea, Craiova)+h(Craiova)=360+160=526 f(Oradea)=c(Sibiu,Oradea)+h(Oradea)=291+380=671 f(Pitesti)=c(Rimnicu Vilcea, Pitesti)+h(Pitesti)=317+100=417 f(Rimnicu Vilcea)=c(Sibiu,Rimnicu Vilcea)+h(Rimnicu Vilcea) f(Sibiu)=c(Rimnicu Vilcea,Sibiu)+h(Sibiu)=300+253=553 =220+192=413 • Best choice is Fagaras • Best choice is Rimnicu Vilcea 21 22 20070322 chap4 20070322 chap4 A* Search Example (cont.-4) A* Search Example (cont.-5) • Expand Fagaras and determine f(n) for each node f(Sibiu)=c(Fagaras, Sibiu)+h(Sibiu)=338+253=591 f(Bucharest)=c(Fagaras,Bucharest)+h(Bucharest)=450+0 • Expand Pitesti and determine f(n) for each node =450 f(Bucharest)=c(Pitesti,Bucharest)+h(Bucharest)=418+0=418 • Best choice is Pitesti • Best choice is Bucharest • Optimal solution (only if h(n) is admissable) • Note values along optimal path 23 24 20070322 chap4 20070322 chap4 4

  5. Optimality of A* ( cont.-1 ) Optimality of A* • C* : cost of the optimal solution path Suppose some suboptimal goal G 2 has been generated A* may expand some nodes before selecting a goal node. and is in the queue. Let n be an unexpanded node on a shortest path • Assume: G is an optimal and G 2 is a suboptimal goal . to an optimal goal G . f ( G 2 ) = g ( G 2 ) + h ( G 2 ) = g ( G 2 ) > C* -------- (1) For some n on an optimal path to G , if h is admissible, then f ( n ) = g ( n ) + h ( n ) ≤ C* -------- (2) From (1) and (2), we have f ( n ) ≤ C* < f ( G 2 ) So, A* will never select G 2 for expansion. 25 26 20070322 chap4 20070322 chap4 Monotonicity (Consistency) of Heuristic Optimality of A* ( cont.-2 ) • A heuristic is consistent if h ( n ) ≤ c ( n, a, n’ ) + h ( n’ ) • BUT … graph search (instead of tree-search) The estimated cost of reaching the goal from n is no greater than the step cost of getting to successor n’ • Discards new paths to repeated state. plus the estimated cost of reaching the goal from n’ - Previous proof breaks down • Solution: • If h is consistent, we have - Add extra bookkeeping f ( n’ ) = g ( n’ ) + h ( n’ ) = g ( n ) + c ( n, a, n’ ) + h ( n’ ) i.e. remove more expensive of two paths. ≥ g ( n ) + h ( n ) = f ( n ) Ensure that optimal path to any repeated state is - ⇒ f ( n’ ) ≥ f ( n ) always first followed. i.e. f(n) is non-decreasing along any path. Extra requirement on h(n) : consistency (monotonicity) • Theorem: If h(n) is cosisient, A* using graph search is optimal . 27 28 20070322 chap4 20070322 chap4 Optimality of A* ( cont.-3 ) Analysis of A* Search Complete?? Yes • A* expands nodes in order of increasing f value Gradually adds “ f -contours” of nodes unless there are indefinitely many nodes with f ≤ f(G) Contour i has all nodes with f = f i , where f i < f i+1 Space?? O(b d ), keep all nodes in memory • All nodes with f(n) > C* (optimal solution) are pruned . Optimal?? Yes, if the heuristic is admissible Optimally Efficient?? Yes i.e. No other optimal algorithm is guaranteed to expand fewer nodes than A* A* is not practical for many large-scale problems. (Since A* usually runs out of space long before it runs out of time.) 29 30 20070322 chap4 20070322 chap4 5

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