0% found this document useful (0 votes)
17 views2 pages

Expert Systems

Uploaded by

rafavo222
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

Expert Systems

Uploaded by

rafavo222
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

A* Algorithm

We create two lists – Open List and Closed List (just like Dijkstra Algorithm)

g = The movement cost to move from the starting point to a given square on the
grid, following the path generated to get there.
h = The estimated movement cost to move from that given square on the grid to
the final destination.

f = Approximation of true evaluation of node.

OPEN – Nodes that have been generated and have had the heuristic function
applied to them but which have not yet been examined.

CLOSED – Nodes that have already examined.

// A* Search Algorithm
1. Initialize the open list
2. Initialize the closed list
put the starting node on the OPEN list (you can leave its f at zero)
3. while the OPEN list is not empty
a) find the node with the least f on the open list, call it "q"
b) pop q off the OPEN list
c) generate q's successors and set their parents to q
d) for each successor
i) if successor is the goal, stop search
ii) else, compute both g and h for successor
successor.g = q.g + distance between successor and q
successor.h = distance from goal to successor
successor.f = successor.g + successor.h
iii) if a node with the same position as successor is in the OPEN list which
has a lower f than successor, skip this successor
iV) if a node with the same position as successor is in the CLOSED list
which has a lower f than successor, skip this successor otherwise, add the node to
the open list
end (for loop)

e) push q on the closed list

end (while loop)

You might also like