1 / 31

Informed Search I (Beginning of AIMA Chapter 4.1)

Informed Search I (Beginning of AIMA Chapter 4.1). CIS 391 Fall 2008. Outline. PART I Informed = use problem-specific knowledge Best-first search and its variants A * - Optimal Search using Knowledge Proof of Optimality of A* A* for maneuvering AI agents in games Heuristic functions?

vinnie
Télécharger la présentation

Informed Search I (Beginning of AIMA Chapter 4.1)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Informed Search I (Beginning of AIMA Chapter 4.1) CIS 391 Fall 2008

  2. Outline PART I • Informed = use problem-specific knowledge • Best-first search and its variants • A* - Optimal Search using Knowledge • Proof of Optimality of A* • A* for maneuvering AI agents in games • Heuristic functions? • How to invent them PART II • Local search and optimization • Hill climbing, local beam search, genetic algorithms,… • Local search in continuous spaces • Online search agents Today!!

  3. Breadth First Search for Games, Robots, … • Pink: Starting Point • Blue: Goal • Teal: Scanned squares • Darker: Closer to starting point… Graphics from http://theory.stanford.edu/~amitp/GameProgramming/ (A great site for practical AI & game Programming

  4. An optimal informed search algorithm • We add a heuristic estimate of distance to the goal • Yellow: examined nodes with high estimated distance • Blue: examined nodes with low estimated distance

  5. Breadth first in a world with obstacles

  6. Informed search in a world with obstacles

  7. Is Uniform Cost Search the best we can do? Consider finding a route from Bucharest to Arad.. Arad 118

  8. A Better Idea… • Node expansion based on some estimate of distance to the goal, extending current path • General approach of informed search: • Best-first search: node is selected for expansion based on an evaluation function f(n) • Implementation: • Sort fringe queue in decreasing order of desirability. • Special cases: greedy search, A* search

  9. Arad 118 Romania with city-to-city distances & straight-line distances in km

  10. A heuristic function • Let evaluation function f(n) = h(n) (heuristic) • h(n)= estimated cost of the cheapest path from node n to goal node. • If n is goal thenh(n)=0 • Here: hSLD(n) = straight-line distance from n to Bucharest [dictionary]“A rule of thumb, simplification, or educated guess that reduces or limits the search for solutions in domains that are difficult and poorly understood.” Heuristic knowledge is useful, but not necessarily correct. Heuristic algorithms use heuristic knowledge to solve a problem. A heuristic function here takes a state and returns an estimate of the distance to the goal. Heureka! ---Archimedes

  11. Greedy best-first search (BFS) • Expands the node that appears to be closest to goal • Expands nodes based on f(n) = h(n) • (Again, h(n)): Some heuristic estimate of cost from n to goal) • Ignores cost so far to get to that node (g(n)) • Here, h(n) = hSLD(n) = straight-line distance from n to Bucharest

  12. Greedy best-first search example Open queue: Arad • Initial State = Arad • Goal State = Bucharest

  13. Greedy best-first search example Open queue: Sibiu Timisoara Zerind

  14. Greedy best-first search example Open queue: Fararas Rimnicu Vilcea Timisoara Arad Zerind Oradea

  15. Greedy best-first search example Open queue: Bucharest Rimnicu Vilcea Timisoara Sibiu Arad Zerind Oradea Goal reached !!

  16. Arad 118 Properties of greedy best-first search • Optimal? • No! • Found: Arad  Sibiu  Fagaras  Bucharest (450km) • Shorter: Arad  Sibiu  Rimnicu Vilcea  Pitesti Bucharest (418km)

  17. Properties of greedy best-first search • Complete? • No – can get stuck in loops, • e.g., Iasi  Neamt  Iasi  Neamt … Initial Goal

  18. Properties of greedy best-first search • Complete? • No – can get stuck in loops, • e.g., Iasi  Neamt  Iasi  Neamt  • Time? • O(bm) – worst case (like Depth First Search) • But a good heuristic can give dramatic improvement • Space? • O(bm) – keeps all nodes in memory • Optimal?No

  19. A* search • Best-known form of best-first search. • Key Idea: avoid expanding paths that are already expensive. • Evaluation function f(n)=g(n) + h(n) • g(n) the cost (so far) to reach the node • h(n) estimated cost to get from the node to the goal • f(n) estimated total cost of path through n to goal • Implementation: Expand the node nwith minimum f(n)

  20. Admissible heuristics • h(n) must be an admissible heuristic • A heuristic is admissible if it never overestimates the cost to reach the goal; i.e. it is optimistic • Formally:n, where n is a node: • h(n)  h*(n) where h*(n) is the true cost from n • h(n)  0 so h(G)=0 for any goal G. • Example: hSLD(n) never overestimates the actual road distance Theorem: If h(n)is admissible, A* using Tree Search is optimal

  21. A* search example Open queue: Arad We start with our initial state Arad. We make a node and add it to the open queue. Since it’s the only thing on the open queue, we expand the node. Implementation: The open queue is just a priority queue (or heap) that sorts the nodes inside of it according to their g()+h() score.

  22. A* search example Open queue: Sibiu Timisoara Zerind We add the three nodes we found to the open queue. We sort them according to the g()+h() calculation.

  23. A* search example Open queue: Rimricu Vicea Fagaras Timisoara Zerind Arad Oradea When we expand Sibiu, we run into Arad again. Note that we’ve already expanded this node once; but we still add it to the open queue again.

  24. A* search example Open queue: Rimricu Vicea Fagaras Timisoara Zerind Arad Oradea We see that Rimricu Vicea is at the top of the open queue; so, it’s the next node we will expand.

  25. A* search example Open queue: Fagaras Pitesti Timisoara Zerind Craiova Sibiu Arad Oradea We expand Rimricu Vicea.

  26. A* search example Open queue: Fagaras Pitesti Timisoara Zerind Craiova Sibiu Arad Oradea Fagaras will be the next node we should expand – it’s at the top of the sorted open queue.

  27. A* search example Open queue: Pitesti Timisoara Zerind Bucharest Craiova Sibiu Sibiu Arad Oradea When we expand Fagaras, we find Bucharest, but we’re not done. The algorithm doesn’t end until we “expand” the goal node – it has to be at the top of the open queue.

  28. A* search example Open queue: Pitesti Timisoara Zerind Bucharest Craiova Sibiu Sibiu Arad Oradea It looks like Pitesti is the next node we should expand.

  29. A* search example Open queue: Bucharest Timisoara Zerind Bucharest Craiova Rimricu Vicea Sibiu Sibiu Craiova Arad Oradea Note that we just found a better value for Bucharest! We also found a worse value for Craiova.

  30. A* search example Open queue: Bucharest Timisoara Zerind Bucharest Craiova Rimricu Vicea Sibiu Sibiu Craiova Arad Oradea Now it looks like Bucharest is at the top of the open queue…

  31. A* search example Open queue: Bucharest Timisoara Zerind Bucharest Craiova Rimricu Vicea Sibiu Sibiu Craiova Arad Oradea Now we “expand” the node for Bucharest. We’re done! (And we know the path that we’ve found is optimal.)

More Related