Fixed heuristic not being calculated for the child nodes correctly
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user