@Override public Path calcLeastCostPath(final Node fromNode, final Node toNode, final double startTime, final Person person, final Vehicle vehicle) { this.fastRouter.initialize(); this.routingNetwork.initialize(); RoutingNetworkNode routingNetworkFromNode = this.routingNetwork.getNodes().get(fromNode.getId()); RoutingNetworkNode routingNetworkToNode = this.routingNetwork.getNodes().get(toNode.getId()); return super.calcLeastCostPath(routingNetworkFromNode, routingNetworkToNode, startTime, person, vehicle); }
/*package*/ static Path createPath(Dijkstra dijsktra, Node fromNode, Node toNode) { Path path = dijsktra.calcLeastCostPath(fromNode, toNode, 0., null, null); if (path == null) return path; for(Node node : path.nodes) log.info("\t\t" + node.getId()); for(Link link : path.links) log.info("\t\t" + link.getId()); log.info(path.travelCost); log.info(path.travelTime); return path; }
@Test public void testPersonAvailableForDisutility_Dijkstra() { Fixture f = new Fixture(); Dijkstra router = new Dijkstra(f.network, f.costFunction, new FreeSpeedTravelTime()); router.calcLeastCostPath( f.network.getNodes().get(Id.create("2", Node.class)), f.network.getNodes().get(Id.create("1", Node.class)), 07*3600, f.person, f.vehicle); // hopefully there was no Exception until here... Assert.assertEquals(22, f.costFunction.cnt); // make sure the costFunction was actually used }