diff --git a/Pathfinding/Pathfinder.cs b/Pathfinding/Pathfinder.cs index 258f503..5a1c638 100644 --- a/Pathfinding/Pathfinder.cs +++ b/Pathfinding/Pathfinder.cs @@ -30,11 +30,14 @@ public static class Pathfinder OsmNode currentNode = openSetfScore.Dequeue(); if (currentNode.Equals(goalNode)) { + Console.WriteLine("Path found."); List path = GetPath(cameFromDict, goalNode, regionManager); + Console.WriteLine("Rendering."); List coords = new(); foreach(PathNode pn in path) coords.Add(pn.coordinates); Renderer.DrawLoadedNodes(gScore, coords, workingDir); + Console.WriteLine("Done."); return path; } @@ -93,7 +96,7 @@ public static class Pathfinder double distance = Utils.DistanceBetween(fromNode, neighborNode); double speed = regionManager.GetSpeedForEdge(fromNode, edge.wayId, vehicle); double prio = GetPriorityVehicleRoad(edge, vehicle, regionManager.GetRegion(fromNode.coordinates)!); - return distance / (speed + (prio * 10)); + return distance / (speed + prio * 50); } private static double Heuristic(OsmNode fromNode, OsmNode neighborNode, OsmNode goalNode, OsmEdge edge, SpeedType vehicle, RegionManager regionManager, double roadPriorityFactor, double junctionFactor, double sameRoadFactor) @@ -121,7 +124,7 @@ public static class Pathfinder //Console.WriteLine($"{roadPriority:000.00} {sameRoadName:000.00} {junctionCount:000.00} {distanceImprovement:+000.00;-000.00;0000.00}"); - return Utils.DistanceBetween(neighborNode, goalNode) - (roadPriority + sameRoadName + junctionCount) * 100; + return Utils.DistanceBetween(neighborNode, goalNode) - (roadPriority + sameRoadName + junctionCount) * 20; } private static double GetPriorityVehicleRoad(OsmEdge edge, SpeedType vehicle, Region region)