@SuppressWarnings("unchecked") public Path calcLeastCostPath(final Map<Node, InitialNode> fromNodes, final Map<Node, InitialNode> toNodes, final Person person) { Map<Node, InitialNode> swapedToNodes = swapNodes(toNodes); TransitLeastCostPathTree tree = new TransitLeastCostPathTree(network, costFunction, timeFunction, swapNodes(fromNodes), swapedToNodes, person); return tree.getPath(swapedToNodes); }
new TransitLeastCostPathTree(f.network, tc, tc, fromNodes, null); long endTime = System.currentTimeMillis(); long elapsedTimeWithoutStopCreterion = (endTime - startTime); startTime = System.currentTimeMillis(); new TransitLeastCostPathTree(f.network, tc, tc, fromNodes, toNodes, null); endTime = System.currentTimeMillis(); long elapsedTimeWithStopCreterion = (endTime - startTime);
tree = new TransitLeastCostPathTree(getTransitRouterNetwork(), getTravelDisutility(), getTravelTime(), tree = new TransitLeastCostPathTree(getTransitRouterNetwork(), getTravelDisutility(), getTravelTime(),
/** * Try to route a connection with interchange. */ @Test public void TestValidRoutingWithInterchange() { instantiateNetworkAndTravelDisutility(); Coord fromCoord = new Coord(1050d, 1050d); Map<Node, InitialNode> wrappedFromNodes = this.locateWrappedNearestTransitNode(null, fromCoord, 28800); TransitLeastCostPathTree tree = new TransitLeastCostPathTree(network, travelDisutility, travelDisutility, wrappedFromNodes, null); Coord toCoord = new Coord(2050d, 2960d); Map<Node, InitialNode> wrappedToNodes = this.locateWrappedNearestTransitNode(null, toCoord, 28800); Path path = tree.getPath(wrappedToNodes); Assert.assertNotNull(path); double pathCost = path.travelCost; Assert.assertEquals(1.7706666666666668d, pathCost, MatsimTestUtils.EPSILON); double pathTime = path.travelTime; Assert.assertEquals(231.20000000000073d, pathTime, MatsimTestUtils.EPSILON); }
/** * Try to route a standard connection. */ @Test public void TestValidRouting() { instantiateNetworkAndTravelDisutility(); Coord fromCoord = new Coord(1050d, 1050d); Map<Node, InitialNode> wrappedFromNodes = this.locateWrappedNearestTransitNode(null, fromCoord, 28800); TransitLeastCostPathTree tree = new TransitLeastCostPathTree(network, travelDisutility, travelDisutility, wrappedFromNodes, null); Coord toCoord = new Coord(3950d, 1050d); Map<Node, InitialNode> wrappedToNodes = this.locateWrappedNearestTransitNode(null, toCoord, 28800); Path path = tree.getPath(wrappedToNodes); Assert.assertNotNull(path); double pathCost = path.travelCost; Assert.assertEquals(1.8d, pathCost, MatsimTestUtils.EPSILON); double pathTime = path.travelTime; Assert.assertEquals(540d, pathTime, MatsimTestUtils.EPSILON); }