Newsgroups: comp.ai
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!news.sprintlink.net!pipex!uunet!newsflash.concordia.ca!nstn.ns.ca!cs.dal.ca!ug!mitchell
From: mitchell@ug.cs.dal.ca (Dave Mitchell)
Subject: Re: Help (A* as applied to shortest path problem)
Message-ID: <Cz0yw6.LH2@cs.dal.ca>
Sender: usenet@cs.dal.ca (USENET News)
Nntp-Posting-Host: ug.cs.dal.ca
Organization: Math, Stats & CS, Dalhousie University, Halifax, NS, Canada
X-Newsreader: TIN [version 1.2 PL2]
References: <39o8bl$lfe@utdallas.edu>
Date: Thu, 10 Nov 1994 00:04:53 GMT
Lines: 47

shnayd@utdallas.edu wrote:
: I am a computer science student at University of Texas at Dallas.
: My AI professor explained the A* search algorithm as applied to finding
: a shortest path, I did not really understand the algorithm.

: It seems to remind me of Dijkstra's algorithm, but not really.

: I would greatly appreciate the help (explanation of this algorithm)
: if possible with example.  Please explain the heuristic function used.

: Thank you, Michael.

  Hiya Mike- this is fresh in my mind because my assignment2 for AI this
term was to implement hillclimb, best-first, and A* search. 

  Here's how it works:

	1) define your graph (or as much as you can..) in terms of passable
	and unpassable nodes, as well as the start and goal areas

	2) define "neighbors" of a node, in a 2D graph this might be
	(x+1),y; (x-1),y; x,(y-1); x,(y+1). You have to be able to make sure
	that a potential neighbor node hasn't already been visited (it will
	exist in the fringe already if this is true..)

	3) define a sorting function which can order your partial paths by
	the sum F(X)+G(X) where F(X) is the (heuristic) distance from the 
	current node to the goal node, and G(X) is the cost function (how 
	much does your
	partial path cost? if you have an unweighted graph this would just be
	the path length).

	4) Create a maintain a "fringe" which is a list of partial paths
	which the program has already checked. At each step, take the partial
	path which minimizes f(x)+g(x). For each legal (unvisited, passable)
	neighbor of the head node, create a new partial path headed by the
	neighbors, and delete the path you started with, extending your 
	fringe by 0-4 paths. 

Note: as far as I can tell, will an unweighted graph, you will never find a
shorter path to a node than the first one you get- since the program picks
the shortest one to update anyways. In X steps you'll never get to a node
for which there exists a different path of less than X length.

Did I forget anything?

							Dave
