@Override public Path calcLeastCostPath(final Node fromNode, final Node toNode, final double startTime, final Person person, final Vehicle vehicle) { this.controlCounter = 0; // reset counter for each calculated path! if (this.landmarks.length >= 2) { initializeActiveLandmarks(fromNode, toNode, 2); } else { initializeActiveLandmarks(fromNode, toNode, this.landmarks.length); } return super.calcLeastCostPath(fromNode, toNode, startTime, person, vehicle); }
@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); }
@Test public void testPersonAvailableForDisutility_AStarEuclidean() { Fixture f = new Fixture(); PreProcessEuclidean preprocess = new PreProcessEuclidean(f.costFunction); preprocess.run(f.network); AStarEuclidean router = new AStarEuclidean(f.network, preprocess, 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 }
@Test public void testPersonAvailableForDisutility_FastAStarEuclidean() { Fixture f = new Fixture(); PreProcessEuclidean preprocess = new PreProcessEuclidean(f.costFunction); preprocess.run(f.network); AStarEuclidean router = new AStarEuclidean(f.network, preprocess, 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 }