diff --git a/extensions/matsim2silo/src/main/java/de/tum/bgu/msm/matsim/MatsimData.java b/extensions/matsim2silo/src/main/java/de/tum/bgu/msm/matsim/MatsimData.java index 21be4d552..b0e35c08d 100644 --- a/extensions/matsim2silo/src/main/java/de/tum/bgu/msm/matsim/MatsimData.java +++ b/extensions/matsim2silo/src/main/java/de/tum/bgu/msm/matsim/MatsimData.java @@ -32,10 +32,10 @@ public final class MatsimData { private final Properties properties; private Config config; - private Network carNetwork; - private Network ptNetwork; + private final Network carNetwork; + private final Network ptNetwork; + private final TransitSchedule schedule; - private TransitSchedule schedule; private RaptorParameters raptorParameters; private DefaultRaptorParametersForPerson parametersForPerson; private LeastCostRaptorRouteSelector routeSelector; @@ -50,10 +50,11 @@ public final class MatsimData { public MatsimData(Config config, Properties properties, ZoneConnectorManager.ZoneConnectorMethod method, - DataContainer dataContainer) { + DataContainer dataContainer, Network network, TransitSchedule schedule) { this.config = config; this.raptorParameters = RaptorUtils.createParameters(config); this.properties = properties; + this.schedule = schedule; final Collection zones = dataContainer.getGeoData().getZones().values(); switch (method) { case RANDOM: @@ -67,13 +68,27 @@ public MatsimData(Config config, Properties properties, default: throw new RuntimeException("No valid zone connector method defined!"); } + + TransportModeNetworkFilter filter = new TransportModeNetworkFilter(network); + + Set car = Sets.newHashSet(TransportMode.car); + Set pt = Sets.newHashSet(TransportMode.pt); + + Network carNetwork = NetworkUtils.createNetwork(); + filter.filter(carNetwork, car); + + Network ptNetwork = NetworkUtils.createNetwork(); + filter.filter(ptNetwork, pt); + + this.carNetwork = carNetwork; + this.ptNetwork = ptNetwork; } ZoneConnectorManager getZoneConnectorManager() { return zoneConnectorManager; } - Network getCarNetwork() { + public Network getCarNetwork() { return carNetwork; } @@ -81,25 +96,9 @@ Network getPtNetwork() { return ptNetwork; } - public void update(Network network, TransitSchedule schedule, - TravelDisutility travelDisutility, TravelTime travelTime) { + public void update(TravelDisutility travelDisutility, TravelTime travelTime) { this.travelDisutility = travelDisutility; this.travelTime = travelTime; - this.schedule = schedule; - - TransportModeNetworkFilter filter = new TransportModeNetworkFilter(network); - - Set car = Sets.newHashSet(TransportMode.car); - Set pt = Sets.newHashSet(TransportMode.pt); - - Network carNetwork = NetworkUtils.createNetwork(); - filter.filter(carNetwork, car); - - Network ptNetwork = NetworkUtils.createNetwork(); - filter.filter(ptNetwork, pt); - - this.carNetwork = carNetwork; - this.ptNetwork = ptNetwork; this.leastCostPathCalculatorFactory = new FastAStarLandmarksFactory(properties.main.numberOfThreads); @@ -118,7 +117,6 @@ public void update(Network network, TransitSchedule schedule, null); routeSelector = new LeastCostRaptorRouteSelector(); } - } MultiNodePathCalculator createMultiNodePathCalculator() { @@ -176,4 +174,7 @@ RaptorParameters getRaptorParameters() { return raptorParameters; } + public TransitSchedule getSchedule() { + return schedule; + } } diff --git a/extensions/matsim2silo/src/main/java/de/tum/bgu/msm/matsim/MatsimTransportModel.java b/extensions/matsim2silo/src/main/java/de/tum/bgu/msm/matsim/MatsimTransportModel.java index b7c46bc3e..e7dad7da4 100644 --- a/extensions/matsim2silo/src/main/java/de/tum/bgu/msm/matsim/MatsimTransportModel.java +++ b/extensions/matsim2silo/src/main/java/de/tum/bgu/msm/matsim/MatsimTransportModel.java @@ -20,47 +20,26 @@ import de.tum.bgu.msm.container.DataContainer; -import de.tum.bgu.msm.data.Zone; -import de.tum.bgu.msm.data.accessibility.MatsimAccessibility; -import de.tum.bgu.msm.data.household.HouseholdUtil; import de.tum.bgu.msm.data.travelTimes.SkimTravelTimes; import de.tum.bgu.msm.data.travelTimes.TravelTimes; +import de.tum.bgu.msm.matsim.accessibility.MatsimAccessibility; import de.tum.bgu.msm.models.transportModel.TransportModel; import de.tum.bgu.msm.properties.Properties; import de.tum.bgu.msm.properties.modules.TransportModelPropertiesModule; import org.apache.log4j.Logger; -import org.locationtech.jts.geom.Geometry; -import org.matsim.api.core.v01.Coord; -import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.TransportMode; -import org.matsim.api.core.v01.network.Network; -import org.matsim.api.core.v01.network.Node; -import org.matsim.contrib.accessibility.AccessibilityAttributes; -import org.matsim.contrib.accessibility.AccessibilityConfigGroup; -import org.matsim.contrib.accessibility.AccessibilityModule; import org.matsim.contrib.dvrp.trafficmonitoring.TravelTimeUtils; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; -import org.matsim.core.config.groups.FacilitiesConfigGroup; import org.matsim.core.controler.Controler; import org.matsim.core.controler.ControlerDefaults; import org.matsim.core.controler.OutputDirectoryHierarchy; -import org.matsim.core.network.NetworkUtils; -import org.matsim.core.router.FastAStarLandmarksFactory; -import org.matsim.core.router.TripRouterFactoryBuilderWithDefaults; import org.matsim.core.router.util.TravelDisutility; import org.matsim.core.router.util.TravelTime; import org.matsim.core.scenario.ScenarioUtils; -import org.matsim.core.utils.geometry.CoordUtils; -import org.matsim.facilities.*; -import org.matsim.pt.transitSchedule.api.TransitSchedule; -import org.opengis.feature.simple.SimpleFeature; -import java.util.HashMap; -import java.util.Map; import java.util.Objects; -import java.util.TreeMap; /** * @author dziemke, nkuehnel @@ -74,18 +53,14 @@ public final class MatsimTransportModel implements TransportModel { private final MatsimData matsimData; private final MatsimTravelTimes internalTravelTimes; - private Scenario scenario; private final DataContainer dataContainer; - private ActivityFacilities zoneRepresentativeCoords; - private MatsimAccessibility accessibility; - private MatsimScenarioAssembler scenarioAssembler; public MatsimTransportModel(DataContainer dataContainer, Config matsimConfig, - Properties properties, MatsimAccessibility accessibility, - ZoneConnectorManager.ZoneConnectorMethod method, MatsimScenarioAssembler scenarioAssembler) { + Properties properties, MatsimScenarioAssembler scenarioAssembler, + MatsimData matsimData) { this.dataContainer = Objects.requireNonNull(dataContainer); this.initialMatsimConfig = Objects.requireNonNull(matsimConfig, "No initial matsim config provided to SiloModel class!"); @@ -96,32 +71,15 @@ public MatsimTransportModel(DataContainer dataContainer, Config matsimConfig, } else { this.internalTravelTimes = new MatsimTravelTimes(matsimConfig); } - this.matsimData = new MatsimData(matsimConfig, properties, method, dataContainer); + this.matsimData = matsimData; this.scenarioAssembler = scenarioAssembler; - this.properties = properties; - this.accessibility = accessibility; } @Override public void setup() { - scenario = ScenarioUtils.loadScenario(initialMatsimConfig); - Network network = scenario.getNetwork(); internalTravelTimes.initialize(dataContainer.getGeoData(), matsimData); - logger.warn("Finding coordinates that represent a given zone."); - zoneRepresentativeCoords = FacilitiesUtils.createActivityFacilities(); - ActivityFacilitiesFactory aff = new ActivityFacilitiesFactoryImpl(); - Map zoneMap = dataContainer.getGeoData().getZones(); - for (int zoneId : zoneMap.keySet()) { - Geometry geometry = (Geometry) zoneMap.get(zoneId).getZoneFeature().getDefaultGeometry(); - Coord centroid = CoordUtils.createCoord(geometry.getCentroid().getX(), geometry.getCentroid().getY()); - Node nearestNode = NetworkUtils.getNearestNode(network, centroid); // TODO choose road of certain category - Coord coord = CoordUtils.createCoord(nearestNode.getCoord().getX(), nearestNode.getCoord().getY()); - ActivityFacility activityFacility = aff.createActivityFacility(Id.create(zoneId, ActivityFacility.class), coord); - zoneRepresentativeCoords.addActivityFacility(activityFacility); - } - if (properties.transportModel.matsimInitialEventsFile == null) { runTransportModel(properties.main.startYear); } else { @@ -163,10 +121,6 @@ private void runTransportModel(int year) { final Controler controler = new Controler(assembledScenario); - if (accessibility != null) { - setupAccessibility(assembledScenario, controler); - } - controler.run(); logger.warn("Running MATSim transport model for year " + year + " finished."); @@ -190,61 +144,6 @@ private void finalizeConfig(Config config, int year) { config.vspExperimental().setWritingOutputEvents(true); } - private void setupAccessibility(Scenario scenario, Controler controler) { - // Opportunities - Map populationMap = HouseholdUtil.getPopulationByZoneAsMap(dataContainer); - Map, Integer> zonePopulationMap = new TreeMap<>(); - for (int zoneId : populationMap.keySet()) { - zonePopulationMap.put(Id.create(zoneId, ActivityFacility.class), populationMap.get(zoneId)); - } - final ActivityFacilities opportunities = scenario.getActivityFacilities(); - int i = 0; - for (ActivityFacility activityFacility : zoneRepresentativeCoords.getFacilities().values()) { - activityFacility.getAttributes().putAttribute(AccessibilityAttributes.WEIGHT, zonePopulationMap.get(activityFacility.getId())); - opportunities.addActivityFacility(activityFacility); - i++; - } - logger.warn(i + " facilities added as opportunities."); - - SiloMatsimUtils.determineExtentOfFacilities(zoneRepresentativeCoords); - - scenario.getConfig().facilities().setFacilitiesSource(FacilitiesConfigGroup.FacilitiesSource.setInScenario); - // End opportunities - - // Accessibility settings - AccessibilityConfigGroup acg = ConfigUtils.addOrGetModule(scenario.getConfig(), AccessibilityConfigGroup.class); - acg.setMeasuringPointsFacilities(zoneRepresentativeCoords); - // - Map, Geometry> measurePointGeometryMap = new TreeMap<>(); - Map zoneFeatureMap = new HashMap<>(); - for (Zone zone : dataContainer.getGeoData().getZones().values()) { - zoneFeatureMap.put(zone.getId(), zone.getZoneFeature()); - } - - for (Integer zoneId : zoneFeatureMap.keySet()) { - SimpleFeature feature = zoneFeatureMap.get(zoneId); - Geometry geometry = (Geometry) feature.getDefaultGeometry(); - measurePointGeometryMap.put(Id.create(zoneId, ActivityFacility.class), geometry); - } - acg.setMeasurePointGeometryProvision(AccessibilityConfigGroup.MeasurePointGeometryProvision.fromShapeFile); - acg.setMeasurePointGeometryMap(measurePointGeometryMap); - - acg.setTileSize_m(1000); // TODO This is only a dummy value here - // - acg.setAreaOfAccessibilityComputation(AccessibilityConfigGroup.AreaOfAccesssibilityComputation.fromFacilitiesObject); - acg.setUseOpportunityWeights(true); - acg.setWeightExponent(Properties.get().accessibility.alphaAuto); // TODO Need differentiation for different modes - logger.warn("Properties.get().accessibility.alphaAuto = " + Properties.get().accessibility.alphaAuto); - acg.setAccessibilityMeasureType(AccessibilityConfigGroup.AccessibilityMeasureType.rawSum); - // End accessibility settings - // Accessibility module - - AccessibilityModule module = new AccessibilityModule(); - module.addFacilityDataExchangeListener(accessibility); - controler.addOverridingModule(module); - // End accessibility module - } - /** * @param eventsFile */ @@ -252,21 +151,11 @@ private void replayFromEvents(String eventsFile) { Scenario scenario = ScenarioUtils.loadScenario(initialMatsimConfig); TravelTime travelTime = TravelTimeUtils.createTravelTimesFromEvents(scenario, eventsFile); TravelDisutility travelDisutility = ControlerDefaults.createDefaultTravelDisutilityFactory(scenario).createTravelDisutility(travelTime); - TripRouterFactoryBuilderWithDefaults builder = new TripRouterFactoryBuilderWithDefaults(); - builder.setLeastCostPathCalculatorFactory(new FastAStarLandmarksFactory(properties.main.numberOfThreads)); - builder.setTravelTime(travelTime); - builder.setTravelDisutility(travelDisutility); updateTravelTimes(travelTime, travelDisutility); } - private void updateTravelTimes(TravelTime travelTime, TravelDisutility disutility) { - Network network = scenario.getNetwork(); - TransitSchedule schedule = null; - if (scenario.getConfig().transit().isUseTransit()) { - schedule = scenario.getTransitSchedule(); - } - matsimData.update(network, schedule, disutility, travelTime); + matsimData.update(disutility, travelTime); internalTravelTimes.update(matsimData); final TravelTimes mainTravelTimes = dataContainer.getTravelTimes(); @@ -279,5 +168,4 @@ private void updateTravelTimes(TravelTime travelTime, TravelDisutility disutilit dataContainer.getGeoData().getZones().values()); } } - } diff --git a/extensions/matsim2silo/src/main/java/de/tum/bgu/msm/matsim/accessibility/AccessibilityModule.java b/extensions/matsim2silo/src/main/java/de/tum/bgu/msm/matsim/accessibility/AccessibilityModule.java new file mode 100644 index 000000000..d33d120ab --- /dev/null +++ b/extensions/matsim2silo/src/main/java/de/tum/bgu/msm/matsim/accessibility/AccessibilityModule.java @@ -0,0 +1,115 @@ +package de.tum.bgu.msm.matsim.accessibility; + +import de.tum.bgu.msm.container.DataContainer; +import de.tum.bgu.msm.data.Zone; +import de.tum.bgu.msm.data.household.HouseholdUtil; +import de.tum.bgu.msm.matsim.MatsimData; +import de.tum.bgu.msm.matsim.SiloMatsimUtils; +import de.tum.bgu.msm.properties.Properties; +import org.apache.log4j.Logger; +import org.locationtech.jts.geom.Geometry; +import org.matsim.api.core.v01.Coord; +import org.matsim.api.core.v01.Id; +import org.matsim.api.core.v01.Scenario; +import org.matsim.api.core.v01.network.Network; +import org.matsim.api.core.v01.network.Node; +import org.matsim.contrib.accessibility.AccessibilityAttributes; +import org.matsim.contrib.accessibility.AccessibilityConfigGroup; +import org.matsim.contrib.accessibility.interfaces.FacilityDataExchangeInterface; +import org.matsim.core.config.ConfigUtils; +import org.matsim.core.config.groups.FacilitiesConfigGroup; +import org.matsim.core.controler.Controler; +import org.matsim.core.network.NetworkUtils; +import org.matsim.core.utils.geometry.CoordUtils; +import org.matsim.facilities.*; +import org.opengis.feature.simple.SimpleFeature; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +public class AccessibilityModule { + + private static final Logger logger = Logger.getLogger(AccessibilityModule.class); + private final MatsimData data; + private final DataContainer dataContainer; + + private ActivityFacilities zoneRepresentativeCoords; + + public AccessibilityModule(MatsimData data, DataContainer dataContainer) { + this.data = data; + this.dataContainer = dataContainer; + } + + public void setup() { + + logger.warn("Finding coordinates that represent a given zone."); + zoneRepresentativeCoords = FacilitiesUtils.createActivityFacilities(); + ActivityFacilitiesFactory aff = new ActivityFacilitiesFactoryImpl(); + Map zoneMap = dataContainer.getGeoData().getZones(); + Network network = data.getCarNetwork(); + for (int zoneId : zoneMap.keySet()) { + Geometry geometry = (Geometry) zoneMap.get(zoneId).getZoneFeature().getDefaultGeometry(); + Coord centroid = CoordUtils.createCoord(geometry.getCentroid().getX(), geometry.getCentroid().getY()); + Node nearestNode = NetworkUtils.getNearestNode(network, centroid); // TODO choose road of certain category + Coord coord = CoordUtils.createCoord(nearestNode.getCoord().getX(), nearestNode.getCoord().getY()); + ActivityFacility activityFacility = aff.createActivityFacility(Id.create(zoneId, ActivityFacility.class), coord); + zoneRepresentativeCoords.addActivityFacility(activityFacility); + } + } + + public void prepareAccessibility(Scenario scenario, Controler controler) { + // Opportunities + Map populationMap = HouseholdUtil.getPopulationByZoneAsMap(dataContainer); + Map, Integer> zonePopulationMap = new TreeMap<>(); + for (int zoneId : populationMap.keySet()) { + zonePopulationMap.put(Id.create(zoneId, ActivityFacility.class), populationMap.get(zoneId)); + } + final ActivityFacilities opportunities = scenario.getActivityFacilities(); + int i = 0; + for (ActivityFacility activityFacility : zoneRepresentativeCoords.getFacilities().values()) { + activityFacility.getAttributes().putAttribute(AccessibilityAttributes.WEIGHT, zonePopulationMap.get(activityFacility.getId())); + opportunities.addActivityFacility(activityFacility); + i++; + } + logger.warn(i + " facilities added as opportunities."); + + SiloMatsimUtils.determineExtentOfFacilities(zoneRepresentativeCoords); + + scenario.getConfig().facilities().setFacilitiesSource(FacilitiesConfigGroup.FacilitiesSource.setInScenario); + // End opportunities + + // Accessibility settings + AccessibilityConfigGroup acg = ConfigUtils.addOrGetModule(scenario.getConfig(), AccessibilityConfigGroup.class); + acg.setMeasuringPointsFacilities(zoneRepresentativeCoords); + // + Map, Geometry> measurePointGeometryMap = new TreeMap<>(); + Map zoneFeatureMap = new HashMap<>(); + for (Zone zone : dataContainer.getGeoData().getZones().values()) { + zoneFeatureMap.put(zone.getId(), zone.getZoneFeature()); + } + + for (Integer zoneId : zoneFeatureMap.keySet()) { + SimpleFeature feature = zoneFeatureMap.get(zoneId); + Geometry geometry = (Geometry) feature.getDefaultGeometry(); + measurePointGeometryMap.put(Id.create(zoneId, ActivityFacility.class), geometry); + } + acg.setMeasurePointGeometryProvision(AccessibilityConfigGroup.MeasurePointGeometryProvision.fromShapeFile); + acg.setMeasurePointGeometryMap(measurePointGeometryMap); + + acg.setTileSize_m(1000); // TODO This is only a dummy value here + // + acg.setAreaOfAccessibilityComputation(AccessibilityConfigGroup.AreaOfAccesssibilityComputation.fromFacilitiesObject); + acg.setUseOpportunityWeights(true); + acg.setWeightExponent(Properties.get().accessibility.alphaAuto); // TODO Need differentiation for different modes + logger.warn("Properties.get().accessibility.alphaAuto = " + Properties.get().accessibility.alphaAuto); + acg.setAccessibilityMeasureType(AccessibilityConfigGroup.AccessibilityMeasureType.rawSum); + // End accessibility settings + // Accessibility module + + org.matsim.contrib.accessibility.AccessibilityModule module = new org.matsim.contrib.accessibility.AccessibilityModule(); + module.addFacilityDataExchangeListener((FacilityDataExchangeInterface) dataContainer.getAccessibility()); + controler.addOverridingModule(module); + // End accessibility module + } +} diff --git a/siloCore/src/main/java/de/tum/bgu/msm/data/accessibility/MatsimAccessibility.java b/extensions/matsim2silo/src/main/java/de/tum/bgu/msm/matsim/accessibility/MatsimAccessibility.java similarity index 97% rename from siloCore/src/main/java/de/tum/bgu/msm/data/accessibility/MatsimAccessibility.java rename to extensions/matsim2silo/src/main/java/de/tum/bgu/msm/matsim/accessibility/MatsimAccessibility.java index 5d13fe1ac..e2b9c54fa 100644 --- a/siloCore/src/main/java/de/tum/bgu/msm/data/accessibility/MatsimAccessibility.java +++ b/extensions/matsim2silo/src/main/java/de/tum/bgu/msm/matsim/accessibility/MatsimAccessibility.java @@ -1,9 +1,10 @@ -package de.tum.bgu.msm.data.accessibility; +package de.tum.bgu.msm.matsim.accessibility; import java.util.Collection; import java.util.HashMap; import java.util.Map; +import de.tum.bgu.msm.data.accessibility.Accessibility; import org.apache.log4j.Logger; import org.jfree.util.Log; import org.matsim.api.core.v01.Id; diff --git a/extensions/matsim2silo/src/test/java/de/tum/bgu/msm/matsim/RegionalTravelTimesTest.java b/extensions/matsim2silo/src/test/java/de/tum/bgu/msm/matsim/RegionalTravelTimesTest.java index f5601088b..6b059949f 100644 --- a/extensions/matsim2silo/src/test/java/de/tum/bgu/msm/matsim/RegionalTravelTimesTest.java +++ b/extensions/matsim2silo/src/test/java/de/tum/bgu/msm/matsim/RegionalTravelTimesTest.java @@ -67,10 +67,10 @@ public void testRegionalTravelTimesWithMatsim() { MatsimTravelTimes travelTimes = new MatsimTravelTimes(config); DefaultDataContainer dataContainer = new DefaultDataContainer(geoData, null, null, null, travelTimes, null, null, properties); - final MatsimData matsimData = new MatsimData(config, properties, ZoneConnectorManager.ZoneConnectorMethod.RANDOM, dataContainer); final Network network = getNetwork(); + final MatsimData matsimData = new MatsimData(config, properties, ZoneConnectorManager.ZoneConnectorMethod.RANDOM, dataContainer, network, null); - matsimData.update(network, null, new TravelDisutility() { + matsimData.update(new TravelDisutility() { @Override public double getLinkTravelDisutility(Link link, double v, Person person, Vehicle vehicle) { return link.getLength(); @@ -122,7 +122,7 @@ private Network getNetwork() { final Link link = factory.createLink(Id.createLinkId(i), network.getNodes().get(Id.createNodeId(i - 1)), network.getNodes().get(Id.createNodeId(i))); - final Link linkR = factory.createLink(Id.createLinkId(i+"r"), + final Link linkR = factory.createLink(Id.createLinkId(i + "r"), network.getNodes().get(Id.createNodeId(i)), network.getNodes().get(Id.createNodeId(i - 1))); network.addLink(link); diff --git a/useCases/capeTown/src/main/java/de/tum/bgu/msm/run/ModelBuilderCapeTown.java b/useCases/capeTown/src/main/java/de/tum/bgu/msm/run/ModelBuilderCapeTown.java index 7ea2341f5..1938c08e2 100644 --- a/useCases/capeTown/src/main/java/de/tum/bgu/msm/run/ModelBuilderCapeTown.java +++ b/useCases/capeTown/src/main/java/de/tum/bgu/msm/run/ModelBuilderCapeTown.java @@ -5,6 +5,7 @@ import de.tum.bgu.msm.data.dwelling.DwellingFactory; import de.tum.bgu.msm.data.household.HouseholdFactory; import de.tum.bgu.msm.data.person.PersonFactory; +import de.tum.bgu.msm.matsim.MatsimData; import de.tum.bgu.msm.matsim.MatsimTransportModel; import de.tum.bgu.msm.matsim.SimpleMatsimScenarioAssembler; import de.tum.bgu.msm.matsim.ZoneConnectorManager; @@ -56,7 +57,9 @@ import de.tum.bgu.msm.models.transportModel.TransportModel; import de.tum.bgu.msm.properties.Properties; import de.tum.bgu.msm.utils.SiloUtil; +import org.matsim.api.core.v01.Scenario; import org.matsim.core.config.Config; +import org.matsim.core.scenario.ScenarioUtils; public class ModelBuilderCapeTown { @@ -119,11 +122,16 @@ dataContainer, properties, new DefaultMovesStrategy(), TransportModel transportModel; + switch (properties.transportModel.transportModelIdentifier) { case MATSIM: - transportModel = new MatsimTransportModel(dataContainer, config, properties, null, - ZoneConnectorManager.ZoneConnectorMethod.RANDOM, - new SimpleMatsimScenarioAssembler(dataContainer, properties)); + MatsimData matsimData = null; + if (config != null) { + final Scenario scenario = ScenarioUtils.loadScenario(config); + matsimData = new MatsimData(config, properties, ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, dataContainer, scenario.getNetwork(), scenario.getTransitSchedule()); + } + transportModel = new MatsimTransportModel(dataContainer, config, properties, + new SimpleMatsimScenarioAssembler(dataContainer, properties), matsimData); // (MatsimAccessibility) dataContainer.getAccessibility()); break; case NONE: diff --git a/useCases/kagawa/src/main/java/de/tum/bgu/msm/run/ModelBuilderTak.java b/useCases/kagawa/src/main/java/de/tum/bgu/msm/run/ModelBuilderTak.java index e9a1914b5..b02820200 100644 --- a/useCases/kagawa/src/main/java/de/tum/bgu/msm/run/ModelBuilderTak.java +++ b/useCases/kagawa/src/main/java/de/tum/bgu/msm/run/ModelBuilderTak.java @@ -5,10 +5,7 @@ import de.tum.bgu.msm.data.dwelling.DwellingFactory; import de.tum.bgu.msm.data.household.HouseholdFactory; import de.tum.bgu.msm.data.person.PersonFactory; -import de.tum.bgu.msm.matsim.MatsimScenarioAssembler; -import de.tum.bgu.msm.matsim.MatsimTransportModel; -import de.tum.bgu.msm.matsim.SimpleMatsimScenarioAssembler; -import de.tum.bgu.msm.matsim.ZoneConnectorManager; +import de.tum.bgu.msm.matsim.*; import de.tum.bgu.msm.mito.MitoMatsimScenarioAssembler; import de.tum.bgu.msm.models.autoOwnership.CreateCarOwnershipModel; import de.tum.bgu.msm.models.carOwnership.CreateCarOwnershipTak; @@ -55,7 +52,9 @@ import de.tum.bgu.msm.models.transportModel.TransportModel; import de.tum.bgu.msm.properties.Properties; import de.tum.bgu.msm.utils.SiloUtil; +import org.matsim.api.core.v01.Scenario; import org.matsim.core.config.Config; +import org.matsim.core.scenario.ScenarioUtils; public class ModelBuilderTak { public static ModelContainer getTakModels(DataContainer dataContainer, Properties properties, Config config) { @@ -115,16 +114,19 @@ dataContainer, properties, new DefaultMovesStrategy(), TransportModel transportModel; MatsimScenarioAssembler scenarioAssembler; + MatsimData matsimData = null; + if (config != null) { + final Scenario scenario = ScenarioUtils.loadScenario(config); + matsimData = new MatsimData(config, properties, ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, dataContainer, scenario.getNetwork(), scenario.getTransitSchedule()); + } switch (properties.transportModel.transportModelIdentifier) { case MITO_MATSIM: scenarioAssembler = new MitoMatsimScenarioAssembler(dataContainer, properties, new MitoDataConverterTak()); - transportModel = new MatsimTransportModel(dataContainer, config, properties, null, - ZoneConnectorManager.ZoneConnectorMethod.RANDOM, scenarioAssembler); + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case MATSIM: scenarioAssembler = new SimpleMatsimScenarioAssembler(dataContainer, properties); - transportModel = new MatsimTransportModel(dataContainer, config, properties, null, - ZoneConnectorManager.ZoneConnectorMethod.RANDOM, scenarioAssembler); + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case NONE: default: diff --git a/useCases/kagawa/src/main/java/de/tum/bgu/msm/scenarios/longCommutePenalty/LongCommutePenaltyModelBuilderTak.java b/useCases/kagawa/src/main/java/de/tum/bgu/msm/scenarios/longCommutePenalty/LongCommutePenaltyModelBuilderTak.java index d055edcf8..d13a837b8 100644 --- a/useCases/kagawa/src/main/java/de/tum/bgu/msm/scenarios/longCommutePenalty/LongCommutePenaltyModelBuilderTak.java +++ b/useCases/kagawa/src/main/java/de/tum/bgu/msm/scenarios/longCommutePenalty/LongCommutePenaltyModelBuilderTak.java @@ -5,10 +5,7 @@ import de.tum.bgu.msm.data.dwelling.DwellingFactory; import de.tum.bgu.msm.data.household.HouseholdFactory; import de.tum.bgu.msm.data.person.PersonFactory; -import de.tum.bgu.msm.matsim.MatsimScenarioAssembler; -import de.tum.bgu.msm.matsim.MatsimTransportModel; -import de.tum.bgu.msm.matsim.SimpleMatsimScenarioAssembler; -import de.tum.bgu.msm.matsim.ZoneConnectorManager; +import de.tum.bgu.msm.matsim.*; import de.tum.bgu.msm.mito.MitoMatsimScenarioAssembler; import de.tum.bgu.msm.models.autoOwnership.CreateCarOwnershipModel; import de.tum.bgu.msm.models.carOwnership.CreateCarOwnershipStrategyTakImpl; @@ -56,7 +53,9 @@ import de.tum.bgu.msm.properties.Properties; import de.tum.bgu.msm.scenarios.oneCarPolicy.OneCarPolicyCarOwnerTak; import de.tum.bgu.msm.utils.SiloUtil; +import org.matsim.api.core.v01.Scenario; import org.matsim.core.config.Config; +import org.matsim.core.scenario.ScenarioUtils; public class LongCommutePenaltyModelBuilderTak { @@ -116,16 +115,19 @@ dataContainer, properties, new DefaultMovesStrategy(), TransportModel transportModel; MatsimScenarioAssembler scenarioAssembler; + MatsimData matsimData = null; + if (config != null) { + final Scenario scenario = ScenarioUtils.loadScenario(config); + matsimData = new MatsimData(config, properties, ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, dataContainer, scenario.getNetwork(), scenario.getTransitSchedule()); + } switch (properties.transportModel.transportModelIdentifier) { case MITO_MATSIM: scenarioAssembler = new MitoMatsimScenarioAssembler(dataContainer, properties, new MitoDataConverterTak()); - transportModel = new MatsimTransportModel(dataContainer, config, properties, null, - ZoneConnectorManager.ZoneConnectorMethod.RANDOM, scenarioAssembler); + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case MATSIM: scenarioAssembler = new SimpleMatsimScenarioAssembler(dataContainer, properties); - transportModel = new MatsimTransportModel(dataContainer, config, properties, null, - ZoneConnectorManager.ZoneConnectorMethod.RANDOM, scenarioAssembler); + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case NONE: default: diff --git a/useCases/kagawa/src/main/java/de/tum/bgu/msm/scenarios/oneCarPolicy/OneCarPolicyModelBuilderTak.java b/useCases/kagawa/src/main/java/de/tum/bgu/msm/scenarios/oneCarPolicy/OneCarPolicyModelBuilderTak.java index 5b9e773b2..bbac1c0c3 100644 --- a/useCases/kagawa/src/main/java/de/tum/bgu/msm/scenarios/oneCarPolicy/OneCarPolicyModelBuilderTak.java +++ b/useCases/kagawa/src/main/java/de/tum/bgu/msm/scenarios/oneCarPolicy/OneCarPolicyModelBuilderTak.java @@ -5,10 +5,7 @@ import de.tum.bgu.msm.data.dwelling.DwellingFactory; import de.tum.bgu.msm.data.household.HouseholdFactory; import de.tum.bgu.msm.data.person.PersonFactory; -import de.tum.bgu.msm.matsim.MatsimScenarioAssembler; -import de.tum.bgu.msm.matsim.MatsimTransportModel; -import de.tum.bgu.msm.matsim.SimpleMatsimScenarioAssembler; -import de.tum.bgu.msm.matsim.ZoneConnectorManager; +import de.tum.bgu.msm.matsim.*; import de.tum.bgu.msm.mito.MitoMatsimScenarioAssembler; import de.tum.bgu.msm.models.autoOwnership.CreateCarOwnershipModel; import de.tum.bgu.msm.models.carOwnership.CreateCarOwnershipStrategyTakImpl; @@ -54,7 +51,9 @@ import de.tum.bgu.msm.models.transportModel.TransportModel; import de.tum.bgu.msm.properties.Properties; import de.tum.bgu.msm.utils.SiloUtil; +import org.matsim.api.core.v01.Scenario; import org.matsim.core.config.Config; +import org.matsim.core.scenario.ScenarioUtils; public class OneCarPolicyModelBuilderTak { public static ModelContainer getTakModels(DataContainer dataContainer, Properties properties, Config config) { @@ -114,16 +113,19 @@ dataContainer, properties, new DefaultMovesStrategy(), TransportModel transportModel; MatsimScenarioAssembler scenarioAssembler; + MatsimData matsimData = null; + if (config != null) { + final Scenario scenario = ScenarioUtils.loadScenario(config); + matsimData = new MatsimData(config, properties, ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, dataContainer, scenario.getNetwork(), scenario.getTransitSchedule()); + } switch (properties.transportModel.transportModelIdentifier) { case MITO_MATSIM: scenarioAssembler = new MitoMatsimScenarioAssembler(dataContainer, properties, new MitoDataConverterTak()); - transportModel = new MatsimTransportModel(dataContainer, config, properties, null, - ZoneConnectorManager.ZoneConnectorMethod.RANDOM, scenarioAssembler); + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case MATSIM: scenarioAssembler = new SimpleMatsimScenarioAssembler(dataContainer, properties); - transportModel = new MatsimTransportModel(dataContainer, config, properties, null, - ZoneConnectorManager.ZoneConnectorMethod.RANDOM, scenarioAssembler); + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case NONE: default: diff --git a/useCases/maryland/src/main/java/de/tum/bgu/msm/run/ModelBuilderMstm.java b/useCases/maryland/src/main/java/de/tum/bgu/msm/run/ModelBuilderMstm.java index b36b4fe57..762f1021c 100644 --- a/useCases/maryland/src/main/java/de/tum/bgu/msm/run/ModelBuilderMstm.java +++ b/useCases/maryland/src/main/java/de/tum/bgu/msm/run/ModelBuilderMstm.java @@ -5,6 +5,7 @@ import de.tum.bgu.msm.data.dwelling.DwellingFactory; import de.tum.bgu.msm.data.household.HouseholdFactory; import de.tum.bgu.msm.data.person.PersonFactory; +import de.tum.bgu.msm.matsim.MatsimData; import de.tum.bgu.msm.matsim.MatsimTransportModel; import de.tum.bgu.msm.matsim.SimpleMatsimScenarioAssembler; import de.tum.bgu.msm.matsim.ZoneConnectorManager; @@ -53,7 +54,9 @@ import de.tum.bgu.msm.properties.Properties; import de.tum.bgu.msm.utils.SiloUtil; import org.apache.log4j.Logger; +import org.matsim.api.core.v01.Scenario; import org.matsim.core.config.Config; +import org.matsim.core.scenario.ScenarioUtils; public class ModelBuilderMstm { @@ -124,10 +127,13 @@ public static ModelContainer getModelContainerForMstm(DataContainer dataContaine case MITO_MATSIM: logger.warn("Mito not implemented for Mstm. Defaulting to simple matsim transport model"); case MATSIM: + MatsimData matsimData = null; + if (config != null) { + final Scenario scenario = ScenarioUtils.loadScenario(config); + matsimData = new MatsimData(config, properties, ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, dataContainer, scenario.getNetwork(), scenario.getTransitSchedule()); + } final SimpleMatsimScenarioAssembler scenarioAssembler = new SimpleMatsimScenarioAssembler(dataContainer, properties); - transportModel = new MatsimTransportModel(dataContainer, config, properties, - null, - ZoneConnectorManager.ZoneConnectorMethod.RANDOM, scenarioAssembler); + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case NONE: default: diff --git a/useCases/munich/src/main/java/de/tum/bgu/msm/ModelBuilderMuc.java b/useCases/munich/src/main/java/de/tum/bgu/msm/ModelBuilderMuc.java index 8974ca80c..a59aefd65 100644 --- a/useCases/munich/src/main/java/de/tum/bgu/msm/ModelBuilderMuc.java +++ b/useCases/munich/src/main/java/de/tum/bgu/msm/ModelBuilderMuc.java @@ -60,7 +60,9 @@ import de.tum.bgu.msm.models.transportModel.TransportModel; import de.tum.bgu.msm.properties.Properties; import de.tum.bgu.msm.utils.SiloUtil; +import org.matsim.api.core.v01.Scenario; import org.matsim.core.config.Config; +import org.matsim.core.scenario.ScenarioUtils; public class ModelBuilderMuc { @@ -123,17 +125,22 @@ public static ModelContainer getModelContainerForMuc(DataContainerWithSchools da TransportModel transportModel; MatsimScenarioAssembler scenarioAssembler; + + + MatsimData matsimData = null; + if (config != null) { + final Scenario scenario = ScenarioUtils.loadScenario(config); + matsimData = new MatsimData(config, properties, ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, dataContainer, scenario.getNetwork(), scenario.getTransitSchedule()); + } switch (properties.transportModel.transportModelIdentifier) { case MITO_MATSIM: scenarioAssembler = new MitoMatsimScenarioAssembler(dataContainer, properties, new MitoDataConverterMuc()); - transportModel = new MatsimTransportModel(dataContainer, config, properties, null, - ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, scenarioAssembler); + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case MATSIM: SimpleCommuteModeChoice commuteModeChoice = new SimpleCommuteModeChoice(dataContainer, properties, SiloUtil.provideNewRandom()); scenarioAssembler = new SimpleCommuteModeChoiceMatsimScenarioAssembler(dataContainer, properties, commuteModeChoice); - transportModel = new MatsimTransportModel(dataContainer, config, properties, null, - ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, scenarioAssembler); + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case NONE: default: diff --git a/useCases/munich/src/main/java/de/tum/bgu/msm/scenarios/av/ModelBuilderMucAv.java b/useCases/munich/src/main/java/de/tum/bgu/msm/scenarios/av/ModelBuilderMucAv.java index 9150ca3f9..972bb745c 100644 --- a/useCases/munich/src/main/java/de/tum/bgu/msm/scenarios/av/ModelBuilderMucAv.java +++ b/useCases/munich/src/main/java/de/tum/bgu/msm/scenarios/av/ModelBuilderMucAv.java @@ -62,7 +62,9 @@ import de.tum.bgu.msm.properties.Properties; import de.tum.bgu.msm.schools.DataContainerWithSchools; import de.tum.bgu.msm.utils.SiloUtil; +import org.matsim.api.core.v01.Scenario; import org.matsim.core.config.Config; +import org.matsim.core.scenario.ScenarioUtils; public class ModelBuilderMucAv { @@ -125,17 +127,20 @@ public static ModelContainer getModelContainerAvForMuc(DataContainerWithSchools TransportModel transportModel; MatsimScenarioAssembler scenarioAssembler; + MatsimData matsimData = null; + if (config != null) { + final Scenario scenario = ScenarioUtils.loadScenario(config); + matsimData = new MatsimData(config, properties, ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, dataContainer, scenario.getNetwork(), scenario.getTransitSchedule()); + } switch (properties.transportModel.transportModelIdentifier) { case MITO_MATSIM: scenarioAssembler = new MitoMatsimScenarioAssembler(dataContainer, properties, new MitoDataConverterMuc()); - transportModel = new MatsimTransportModel(dataContainer, config, properties, null, - ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, scenarioAssembler); + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case MATSIM: CommuteModeChoice commuteModeChoice = new SimpleCommuteModeChoice(dataContainer, properties, SiloUtil.provideNewRandom()); scenarioAssembler = new SimpleCommuteModeChoiceMatsimScenarioAssembler(dataContainer, properties, commuteModeChoice); - transportModel = new MatsimTransportModel(dataContainer, config, properties, null, - ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, scenarioAssembler); + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case NONE: default: diff --git a/useCases/munich/src/main/java/de/tum/bgu/msm/scenarios/longCommutePenalty/LongCommutePenaltyModelBuilderMuc.java b/useCases/munich/src/main/java/de/tum/bgu/msm/scenarios/longCommutePenalty/LongCommutePenaltyModelBuilderMuc.java index 0abc0304c..185b3d185 100644 --- a/useCases/munich/src/main/java/de/tum/bgu/msm/scenarios/longCommutePenalty/LongCommutePenaltyModelBuilderMuc.java +++ b/useCases/munich/src/main/java/de/tum/bgu/msm/scenarios/longCommutePenalty/LongCommutePenaltyModelBuilderMuc.java @@ -61,7 +61,9 @@ import de.tum.bgu.msm.properties.Properties; import de.tum.bgu.msm.schools.DataContainerWithSchools; import de.tum.bgu.msm.utils.SiloUtil; +import org.matsim.api.core.v01.Scenario; import org.matsim.core.config.Config; +import org.matsim.core.scenario.ScenarioUtils; public class LongCommutePenaltyModelBuilderMuc { @@ -124,17 +126,20 @@ public static ModelContainer getModelContainerForMuc(DataContainerWithSchools da TransportModel transportModel; MatsimScenarioAssembler scenarioAssembler; + MatsimData matsimData = null; + if (config != null) { + final Scenario scenario = ScenarioUtils.loadScenario(config); + matsimData = new MatsimData(config, properties, ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, dataContainer, scenario.getNetwork(), scenario.getTransitSchedule()); + } switch (properties.transportModel.transportModelIdentifier) { case MITO_MATSIM: scenarioAssembler = new MitoMatsimScenarioAssembler(dataContainer, properties, new MitoDataConverterMuc()); - transportModel = new MatsimTransportModel(dataContainer, config, properties, null, - ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, scenarioAssembler); + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case MATSIM: CommuteModeChoice commuteModeChoice = new SimpleCommuteModeChoice(dataContainer, properties, SiloUtil.provideNewRandom()); scenarioAssembler = new SimpleCommuteModeChoiceMatsimScenarioAssembler(dataContainer, properties, commuteModeChoice); - transportModel = new MatsimTransportModel(dataContainer, config, properties, null, - ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, scenarioAssembler); + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case NONE: default: diff --git a/useCases/munich/src/main/java/de/tum/bgu/msm/scenarios/oneCarPolicy/OneCarPolicyModelBuilderMuc.java b/useCases/munich/src/main/java/de/tum/bgu/msm/scenarios/oneCarPolicy/OneCarPolicyModelBuilderMuc.java index bbc3bb497..4b6641057 100644 --- a/useCases/munich/src/main/java/de/tum/bgu/msm/scenarios/oneCarPolicy/OneCarPolicyModelBuilderMuc.java +++ b/useCases/munich/src/main/java/de/tum/bgu/msm/scenarios/oneCarPolicy/OneCarPolicyModelBuilderMuc.java @@ -60,7 +60,9 @@ import de.tum.bgu.msm.properties.Properties; import de.tum.bgu.msm.schools.DataContainerWithSchools; import de.tum.bgu.msm.utils.SiloUtil; +import org.matsim.api.core.v01.Scenario; import org.matsim.core.config.Config; +import org.matsim.core.scenario.ScenarioUtils; public class OneCarPolicyModelBuilderMuc { @@ -123,17 +125,20 @@ public static ModelContainer getModelContainerForMuc(DataContainerWithSchools da TransportModel transportModel; MatsimScenarioAssembler scenarioAssembler; + MatsimData matsimData = null; + if (config != null) { + final Scenario scenario = ScenarioUtils.loadScenario(config); + matsimData = new MatsimData(config, properties, ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, dataContainer, scenario.getNetwork(), scenario.getTransitSchedule()); + } switch (properties.transportModel.transportModelIdentifier) { case MITO_MATSIM: scenarioAssembler = new MitoMatsimScenarioAssembler(dataContainer, properties, new MitoDataConverterMuc()); - transportModel = new MatsimTransportModel(dataContainer, config, properties, null, - ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, scenarioAssembler); + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case MATSIM: CommuteModeChoice commuteModeChoice = new SimpleCommuteModeChoice(dataContainer, properties, SiloUtil.provideNewRandom()); scenarioAssembler = new SimpleCommuteModeChoiceMatsimScenarioAssembler(dataContainer, properties, commuteModeChoice); - transportModel = new MatsimTransportModel(dataContainer, config, properties, null, - ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, scenarioAssembler); + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case NONE: default: diff --git a/useCases/perth/src/main/java/run/ModelBuilderPerth.java b/useCases/perth/src/main/java/run/ModelBuilderPerth.java index 827037345..908eed012 100644 --- a/useCases/perth/src/main/java/run/ModelBuilderPerth.java +++ b/useCases/perth/src/main/java/run/ModelBuilderPerth.java @@ -2,7 +2,8 @@ import de.tum.bgu.msm.container.DataContainer; import de.tum.bgu.msm.container.ModelContainer; -import de.tum.bgu.msm.data.accessibility.MatsimAccessibility; +import de.tum.bgu.msm.matsim.MatsimData; +import de.tum.bgu.msm.matsim.accessibility.MatsimAccessibility; import de.tum.bgu.msm.data.dwelling.DwellingFactory; import de.tum.bgu.msm.data.household.HouseholdFactory; import de.tum.bgu.msm.data.person.PersonFactory; @@ -49,9 +50,9 @@ import de.tum.bgu.msm.properties.Properties; import de.tum.bgu.msm.utils.SiloUtil; import org.apache.log4j.Logger; +import org.matsim.api.core.v01.Scenario; import org.matsim.core.config.Config; - -import java.util.Random; +import org.matsim.core.scenario.ScenarioUtils; public class ModelBuilderPerth { @@ -117,9 +118,12 @@ dataContainer, properties, new DefaultMovesStrategy(), new CarOnlyHousingStrateg logger.warn("Mito not implemented for perth. Defaulting to simple matsim transport model"); case MATSIM: final SimpleMatsimScenarioAssembler scenarioAssembler = new SimpleMatsimScenarioAssembler(dataContainer, properties); - transportModel = new MatsimTransportModel(dataContainer, config, properties, - (MatsimAccessibility) dataContainer.getAccessibility(), - ZoneConnectorManager.ZoneConnectorMethod.RANDOM, scenarioAssembler); + MatsimData matsimData = null; + if (config != null) { + final Scenario scenario = ScenarioUtils.loadScenario(config); + matsimData = new MatsimData(config, properties, ZoneConnectorManager.ZoneConnectorMethod.WEIGHTED_BY_POPULATION, dataContainer, scenario.getNetwork(), scenario.getTransitSchedule()); + }; + transportModel = new MatsimTransportModel(dataContainer, config, properties, scenarioAssembler, matsimData); break; case NONE: default: