More logging

This commit is contained in:
glax 2023-04-13 01:12:16 +02:00
parent 08e3da6fe3
commit d35aab9c39

View File

@ -30,11 +30,14 @@ public static class Pathfinder
OsmNode currentNode = openSetfScore.Dequeue();
if (currentNode.Equals(goalNode))
{
Console.WriteLine("Path found.");
List<PathNode> path = GetPath(cameFromDict, goalNode, regionManager);
Console.WriteLine("Rendering.");
List<Coordinates> 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)