Talk:A* search algorithm: Difference between revisions

Content deleted Content added
Mikademus (talk | contribs)
Line 119:
 
:<math>O(log(h^{*}(x))</math> is the asymptotic growth of the perfect heuristic <math>h^{*}</math>. I explained this and inserted a reference. Btw., visiting each edge and each node once is only possible for finite graphs. A* can be used for infinite graphs, or at least graphs that do not fit in any computer memory using an "explicit" representation. [[User:Qwertyus|Qwertyus]] 00:44, 21 July 2006 (UTC)
 
== The Pseudo-code ==
I'm not satisfied with the pseduo-code [[http://en.wikipedia.org/w/index.php?title=A%2A_search_algorithm&oldid=66604401as it is atm]]; in attempting to stay close to actual programming it is in fact more confusing than helpful. I'd suggest something more talkative and close to natural-language, like my take below. I'd appreciate any opinions or alternative takes, because I think we do need another pseudo-code.
 
<code>
AStarSearch( ''start_node'', ''goal_node'' )
queue ''open_list''
queue ''closed_list''
'''push''' ''start_node'' on ''open_list''
'''while''' ''open_list'' not empty
'''let''' ''node'' be RemoveLowestCostFrom( ''open_list'' )
'''if''' ''node'' is ''goal_node''
'''then return''' SUCCESS
'''else'''
'''push''' ''node'' on ''closed_list''
'''foreach''' ''neighbor'' that is adjancent_to( ''node'' )
'''if''' ''neighbor'' is not in ''open_list''
'''then if''' ''neighbor'' is not in ''closed_list''
'''then'''
EstimateCostFor( ''neighbor'' )
'''push''' ''neighbor'' on ''open_list''
'''return''' FAILURE
</code>
[[User:Mikademus|Mikademus]] 08:07, 11 August 2006 (UTC)