本文整理了Java中org.matsim.api.core.v01.population.Population.getFactory()
方法的一些代码示例,展示了Population.getFactory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Population.getFactory()
方法的具体详情如下:
包路径:org.matsim.api.core.v01.population.Population
类名称:Population
方法名:getFactory
暂无
代码示例来源:origin: matsim-org/matsim
@Override
public PopulationFactory getFactory() {
return population.getFactory();
}
代码示例来源:origin: matsim-org/matsim
/*package*/ CurrentLegReplanner(Id<WithinDayReplanner> id, Scenario scenario, ActivityEndRescheduler internalInterface,
LeastCostPathCalculator pathCalculator) {
super(id, scenario, internalInterface);
this.pathCalculator = pathCalculator;
this.populationFactory = scenario.getPopulation().getFactory() ;
}
代码示例来源:origin: matsim-org/matsim
public EditTrips( TripRouter tripRouter, Scenario scenario ) {
log.setLevel( Level.INFO);
this.tripRouter = tripRouter;
this.scenario = scenario;
this.pf = scenario.getPopulation().getFactory() ;
}
public final Trip findCurrentTrip( MobsimAgent agent ) {
代码示例来源:origin: matsim-org/matsim
@Override
public RoutingModule get() {
return new PassengerRoutingModule(
JointActingTypes.PASSENGER,
scenario.getPopulation().getFactory());
}
}
代码示例来源:origin: matsim-org/matsim
@Override
public RoutingModule get() {
return new DriverRoutingModule(
JointActingTypes.DRIVER,
scenario.getPopulation().getFactory(),
carRouter);
}
}
代码示例来源:origin: matsim-org/matsim
private void startRoute(final Attributes atts) {
this.currroute = this.plans.getFactory().getRouteFactories().createRoute(NetworkRoute.class, this.prevAct.getLinkId(), this.prevAct.getLinkId());
this.currleg.setRoute(this.currroute);
if (atts.getValue("dist") != null) {
this.currroute.setDistance(Double.parseDouble(atts.getValue("dist")));
}
if (atts.getValue("trav_time") != null) {
this.currroute.setTravelTime(Time.parseTime(atts.getValue("trav_time")));
}
}
代码示例来源:origin: matsim-org/matsim
public TransitScheduleReaderV1(
final CoordinateTransformation coordinateTransformation,
final Scenario scenario) {
this( coordinateTransformation,
scenario.getTransitSchedule(),
scenario.getPopulation().getFactory().getRouteFactories() );
}
代码示例来源:origin: matsim-org/matsim
public TransitScheduleReaderV2(
final String externalInputCRS,
final String targetCRS,
final Scenario scenario) {
this( externalInputCRS, targetCRS , scenario.getTransitSchedule() , scenario.getPopulation().getFactory().getRouteFactories() );
}
代码示例来源:origin: matsim-org/matsim
public TransitScheduleReaderV1(final Scenario scenario) {
this( scenario.getTransitSchedule(),
scenario.getPopulation().getFactory().getRouteFactories() );
}
代码示例来源:origin: matsim-org/matsim
private void startRoute() {
this.currroute = this.plans.getFactory().getRouteFactories().createRoute(NetworkRoute.class, this.prevAct.getLinkId(), this.prevAct.getLinkId());
this.currleg.setRoute(this.currroute);
}
代码示例来源:origin: matsim-org/matsim
public EditPlans( QSim mobsim, TripRouter tripRouter, EditTrips editTrips ) {
Gbl.assertNotNull( this.mobsim = mobsim );
Gbl.assertNotNull( this.tripRouter = tripRouter );
Gbl.assertNotNull( this.editTrips = editTrips ) ;
Gbl.assertNotNull( this.pf = mobsim.getScenario().getPopulation().getFactory() ) ;
}
public boolean addActivityAtEnd(MobsimAgent agent, Activity activity, String routingMode) {
代码示例来源:origin: io.github.agentsoz/bdi-matsim
@Inject
Replanner(QSim qSim2, TripRouter tripRouter, Map<String,TravelTime> travelTimes ) {
Scenario scenario = qSim2.getScenario();
this.travelTimes = travelTimes ;
{
TravelTime travelTime = TravelTimeUtils.createFreeSpeedTravelTime();
TravelDisutility travelDisutility = TravelDisutilityUtils.createFreespeedTravelTimeAndDisutility(scenario.getConfig().planCalcScore());
LeastCostPathCalculator pathCalculator = new FastAStarLandmarksFactory().createPathCalculator(scenario.getNetwork(), travelDisutility, travelTime);
this.editRoutes = new EditRoutes(scenario.getNetwork(), pathCalculator, scenario.getPopulation().getFactory());
}
this.editTrips = new EditTrips(tripRouter, qSim2.getScenario() ) ;
this.editPlans = new EditPlans(qSim2, tripRouter, editTrips, scenario.getPopulation().getFactory() ) ;
}
代码示例来源:origin: matsim-org/matsim
@Override
public void handlePlan(final Plan plan) {
// Creating a dummy population which only contains the plans which are passed here.
// I need to copy the plans because I am not supposed to add a plan to a different Person.
// I also need to memorize the plans which are passed here, because I am supposed to mutate them.
final Person personWithOnlySelectedPlan = this.exportPopulation.getFactory().createPerson(plan.getPerson().getId());
final Plan planForNewPerson = PopulationUtils.createPlan(personWithOnlySelectedPlan);
PopulationUtils.copyFromTo(plan, planForNewPerson);
personWithOnlySelectedPlan.addPlan(planForNewPerson);
this.exportPopulation.addPerson(personWithOnlySelectedPlan);
this.plansToMutate.put(plan.getPerson().getId(), plan);
}
代码示例来源:origin: matsim-org/matsim
public static Scenario createScenario(final Config config) {
final Scenario sc = ScenarioUtils.createScenario( config );
final RouteFactories rFactory = ((PopulationFactory) sc.getPopulation().getFactory()).getRouteFactories();
rFactory.setRouteFactory(
DriverRoute.class,//JointActingTypes.DRIVER,
new DriverRouteFactory());
rFactory.setRouteFactory(
PassengerRoute.class,//JointActingTypes.PASSENGER,
new PassengerRouteFactory());
return sc;
}
代码示例来源:origin: matsim-org/matsim
@Test
public void testConstructor_DefaultNetworkRouteType() {
Config config = ConfigUtils.createConfig();
Scenario scenario = ScenarioUtils.createScenario(config);
PopulationFactory pf = scenario.getPopulation().getFactory();
Id<Link> linkId = Id.create(1, Link.class);
final Id<Link> startLinkId = linkId;
final Id<Link> endLinkId = linkId;
Assert.assertEquals(GenericRouteImpl.class, pf.getRouteFactories().createRoute(Route.class, startLinkId, endLinkId).getClass());
}
代码示例来源:origin: matsim-org/matsim
@Test
public void testConstructor_CompressedNetworkRouteType() {
Config config = ConfigUtils.createConfig();
config.plans().setNetworkRouteType(PlansConfigGroup.NetworkRouteType.CompressedNetworkRoute);
Scenario scenario = ScenarioUtils.createScenario(config);
PopulationFactory pf = scenario.getPopulation().getFactory();
Id<Link> linkId = Id.create(1, Link.class);
final Id<Link> startLinkId = linkId;
final Id<Link> endLinkId = linkId;
Assert.assertEquals(CompressedNetworkRouteImpl.class, pf.getRouteFactories().createRoute(NetworkRoute.class, startLinkId, endLinkId).getClass());
}
代码示例来源:origin: matsim-org/matsim
@Override
public List<? extends PlanElement> calcRoute(Facility fromFacility, Facility toFacility, double departureTime, Person person) {
List<? extends PlanElement> trip = DefaultRoutingModules.createPureNetworkRouter("car", scenario.getPopulation().getFactory(),
scenario.getNetwork(),
leastCostAlgoFactory.createPathCalculator(scenario.getNetwork(), disutilityFactory.createTravelDisutility(travelTime), travelTime)
).calcRoute(fromFacility, toFacility, departureTime, person);
((NetworkRoute) TripStructureUtils.getLegs(trip).get(0).getRoute()).setVehicleId(newVehicleId);
return trip;
}
代码示例来源:origin: matsim-org/matsim
@Test
public void testConstructor_LinkNetworkRouteType() {
Config config = ConfigUtils.createConfig();
config.plans().setNetworkRouteType(PlansConfigGroup.NetworkRouteType.LinkNetworkRoute);
Scenario scenario = ScenarioUtils.createScenario(config);
PopulationFactory pf = scenario.getPopulation().getFactory();
Id<Link> linkId = Id.create(1, Link.class);
final Id<Link> startLinkId = linkId;
final Id<Link> endLinkId = linkId;
Assert.assertEquals(LinkNetworkRouteImpl.class, pf.getRouteFactories().createRoute(NetworkRoute.class, startLinkId, endLinkId).getClass());
}
代码示例来源:origin: matsim-org/matsim
@Test
public void testEmptyPersonAttributesIO() {
final Population population = PopulationUtils.createPopulation(ConfigUtils.createConfig() );
final Person person = population.getFactory().createPerson(Id.createPersonId( "Donald Trump"));
population.addPerson( person );
final String file = utils.getOutputDirectory()+"/population.xml";
new PopulationWriter( population ).writeV6( file );
// just check everything works without attributes (dtd validation etc)
final Scenario readScenario = ScenarioUtils.createScenario( ConfigUtils.createConfig() );
new PopulationReader( readScenario ).readFile( file );
}
代码示例来源:origin: matsim-org/matsim
@Test
public void testEmptyPopulationVsOnePerson() {
Scenario s1 = ScenarioUtils.createScenario(ConfigUtils.createConfig());
Scenario s2 = ScenarioUtils.createScenario(ConfigUtils.createConfig());
Person person = s2.getPopulation().getFactory().createPerson(Id.create("1", Person.class));
s2.getPopulation().addPerson(person);
Assert.assertFalse(PopulationUtils.equalPopulation(s1.getPopulation(), s2.getPopulation()));
Assert.assertFalse(PopulationUtils.equalPopulation(s2.getPopulation(), s1.getPopulation()));
}
内容来源于网络,如有侵权,请联系作者删除!