artificial-intelligencea-starheuristics

How to implement an A* search algorithm where h(n) = h*(n)?


I'm interested in the steps/logic behind implementing an A* search algorithm if we wanted our h(n) value for every n to be exactly the perfect heuristic value (h*(n)).

Am I correct in the assumption that for each node, we would have to perform 1 A* traversal of the tree from that node till the end node in order to calculate h*(n) for it? I know admissible heuristics aim to get as close to h*(n) as possible to reduce checking nodes/paths that are not optimal.


Solution

  • If your heuristic is "perfect" (ie. it represents the actual distance), that will always be consistent so there's nothing special to do. The next node dequeued will always be the next node in the path.

    In fact in this case you can skip A* altogether and just immediately calculate the best path.