Compare commits

..

No commits in common. "62d527737a88b64a3a22dfae37371aeee21d33a4" and "1604b150d431ff305c19a73e9399c6bd9f303638" have entirely different histories.

View File

@ -52,6 +52,8 @@ namespace astar
for(int i = 0; i < Math.Min(toVisitStart.Count * 0.5, 50) && meetingEnds is null; i++)
meetingEnds = ExploreSide(true, graph, toVisitStart, rl, priorityHelper, closestEndNode, car, DefaultPriorityWeights, pathing, logger);
}
if(meetingEnds is null)
meetingEnds = ExploreSide(true, graph, toVisitStart, rl, priorityHelper, closestEndNode, car, DefaultPriorityWeights, pathing, logger);
ulong closestStartNodeId = toVisitStart.UnorderedItems
.MinBy(n => graph.Nodes[n.Element].DistanceTo(endNode.Value)).Element;
@ -61,6 +63,8 @@ namespace astar
for(int i = 0; i < Math.Min(toVisitEnd.Count * 0.5, 50) && meetingEnds is null; i++)
meetingEnds = ExploreSide(false, graph, toVisitEnd, rl, priorityHelper, closestStartNode, car, DefaultPriorityWeights, pathing, logger);
}
if(meetingEnds is null)
meetingEnds = ExploreSide(false, graph, toVisitEnd, rl, priorityHelper, closestStartNode, car, DefaultPriorityWeights, pathing, logger);
if (meetingEnds is not null)
break;
@ -84,7 +88,7 @@ namespace astar
return PathFound(graph, meetingEnds!.Value.Item1, meetingEnds.Value.Item2, car, logger);
}
private static ValueTuple<Node, Node>? ExploreSide(bool fromStart, Graph graph, PriorityQueue<ulong, int> toVisit, RegionLoader rl, PriorityHelper priorityHelper, Node goalNode, bool car, ValueTuple<float,float,float,float> ratingWeights, PathMeasure pathing, ILogger? logger = null)
private static ValueTuple<Node, Node>? ExploreSide(bool fromStart, Graph graph, PriorityQueue<ulong, int> toVisit, RegionLoader rl, PriorityHelper priorityHelper, Node goalNode, bool car, ValueTuple<float,float,float,float> ratingWeights, PathMeasure pathing = PathMeasure.Distance, ILogger? logger = null)
{
ulong currentNodeId = toVisit.Dequeue();
Node currentNode = graph.Nodes[currentNodeId];
@ -95,7 +99,6 @@ namespace astar
graph.ConcatGraph(Graph.FromGraph(rl.LoadRegionFromNodeId(neighborId)));
if (!graph.ContainsWay(wayId.Key))
{
logger?.LogDebug("Loading way... This will be slow.");
foreach (global::Graph.Graph? g in rl.LoadRegionsFromWayId(wayId.Key))
graph.ConcatGraph(Graph.FromGraph(g));
}