use of org.opentripplanner.routing.algorithm.astar.strategies.SearchTerminationStrategy in project OpenTripPlanner by opentripplanner.
the class AStarTest method testMultipleTargets.
@Test
public void testMultipleTargets() {
RoutingRequest options = new RoutingRequest();
options.walkSpeed = 1.0;
options.setRoutingContext(graph, graph.getVertex("56th_24th"), graph.getVertex("leary_20th"));
Set<Vertex> targets = new HashSet<Vertex>();
targets.add(graph.getVertex("shilshole_22nd"));
targets.add(graph.getVertex("market_russell"));
targets.add(graph.getVertex("56th_20th"));
targets.add(graph.getVertex("leary_20th"));
SearchTerminationStrategy strategy = new MultiTargetTerminationStrategy(targets);
ShortestPathTree tree = new AStar().getShortestPathTree(options, -1, strategy);
for (Vertex v : targets) {
GraphPath path = tree.getPath(v, false);
assertNotNull("No path found for target " + v.getLabel(), path);
}
}
Aggregations