The A* Algorithm Héctor Muñoz-Avila. The Search Problem Starting from a node n find the shortest path to a goal node g 10 15 20 ? 15 5 18 25 33.

Slides:



Advertisements
Similar presentations
Informed search algorithms
Advertisements

Heuristic Search Russell and Norvig: Chapter 4 Slides adapted from:
Chapter 4: Informed Heuristic Search
Heuristic Search The search techniques we have seen so far...
Lights Out Issues Questions? Comment from me.
Heuristics in AI Search. waretopics/software/story/0,10801, 99340,00.html waretopics/software/story/0,10801,
Informed Search CS 171/271 (Chapter 4)
Heuristic Functions By Peter Lane
Informed search algorithms
Heuristic Searches. Feedback: Tutorial 1 Describing a state. Entire state space vs. incremental development. Elimination of children. Closed and the solution.
Review: Search problem formulation
Informed Search Algorithms
Notes Dijstra’s Algorithm Corrected syllabus.
Announcements Course TA: Danny Kumar
Lecture 4: Informed/Heuristic Search
Informed search strategies
Informed Search Problems
Informed search algorithms
An Introduction to Artificial Intelligence
A* Search. 2 Tree search algorithms Basic idea: Exploration of state space by generating successors of already-explored states (a.k.a.~expanding states).
Informed Search Strategies
Problem Solving: Informed Search Algorithms Edmondo Trentin, DIISM.
Greedy best-first search Use the heuristic function to rank the nodes Search strategy –Expand node with lowest h-value Greedily trying to find the least-cost.
Informed Search Methods Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 4 Spring 2004.
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*
CS171 Introduction to Computer Science II Graphs Strike Back.
Review: Search problem formulation
Problem Solving and Search in AI Heuristic Search
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.
Informed Search Idea: be smart about what paths to try.
Graphs II Robin Burke GAM 376. Admin Skip the Lua topic.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
Informed search algorithms
1 Shanghai Jiao Tong University Informed Search and Exploration.
Informed search algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most.
Informed search strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
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 Strategies Lecture # 8 & 9. Outline 2 Best-first search Greedy best-first search A * search Heuristics.
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.
1 Kuliah 4 : Informed Search. 2 Outline Best-First Search Greedy Search A* Search.
Informed Search Reading: Chapter 4.5 HW #1 out today, due Sept 26th.
Informed Search and Heuristics Chapter 3.5~7. Outline Best-first search Greedy best-first search A * search Heuristics.
A General Introduction to Artificial Intelligence.
Feng Zhiyong Tianjin University Fall  Best-first search  Greedy best-first search  A * search  Heuristics  Local search algorithms  Hill-climbing.
Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most desirable unexpanded node Implementation:
Graph Algorithms GAM 376 Robin Burke Fall Outline Graphs Theory Data structures Graph search Algorithms DFS BFS Project #1 Soccer Break Lab.
The A* and applications to Games Sources: My own Joseph Siefers presentation 2008.
A* optimality proof, cycle checking CPSC 322 – Search 5 Textbook § 3.6 and January 21, 2011 Taught by Mike Chiang.
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
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.
For Monday Read chapter 4 exercise 1 No homework.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Review: Tree search Initialize the frontier using the starting state
Artificial Intelligence (CS 370D)
Department of Computer Science
Heuristic Search Introduction to Artificial Intelligence
Artificial Intelligence Problem solving by searching CSC 361
Algorithms for Exploration
HW #1 Due 29/9/2008 Write Java Applet to solve Goats and Cabbage “Missionaries and cannibals” problem with the following search algorithms: Breadth first.
The A* Algorithm Héctor Muñoz-Avila.
Discussion on Greedy Search and A*
Discussion on Greedy Search and A*
CS 4100 Artificial Intelligence
Announcements This Friday Project 1 due Talk by Jeniya Tabassum
Midterm Review.
Reading: Chapter 4.5 HW#2 out today, due Oct 5th
Informed Search.
Presentation transcript:

The A* Algorithm Héctor Muñoz-Avila

The Search Problem Starting from a node n find the shortest path to a goal node g ?

Consider the following weighted undirected graph: Shortest Path We want: A path 5  v1  v2  …  20 Such that g(20) = cost(5  v1) + cost(v1  v2) + … + cost (  20) is minimum

Djikstra Algorithm Greedy algorithm: from the candidate nodes select the one that has a path with minimum cost from the starting node ?

Djikstra Algorithm T Given a Graph G = (V,E) and T a subset of V, the fringe of T, is defined as: Fringe(T) = { (w,x) in E : w  T and x  V − T} Djikstra’s algorithm pick the edge v in Fringe(T) that has minimum distance to the starting node g(v) is minimum

Example

Properties Dijkstra’s is a greedy algorithm Why Dijkstra’s Algorithm works? T V  T The path from u to every node in T is the minimum path w u r s v 6 20 x 7 15

Example What does Djikstra’s algorithm will do? (minimizing g(n)) Problem: Visit too many nodes, some clearly out of the question

Complexity Actual complexity is O(|E|log 2 |E|) Is this good? Actually it is bad for very large graphs! Branching factor: b …. # nodes = b (# levels) Another Example: think of the search space in chess

Better Solution: Make a ‘hunch”! Use heuristics to guide the search –Heuristic: estimation or “hunch” of how to search for a solution We define a heuristic function: h(n) = “estimate of the cost of the cheapest path from the starting node to the goal node”

Lets Try A Heuristic Heuristic: minimize h(n) = “Euclidean distance to destination” Problem: not optimal (through Rimmici Viicea and Pitesti is shorter)

The A* Search Difficulty: we want to still be able to generate the path with minimum cost A* is an algorithm that: –Uses heuristic to guide search –While ensuring that it will compute a path with minimum cost A* computes the function f(n) = g(n) + h(n) “actual cost” “estimated cost”

A* f(n) = g(n) + h(n) –g(n) = “cost from the starting node to reach n” –h(n) = “estimate of the cost of the cheapest path from n to the goal node” n g(n) h(n)

Example A*: minimize f(n) = g(n) + h(n)

Properties of A* A* generates an optimal solution if h(n) is an admissible heuristic and the search space is a tree: –h(n) is admissible if it never overestimates the cost to reach the destination node A* generates an optimal solution if h(n) is a consistent heuristic and the search space is a graph: –h(n) is consistent if for every node n and for every successor node n’ of n: h(n) ≤ c(n,n’) + h(n’) n n’ d h(n) c(n,n’) h(n’) If h(n) is consistent then h(n) is admissible Frequently when h(n) is admissible, it is also consistent

Admissible Heuristics A heuristic is admissible if it is too optimistic, estimating the cost to be smaller than it actually is. Example: In the road map domain, h(n) = “Euclidean distance to destination” is admissible as normally cities are not connected by roads that make straight lines

How to Create Admissible Heuristics Relax the conditions of the problem –This will result in admissible heuristics! Lets look at an 8-puzzle game: Possible heuristics?

Example: Admissible Heuristics in 8- Puzzle Game Heuristic: a tile A can be moved to any tile B –H1(n) = “number of misplaced tiles in board n” Heuristic: a tile A can be moved to a tile B if B is adjacent to A –H2(n) = “sum of distances of misplaced tiles to goal positions in board n” Some experimental results reported in Russell & Norvig (2002): –A* with h2 performs up to 10 times better than A* with h1 –A* with h2 performs up to 36,000 times better than a classical uninformed search algorithm (iterative deepening)

Using A* in Planning A C B ABC AC B C B A B A C B A C BC A C A B A C B B C A AB C A B C A B C h(n) = “# of goals remaining to be satisfied” g(n) = “# of steps so far”

A* in Games Path finding (duh!) –We will have several presentations on the topic –We will see that sometimes even A* speed improvements are not sufficient –Additional improvements are required A* can be used for planning moves computer-controlled player (e.g., chess) F.E.A.R. uses A* to plan its search