Fixed heuristic not being calculated for the child nodes correctly

This commit is contained in:
Brychan Dempsey 2021-10-23 01:12:15 +13:00
parent 2a1c7c8c5e
commit ef67b5cf5e

View File

@ -62,8 +62,9 @@ namespace ShortestTotalPath
Console.Write(" -> ");
}
}
}
Console.WriteLine("Finished");
Console.ReadLine();
}
@ -134,7 +135,7 @@ namespace ShortestTotalPath
double length = poppedNode.TotalTraversedLength + poppedNode.Children[child];
Node qNode = new(child, poppedNode, length);
// A admissible (never over-estimates) heuristic is largest distance to an un-traversed node from our current node.
qNode.LocalHeuristic = poppedNode.FarthestUnvisitedNodeDistance();
qNode.LocalHeuristic = qNode.FarthestUnvisitedNodeDistance();
// Add the node to the queue
queue.Add(qNode, length);
}