Heuristic Search: A* 1 CPSC 322 – Search 4 January 19, 2011 Textbook §3.6 Taught by: Vasanth.

Slides:



Advertisements
Similar presentations
CPSC 322, Lecture 7Slide 1 Heuristic Search Computer Science cpsc322, Lecture 7 (Textbook Chpt 3.5) January, 19, 2009.
Advertisements

Review: Search problem formulation
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 14, 2012.
Heuristic Search Jim Little UBC CS 322 – Search 4 September 17, 2014 Textbook §
Informed Search Methods How can we improve searching strategy by using intelligence? Map example: Heuristic: Expand those nodes closest in “as the crow.
Solving Problem by Searching
1 Heuristic Search Chapter 4. 2 Outline Heuristic function Greedy Best-first search Admissible heuristic and A* Properties of A* Algorithm IDA*
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.4) January, 14, 2009.
Uninformed Search Jim Little UBC CS 322 – Search 2 September 12, 2014
Search Strategies CPS4801. Uninformed Search Strategies Uninformed search strategies use only the information available in the problem definition Breadth-first.
Slide 1 Heuristic Search: BestFS and A * Jim Little UBC CS 322 – Search 5 September 19, 2014 Textbook § 3.6.
CPSC 322, Lecture 9Slide 1 Search: Advanced Topics Computer Science cpsc322, Lecture 9 (Textbook Chpt 3.6) January, 23, 2009.
Review: Search problem formulation
Informed Search Methods How can we make use of other knowledge about the problem to improve searching strategy? Map example: Heuristic: Expand those nodes.
CPSC 322, Lecture 8Slide 1 Heuristic Search: BestFS and A * Computer Science cpsc322, Lecture 8 (Textbook Chpt 3.5) January, 21, 2009.
CSC344: AI for Games Lecture 4: Informed search
5-Nov-2003 Heuristic Search Techniques What do you do when the search space is very large or infinite? We’ll study three more AI search algorithms: Backtracking.
Uninformed Search (cont.)
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Problem Solving and Search Andrea Danyluk September 11, 2013.
CPSC 322, Lecture 8Slide 1 Heuristic Search: BestFS and A * Computer Science cpsc322, Lecture 8 (Textbook Chpt 3.6) Sept, 23, 2013.
Uninformed Search Strategies CPSC 322 – Search 2 January 14, 2011 Textbook §3.5 1.
Computer Science CPSC 322 Lecture Heuristic Search (Ch: 3.6, 3.6.1) Slide 1.
Computer Science CPSC 322 Lecture A* and Search Refinements (Ch 3.6.1, 3.7.1, 3.7.2) Slide 1.
Lecture 2 Search (textbook Ch: 3)
CHAPTER 4: INFORMED SEARCH & EXPLORATION Prepared by: Ece UYKUR.
Computer Science CPSC 322 Lecture 9 (Ch , 3.7.6) Slide 1.
Informed search strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
Search (cont) & CSP Intro Tamara Berg CS 560 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,
Informed searching. Informed search Blind search algorithms do not consider any information about the states and the goals Often there is extra knowledge.
Informed Search Methods. Informed Search  Uninformed searches  easy  but very inefficient in most cases of huge search tree  Informed searches  uses.
Informed Search Strategies Lecture # 8 & 9. Outline 2 Best-first search Greedy best-first search A * search Heuristics.
Search with Costs and Heuristic Search 1 CPSC 322 – Search 3 January 17, 2011 Textbook §3.5.3, Taught by: Mike Chiang.
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
Advanced Artificial Intelligence Lecture 2: Search.
CSC3203: AI for Games Informed search (1) Patrick Olivier
Computer Science CPSC 322 Lecture 6 Iterative Deepening and Search with Costs (Ch: 3.7.3, 3.5.3)
1 Kuliah 4 : Informed Search. 2 Outline Best-First Search Greedy Search A* Search.
Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Informed Search and Heuristics Chapter 3.5~7. Outline Best-first search Greedy best-first search A * search Heuristics.
Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most desirable unexpanded node Implementation:
CPSC 322, Lecture 8Slide 1 Heuristic Search: BestFS and A * Computer Science cpsc322, Lecture 8 (Textbook Chpt 3.6) Sept, 21, 2010.
CPSC 322, Lecture 6Slide 1 Uniformed Search (cont.) Computer Science cpsc322, Lecture 6 (Textbook finish 3.5) Sept, 17, 2012.
A* optimality proof, cycle checking CPSC 322 – Search 5 Textbook § 3.6 and January 21, 2011 Taught by Mike Chiang.
CHAPTER 2 SEARCH HEURISTIC. QUESTION ???? What is Artificial Intelligence? The study of systems that act rationally What does rational mean? Given its.
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Heuristic Functions.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 13, 2013.
G5AIAI Introduction to AI Graham Kendall Heuristic Searches.
Artificial Intelligence Lecture No. 8 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
CPSC 420 – Artificial Intelligence Texas A & M University Lecture 5 Lecturer: Laurie webster II, M.S.S.E., M.S.E.e., M.S.BME, Ph.D., P.E.
CPSC 322, Lecture 7Slide 1 Heuristic Search Computer Science cpsc322, Lecture 7 (Textbook Chpt 3.6) Sept, 20, 2013.
Computer Science CPSC 322 Lecture 6 Analysis of A*, Search Refinements (Ch ) Slide 1.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Chapter 3.5 Heuristic Search. Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Computer Science CPSC 322 Lecture 5 Heuristic Search and A* (Ch: 3.6, 3.6.1) Slide 1.
Computer Science cpsc322, Lecture 7
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Department of Computer Science
Heuristic Search Introduction to Artificial Intelligence
Artificial Intelligence Problem solving by searching CSC 361
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
CS 4100 Artificial Intelligence
Informed search algorithms
Informed search algorithms
Artificial Intelligence
Iterative Deepening CPSC 322 – Search 6 Textbook § 3.7.3
Iterative Deepening and Branch & Bound
Artificial Intelligence
Informed Search.
Presentation transcript:

Heuristic Search: A* 1 CPSC 322 – Search 4 January 19, 2011 Textbook §3.6 Taught by: Vasanth

Lecture Overview Recap Search heuristics: admissibility and examples Recap of BestFS Heuristic search: A* 2

Example for search with costs: finding routes 3

Lowest-Cost First Search (LCFS) Expand the path with the lowest cost –Generalization of Breadth-First Search –Implemented as priority queue of cost values Only complete for strictly positive arc costs - Otherwise: a cycle with zero cost <= 0 could be followed forever Only optimal for non-negative arc costs - Otherwise: a path that initially looks high-cost could end up getting a ``refund‘‘ Time and space complexity: O(b m ) - E.g., uniform arc costs: identical to Breadth-First Search Slide 4

Search heuristics Slide 5 Def.: A search heuristic h(n) is an estimate of the cost of the optimal (cheapest) path from node n to a goal node. Estimate: h(n1) 5 Estimate: h(n2) Estimate: h(n3) n3 n2 n1

Lecture Overview Recap Search heuristics: admissibility and examples Recap of BestFS Heuristic search: A* 6

Last lecture’s example: finding routes 7 What could we use as h(n)? E.g., the straight-line distance between source and goal node

Admissibility of a heuristic 8 Def.: Let c(n) denote the cost of the optimal path from node n to any goal node. A search heuristic h(n) is called admissible if h(n) ≤ c(n) for all nodes n, i.e. if for all nodes it is an underestimate of the cost to any goal. Example: is the straight-line distance admissible? - Yes! The shortest distance between two points is a line. YESNO

Admissibility of a heuristic 9 Def.: Let c(n) denote the cost of the optimal path from node n to any goal node. A search heuristic h(n) is called admissible if h(n) ≤ c(n) for all nodes n, i.e. if for all nodes it is an underestimate of the cost to any goal. Another example: the goal is Urzizeni (red box), but all we know is the straight-linedistances to Bucharest (green box) YESNO Possible h(n) = sld(n, Bucharest) + cost(Bucharest, Urzineni) Admissible?

Example 2: grid world Search problem: robot has to find a route from start to goal location G on a grid with obstacles Actions: move up, down, left, right from tile to tile Cost : number of moves Possible h(n)? - Manhattan distance (L 1 distance) to the goal G: sum of the (absolute) difference of their coordinates - Admissible? G YESNO

Example 3: Eight Puzzle 11 One possible h(n): Number of Misplaced Tiles YESNO Is this heuristic admissible?

Example 3: Eight Puzzle 12 Another possible h(n): Sum of number of moves between each tile's current position and its goal position YESNO Is this heuristic admissible?

How to Construct an Admissible Heuristic 13 Identify relaxed version of the problem: - where one or more constraints have been dropped - problem with fewer restrictions on the actions Grid world: the agent can move through walls Driver: the agent can move straight 8 puzzle: -“number of misplaced tiles”: tiles can move everywhere and occupy same spot as others -“sum of moves between current and goal position”: tiles can occupy same spot as others Why does this lead to an admissible heuristic? - The problem only gets easier!

Lecture Overview Recap Search heuristics: admissibility and examples Recap of BestFS Heuristic search: A* 14

Idea: always choose the path on the frontier with the smallest h value. BestFS treats the frontier as a priority queue ordered by h. Greedy approach: expand path whose last node seems closest to the goal Best First Search (BestFS) 15 Let’s look at this in action: Optimal? AISPACE example, load from URL

Example 4: Infinite Mario Bros 16

Lecture Overview Recap Search heuristics: admissibility and examples Recap of BestFS Heuristic search: A* 17

A* search takes into account both - the cost of the path to a node c(p) - the heuristic value of that path h(p). Let f(p) = c(p) + h(p). - f(p) is an estimate of the cost of a path from the start to a goal via p. A* Search c(p) h(p) f(p) 18

A* combines elements of which two search algorithms? It treats the frontier as a priority queue ordered by f(n) It always chooses the path on the frontier with the lowest estimated distance from the start to a goal node constrained to go via that path. Let’s see it in action: A* Search Algorithm 19 Least cost first Breadth-first Best-first Depth-first

A* in Infinite Mario Bros 20

Analysis of A* 21 What is A*’s time complexity, in terms of m and b ? E.g., uniform costs and constant heuristic h(n) = 0 - Behaves exactly like LCFS Def.: The time complexity of a search algorithm is the worst-case amount of time it will take to run, expressed in terms of -maximum path length m -maximum forward branching factor b. O(b+m) O(b m ) O(m b )

Analysis of A* 22 Def.: The space complexity of a search algorithm is the worst-case amount of memory that the algorithm will use (i.e., the maxmial number of nodes on the frontier), expressed in terms of - maximum path length m - maximum forward branching factor b. O(b+m) O(b m ) O(m b ) What is A*’s space complexity, in terms of m and b ? E.g., uniform costs and constant heuristic h(n) = 0 - Behaves exactly like LCFS

A* is complete (finds a solution, if one exists) and optimal (finds the optimal path to a goal) if: - the branching factor is finite - arc costs are > 0 - h(n) is admissible -> an underestimate of the length of the shortest path from n to a goal node. This property of A* is called admissibility of A* A* completeness and optimality 23

Construct heuristic functions for specific search problems Define/read/write/trace/debug different search algorithms - With/without cost - Informed/Uninformed Formally prove A* optimality (continued next class) 24 Learning Goals for today’s class