Package org.opentripplanner.routing.algorithm

Examples of org.opentripplanner.routing.algorithm.GenericDijkstra


     * Figure out the minimum amount of walking to reach the destination from transit.
     * This is done by doing a Dijkstra search for the first reachable transit stop.
     */
    private double determineRequiredWalkDistance(RoutingRequest req) {
        if ( ! req.modes.isTransit()) return 0; // required walk distance will be unused.
        GenericDijkstra gd = new GenericDijkstra(req);
        State s = new State(req.rctx.target, req);
        gd.setHeuristic(new TrivialRemainingWeightHeuristic());
        final ClosestStopTraverseVisitor visitor = new ClosestStopTraverseVisitor();
        gd.traverseVisitor = visitor;
        gd.searchTerminationStrategy = new SearchTerminationStrategy() {
            @Override public boolean shouldSearchTerminate(Vertex origin, Vertex target, State current,
                                                           ShortestPathTree spt, RoutingRequest traverseOptions) {
                return visitor.distanceToClosestStop != Double.POSITIVE_INFINITY;
            }
        };
        gd.getShortestPathTree(s);
        return visitor.distanceToClosestStop;
    }
View Full Code Here


        } else {
            mode = TraverseMode.CAR;
        }
        RoutingRequest options = new RoutingRequest(mode);
        options.setDummyRoutingContext(graph);
        GenericDijkstra search = new GenericDijkstra(options);
        search.setSkipEdgeStrategy(new ListedEdgesOnly(edges));
        Set<Edge> usedEdges = new HashSet<Edge>();
        for (Vertex vertex : startingVertices) {
            State state = new State(vertex, options);
            ShortestPathTree spt = search.getShortestPathTree(state);
            for (Vertex endVertex : startingVertices) {
                GraphPath path = spt.getPath(endVertex, false);
                if (path != null) {
                    for (Edge edge : path.edges) {
                        usedEdges.add(edge);
View Full Code Here

        if (isHubStop)
          options.maxTransfers = Integer.MAX_VALUE;
        else
          options.maxTransfers = 2;

        GenericDijkstra dijkstra = new GenericDijkstra(graph, options);
        dijkstra.setSkipTraverseResultStrategy(new SkipVertexImpl(stop, tFrom));
        dijkstra.setShortestPathTreeFactory(MultiShortestPathTree.FACTORY);
        dijkstra.setPriorityQueueFactory(PriorityQueueImpl.FACTORY);

        TPOfflineOriginVertex origin = new TPOfflineOriginVertex(context, stop,
            instances, nearbyStopsAndWalkTimes, nearbyStopTimeInstances);
        State state = new OBAState(tFrom, origin, options);

        MultiShortestPathTree spt = (MultiShortestPathTree) dijkstra.getShortestPathTree(state);

        processTree(spt, stop, pathCountsByStop);
      }

      MutableTransferPattern pattern = new MutableTransferPattern(stop);
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.algorithm.GenericDijkstra

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.