Package org.opentripplanner.routing.core

Examples of org.opentripplanner.routing.core.RoutingRequest


    }
   
    public void testFewestTransfers() {
        Vertex stop_c = graph.getVertex("agency:C");
        Vertex stop_d = graph.getVertex("agency:D");
        RoutingRequest options = new RoutingRequest();
        options.optimize = OptimizeType.QUICK;
        options.dateTime = TestUtils.dateInSeconds("America/New_York", 2009, 8, 1, 16, 0, 0);
        options.setRoutingContext(graph, stop_c, stop_d)
               
        ShortestPathTree spt = aStar.getShortestPathTree(options);

        //when optimizing for speed, take the fast two-bus path
        GraphPath path = spt.getPath(stop_d, false);
View Full Code Here


        Vertex entrance = graph.getVertex("agency:entrance_a");
        assertNotNull(entrance);
        Vertex stop = graph.getVertex("agency:A");
        assertNotNull(stop);

        RoutingRequest options = new RoutingRequest();
        options.dateTime = TestUtils.dateInSeconds("America/New_York", 2009, 8, 1, 16, 0, 0);
        options.setRoutingContext(graph, entrance, stop);
        ShortestPathTree spt = aStar.getShortestPathTree(options);
       
        GraphPath path = spt.getPath(stop, false);
        assertNotNull(path);
        assertEquals(TestUtils.dateInSeconds("America/New_York", 2009, 8, 1, 16, 0, 34), path.getEndTime());
View Full Code Here

        } else if (firstEdge.getPermission().allows(StreetTraversalPermission.BICYCLE)) {
            mode = TraverseMode.BICYCLE;
        } 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);
View Full Code Here

    public void testDwell() throws Exception {
        Vertex stop_a = graph.getVertex("agency:A_depart");
        Vertex stop_c = graph.getVertex("agency:C_arrive");

        RoutingRequest options = new RoutingRequest();
        options.dateTime = TestUtils.dateInSeconds("America/New_York", 2009, 8, 7, 8, 0, 0);
        options.setRoutingContext(graph, stop_a, stop_c);
        ShortestPathTree spt = aStar.getShortestPathTree(options);

        GraphPath path = spt.getPath(stop_c, false);
        assertNotNull(path);
        assertEquals(6, path.states.size());
View Full Code Here

        Vertex stop_b = graph.getVertex("agency:B");
        Vertex stop_c = graph.getVertex("agency:C");
        Vertex stop_d = graph.getVertex("agency:D");
        Vertex stop_e = graph.getVertex("agency:E");

        RoutingRequest options = new RoutingRequest();
        options.dateTime = TestUtils.dateInSeconds("America/New_York", 2009, 8, 7, 0, 0, 0);

        ShortestPathTree spt;
        GraphPath path;

        // A to B
        options.setRoutingContext(graph, stop_a, stop_b);
        spt = aStar.getShortestPathTree(options);

        path = spt.getPath(stop_b, false);
        assertNotNull(path);
        assertEquals(extractStopVertices(path), Lists.newArrayList(stop_a, stop_b));


        // A to C
        options.setRoutingContext(graph, stop_a, stop_c);
        spt = aStar.getShortestPathTree(options);

        path = spt.getPath(stop_c, false);
        assertNotNull(path);
        assertEquals(extractStopVertices(path), Lists.newArrayList(stop_a, stop_c));


        // A to D
        options.setRoutingContext(graph, stop_a, stop_d);
        spt = aStar.getShortestPathTree(options);

        path = spt.getPath(stop_d, false);
        assertNotNull(path);
        assertEquals(extractStopVertices(path), Lists.newArrayList(stop_a, stop_c, stop_d));
        long endTime = TestUtils.dateInSeconds("America/New_York", 2009, 8, 7, 0, 0, 0) + 40 * 60;
        assertEquals(endTime, path.getEndTime());

        // A to E
        options.setRoutingContext(graph, stop_a, stop_e);
        spt = aStar.getShortestPathTree(options);

        path = spt.getPath(stop_e, false);
        assertNotNull(path);
        assertEquals(extractStopVertices(path), Lists.newArrayList(stop_a, stop_c, stop_e));
View Full Code Here

        end = _graph.getVertex("osm:node:42448554");   
    }

    private GraphPath getPath(SPTService sptService, RoutingRequest proto,
            Edge startBackEdge, Vertex u, Vertex v) {
        RoutingRequest options = proto.clone();
        options.setRoutingContext(_graph, startBackEdge, u, v);
        ShortestPathTree tree = sptService.getShortestPathTree(options);
        GraphPath path = tree.getPath(v, false);
        options.cleanup();
        return path;
    }
View Full Code Here

   
    private void checkTriangleInequality(TraverseModeSet traverseModes) {
        assertNotNull(start);
        assertNotNull(end);
       
        RoutingRequest prototypeOptions = new RoutingRequest();
       
        // All reluctance terms are 1.0 so that duration is monotonically increasing in weight.
        prototypeOptions.stairsReluctance = (1.0);
        prototypeOptions.setWalkReluctance(1.0);
        prototypeOptions.turnReluctance = (1.0);
        prototypeOptions.carSpeed = 1.0;
        prototypeOptions.walkSpeed = 1.0;
        prototypeOptions.bikeSpeed = 1.0;
        prototypeOptions.traversalCostModel = (new ConstantIntersectionTraversalCostModel(10.0));
       
        if (traverseModes != null) {
            prototypeOptions.setModes(traverseModes);
        }
       
        RoutingRequest options = prototypeOptions.clone();
        options.setRoutingContext(_graph, start, end);
       
        GenericAStar aStar = new GenericAStar();
       
        ShortestPathTree tree = aStar.getShortestPathTree(options);
        GraphPath path = tree.getPath(end, false);
        options.cleanup();
        assertNotNull(path);
       
        double startEndWeight = path.getWeight();
        int startEndDuration = path.getDuration();
        assertTrue(startEndWeight > 0);
View Full Code Here

        super(bikeParkVertex, bikeParkVertex);
    }

    @Override
    public State traverse(State s0) {
        RoutingRequest options = s0.getOptions();
        if (options.arriveBy) {
            return traverseUnpark(s0);
        } else {
            return traversePark(s0);
        }
View Full Code Here

            return traversePark(s0);
        }
    }

    protected State traverseUnpark(State s0) {
        RoutingRequest options = s0.getOptions();
        /*
         * To unpark a bike, we need to be walking, and be allowed to bike.
         */
        if (s0.getNonTransitMode() != TraverseMode.WALK || !options.modes.getBicycle())
            return null;
View Full Code Here

        State s1 = s0e.makeState();
        return s1;
    }

    protected State traversePark(State s0) {
        RoutingRequest options = s0.getOptions();
        /*
         * To park a bike, we need to be riding one, (not rented) and be allowed to walk and to park
         * it.
         */
        if (s0.getNonTransitMode() != TraverseMode.BICYCLE || !options.modes.getWalk()
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.core.RoutingRequest

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.