public JointPlanRouter( final TripRouter routingHandler, final ActivityFacilities facilities ) { delegate = new PlanRouter( routingHandler , facilities ); }
@Override public PlanAlgorithm createPlanRoutingAlgorithm( final TripRouter tripRouter) { return new PlanRouter(tripRouter); } });
@Override public final PlanAlgorithm getPlanAlgoInstance() { return new PlanRouter( tripRouterProvider.get(), facilities); }
@Override public AbstractPersonAlgorithm getPersonAlgorithm() { return new PersonPrepareForSim(new PlanRouter(tripRouterProvider.get(), activityFacilities), scenario, carOnlyNetwork ); } // yyyyyy This prepared network is only used for computing the distance. So the full network would
@Override public AbstractPersonAlgorithm getPersonAlgorithm() { return new PersonPrepareForSim(new PlanRouter(tripRouterProvider.get(), activityFacilities), scenario, carOnlyNetwork); } }
@Override public WithinDayInitialReplanner createReplanner() { WithinDayInitialReplanner replanner = new InitialReplanner(super.getId(), scenario, this.getWithinDayEngine().getActivityRescheduler(), new PlanRouter(this.tripRouterFactory.get(), this.scenario.getActivityFacilities())); return replanner; }
private void handlePlan(Plan plan) { // This calculates a best-response plan from the two options, paying area toll or not. // From what I understand, it may be simpler/better to just throw a coin and produce // one of the two options. replaceCarModeWithTolledCarMode(plan); PlanRouter untolledPlanRouter = new PlanRouter(tripRouterFactory.get()); untolledPlanRouter.run(plan); double areaToll = roadPricingScheme.getTypicalCosts().iterator().next().amount; double routeCostWithAreaToll = sumNetworkModeCosts(plan) + areaToll; replaceTolledCarModeWithCarMode(plan); new PlanRouter(tripRouterFactory.get()).run(plan); double routeCostWithoutAreaToll = sumNetworkModeCosts(plan); if (routeCostWithAreaToll < routeCostWithoutAreaToll) { replaceCarModeWithTolledCarMode(plan); untolledPlanRouter.run(plan); } }
@Override public AbstractPersonAlgorithm getPersonAlgorithm() { return stuckFactory.getReRouteStuck(new PlanRouter( controler.getTripRouterProvider().get(), controler.getScenario().getActivityFacilities() ), ((MutableScenario)controler.getScenario()), agentsStuckHandler.getAgentsStuck()); } });
PlanRouter planRouter = new PlanRouter(tripRouterProvider.get());
@Deprecated // use TripRouter instead. kai, dec'13 public PlanRouterAdapter( final MatsimServices controler) { this.planRouter = new PlanRouter( controler.getTripRouterProvider().get(), controler.getScenario().getActivityFacilities() ); TravelTime time = controler.getLinkTravelTimes(); TravelDisutility disutility = controler.getTravelDisutilityFactory().createTravelDisutility( time); LeastCostPathCalculatorFactory factory = controler.getLeastCostPathCalculatorFactory(); Network network = controler.getScenario().getNetwork(); this.routeAlgo = factory.createPathCalculator(network, disutility, time); PopulationFactory populationFactory = controler.getScenario().getPopulation().getFactory(); this.routeFactory = ((PopulationFactory) populationFactory).getRouteFactories(); }
final PersonAlgorithm router = new PlanRouter(tripRouter);
reader.addAlgorithm(new PlanRouter(injector.getInstance(TripRouter.class), null)); reader.addAlgorithm(plansWriter); reader.readFile(this.config.plans().getInputFile());
@Test public void passesVehicleFromOldPlan() { final Config config = ConfigUtils.loadConfig(IOUtils.newUrl(ExamplesUtils.getTestScenarioURL("equil"), "config.xml")); config.plans().setInputFile("plans1.xml"); final Scenario scenario = ScenarioUtils.loadScenario(config); com.google.inject.Injector injector = Injector.createInjector(scenario.getConfig(), new AbstractModule() { @Override public void install() { install(new TripRouterModule()); install(new ScenarioByInstanceModule(scenario)); addTravelTimeBinding("car").toInstance(new FreespeedTravelTimeAndDisutility(config.planCalcScore())); addTravelDisutilityFactoryBinding("car").toInstance(new OnlyTimeDependentTravelDisutilityFactory()); } }); TripRouter tripRouter = injector.getInstance(TripRouter.class); PlanRouter testee = new PlanRouter(tripRouter); Plan plan = scenario.getPopulation().getPersons().get(Id.createPersonId(1)).getSelectedPlan(); Id<Vehicle> vehicleId = Id.create(1, Vehicle.class); ((NetworkRoute) TripStructureUtils.getLegs(plan).get(0).getRoute()).setVehicleId(vehicleId); testee.run(plan); if ( !config.plansCalcRoute().isInsertingAccessEgressWalk() ) { Assert.assertEquals("Vehicle Id transferred to new Plan", vehicleId, ((NetworkRoute) TripStructureUtils.getLegs(plan).get(0).getRoute()).getVehicleId()); } else { Assert.assertEquals("Vehicle Id transferred to new Plan", vehicleId, ((NetworkRoute) TripStructureUtils.getLegs(plan).get(1).getRoute()).getVehicleId()); // yy I changed get(0) to get(1) since in the input file there is no intervening walk leg, but in the output there is. kai, feb'16 } }
TripRouter tripRouter = injector.getInstance(TripRouter.class); PlanRouter testee = new PlanRouter(tripRouter); testee.run(plan); if ( !config.plansCalcRoute().isInsertingAccessEgressWalk() ) {
new PlanRouter(tripRouter).run(plan);
final PlanAlgorithm plansCalcRoute = new PlanRouter(tripRouter);