# Pathfinding: Where do you apply the heuristics?

This topic is 769 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am currently in the progress of writing the Jump Sort Algorithm, which is basically A* with a massive skip function. But I am curious about something. Where do you apply the heuristic function? I've never written A* before, and the explination for it's pseudo code is rarely ever clear.

Do I add the Heuristic to the distance cost of the node when I submit the node to the open list and then sort? Or do I submit it with it's normal distance traveled, and search for a node with the best heuristic score?

##### Share on other sites

When adding nodes to the open list you add their heuristic to the cost of their path to the start node. That is, when you visit a node you add each of its successors to the open list with a tentative score "f"', where f = g + h. "g" is the true cost of the path you followed to reach the current node, plus the cost to enter the node you're adding to the open list. "h" is the heuristic value of the node being added. After you've processed all the successors you move the current node to the closed list and select the node with the lowest "f" from the open list.

##### Share on other sites

When adding nodes to the open list you add their heuristic to the cost of their path to the start node. That is, when you visit a node you add each of its successors to the open list with a tentative score "f"', where f = g + h. "g" is the true cost of the path you followed to reach the current node, plus the cost to enter the node you're adding to the open list. "h" is the heuristic value of the node being added. After you've processed all the successors you move the current node to the closed list and select the node with the lowest "f" from the open list.

Thank you! That cleared things up quickly enough. And yeah, Jump Point Search. Sorry about that. Been mentally burned out lately.

1. 1
2. 2
Rutin
21
3. 3
4. 4
A4L
15
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633737
• Total Posts
3013612
×