Package org.opentripplanner.routing.spt

Examples of org.opentripplanner.routing.spt.GraphPath


        options.setArriveBy(true);
        options.setRoutingContext(_graph, _graph.getVertex("56th_24th"),
                _graph.getVertex("leary_20th"));
        ShortestPathTree tree = new GenericAStar().getShortestPathTree(options);

        GraphPath path = tree.getPath(_graph.getVertex("56th_24th"), false);

        List<State> states = path.states;

        assertTrue(states.size() == 6 || states.size() == 7);
View Full Code Here


                .add(new SimpleConcreteEdge(_graph.getVertex("56th_20th"), toLocation));

        options.setRoutingContext(_graph, fromLocation, toLocation);
        ShortestPathTree tree = new GenericAStar().getShortestPathTree(options);

        GraphPath path = tree.getPath(toLocation, false);

        List<State> states = path.states;

        assertEquals(9, states.size());
View Full Code Here

                .add(new SimpleConcreteEdge(_graph.getVertex("56th_20th"), toLocation));

        options.setRoutingContext(_graph, fromLocation, toLocation);
        ShortestPathTree tree = new GenericAStar().getShortestPathTree(options);

        GraphPath path = tree.getPath(fromLocation, false);

        List<State> states = path.states;

        assertEquals(9, states.size());
View Full Code Here

        SearchTerminationStrategy strategy = new MultiTargetTerminationStrategy(targets);
        ShortestPathTree tree = new GenericAStar().getShortestPathTree(options, -1, strategy);

        for (Vertex v : targets) {
            GraphPath path = tree.getPath(v, false);
            assertNotNull("No path found for target " + v.getLabel(), path);
        }
    }
View Full Code Here

        options.dateTime = startTime;
        options.setRoutingContext(graph, br, end);
        options.setMaxWalkDistance(Double.MAX_VALUE);
        ShortestPathTree spt1 = aStar.getShortestPathTree(options);

        GraphPath pathBr = spt1.getPath(end, false);
        assertNotNull("There must be a path from br to end", pathBr);

        options.setRoutingContext(graph, tr, end);
        ShortestPathTree spt2 = aStar.getShortestPathTree(options);

        GraphPath pathTr = spt2.getPath(end, false);
        assertNotNull("There must be a path from tr to end", pathTr);
        assertTrue("path from bottom to end must be longer than path from top to end",
                pathBr.getWeight() > pathTr.getWeight());

        options.setRoutingContext(graph, start, end);
        ShortestPathTree spt = aStar.getShortestPathTree(options);

        GraphPath path = spt.getPath(end, false);
        assertNotNull("There must be a path from start to end", path);

        // the bottom is not part of the shortest path
        for (State s : path.states) {
            assertNotSame(s.getVertex(), graph.getVertex("bottom"));
View Full Code Here

        options.dateTime = startTime;
        options.setRoutingContext(graph, start, end);
        options.setMaxWalkDistance(Double.MAX_VALUE);
        ShortestPathTree spt = aStar.getShortestPathTree(options);

        GraphPath path = spt.getPath(end, false);
        assertNotNull("There must be a path from start to end", path);       
        assertEquals(1, path.edges.size());
    }
View Full Code Here

        options.dateTime = startTime;
        options.setRoutingContext(graph, start, end);
        options.setMaxWalkDistance(Double.MAX_VALUE);
        ShortestPathTree spt = aStar.getShortestPathTree(options);

        GraphPath path = spt.getPath(end, false);
        assertNotNull("There must be a path from start to end", path);       
        assertTrue(path.edges.size() > 1);
    }
View Full Code Here

                walking);
        assertNotNull(end);
        // The visibility for temp edges for start and end is set in the setRoutingContext call
        walking.setRoutingContext(graph, start, end);
        ShortestPathTree spt = aStar.getShortestPathTree(walking);
        GraphPath path = spt.getPath(end, false);
        for (State s : path.states) {
            assertFalse(s.getBackEdge() == top);
        }
    }
View Full Code Here

        proto.traversalCostModel = (new ConstantIntersectionTraversalCostModel(0.0));
    }
   
    private GraphPath checkForwardRouteDuration(RoutingRequest options, int expectedDuration) {
        ShortestPathTree tree = new GenericAStar().getShortestPathTree(options);
        GraphPath path = tree.getPath(bottomLeft, false);
        assertNotNull(path);
       
        // Without turn costs, this path costs 2x100 + 2x50 = 300.
        assertEquals(expectedDuration, path.getDuration());
       
        // Weight == duration when reluctances == 0.
        assertEquals(expectedDuration, (int) path.getWeight());
       
        for (State s : path.states) {
            assertEquals(s.getElapsedTimeSeconds(), (int) s.getWeight());
        }
       
View Full Code Here

        options.traversalCostModel = (new ConstantIntersectionTraversalCostModel(10.0));
        options.setRoutingContext(_graph, topRight, bottomLeft);
       
        // Without turn costs, this path costs 2x100 + 2x50 = 300.
        // Since we traverse 3 intersections, the total cost should be 330.
        GraphPath path = checkForwardRouteDuration(options, 330);
       
        // The intersection traversal cost should be applied to the state *after*
        // the intersection itself.
        List<State> states = path.states;
        assertEquals(5, states.size());
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.spt.GraphPath

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.