0% found this document useful (0 votes)
50 views18 pages

A Searches: Click To Edit Master Subtitle Style

1. A* is a graph traversal algorithm that finds the shortest path between nodes. It uses a heuristic to prioritize searching of nodes closest to the goal. 2. It maintains an open list of nodes to search and a closed list of searched nodes. The node with the lowest cost (F=G+H) is selected from the open list for expansion. 3. The cost G is the distance from start to current node. The heuristic H estimates distance to goal. Children nodes are added to the open list and the search continues until the goal is found.

Uploaded by

ryan_bohler
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views18 pages

A Searches: Click To Edit Master Subtitle Style

1. A* is a graph traversal algorithm that finds the shortest path between nodes. It uses a heuristic to prioritize searching of nodes closest to the goal. 2. It maintains an open list of nodes to search and a closed list of searched nodes. The node with the lowest cost (F=G+H) is selected from the open list for expansion. 3. The cost G is the distance from start to current node. The heuristic H estimates distance to goal. Children nodes are added to the open list and the search continues until the goal is found.

Uploaded by

ryan_bohler
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

A* Searches

Ryan to edit Click Bohler Master subtitle style

4/17/12

Introduction
First described Nils Nilsson, Bertram

Raphael, and Peter Hart- 1968

extension of Edsger Dijkstra's 1959 algorithm

Path finding and graph traversal Heuristic approach


problem solving, learning, and discovery
ex) rule of thumb, educated guess, trial and error,

common sense

4/17/12

Basics of A*
Informed search algorithms- searches the

routes that appear to be most likely to lead towards the goal


takes distance already traveled into account

Maintains a priority queue of nodes to be

traversed- open set

closed set may also be included (nodes already

traversed) for efficiency


Best-first search- explores a graph by

expanding the most promising node chosen according to a specified rule. 4/17/12

Calculation
Distance-plus-cost heuristic is a sum of:
the path-cost function
which is the cost from the starting node to the

current node

an admissible "heuristic estimate" of the

distance to the goal


never overestimates the cost of reaching the

goal

F=G+H
4/17/12

Properties
A* is complete and will always find a

solution if one exists

If a closed set is used, then it must also be

monotonic for A* to be optimal


approaches the solution in an incremental way

without taking any step back

No node is examined more than once

4/17/12

Setup
Divide search area into a square grid. Lets assume that we Simplifying the search have someone whoin area is the first step wants to get from pathfinding. Simplified to B. point A to point two-A dimensional array. wall separates the array Each item in the two points. represents one of the squares on the grid, and its status is recorded as walkable

4/17/12

Starting the Search


We begin the search by doing the following: 1. Begin at A and add it to the Once we have open list our search simplified a) contains squares that area into a along the path might fall manageable number you want to take (but ofmaybe not) next nodes, the 2. Look at all the reachable or step is to conduct a walkable to find the search squares adjacent (ignoring squares with shortest path. walls, water, or other illegal terrain) a) Add them to the open

4/17/12

Path Scoring
The key to determining which squares to

use when figuring out the path is the following equation: F = G + H, where :

G = cost to move from the starting point A to

a given square on the grid, following the path generated to get there. from that given square on the grid to the final destination, point B.
Like an educated guess

H = the estimated movement cost to move

Our path is generated by repeatedly going

4/17/12

Path Scoring
H can be estimated in a variety of ways. Manhattan 2 For simplicity, lets method 1.4horizontal 1 assume a number of or vertical movement squares to move will have a cost of 10 horizontally and 1 vertically to reach the target square from the current square Ignore diagonal

4/17/12

Continuing the Search


Choose the lowest F score square from all those that are

on the open list.


4. 5.

Drop it from the open list and add it to the closed list Check all of the adjacent squares
a) b)

Ignoring those that are on the closed list or unwalkable, add new squares to the open list Make the selected square the parent of the new squares

6.

Check if the G score for that square is lower if we use the current square to get there
a)

If higher (or equal)


Do nothing

b)

If lower

4/17/12

Continuing the Search


Of the initial 9 Other four squares are already on More direct to get to that the open list squares, if thehave 8 we starting Check square from the paths to those left squares are better using on the open list square by simply moving Add it to our this square to get after the starting there, one square diagonally to get closed list as our using G scores square was switchedpoint there of reference

Drop it from the open list

to the closed list

Looking at the square right below Repeat process for all 4 of (or above) our selected square the adjacent squares already G score 14 on the openFisscore is the Lowest list If went through the Immediate paths are oneNone of immediate to the the to get current square right of improved score is there, the starting right of the Gby going square are wall 20

Check the adjacent squares

A G score of 20 > 14, so this is square,

through F current square, withignore squares,the = 40

4/17/12

Continuing the Search


Five remaining squares Now that we looked at all Two squares below the current square arent on the open list of the adjacent squares Check the adjacent squares Add them Done with this Current square becomes Immediate right is a their square parent

wall square, ignore it Ready to move to Of the other three squares Two are already on the closed list the next square (the starting square, and the one (Note: This following rule above the current square), ignore is optional.) List of squares on our them In certain cases we ignore open list, now down to the Last square, to the immediate left of7 the square just below the current square squares wall. Check to see if the G score is any Pick the through F lower if you golowestthe current Cant get to that square to get there cost Its not square directly from Done and to the current ready on check square the next square our In this case, two squares open list. without cutting across have a score of 54

4/17/12

Final Steps
Determining the path: Start at the red target square. Work backwards moving from one square to its parent, following the arrows Eventually you reach the starting square, and thats your path

Moving from A to B is just moving from the center of each square to the center of the next square on the path, until you reach the target.

4/17/12

Summary of A*
1. 2.

Add the starting square (or node) to the open list. Repeat the following:
a)

Look for the lowest F cost square on the open list. This is our current square. Switch it to the closed list. For each of the 8 squares adjacent to this current square

b) c)

If it is not walkable or if it is on the closed list, ignore it. Otherwise:

If it isnt on the open list, add it to the open list. Make the current square the parent of this square. Record the F, G, and H costs of the square. If it is on the open list already, check to see if this path to that square is better, using G cost as the measure. A lower G cost means that this is a better path. If so, change the parent of the square to the current square, and recalculate the G and F scores of the square. 4/17/12

a)

Stop when you:

Other Things to Think About


Collision Avoidance Variable Terrain Cost Handling Unexplored Areas Smoother Paths Non-square Search Areas Dijkstra's Algorithm (H = 0)
No heuristic, it searches by expanding out

equally in every direction.

Dijkstra's usually ends up exploring a much

larger area before the target is found. 4/17/12

Graph Traversal

4/17/12

Weighted A*
Variant of A* algorithm that speeds-up a

search at the expense of optimality.

Inflate" the heuristic to speed up the

search, and have a bound on the suboptimality.


If ha(n) is an admissible heuristic function,

the weighted version uses hw(n) = Eha(n), E>1


Perform the A* search as usual

Weighted search can be orders of

magnitude faster than A*

4/17/12

Representation
A* Weighted A* F = G + H F = G+ EH Dijkstras Algorithm F=G

4/17/12

You might also like