@Override public synchronized LeastCostPathCalculator createPathCalculator(final Network network, final TravelDisutility travelCosts, final TravelTime travelTimes) { PreProcessEuclidean preProcessEuclidean = this.preProcessData.get(network); if (preProcessEuclidean == null) { preProcessEuclidean = new PreProcessEuclidean(travelCosts); preProcessEuclidean.run(network); this.preProcessData.put(network, preProcessEuclidean); } return new AStarEuclidean(network, preProcessEuclidean, travelCosts, travelTimes, overdoFactor); } }
@Override protected LeastCostPathCalculator getLeastCostPathCalculator(Network network) { FreespeedTravelTimeAndDisutility travelTimeCostCalculator = new FreespeedTravelTimeAndDisutility(new PlanCalcScoreConfigGroup()); PreProcessEuclidean preProcessData = new PreProcessEuclidean(travelTimeCostCalculator); preProcessData.run(network); return new AStarEuclidean(network, preProcessData, travelTimeCostCalculator); }
@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 }