Removed/Replaced unnecessary checks in AStar.
This commit is contained in:
parent
b87d8a0300
commit
90a09e84c5
@ -62,14 +62,9 @@ public class Pathfinder
|
||||
gScore.TryAdd(neighbor, double.MaxValue);
|
||||
if (tentativeGScore < gScore[neighbor])
|
||||
{
|
||||
if (cameFromDict.ContainsKey(neighbor))
|
||||
if(!cameFromDict.TryAdd(neighbor, currentNode))
|
||||
cameFromDict[neighbor] = currentNode;
|
||||
else
|
||||
cameFromDict.Add(neighbor, currentNode);
|
||||
if (gScore.ContainsKey(neighbor))
|
||||
gScore[neighbor] = tentativeGScore;
|
||||
else
|
||||
gScore.Add(neighbor, tentativeGScore);
|
||||
gScore[neighbor] = tentativeGScore;
|
||||
double h = Heuristic(currentNode, neighbor, goalNode, edge, vehicle,
|
||||
heuristicRoadLevelPriority, heuristicFewJunctionsPriority, heuristicSameRoadPriority);
|
||||
//Console.WriteLine($"Queue: {openSetfScore.Count:00000} Current Distance: {Utils.DistanceBetween(currentNode, goalNode):000000.00} Visited: {cameFromDict.Count:00000} Current heuristic: {h:00000.00}");
|
||||
|
Loading…
Reference in New Issue
Block a user