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