From a35df06d1badabd679df42225b8b5ccb40be6e2c Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 29 Aug 2024 11:30:44 +0200 Subject: [PATCH 01/60] update TODOS --- .../GenerateSmallScaleCommercialTrafficDemand.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index af8fbacf479..4b0d227853d 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -94,7 +94,9 @@ * * @author Ricardo Ewert */ -//TODO: use EnumeratedDistribution for distributions with probabilities +//TODO check if service duration is larger than tour duration +//TODO make vehicle selection (see method createCarriers()) configurable in separate class (use interface) +//TODO move generationRates in class TrafficVolumeGeneration in separate class in package data (similar to GetCommercialTourSpecifications) @CommandLine.Command(name = "generate-small-scale-commercial-traffic", description = "Generates plans for a small scale commercial traffic model", showDefaultValues = true) public class GenerateSmallScaleCommercialTrafficDemand implements MATSimAppCommand { // freight traffic from extern: @@ -601,7 +603,7 @@ private void createCarriers(Scenario scenario, TripDistributionMatrix odMatrix, } } } - //TODO make vehcile selection configurable + if (isStartingLocation) { double occupancyRate = 0; String[] possibleVehicleTypes = null; From 97614b5957fc927545988d29a007e218ead27306 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 29 Aug 2024 11:30:58 +0200 Subject: [PATCH 02/60] change service timeWindow --- .../GenerateSmallScaleCommercialTrafficDemand.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 4b0d227853d..7a086badf9d 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -720,8 +720,7 @@ private void createCarriers(Scenario scenario, TripDistributionMatrix odMatrix, else serviceTimePerStop = getServiceTimePerStop(stopDurationTimeSelector, selectedStartCategory, modeORvehType, smallScaleCommercialTrafficType); - TimeWindow serviceTimeWindow = TimeWindow.newInstance(0, - 24 * 3600); //TODO eventuell anpassen wegen veränderter Tourzeiten + TimeWindow serviceTimeWindow = TimeWindow.newInstance(0, 36 * 3600); // extended time window, so that late tours can handle it createServices(scenario, vehicleDepots, selectedStopCategory, carrierName, numberOfJobs, serviceArea, serviceTimePerStop, serviceTimeWindow, linksPerZone); } From 7ce25ffeeff0673f8a8e7588e102f964044c77d8 Mon Sep 17 00:00:00 2001 From: aleks Date: Wed, 4 Sep 2024 10:36:19 +0200 Subject: [PATCH 03/60] Outsourced VehicleSelection and GetGenerationRates --- .../DefaultVehicleSelection.java | 407 +++++++++ ...rateSmallScaleCommercialTrafficDemand.java | 360 +------- .../TrafficVolumeGeneration.java | 858 +----------------- .../VehicleSelection.java | 31 + .../data/GetGenerationRates.java | 856 +++++++++++++++++ 5 files changed, 1323 insertions(+), 1189 deletions(-) create mode 100644 contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java create mode 100644 contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java create mode 100644 contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/data/GetGenerationRates.java diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java new file mode 100644 index 00000000000..d7bb9cded40 --- /dev/null +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java @@ -0,0 +1,407 @@ +package org.matsim.smallScaleCommercialTrafficGeneration; + +import it.unimi.dsi.fastutil.objects.Object2DoubleMap; +import org.apache.commons.math3.distribution.EnumeratedDistribution; +import org.apache.commons.math3.random.MersenneTwister; +import org.apache.commons.math3.random.RandomGenerator; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +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.Link; +import org.matsim.core.gbl.MatsimRandom; +import org.matsim.facilities.ActivityFacility; +import org.matsim.freight.carriers.*; +import org.matsim.smallScaleCommercialTrafficGeneration.data.GetCommercialTourSpecifications; +import org.matsim.vehicles.CostInformation; +import org.matsim.vehicles.Vehicle; +import org.matsim.vehicles.VehicleType; +import org.matsim.vehicles.VehicleUtils; + +import java.util.*; + +import static org.matsim.smallScaleCommercialTrafficGeneration.GenerateSmallScaleCommercialTrafficDemand.getVehicleStartTime; +import static org.matsim.smallScaleCommercialTrafficGeneration.GenerateSmallScaleCommercialTrafficDemand.getVehicleTourDuration; + +public class DefaultVehicleSelection implements VehicleSelection{ + private static final Logger log = LogManager.getLogger(GenerateSmallScaleCommercialTrafficDemand.class); + + //Configurations + private final int jspritIterations; + + //Needed for all computations (static) + private final static Random rnd = MatsimRandom.getRandom(); + + //Needed for this computation + GetCommercialTourSpecifications getCommercialTourSpecifications; + Map>> facilitiesPerZone; + TripDistributionMatrix odMatrix; + Map> resultingDataPerZone; + Map, Link>> linksPerZone; + + /** + * Prepares the Vehicle Selection. + * @param jspritIterations Configuration: Number of jsprit iterations (Given in {@link GenerateSmallScaleCommercialTrafficDemand}) + */ + DefaultVehicleSelection(int jspritIterations) { + this.jspritIterations = jspritIterations; //TODO Whoever calls this class will not get any feedback about this variable. Check if this may cause problems + } + + /** + * Creates the carriers and the related demand, based on the generated + * TripDistributionMatrix. + * @param scenario Scenario (loaded from your config), where the carriers will be put into + * @param getCommercialTourSpecifications + * @param facilitiesPerZone + * @param odMatrix Can be generated in {@link GenerateSmallScaleCommercialTrafficDemand} + * @param smallScaleCommercialTrafficType Selected traffic types. Options: commercialPersonTraffic, goodsTraffic + * @param resultingDataPerZone Data distribution to zones (Given in {@link GenerateSmallScaleCommercialTrafficDemand} + * @param linksPerZone + */ + @Override + public void createCarriers(Scenario scenario, + GetCommercialTourSpecifications getCommercialTourSpecifications, + Map>> facilitiesPerZone, + TripDistributionMatrix odMatrix, + String smallScaleCommercialTrafficType, + Map> resultingDataPerZone, + Map, Link>> linksPerZone){ + //Save the given data + RandomGenerator rng = new MersenneTwister(scenario.getConfig().global().getRandomSeed()); + this.getCommercialTourSpecifications = getCommercialTourSpecifications; + this.facilitiesPerZone = facilitiesPerZone; + this.odMatrix = odMatrix; + this.resultingDataPerZone = resultingDataPerZone; + this.linksPerZone = linksPerZone; + + //TODO configuration with both smallScaleCommercialTrafficType + + int maxNumberOfCarrier = odMatrix.getListOfPurposes().size() * odMatrix.getListOfZones().size() + * odMatrix.getListOfModesOrVehTypes().size(); + int createdCarrier = 0; + int fixedNumberOfVehiclePerTypeAndLocation = 1; //TODO possible improvement, perhaps check KiD + + EnumeratedDistribution tourDistribution = getCommercialTourSpecifications.createTourDistribution(smallScaleCommercialTrafficType, rng); + + Map> stopDurationTimeSelector = getCommercialTourSpecifications.createStopDurationDistributionPerCategory(smallScaleCommercialTrafficType, rng); + + CarrierVehicleTypes carrierVehicleTypes = CarriersUtils.getCarrierVehicleTypes(scenario); + Map, VehicleType> additionalCarrierVehicleTypes = scenario.getVehicles().getVehicleTypes(); + + // Only a vehicle with cost information will work properly + additionalCarrierVehicleTypes.values().stream() + .filter(vehicleType -> vehicleType.getCostInformation().getCostsPerSecond() != null) + .forEach(vehicleType -> carrierVehicleTypes.getVehicleTypes().putIfAbsent(vehicleType.getId(), vehicleType)); + + for (VehicleType vehicleType : carrierVehicleTypes.getVehicleTypes().values()) { + CostInformation costInformation = vehicleType.getCostInformation(); + VehicleUtils.setCostsPerSecondInService(costInformation, costInformation.getCostsPerSecond()); + VehicleUtils.setCostsPerSecondWaiting(costInformation, costInformation.getCostsPerSecond()); + } + + for (Integer purpose : odMatrix.getListOfPurposes()) { + for (String startZone : odMatrix.getListOfZones()) { + for (String modeORvehType : odMatrix.getListOfModesOrVehTypes()) { + boolean isStartingLocation = false; + checkIfIsStartingPosition: + { + for (String possibleStopZone : odMatrix.getListOfZones()) { + if (!modeORvehType.equals("pt") && !modeORvehType.equals("op")) + if (odMatrix.getTripDistributionValue(startZone, possibleStopZone, modeORvehType, + purpose, smallScaleCommercialTrafficType) != 0) { + isStartingLocation = true; + break checkIfIsStartingPosition; + } + } + } + + if (isStartingLocation) { + double occupancyRate = 0; + String[] possibleVehicleTypes = null; + ArrayList startCategory = new ArrayList<>(); + ArrayList stopCategory = new ArrayList<>(); + stopCategory.add("Employee Primary Sector"); + stopCategory.add("Employee Construction"); + stopCategory.add("Employee Secondary Sector Rest"); + stopCategory.add("Employee Retail"); + stopCategory.add("Employee Traffic/Parcels"); + stopCategory.add("Employee Tertiary Sector Rest"); + stopCategory.add("Inhabitants"); + if (purpose == 1) { + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; + occupancyRate = 1.5; + } + startCategory.add("Employee Secondary Sector Rest"); + stopCategory.clear(); + stopCategory.add("Employee Secondary Sector Rest"); + } else if (purpose == 2) { + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; + occupancyRate = 1.6; + } + startCategory.add("Employee Secondary Sector Rest"); + } else if (purpose == 3) { + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + possibleVehicleTypes = new String[]{"golf1.4", "c_zero"}; + occupancyRate = 1.2; + } + startCategory.add("Employee Retail"); + startCategory.add("Employee Tertiary Sector Rest"); + } else if (purpose == 4) { + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + possibleVehicleTypes = new String[]{"golf1.4", "c_zero"}; + occupancyRate = 1.2; + } + startCategory.add("Employee Traffic/Parcels"); + } else if (purpose == 5) { + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + possibleVehicleTypes = new String[]{"mercedes313", "e_SpaceTourer"}; + occupancyRate = 1.7; + } + startCategory.add("Employee Construction"); + } else if (purpose == 6) { + startCategory.add("Inhabitants"); + } + if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { + occupancyRate = 1.; + switch (modeORvehType) { + case "vehTyp1" -> + possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; // possible to add more types, see source + case "vehTyp2" -> + possibleVehicleTypes = new String[]{"mercedes313", "e_SpaceTourer"}; + case "vehTyp3", "vehTyp4" -> + possibleVehicleTypes = new String[]{"light8t", "light8t_electro"}; + case "vehTyp5" -> + possibleVehicleTypes = new String[]{"medium18t", "medium18t_electro", "heavy40t", "heavy40t_electro"}; + } + } + + // use only types of the possibleTypes which are in the given types file + List vehicleTypes = new ArrayList<>(); + assert possibleVehicleTypes != null; + + for (String possibleVehicleType : possibleVehicleTypes) { + if (CarriersUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().containsKey( + Id.create(possibleVehicleType, VehicleType.class))) + vehicleTypes.add(possibleVehicleType); + } + // find a start category with existing employees in this zone + Collections.shuffle(startCategory, rnd); + String selectedStartCategory = startCategory.getFirst(); + for (int count = 1; resultingDataPerZone.get(startZone).getDouble(selectedStartCategory) == 0; count++) { + if (count <= startCategory.size()) + selectedStartCategory = startCategory.get(rnd.nextInt(startCategory.size())); + else + selectedStartCategory = stopCategory.get(rnd.nextInt(stopCategory.size())); + } + String carrierName = null; + if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { + carrierName = "Carrier_Goods_" + startZone + "_purpose_" + purpose + "_" + modeORvehType; + } else if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) + carrierName = "Carrier_Business_" + startZone + "_purpose_" + purpose; + int numberOfDepots = odMatrix.getSumOfServicesForStartZone(startZone, modeORvehType, purpose, + smallScaleCommercialTrafficType); + CarrierCapabilities.FleetSize fleetSize = CarrierCapabilities.FleetSize.FINITE; + ArrayList vehicleDepots = new ArrayList<>(); + createdCarrier++; + log.info("Create carrier number {} of a maximum Number of {} carriers.", createdCarrier, maxNumberOfCarrier); + log.info("Carrier: {}; depots: {}; services: {}", carrierName, numberOfDepots, + (int) Math.ceil(odMatrix.getSumOfServicesForStartZone(startZone, modeORvehType, + purpose, smallScaleCommercialTrafficType) / occupancyRate)); + createNewCarrierAndAddVehicleTypes(scenario, purpose, startZone, + selectedStartCategory, carrierName, vehicleTypes, numberOfDepots, fleetSize, + fixedNumberOfVehiclePerTypeAndLocation, vehicleDepots, smallScaleCommercialTrafficType, + tourDistribution); + log.info("Create services for carrier: {}", carrierName); + for (String stopZone : odMatrix.getListOfZones()) { + int trafficVolumeForOD = Math.round((float)odMatrix.getTripDistributionValue(startZone, + stopZone, modeORvehType, purpose, smallScaleCommercialTrafficType)); + int numberOfJobs = (int) Math.ceil(trafficVolumeForOD / occupancyRate); + if (numberOfJobs == 0) + continue; + // find a category for the tour stop with existing employees in this zone + String selectedStopCategory = stopCategory.get(rnd.nextInt(stopCategory.size())); + while (resultingDataPerZone.get(stopZone).getDouble(selectedStopCategory) == 0) + selectedStopCategory = stopCategory.get(rnd.nextInt(stopCategory.size())); + String[] serviceArea = new String[]{stopZone}; + int serviceTimePerStop; + if (selectedStartCategory.equals("Inhabitants")) + serviceTimePerStop = getServiceTimePerStop(stopDurationTimeSelector, startCategory.getFirst(), modeORvehType, smallScaleCommercialTrafficType); + else + serviceTimePerStop = getServiceTimePerStop(stopDurationTimeSelector, selectedStartCategory, modeORvehType, smallScaleCommercialTrafficType); + + TimeWindow serviceTimeWindow = TimeWindow.newInstance(0, 36 * 3600); // extended time window, so that late tours can handle it + createServices(scenario, vehicleDepots, selectedStopCategory, carrierName, + numberOfJobs, serviceArea, serviceTimePerStop, serviceTimeWindow); + } + } + } + } + } + +// System.out.println("Final results for the start time distribution"); +// tourStartTimeSelector.writeResults(); + +// System.out.println("Final results for the tour duration distribution"); +// tourDurationTimeSelector.writeResults(); + +// for (StopDurationGoodTrafficKey sector : stopDurationTimeSelector.keySet()) { +// System.out.println("Final results for the stop duration distribution in sector " + sector); +// stopDurationTimeSelector.get(sector); +// } + + log.warn("The jspritIterations are now set to {} in this simulation!", jspritIterations); + log.info("Finished creating {} carriers including related services.", createdCarrier); + + } + + /** + * Creates the services for one carrier. + */ + private void createServices(Scenario scenario, + ArrayList noPossibleLinks, + String selectedStopCategory, + String carrierName, + int numberOfJobs, + String[] serviceArea, + Integer serviceTimePerStop, + TimeWindow serviceTimeWindow) { + + String stopZone = serviceArea[0]; + + for (int i = 0; i < numberOfJobs; i++) { + + Id linkId = findPossibleLink(stopZone, selectedStopCategory, noPossibleLinks); + Id idNewService = Id.create(carrierName + "_" + linkId + "_" + rnd.nextInt(10000), + CarrierService.class); + + CarrierService thisService = CarrierService.Builder.newInstance(idNewService, linkId) + .setServiceDuration(serviceTimePerStop).setServiceStartTimeWindow(serviceTimeWindow).build(); + CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)).getServices() + .put(thisService.getId(), thisService); + } + } + + /** + * Creates the carrier and the related vehicles. + */ + private void createNewCarrierAndAddVehicleTypes(Scenario scenario, + Integer purpose, + String startZone, + String selectedStartCategory, + String carrierName, + List vehicleTypes, + int numberOfDepots, + CarrierCapabilities.FleetSize fleetSize, + int fixedNumberOfVehiclePerTypeAndLocation, + List vehicleDepots, + String smallScaleCommercialTrafficType, + EnumeratedDistribution tourStartTimeSelector) { + + Carriers carriers = CarriersUtils.addOrGetCarriers(scenario); + CarrierVehicleTypes carrierVehicleTypes = CarriersUtils.getCarrierVehicleTypes(scenario); + + CarrierCapabilities carrierCapabilities; + + Carrier thisCarrier = CarriersUtils.createCarrier(Id.create(carrierName, Carrier.class)); + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic") && purpose == 3) + thisCarrier.getAttributes().putAttribute("subpopulation", smallScaleCommercialTrafficType + "_service"); + else + thisCarrier.getAttributes().putAttribute("subpopulation", smallScaleCommercialTrafficType); + + thisCarrier.getAttributes().putAttribute("purpose", purpose); + thisCarrier.getAttributes().putAttribute("tourStartArea", startZone); + if (jspritIterations > 0) + CarriersUtils.setJspritIterations(thisCarrier, jspritIterations); + carrierCapabilities = CarrierCapabilities.Builder.newInstance().setFleetSize(fleetSize).build(); + + carriers.addCarrier(thisCarrier); + + while (vehicleDepots.size() < numberOfDepots) { + Id linkId = findPossibleLink(startZone, selectedStartCategory, null); + vehicleDepots.add(linkId.toString()); + } + + for (String singleDepot : vehicleDepots) { + GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = tourStartTimeSelector.sample(); + + int vehicleStartTime = getVehicleStartTime(t); + int tourDuration = getVehicleTourDuration(t); //TODO### + int vehicleEndTime = vehicleStartTime + tourDuration; + for (String thisVehicleType : vehicleTypes) { //TODO Flottenzusammensetzung anpassen. Momentan pro Depot alle Fahrzeugtypen 1x erzeugen + VehicleType thisType = carrierVehicleTypes.getVehicleTypes() + .get(Id.create(thisVehicleType, VehicleType.class)); + if (fixedNumberOfVehiclePerTypeAndLocation == 0) + fixedNumberOfVehiclePerTypeAndLocation = 1; + for (int i = 0; i < fixedNumberOfVehiclePerTypeAndLocation; i++) { + CarrierVehicle newCarrierVehicle = CarrierVehicle.Builder + .newInstance( + Id.create( + thisCarrier.getId().toString() + "_" + + (carrierCapabilities.getCarrierVehicles().size() + 1), + Vehicle.class), + Id.createLinkId(singleDepot), thisType) + .setEarliestStart(vehicleStartTime).setLatestEnd(vehicleEndTime).build(); + carrierCapabilities.getCarrierVehicles().put(newCarrierVehicle.getId(), newCarrierVehicle); + if (!carrierCapabilities.getVehicleTypes().contains(thisType)) + carrierCapabilities.getVehicleTypes().add(thisType); + } + } + + thisCarrier.setCarrierCapabilities(carrierCapabilities); + } + } + + /** + * Give a service duration based on the purpose and the trafficType under a given probability + * + * @param serviceDurationTimeSelector the selector for the service duration + * @param employeeCategory the category of the employee + * @param modeORvehType the mode or vehicle type + * @return the service duration + */ + private Integer getServiceTimePerStop(Map> serviceDurationTimeSelector, + String employeeCategory, + String modeORvehType, + String smallScaleCommercialTrafficType) { + GenerateSmallScaleCommercialTrafficDemand.StopDurationGoodTrafficKey key = null; + if (smallScaleCommercialTrafficType.equals(GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString())) + key = GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey(employeeCategory, null); + else if (smallScaleCommercialTrafficType.equals(GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString())) { + key = GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey(employeeCategory, modeORvehType); + } + GenerateSmallScaleCommercialTrafficDemand.DurationsBounds serviceDurationBounds = serviceDurationTimeSelector.get(key).sample(); + int serviceDurationLowerBound = serviceDurationBounds.minDuration(); + int serviceDurationUpperBound = serviceDurationBounds.maxDuration(); + return rnd.nextInt(serviceDurationLowerBound * 60, serviceDurationUpperBound * 60); + } + + + + /** + * Finds a possible link for a service or the vehicle location. + */ + private Id findPossibleLink(String zone, String selectedCategory, List noPossibleLinks) { + + Id newLink = null; + for (int a = 0; newLink == null && a < facilitiesPerZone.get(zone).get(selectedCategory).size() * 2; a++) { + + ActivityFacility possibleBuilding = facilitiesPerZone.get(zone).get(selectedCategory) + .get(rnd.nextInt(facilitiesPerZone.get(zone).get(selectedCategory).size())); //TODO Wkt für die Auswahl anpassen + Coord centroidPointOfBuildingPolygon = possibleBuilding.getCoord(); + + int numberOfPossibleLinks = linksPerZone.get(zone).size(); + + // searches and selects the nearest link of the possible links in this zone + newLink = SmallScaleCommercialTrafficUtils.findNearestPossibleLink(zone, noPossibleLinks, linksPerZone, newLink, + centroidPointOfBuildingPolygon, numberOfPossibleLinks); + } + if (newLink == null) + throw new RuntimeException("No possible link for buildings with type '" + selectedCategory + "' in zone '" + + zone + "' found. buildings in category: " + facilitiesPerZone.get(zone).get(selectedCategory) + + "; possibleLinks in zone: " + linksPerZone.get(zone).size()); + return newLink; + } +} diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 7a086badf9d..bf0cac4313e 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -22,7 +22,6 @@ import com.google.inject.Inject; import com.google.inject.Provider; import it.unimi.dsi.fastutil.objects.Object2DoubleMap; -import org.apache.commons.math3.distribution.EnumeratedDistribution; import org.apache.commons.math3.random.MersenneTwister; import org.apache.commons.math3.random.RandomGenerator; import org.apache.logging.log4j.Level; @@ -68,15 +67,12 @@ import org.matsim.core.utils.geometry.CoordinateTransformation; import org.matsim.facilities.ActivityFacility; import org.matsim.freight.carriers.*; -import org.matsim.freight.carriers.CarrierCapabilities.FleetSize; import org.matsim.freight.carriers.controler.*; import org.matsim.freight.carriers.usecases.chessboard.CarrierTravelDisutilities; import org.matsim.smallScaleCommercialTrafficGeneration.data.DefaultTourSpecificationsByUsingKID2002; import org.matsim.smallScaleCommercialTrafficGeneration.data.GetCommercialTourSpecifications; -import org.matsim.vehicles.CostInformation; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; -import org.matsim.vehicles.VehicleUtils; import picocli.CommandLine; import java.io.File; @@ -95,8 +91,8 @@ * @author Ricardo Ewert */ //TODO check if service duration is larger than tour duration -//TODO make vehicle selection (see method createCarriers()) configurable in separate class (use interface) -//TODO move generationRates in class TrafficVolumeGeneration in separate class in package data (similar to GetCommercialTourSpecifications) +//TODO make vehicle selection (see method createCarriers()) configurable in separate class (use interface) -> (done, untested) +//TODO move generationRates in class TrafficVolumeGeneration in separate class in package data (similar to GetCommercialTourSpecifications) -> (done, untested) @CommandLine.Command(name = "generate-small-scale-commercial-traffic", description = "Generates plans for a small scale commercial traffic model", showDefaultValues = true) public class GenerateSmallScaleCommercialTrafficDemand implements MATSimAppCommand { // freight traffic from extern: @@ -111,6 +107,7 @@ public class GenerateSmallScaleCommercialTrafficDemand implements MATSimAppComma private static final Logger log = LogManager.getLogger(GenerateSmallScaleCommercialTrafficDemand.class); private final IntegrateExistingTrafficToSmallScaleCommercial integrateExistingTrafficToSmallScaleCommercial; private final GetCommercialTourSpecifications getCommercialTourSpecifications; + private final VehicleSelection vehicleSelection; private enum CreationOption { useExistingCarrierFileWithSolution, createNewCarrierFile, useExistingCarrierFileWithoutSolution @@ -171,7 +168,7 @@ public enum SmallScaleCommercialTrafficType { @CommandLine.Option(names = "--pathOutput", description = "Path for the output") private Path output; - private Random rnd; + private static Random rnd; private RandomGenerator rng; private final Map>> facilitiesPerZone = new HashMap<>(); @@ -182,8 +179,10 @@ public GenerateSmallScaleCommercialTrafficDemand() { log.info("Using default {} if existing models are integrated!", DefaultIntegrateExistingTrafficToSmallScaleCommercialImpl.class.getSimpleName()); this.getCommercialTourSpecifications = new DefaultTourSpecificationsByUsingKID2002(); log.info("Using default {} for tour specifications!", DefaultTourSpecificationsByUsingKID2002.class.getSimpleName()); + this.vehicleSelection = new DefaultVehicleSelection(jspritIterations); + log.info("Using default {} for tour vehicle-selection!", DefaultVehicleSelection.class.getSimpleName()); } - public GenerateSmallScaleCommercialTrafficDemand(IntegrateExistingTrafficToSmallScaleCommercial integrateExistingTrafficToSmallScaleCommercial, GetCommercialTourSpecifications getCommercialTourSpecifications) { + public GenerateSmallScaleCommercialTrafficDemand(IntegrateExistingTrafficToSmallScaleCommercial integrateExistingTrafficToSmallScaleCommercial, GetCommercialTourSpecifications getCommercialTourSpecifications, VehicleSelection vehicleSelection) { if (integrateExistingTrafficToSmallScaleCommercial == null){ this.integrateExistingTrafficToSmallScaleCommercial = new DefaultIntegrateExistingTrafficToSmallScaleCommercialImpl(); log.info("Using default {} if existing models are integrated!", DefaultIntegrateExistingTrafficToSmallScaleCommercialImpl.class.getSimpleName()); @@ -198,6 +197,13 @@ public GenerateSmallScaleCommercialTrafficDemand(IntegrateExistingTrafficToSmall this.getCommercialTourSpecifications = getCommercialTourSpecifications; log.info("Using {} for tour specifications!", getCommercialTourSpecifications.getClass().getSimpleName()); } + if(vehicleSelection == null){ + this.vehicleSelection = new DefaultVehicleSelection(jspritIterations); + log.info("Using default {} for tour vehicle-selection!", DefaultVehicleSelection.class.getSimpleName()); + } else { + this.vehicleSelection = vehicleSelection; + log.info("Using {} for tour vehicle-selection!", vehicleSelection.getClass().getSimpleName()); + } } public static void main(String[] args) { @@ -482,7 +488,14 @@ else if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) } final TripDistributionMatrix odMatrix = createTripDistribution(trafficVolumePerTypeAndZone_start, trafficVolumePerTypeAndZone_stop, smallScaleCommercialTrafficType, scenario, output, linksPerZone); - createCarriers(scenario, odMatrix, resultingDataPerZone, smallScaleCommercialTrafficType, linksPerZone); + vehicleSelection.createCarriers( + scenario, + getCommercialTourSpecifications, + facilitiesPerZone, + odMatrix, + smallScaleCommercialTrafficType, + resultingDataPerZone, + linksPerZone); } /** @@ -558,346 +571,21 @@ public void install() { return controler; } - /** - * Creates the carriers and the related demand, based on the generated - * TripDistributionMatrix. - */ - private void createCarriers(Scenario scenario, TripDistributionMatrix odMatrix, - Map> resultingDataPerZone, String smallScaleCommercialTrafficType, - Map, Link>> linksPerZone) { - int maxNumberOfCarrier = odMatrix.getListOfPurposes().size() * odMatrix.getListOfZones().size() - * odMatrix.getListOfModesOrVehTypes().size(); - int createdCarrier = 0; - int fixedNumberOfVehiclePerTypeAndLocation = 1; //TODO possible improvement, perhaps check KiD - - EnumeratedDistribution tourDistribution = getCommercialTourSpecifications.createTourDistribution(smallScaleCommercialTrafficType, rng); - - Map> stopDurationTimeSelector = getCommercialTourSpecifications.createStopDurationDistributionPerCategory(smallScaleCommercialTrafficType, rng); - - CarrierVehicleTypes carrierVehicleTypes = CarriersUtils.getCarrierVehicleTypes(scenario); - Map, VehicleType> additionalCarrierVehicleTypes = scenario.getVehicles().getVehicleTypes(); - - // Only a vehicle with cost information will work properly - additionalCarrierVehicleTypes.values().stream() - .filter(vehicleType -> vehicleType.getCostInformation().getCostsPerSecond() != null) - .forEach(vehicleType -> carrierVehicleTypes.getVehicleTypes().putIfAbsent(vehicleType.getId(), vehicleType)); - - for (VehicleType vehicleType : carrierVehicleTypes.getVehicleTypes().values()) { - CostInformation costInformation = vehicleType.getCostInformation(); - VehicleUtils.setCostsPerSecondInService(costInformation, costInformation.getCostsPerSecond()); - VehicleUtils.setCostsPerSecondWaiting(costInformation, costInformation.getCostsPerSecond()); - } - - for (Integer purpose : odMatrix.getListOfPurposes()) { - for (String startZone : odMatrix.getListOfZones()) { - for (String modeORvehType : odMatrix.getListOfModesOrVehTypes()) { - boolean isStartingLocation = false; - checkIfIsStartingPosition: - { - for (String possibleStopZone : odMatrix.getListOfZones()) { - if (!modeORvehType.equals("pt") && !modeORvehType.equals("op")) - if (odMatrix.getTripDistributionValue(startZone, possibleStopZone, modeORvehType, - purpose, smallScaleCommercialTrafficType) != 0) { - isStartingLocation = true; - break checkIfIsStartingPosition; - } - } - } - - if (isStartingLocation) { - double occupancyRate = 0; - String[] possibleVehicleTypes = null; - ArrayList startCategory = new ArrayList<>(); - ArrayList stopCategory = new ArrayList<>(); - stopCategory.add("Employee Primary Sector"); - stopCategory.add("Employee Construction"); - stopCategory.add("Employee Secondary Sector Rest"); - stopCategory.add("Employee Retail"); - stopCategory.add("Employee Traffic/Parcels"); - stopCategory.add("Employee Tertiary Sector Rest"); - stopCategory.add("Inhabitants"); - if (purpose == 1) { - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; - occupancyRate = 1.5; - } - startCategory.add("Employee Secondary Sector Rest"); - stopCategory.clear(); - stopCategory.add("Employee Secondary Sector Rest"); - } else if (purpose == 2) { - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; - occupancyRate = 1.6; - } - startCategory.add("Employee Secondary Sector Rest"); - } else if (purpose == 3) { - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - possibleVehicleTypes = new String[]{"golf1.4", "c_zero"}; - occupancyRate = 1.2; - } - startCategory.add("Employee Retail"); - startCategory.add("Employee Tertiary Sector Rest"); - } else if (purpose == 4) { - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - possibleVehicleTypes = new String[]{"golf1.4", "c_zero"}; - occupancyRate = 1.2; - } - startCategory.add("Employee Traffic/Parcels"); - } else if (purpose == 5) { - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - possibleVehicleTypes = new String[]{"mercedes313", "e_SpaceTourer"}; - occupancyRate = 1.7; - } - startCategory.add("Employee Construction"); - } else if (purpose == 6) { - startCategory.add("Inhabitants"); - } - if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { - occupancyRate = 1.; - switch (modeORvehType) { - case "vehTyp1" -> - possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; // possible to add more types, see source - case "vehTyp2" -> - possibleVehicleTypes = new String[]{"mercedes313", "e_SpaceTourer"}; - case "vehTyp3", "vehTyp4" -> - possibleVehicleTypes = new String[]{"light8t", "light8t_electro"}; - case "vehTyp5" -> - possibleVehicleTypes = new String[]{"medium18t", "medium18t_electro", "heavy40t", "heavy40t_electro"}; - } - } - - // use only types of the possibleTypes which are in the given types file - List vehicleTypes = new ArrayList<>(); - assert possibleVehicleTypes != null; - - for (String possibleVehicleType : possibleVehicleTypes) { - if (CarriersUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().containsKey( - Id.create(possibleVehicleType, VehicleType.class))) - vehicleTypes.add(possibleVehicleType); - } - // find a start category with existing employees in this zone - Collections.shuffle(startCategory, rnd); - String selectedStartCategory = startCategory.getFirst(); - for (int count = 1; resultingDataPerZone.get(startZone).getDouble(selectedStartCategory) == 0; count++) { - if (count <= startCategory.size()) - selectedStartCategory = startCategory.get(rnd.nextInt(startCategory.size())); - else - selectedStartCategory = stopCategory.get(rnd.nextInt(stopCategory.size())); - } - String carrierName = null; - if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { - carrierName = "Carrier_Goods_" + startZone + "_purpose_" + purpose + "_" + modeORvehType; - } else if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) - carrierName = "Carrier_Business_" + startZone + "_purpose_" + purpose; - int numberOfDepots = odMatrix.getSumOfServicesForStartZone(startZone, modeORvehType, purpose, - smallScaleCommercialTrafficType); - FleetSize fleetSize = FleetSize.FINITE; - ArrayList vehicleDepots = new ArrayList<>(); - createdCarrier++; - log.info("Create carrier number {} of a maximum Number of {} carriers.", createdCarrier, maxNumberOfCarrier); - log.info("Carrier: {}; depots: {}; services: {}", carrierName, numberOfDepots, - (int) Math.ceil(odMatrix.getSumOfServicesForStartZone(startZone, modeORvehType, - purpose, smallScaleCommercialTrafficType) / occupancyRate)); - createNewCarrierAndAddVehicleTypes(scenario, purpose, startZone, - selectedStartCategory, carrierName, vehicleTypes, numberOfDepots, fleetSize, - fixedNumberOfVehiclePerTypeAndLocation, vehicleDepots, linksPerZone, smallScaleCommercialTrafficType, - tourDistribution); - log.info("Create services for carrier: {}", carrierName); - for (String stopZone : odMatrix.getListOfZones()) { - int trafficVolumeForOD = Math.round((float)odMatrix.getTripDistributionValue(startZone, - stopZone, modeORvehType, purpose, smallScaleCommercialTrafficType)); - int numberOfJobs = (int) Math.ceil(trafficVolumeForOD / occupancyRate); - if (numberOfJobs == 0) - continue; - // find a category for the tour stop with existing employees in this zone - String selectedStopCategory = stopCategory.get(rnd.nextInt(stopCategory.size())); - while (resultingDataPerZone.get(stopZone).getDouble(selectedStopCategory) == 0) - selectedStopCategory = stopCategory.get(rnd.nextInt(stopCategory.size())); - String[] serviceArea = new String[]{stopZone}; - int serviceTimePerStop; - if (selectedStartCategory.equals("Inhabitants")) - serviceTimePerStop = getServiceTimePerStop(stopDurationTimeSelector, startCategory.getFirst(), modeORvehType, smallScaleCommercialTrafficType); - else - serviceTimePerStop = getServiceTimePerStop(stopDurationTimeSelector, selectedStartCategory, modeORvehType, smallScaleCommercialTrafficType); - - TimeWindow serviceTimeWindow = TimeWindow.newInstance(0, 36 * 3600); // extended time window, so that late tours can handle it - createServices(scenario, vehicleDepots, selectedStopCategory, carrierName, - numberOfJobs, serviceArea, serviceTimePerStop, serviceTimeWindow, linksPerZone); - } - } - } - } - } - -// System.out.println("Final results for the start time distribution"); -// tourStartTimeSelector.writeResults(); - -// System.out.println("Final results for the tour duration distribution"); -// tourDurationTimeSelector.writeResults(); - -// for (StopDurationGoodTrafficKey sector : stopDurationTimeSelector.keySet()) { -// System.out.println("Final results for the stop duration distribution in sector " + sector); -// stopDurationTimeSelector.get(sector); -// } - - log.warn("The jspritIterations are now set to {} in this simulation!", jspritIterations); - log.info("Finished creating {} carriers including related services.", createdCarrier); - } - - /** - * Creates the services for one carrier. - */ - private void createServices(Scenario scenario, ArrayList noPossibleLinks, - String selectedStopCategory, String carrierName, int numberOfJobs, String[] serviceArea, - Integer serviceTimePerStop, TimeWindow serviceTimeWindow, - Map, Link>> linksPerZone) { - - String stopZone = serviceArea[0]; - - for (int i = 0; i < numberOfJobs; i++) { - - Id linkId = findPossibleLink(stopZone, selectedStopCategory, noPossibleLinks, linksPerZone); - Id idNewService = Id.create(carrierName + "_" + linkId + "_" + rnd.nextInt(10000), - CarrierService.class); - - CarrierService thisService = CarrierService.Builder.newInstance(idNewService, linkId) - .setServiceDuration(serviceTimePerStop).setServiceStartTimeWindow(serviceTimeWindow).build(); - CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)).getServices() - .put(thisService.getId(), thisService); - } - - } - - /** - * Creates the carrier and the related vehicles. - */ - private void createNewCarrierAndAddVehicleTypes(Scenario scenario, Integer purpose, String startZone, - String selectedStartCategory, String carrierName, - List vehicleTypes, int numberOfDepots, FleetSize fleetSize, - int fixedNumberOfVehiclePerTypeAndLocation, - List vehicleDepots, Map, Link>> linksPerZone, - String smallScaleCommercialTrafficType, - EnumeratedDistribution tourStartTimeSelector) { - - Carriers carriers = CarriersUtils.addOrGetCarriers(scenario); - CarrierVehicleTypes carrierVehicleTypes = CarriersUtils.getCarrierVehicleTypes(scenario); - - CarrierCapabilities carrierCapabilities; - - Carrier thisCarrier = CarriersUtils.createCarrier(Id.create(carrierName, Carrier.class)); - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic") && purpose == 3) - thisCarrier.getAttributes().putAttribute("subpopulation", smallScaleCommercialTrafficType + "_service"); - else - thisCarrier.getAttributes().putAttribute("subpopulation", smallScaleCommercialTrafficType); - - thisCarrier.getAttributes().putAttribute("purpose", purpose); - thisCarrier.getAttributes().putAttribute("tourStartArea", startZone); - if (jspritIterations > 0) - CarriersUtils.setJspritIterations(thisCarrier, jspritIterations); - carrierCapabilities = CarrierCapabilities.Builder.newInstance().setFleetSize(fleetSize).build(); - carriers.addCarrier(thisCarrier); - - while (vehicleDepots.size() < numberOfDepots) { - Id linkId = findPossibleLink(startZone, selectedStartCategory, null, linksPerZone); - vehicleDepots.add(linkId.toString()); - } - - for (String singleDepot : vehicleDepots) { - TourStartAndDuration t = tourStartTimeSelector.sample(); - - int vehicleStartTime = getVehicleStartTime(t); - int tourDuration = getVehicleTourDuration(t); - int vehicleEndTime = vehicleStartTime + tourDuration; - for (String thisVehicleType : vehicleTypes) { //TODO Flottenzusammensetzung anpassen. Momentan pro Depot alle Fahrzeugtypen 1x erzeugen - VehicleType thisType = carrierVehicleTypes.getVehicleTypes() - .get(Id.create(thisVehicleType, VehicleType.class)); - if (fixedNumberOfVehiclePerTypeAndLocation == 0) - fixedNumberOfVehiclePerTypeAndLocation = 1; - for (int i = 0; i < fixedNumberOfVehiclePerTypeAndLocation; i++) { - CarrierVehicle newCarrierVehicle = CarrierVehicle.Builder - .newInstance( - Id.create( - thisCarrier.getId().toString() + "_" - + (carrierCapabilities.getCarrierVehicles().size() + 1), - Vehicle.class), - Id.createLinkId(singleDepot), thisType) - .setEarliestStart(vehicleStartTime).setLatestEnd(vehicleEndTime).build(); - carrierCapabilities.getCarrierVehicles().put(newCarrierVehicle.getId(), newCarrierVehicle); - if (!carrierCapabilities.getVehicleTypes().contains(thisType)) - carrierCapabilities.getVehicleTypes().add(thisType); - } - } - - thisCarrier.setCarrierCapabilities(carrierCapabilities); - } - } - /** * Gives a duration for the created tour under the given probability. * */ - private int getVehicleTourDuration(TourStartAndDuration t) { + static int getVehicleTourDuration(TourStartAndDuration t) { return (int) rnd.nextDouble(t.minDuration * 60, t.maxDuration * 60); } /** * Gives a tour start time for the created tour under the given probability. */ - private int getVehicleStartTime(TourStartAndDuration t) { + static int getVehicleStartTime(TourStartAndDuration t) { return rnd.nextInt(t.hourLower * 3600, t.hourUpper * 3600); } - - /** - * Give a service duration based on the purpose and the trafficType under a given probability - * - * @param serviceDurationTimeSelector the selector for the service duration - * @param employeeCategory the category of the employee - * @param modeORvehType the mode or vehicle type - * @param smallScaleCommercialTrafficType the traffic type - * @return the service duration - */ - private Integer getServiceTimePerStop(Map> serviceDurationTimeSelector, - String employeeCategory, - String modeORvehType, String smallScaleCommercialTrafficType) { - StopDurationGoodTrafficKey key = null; - if (smallScaleCommercialTrafficType.equals(SmallScaleCommercialTrafficType.commercialPersonTraffic.toString())) - key = makeStopDurationGoodTrafficKey(employeeCategory, null); - else if (smallScaleCommercialTrafficType.equals(SmallScaleCommercialTrafficType.goodsTraffic.toString())) { - key = makeStopDurationGoodTrafficKey(employeeCategory, modeORvehType); - } - DurationsBounds serviceDurationBounds = serviceDurationTimeSelector.get(key).sample(); - int serviceDurationLowerBound = serviceDurationBounds.minDuration(); - int serviceDurationUpperBound = serviceDurationBounds.maxDuration(); - return rnd.nextInt(serviceDurationLowerBound * 60, serviceDurationUpperBound * 60); - } - - /** - * Finds a possible link for a service or the vehicle location. - */ - private Id findPossibleLink(String zone, String selectedCategory, List noPossibleLinks, - Map, Link>> linksPerZone) { - - Id newLink = null; - for (int a = 0; newLink == null && a < facilitiesPerZone.get(zone).get(selectedCategory).size() * 2; a++) { - - ActivityFacility possibleBuilding = facilitiesPerZone.get(zone).get(selectedCategory) - .get(rnd.nextInt(facilitiesPerZone.get(zone).get(selectedCategory).size())); //TODO Wkt für die Auswahl anpassen - Coord centroidPointOfBuildingPolygon = possibleBuilding.getCoord(); - - int numberOfPossibleLinks = linksPerZone.get(zone).size(); - - // searches and selects the nearest link of the possible links in this zone - newLink = SmallScaleCommercialTrafficUtils.findNearestPossibleLink(zone, noPossibleLinks, linksPerZone, newLink, - centroidPointOfBuildingPolygon, numberOfPossibleLinks); - } - if (newLink == null) - throw new RuntimeException("No possible link for buildings with type '" + selectedCategory + "' in zone '" - + zone + "' found. buildings in category: " + facilitiesPerZone.get(zone).get(selectedCategory) - + "; possibleLinks in zone: " + linksPerZone.get(zone).size()); - return newLink; - } - /** * Filters links by used mode "car" and creates Map with all links in each zone */ diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java index a536f751552..34af805ee00 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TrafficVolumeGeneration.java @@ -25,6 +25,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.core.utils.io.IOUtils; +import org.matsim.smallScaleCommercialTrafficGeneration.data.GetGenerationRates; import java.io.BufferedWriter; import java.io.IOException; @@ -246,865 +247,16 @@ private static void writeCSVTrafficVolume(Map> setGenerationRates(String smallScaleCommercialTrafficType, - String generationType) { - - Map> generationRates = new HashMap<>(); - Map ratesPerPurpose1 = new HashMap<>(); - Map ratesPerPurpose2 = new HashMap<>(); - Map ratesPerPurpose3 = new HashMap<>(); - Map ratesPerPurpose4 = new HashMap<>(); - Map ratesPerPurpose5 = new HashMap<>(); - Map ratesPerPurpose6 = new HashMap<>(); - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - if (generationType.equals("start")) { - ratesPerPurpose1.put("Inhabitants", 0.0); - ratesPerPurpose1.put("Employee", 0.0); - ratesPerPurpose1.put("Employee Primary Sector", 0.0); - ratesPerPurpose1.put("Employee Construction", 0.0); - ratesPerPurpose1.put("Employee Secondary Sector Rest", 0.059); - ratesPerPurpose1.put("Employee Retail", 0.0); - ratesPerPurpose1.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose1.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose2.put("Inhabitants", 0.0); - ratesPerPurpose2.put("Employee", 0.029); - ratesPerPurpose2.put("Employee Primary Sector", 0.0); - ratesPerPurpose2.put("Employee Construction", 0.0); - ratesPerPurpose2.put("Employee Secondary Sector Rest", 0.045); - ratesPerPurpose2.put("Employee Retail", 0.0); - ratesPerPurpose2.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose2.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose3.put("Inhabitants", 0.0); - ratesPerPurpose3.put("Employee", 0.021); - ratesPerPurpose3.put("Employee Primary Sector", 0.0); - ratesPerPurpose3.put("Employee Construction", 0.0); - ratesPerPurpose3.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose3.put("Employee Retail", 0.0192); - ratesPerPurpose3.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose3.put("Employee Tertiary Sector Rest", 0.184); - - ratesPerPurpose4.put("Inhabitants", 0.0); - ratesPerPurpose4.put("Employee", 0.021); - ratesPerPurpose4.put("Employee Primary Sector", 0.0); - ratesPerPurpose4.put("Employee Construction", 0.0); - ratesPerPurpose4.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose4.put("Employee Retail", 0.0); - ratesPerPurpose4.put("Employee Traffic/Parcels", 0.203); - ratesPerPurpose4.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose5.put("Inhabitants", 0.0); - ratesPerPurpose5.put("Employee", 0.03); - ratesPerPurpose5.put("Employee Primary Sector", 0.0); - ratesPerPurpose5.put("Employee Construction", 0.29); - ratesPerPurpose5.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose5.put("Employee Retail", 0.0); - ratesPerPurpose5.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose5.put("Employee Tertiary Sector Rest", 0.0); - } else if (generationType.equals("stop")) { - ratesPerPurpose1.put("Inhabitants", 0.0); - ratesPerPurpose1.put("Employee", 0.0); - ratesPerPurpose1.put("Employee Primary Sector", 0.0); - ratesPerPurpose1.put("Employee Construction", 0.0); - ratesPerPurpose1.put("Employee Secondary Sector Rest", 0.02); - ratesPerPurpose1.put("Employee Retail", 0.0); - ratesPerPurpose1.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose1.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose2.put("Inhabitants", 0.002); - ratesPerPurpose2.put("Employee", 0.0); - ratesPerPurpose2.put("Employee Primary Sector", 0.029); - ratesPerPurpose2.put("Employee Construction", 0.029); - ratesPerPurpose2.put("Employee Secondary Sector Rest", 0.009); - ratesPerPurpose2.put("Employee Retail", 0.029); - ratesPerPurpose2.put("Employee Traffic/Parcels", 0.039); - ratesPerPurpose2.put("Employee Tertiary Sector Rest", 0.029); - - ratesPerPurpose3.put("Inhabitants", 0.025); - ratesPerPurpose3.put("Employee", 0.0); - ratesPerPurpose3.put("Employee Primary Sector", 0.0168); - ratesPerPurpose3.put("Employee Construction", 0.168); - ratesPerPurpose3.put("Employee Secondary Sector Rest", 0.0168); - ratesPerPurpose3.put("Employee Retail", 0.0168); - ratesPerPurpose3.put("Employee Traffic/Parcels", 0.097); - ratesPerPurpose3.put("Employee Tertiary Sector Rest", 0.168); - - ratesPerPurpose4.put("Inhabitants", 0.002); - ratesPerPurpose4.put("Employee", 0.0); - ratesPerPurpose4.put("Employee Primary Sector", 0.025); - ratesPerPurpose4.put("Employee Construction", 0.025); - ratesPerPurpose4.put("Employee Secondary Sector Rest", 0.025); - ratesPerPurpose4.put("Employee Retail", 0.025); - ratesPerPurpose4.put("Employee Traffic/Parcels", 0.075); - ratesPerPurpose4.put("Employee Tertiary Sector Rest", 0.025); - - ratesPerPurpose5.put("Inhabitants", 0.004); - ratesPerPurpose5.put("Employee", 0.0); - ratesPerPurpose5.put("Employee Primary Sector", 0.015); - ratesPerPurpose5.put("Employee Construction", 0.002); - ratesPerPurpose5.put("Employee Secondary Sector Rest", 0.015); - ratesPerPurpose5.put("Employee Retail", 0.015); - ratesPerPurpose5.put("Employee Traffic/Parcels", 0.02); - ratesPerPurpose5.put("Employee Tertiary Sector Rest", 0.015); - - } - } else if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { - if (generationType.equals("start")) { - ratesPerPurpose1.put("Inhabitants", 0.0); - ratesPerPurpose1.put("Employee", 0.0); - ratesPerPurpose1.put("Employee Primary Sector", 0.0); - ratesPerPurpose1.put("Employee Construction", 0.0); - ratesPerPurpose1.put("Employee Secondary Sector Rest", 0.023); - ratesPerPurpose1.put("Employee Retail", 0.0); - ratesPerPurpose1.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose1.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose2.put("Inhabitants", 0.0); - ratesPerPurpose2.put("Employee", 0.002); - ratesPerPurpose2.put("Employee Primary Sector", 0.0); - ratesPerPurpose2.put("Employee Construction", 0.0); - ratesPerPurpose2.put("Employee Secondary Sector Rest", 0.049); - ratesPerPurpose2.put("Employee Retail", 0.0); - ratesPerPurpose2.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose2.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose3.put("Inhabitants", 0.0); - ratesPerPurpose3.put("Employee", 0.002); - ratesPerPurpose3.put("Employee Primary Sector", 0.0); - ratesPerPurpose3.put("Employee Construction", 0.0); - ratesPerPurpose3.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose3.put("Employee Retail", 0.139); - ratesPerPurpose3.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose3.put("Employee Tertiary Sector Rest", 0.059); - - ratesPerPurpose4.put("Inhabitants", 0.0); - ratesPerPurpose4.put("Employee", 0.002); - ratesPerPurpose4.put("Employee Primary Sector", 0.0); - ratesPerPurpose4.put("Employee Construction", 0.0); - ratesPerPurpose4.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose4.put("Employee Retail", 0.0); - ratesPerPurpose4.put("Employee Traffic/Parcels", 0.333); - ratesPerPurpose4.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose5.put("Inhabitants", 0.0); - ratesPerPurpose5.put("Employee", 0.002); - ratesPerPurpose5.put("Employee Primary Sector", 0.0); - ratesPerPurpose5.put("Employee Construction", 0.220); - ratesPerPurpose5.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose5.put("Employee Retail", 0.0); - ratesPerPurpose5.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose5.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose6.put("Inhabitants", 0.009); - ratesPerPurpose6.put("Employee", 0.0); - ratesPerPurpose6.put("Employee Primary Sector", 0.0); - ratesPerPurpose6.put("Employee Construction", 0.0); - ratesPerPurpose6.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose6.put("Employee Retail", 0.0); - ratesPerPurpose6.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose6.put("Employee Tertiary Sector Rest", 0.0); - - } else if (generationType.equals("stop")) { - ratesPerPurpose1.put("Inhabitants", 0.0); - ratesPerPurpose1.put("Employee", 0.0); - ratesPerPurpose1.put("Employee Primary Sector", 0.0); - ratesPerPurpose1.put("Employee Construction", 0.0); - ratesPerPurpose1.put("Employee Secondary Sector Rest", 0.031); - ratesPerPurpose1.put("Employee Retail", 0.0); - ratesPerPurpose1.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose1.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose2.put("Inhabitants", 0.001); - ratesPerPurpose2.put("Employee", 0.0); - ratesPerPurpose2.put("Employee Primary Sector", 0.001); - ratesPerPurpose2.put("Employee Construction", 0.01); - ratesPerPurpose2.put("Employee Secondary Sector Rest", 0.011); - ratesPerPurpose2.put("Employee Retail", 0.021); - ratesPerPurpose2.put("Employee Traffic/Parcels", 0.001); - ratesPerPurpose2.put("Employee Tertiary Sector Rest", 0.001); - - ratesPerPurpose3.put("Inhabitants", 0.009); - ratesPerPurpose3.put("Employee", 0.0); - ratesPerPurpose3.put("Employee Primary Sector", 0.02); - ratesPerPurpose3.put("Employee Construction", 0.005); - ratesPerPurpose3.put("Employee Secondary Sector Rest", 0.029); - ratesPerPurpose3.put("Employee Retail", 0.055); - ratesPerPurpose3.put("Employee Traffic/Parcels", 0.02); - ratesPerPurpose3.put("Employee Tertiary Sector Rest", 0.02); - - ratesPerPurpose4.put("Inhabitants", 0.014); - ratesPerPurpose4.put("Employee", 0.0); - ratesPerPurpose4.put("Employee Primary Sector", 0.02); - ratesPerPurpose4.put("Employee Construction", 0.002); - ratesPerPurpose4.put("Employee Secondary Sector Rest", 0.11); - ratesPerPurpose4.put("Employee Retail", 0.154); - ratesPerPurpose4.put("Employee Traffic/Parcels", 0.02); - ratesPerPurpose4.put("Employee Tertiary Sector Rest", 0.02); - - ratesPerPurpose5.put("Inhabitants", 0.002); - ratesPerPurpose5.put("Employee", 0.0); - ratesPerPurpose5.put("Employee Primary Sector", 0.005); - ratesPerPurpose5.put("Employee Construction", 0.002); - ratesPerPurpose5.put("Employee Secondary Sector Rest", 0.01); - ratesPerPurpose5.put("Employee Retail", 0.01); - ratesPerPurpose5.put("Employee Traffic/Parcels", 0.005); - ratesPerPurpose5.put("Employee Tertiary Sector Rest", 0.005); - - ratesPerPurpose6.put("Inhabitants", 0.002); - ratesPerPurpose6.put("Employee", 0.0); - ratesPerPurpose6.put("Employee Primary Sector", 0.005); - ratesPerPurpose6.put("Employee Construction", 0.002); - ratesPerPurpose6.put("Employee Secondary Sector Rest", 0.01); - ratesPerPurpose6.put("Employee Retail", 0.01); - ratesPerPurpose6.put("Employee Traffic/Parcels", 0.005); - ratesPerPurpose6.put("Employee Tertiary Sector Rest", 0.005); - } - generationRates.put(6, ratesPerPurpose6); - } - generationRates.put(1, ratesPerPurpose1); - generationRates.put(2, ratesPerPurpose2); - generationRates.put(3, ratesPerPurpose3); - generationRates.put(4, ratesPerPurpose4); - generationRates.put(5, ratesPerPurpose5); - return generationRates; - } - - /** - * Sets the commitment rates based on the IVV 2005 for the goodsTraffic. The - * commitment rate for the commercialPersonTraffic is 1, because mode choice will be - * done in MATSim. - * - * @param smallScaleCommercialTrafficType used trafficType (freight or business traffic) - * @param commitmentType start or stop parameter - */ - private static Map> setCommitmentRates(String smallScaleCommercialTrafficType, - String commitmentType) { - Map> commitmentRates = new HashMap<>(); - - if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { - - // the first number is the purpose; second number the vehicle type - Map ratesPerPurpose1_1 = new HashMap<>(); - Map ratesPerPurpose1_2 = new HashMap<>(); - Map ratesPerPurpose1_3 = new HashMap<>(); - Map ratesPerPurpose1_4 = new HashMap<>(); - Map ratesPerPurpose1_5 = new HashMap<>(); - Map ratesPerPurpose2_1 = new HashMap<>(); - Map ratesPerPurpose2_2 = new HashMap<>(); - Map ratesPerPurpose2_3 = new HashMap<>(); - Map ratesPerPurpose2_4 = new HashMap<>(); - Map ratesPerPurpose2_5 = new HashMap<>(); - Map ratesPerPurpose3_1 = new HashMap<>(); - Map ratesPerPurpose3_2 = new HashMap<>(); - Map ratesPerPurpose3_3 = new HashMap<>(); - Map ratesPerPurpose3_4 = new HashMap<>(); - Map ratesPerPurpose3_5 = new HashMap<>(); - Map ratesPerPurpose4_1 = new HashMap<>(); - Map ratesPerPurpose4_2 = new HashMap<>(); - Map ratesPerPurpose4_3 = new HashMap<>(); - Map ratesPerPurpose4_4 = new HashMap<>(); - Map ratesPerPurpose4_5 = new HashMap<>(); - Map ratesPerPurpose5_1 = new HashMap<>(); - Map ratesPerPurpose5_2 = new HashMap<>(); - Map ratesPerPurpose5_3 = new HashMap<>(); - Map ratesPerPurpose5_4 = new HashMap<>(); - Map ratesPerPurpose5_5 = new HashMap<>(); - Map ratesPerPurpose6_1 = new HashMap<>(); - Map ratesPerPurpose6_2 = new HashMap<>(); - Map ratesPerPurpose6_3 = new HashMap<>(); - Map ratesPerPurpose6_4 = new HashMap<>(); - Map ratesPerPurpose6_5 = new HashMap<>(); - if (commitmentType.equals("start")) { - ratesPerPurpose1_1.put("Inhabitants", 0.0); - ratesPerPurpose1_1.put("Employee", 0.8); - ratesPerPurpose1_1.put("Employee Primary Sector", 0.0); - ratesPerPurpose1_1.put("Employee Construction", 0.0); - ratesPerPurpose1_1.put("Employee Secondary Sector Rest", 0.44); - ratesPerPurpose1_1.put("Employee Retail", 0.0); - ratesPerPurpose1_1.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose1_1.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose1_2.put("Inhabitants", 0.0); - ratesPerPurpose1_2.put("Employee", 0.1); - ratesPerPurpose1_2.put("Employee Primary Sector", 0.0); - ratesPerPurpose1_2.put("Employee Construction", 0.0); - ratesPerPurpose1_2.put("Employee Secondary Sector Rest", 0.11); - ratesPerPurpose1_2.put("Employee Retail", 0.0); - ratesPerPurpose1_2.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose1_2.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose1_3.put("Inhabitants", 0.0); - ratesPerPurpose1_3.put("Employee", 0.1); - ratesPerPurpose1_3.put("Employee Primary Sector", 0.0); - ratesPerPurpose1_3.put("Employee Construction", 0.0); - ratesPerPurpose1_3.put("Employee Secondary Sector Rest", 0.22); - ratesPerPurpose1_3.put("Employee Retail", 0.0); - ratesPerPurpose1_3.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose1_3.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose1_4.put("Inhabitants", 0.0); - ratesPerPurpose1_4.put("Employee", 0.0); - ratesPerPurpose1_4.put("Employee Primary Sector", 0.0); - ratesPerPurpose1_4.put("Employee Construction", 0.0); - ratesPerPurpose1_4.put("Employee Secondary Sector Rest", 0.06); - ratesPerPurpose1_4.put("Employee Retail", 0.0); - ratesPerPurpose1_4.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose1_4.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose1_5.put("Inhabitants", 0.0); - ratesPerPurpose1_5.put("Employee", 0.0); - ratesPerPurpose1_5.put("Employee Primary Sector", 0.0); - ratesPerPurpose1_5.put("Employee Construction", 0.0); - ratesPerPurpose1_5.put("Employee Secondary Sector Rest", 0.16); - ratesPerPurpose1_5.put("Employee Retail", 0.0); - ratesPerPurpose1_5.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose1_5.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose2_1.put("Inhabitants", 0.0); - ratesPerPurpose2_1.put("Employee", 0.8); - ratesPerPurpose2_1.put("Employee Primary Sector", 0.0); - ratesPerPurpose2_1.put("Employee Construction", 0.0); - ratesPerPurpose2_1.put("Employee Secondary Sector Rest", 0.44); - ratesPerPurpose2_1.put("Employee Retail", 0.0); - ratesPerPurpose2_1.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose2_1.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose2_2.put("Inhabitants", 0.0); - ratesPerPurpose2_2.put("Employee", 0.1); - ratesPerPurpose2_2.put("Employee Primary Sector", 0.0); - ratesPerPurpose2_2.put("Employee Construction", 0.0); - ratesPerPurpose2_2.put("Employee Secondary Sector Rest", 0.11); - ratesPerPurpose2_2.put("Employee Retail", 0.0); - ratesPerPurpose2_2.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose2_2.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose2_3.put("Inhabitants", 0.0); - ratesPerPurpose2_3.put("Employee", 0.1); - ratesPerPurpose2_3.put("Employee Primary Sector", 0.0); - ratesPerPurpose2_3.put("Employee Construction", 0.0); - ratesPerPurpose2_3.put("Employee Secondary Sector Rest", 0.22); - ratesPerPurpose2_3.put("Employee Retail", 0.0); - ratesPerPurpose2_3.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose2_3.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose2_4.put("Inhabitants", 0.0); - ratesPerPurpose2_4.put("Employee", 0.0); - ratesPerPurpose2_4.put("Employee Primary Sector", 0.0); - ratesPerPurpose2_4.put("Employee Construction", 0.0); - ratesPerPurpose2_4.put("Employee Secondary Sector Rest", 0.06); - ratesPerPurpose2_4.put("Employee Retail", 0.0); - ratesPerPurpose2_4.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose2_4.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose2_5.put("Inhabitants", 0.0); - ratesPerPurpose2_5.put("Employee", 0.0); - ratesPerPurpose2_5.put("Employee Primary Sector", 0.0); - ratesPerPurpose2_5.put("Employee Construction", 0.0); - ratesPerPurpose2_5.put("Employee Secondary Sector Rest", 0.16); - ratesPerPurpose2_5.put("Employee Retail", 0.0); - ratesPerPurpose2_5.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose2_5.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose3_1.put("Inhabitants", 0.0); - ratesPerPurpose3_1.put("Employee", 0.8); - ratesPerPurpose3_1.put("Employee Primary Sector", 0.0); - ratesPerPurpose3_1.put("Employee Construction", 0.0); - ratesPerPurpose3_1.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose3_1.put("Employee Retail", 0.46); - ratesPerPurpose3_1.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose3_1.put("Employee Tertiary Sector Rest", 0.54); - - ratesPerPurpose3_2.put("Inhabitants", 0.0); - ratesPerPurpose3_2.put("Employee", 0.1); - ratesPerPurpose3_2.put("Employee Primary Sector", 0.0); - ratesPerPurpose3_2.put("Employee Construction", 0.0); - ratesPerPurpose3_2.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose3_2.put("Employee Retail", 0.1); - ratesPerPurpose3_2.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose3_2.put("Employee Tertiary Sector Rest", 0.1); - - ratesPerPurpose3_3.put("Inhabitants", 0.0); - ratesPerPurpose3_3.put("Employee", 0.1); - ratesPerPurpose3_3.put("Employee Primary Sector", 0.0); - ratesPerPurpose3_3.put("Employee Construction", 0.0); - ratesPerPurpose3_3.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose3_3.put("Employee Retail", 0.23); - ratesPerPurpose3_3.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose3_3.put("Employee Tertiary Sector Rest", 0.2); - - ratesPerPurpose3_4.put("Inhabitants", 0.0); - ratesPerPurpose3_4.put("Employee", 0.0); - ratesPerPurpose3_4.put("Employee Primary Sector", 0.0); - ratesPerPurpose3_4.put("Employee Construction", 0.0); - ratesPerPurpose3_4.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose3_4.put("Employee Retail", 0.06); - ratesPerPurpose3_4.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose3_4.put("Employee Tertiary Sector Rest", 0.02); - - ratesPerPurpose3_5.put("Inhabitants", 0.0); - ratesPerPurpose3_5.put("Employee", 0.0); - ratesPerPurpose3_5.put("Employee Primary Sector", 0.0); - ratesPerPurpose3_5.put("Employee Construction", 0.0); - ratesPerPurpose3_5.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose3_5.put("Employee Retail", 0.15); - ratesPerPurpose3_5.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose3_5.put("Employee Tertiary Sector Rest", 0.14); - - ratesPerPurpose4_1.put("Inhabitants", 0.009); - ratesPerPurpose4_1.put("Employee", 0.8); - ratesPerPurpose4_1.put("Employee Primary Sector", 0.0); - ratesPerPurpose4_1.put("Employee Construction", 0.0); - ratesPerPurpose4_1.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose4_1.put("Employee Retail", 0.0); - ratesPerPurpose4_1.put("Employee Traffic/Parcels", 0.18); - ratesPerPurpose4_1.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose4_2.put("Inhabitants", 0.0); - ratesPerPurpose4_2.put("Employee", 0.1); - ratesPerPurpose4_2.put("Employee Primary Sector", 0.0); - ratesPerPurpose4_2.put("Employee Construction", 0.0); - ratesPerPurpose4_2.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose4_2.put("Employee Retail", 0.0); - ratesPerPurpose4_2.put("Employee Traffic/Parcels", 0.06); - ratesPerPurpose4_2.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose4_3.put("Inhabitants", 0.0); - ratesPerPurpose4_3.put("Employee", 0.1); - ratesPerPurpose4_3.put("Employee Primary Sector", 0.0); - ratesPerPurpose4_3.put("Employee Construction", 0.0); - ratesPerPurpose4_3.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose4_3.put("Employee Retail", 0.0); - ratesPerPurpose4_3.put("Employee Traffic/Parcels", 0.25); - ratesPerPurpose4_3.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose4_4.put("Inhabitants", 0.0); - ratesPerPurpose4_4.put("Employee", 0.0); - ratesPerPurpose4_4.put("Employee Primary Sector", 0.0); - ratesPerPurpose4_4.put("Employee Construction", 0.0); - ratesPerPurpose4_4.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose4_4.put("Employee Retail", 0.0); - ratesPerPurpose4_4.put("Employee Traffic/Parcels", 0.08); - ratesPerPurpose4_4.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose4_5.put("Inhabitants", 0.0); - ratesPerPurpose4_5.put("Employee", 0.0); - ratesPerPurpose4_5.put("Employee Primary Sector", 0.0); - ratesPerPurpose4_5.put("Employee Construction", 0.0); - ratesPerPurpose4_5.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose4_5.put("Employee Retail", 0.0); - ratesPerPurpose4_5.put("Employee Traffic/Parcels", 0.43); - ratesPerPurpose4_5.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose5_1.put("Inhabitants", 0.0); - ratesPerPurpose5_1.put("Employee", 0.8); - ratesPerPurpose5_1.put("Employee Primary Sector", 0.0); - ratesPerPurpose5_1.put("Employee Construction", 0.25); - ratesPerPurpose5_1.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose5_1.put("Employee Retail", 0.0); - ratesPerPurpose5_1.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose5_1.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose5_2.put("Inhabitants", 0.0); - ratesPerPurpose5_2.put("Employee", 0.1); - ratesPerPurpose5_2.put("Employee Primary Sector", 0.0); - ratesPerPurpose5_2.put("Employee Construction", 0.2); - ratesPerPurpose5_2.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose5_2.put("Employee Retail", 0.0); - ratesPerPurpose5_2.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose5_2.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose5_3.put("Inhabitants", 0.0); - ratesPerPurpose5_3.put("Employee", 0.1); - ratesPerPurpose5_3.put("Employee Primary Sector", 0.0); - ratesPerPurpose5_3.put("Employee Construction", 0.25); - ratesPerPurpose5_3.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose5_3.put("Employee Retail", 0.139); - ratesPerPurpose5_3.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose5_3.put("Employee Tertiary Sector Rest", 0.059); - - ratesPerPurpose5_4.put("Inhabitants", 0.0); - ratesPerPurpose5_4.put("Employee", 0.0); - ratesPerPurpose5_4.put("Employee Primary Sector", 0.0); - ratesPerPurpose5_4.put("Employee Construction", 0.02); - ratesPerPurpose5_4.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose5_4.put("Employee Retail", 0.0); - ratesPerPurpose5_4.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose5_4.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose5_5.put("Inhabitants", 0.0); - ratesPerPurpose5_5.put("Employee", 0.0); - ratesPerPurpose5_5.put("Employee Primary Sector", 0.0); - ratesPerPurpose5_5.put("Employee Construction", 0.28); - ratesPerPurpose5_5.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose5_5.put("Employee Retail", 0.0); - ratesPerPurpose5_5.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose5_5.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose6_1.put("Inhabitants", 0.0); - ratesPerPurpose6_1.put("Employee", 0.0); - ratesPerPurpose6_1.put("Employee Primary Sector", 0.0); - ratesPerPurpose6_1.put("Employee Construction", 0.0); - ratesPerPurpose6_1.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose6_1.put("Employee Retail", 0.0); - ratesPerPurpose6_1.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose6_1.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose6_2.put("Inhabitants", 0.29); - ratesPerPurpose6_2.put("Employee", 0.0); - ratesPerPurpose6_2.put("Employee Primary Sector", 0.0); - ratesPerPurpose6_2.put("Employee Construction", 0.0); - ratesPerPurpose6_2.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose6_2.put("Employee Retail", 0.0); - ratesPerPurpose6_2.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose6_2.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose6_3.put("Inhabitants", 0.63); - ratesPerPurpose6_3.put("Employee", 0.0); - ratesPerPurpose6_3.put("Employee Primary Sector", 0.0); - ratesPerPurpose6_3.put("Employee Construction", 0.0); - ratesPerPurpose6_3.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose6_3.put("Employee Retail", 0.0); - ratesPerPurpose6_3.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose6_3.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose6_4.put("Inhabitants", 0.07); - ratesPerPurpose6_4.put("Employee", 0.0); - ratesPerPurpose6_4.put("Employee Primary Sector", 0.0); - ratesPerPurpose6_4.put("Employee Construction", 0.0); - ratesPerPurpose6_4.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose6_4.put("Employee Retail", 0.0); - ratesPerPurpose6_4.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose6_4.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose6_5.put("Inhabitants", 0.001); - ratesPerPurpose6_5.put("Employee", 0.0); - ratesPerPurpose6_5.put("Employee Primary Sector", 0.0); - ratesPerPurpose6_5.put("Employee Construction", 0.2); - ratesPerPurpose6_5.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose6_5.put("Employee Retail", 0.0); - ratesPerPurpose6_5.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose6_5.put("Employee Tertiary Sector Rest", 0.0); - } else if (commitmentType.equals("stop")) { - ratesPerPurpose1_1.put("Inhabitants", 0.0); - ratesPerPurpose1_1.put("Employee", 0.0); - ratesPerPurpose1_1.put("Employee Primary Sector", 0.0); - ratesPerPurpose1_1.put("Employee Construction", 0.0); - ratesPerPurpose1_1.put("Employee Secondary Sector Rest", 0.35); - ratesPerPurpose1_1.put("Employee Retail", 0.0); - ratesPerPurpose1_1.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose1_1.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose1_2.put("Inhabitants", 0.0); - ratesPerPurpose1_2.put("Employee", 0.0); - ratesPerPurpose1_2.put("Employee Primary Sector", 0.0); - ratesPerPurpose1_2.put("Employee Construction", 0.0); - ratesPerPurpose1_2.put("Employee Secondary Sector Rest", 0.1); - ratesPerPurpose1_2.put("Employee Retail", 0.0); - ratesPerPurpose1_2.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose1_2.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose1_3.put("Inhabitants", 0.0); - ratesPerPurpose1_3.put("Employee", 0.0); - ratesPerPurpose1_3.put("Employee Primary Sector", 0.0); - ratesPerPurpose1_3.put("Employee Construction", 0.0); - ratesPerPurpose1_3.put("Employee Secondary Sector Rest", 0.27); - ratesPerPurpose1_3.put("Employee Retail", 0.0); - ratesPerPurpose1_3.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose1_3.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose1_4.put("Inhabitants", 0.0); - ratesPerPurpose1_4.put("Employee", 0.0); - ratesPerPurpose1_4.put("Employee Primary Sector", 0.0); - ratesPerPurpose1_4.put("Employee Construction", 0.0); - ratesPerPurpose1_4.put("Employee Secondary Sector Rest", 0.01); - ratesPerPurpose1_4.put("Employee Retail", 0.0); - ratesPerPurpose1_4.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose1_4.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose1_5.put("Inhabitants", 0.0); - ratesPerPurpose1_5.put("Employee", 0.0); - ratesPerPurpose1_5.put("Employee Primary Sector", 0.0); - ratesPerPurpose1_5.put("Employee Construction", 0.0); - ratesPerPurpose1_5.put("Employee Secondary Sector Rest", 0.27); - ratesPerPurpose1_5.put("Employee Retail", 0.0); - ratesPerPurpose1_5.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose1_5.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose2_1.put("Inhabitants", 0.55); - ratesPerPurpose2_1.put("Employee", 0.0); - ratesPerPurpose2_1.put("Employee Primary Sector", 0.46); - ratesPerPurpose2_1.put("Employee Construction", 0.46); - ratesPerPurpose2_1.put("Employee Secondary Sector Rest", 0.46); - ratesPerPurpose2_1.put("Employee Retail", 0.46); - ratesPerPurpose2_1.put("Employee Traffic/Parcels", 0.34); - ratesPerPurpose2_1.put("Employee Tertiary Sector Rest", 0.46); - - ratesPerPurpose2_2.put("Inhabitants", 0.09); - ratesPerPurpose2_2.put("Employee", 0.0); - ratesPerPurpose2_2.put("Employee Primary Sector", 0.09); - ratesPerPurpose2_2.put("Employee Construction", 0.09); - ratesPerPurpose2_2.put("Employee Secondary Sector Rest", 0.09); - ratesPerPurpose2_2.put("Employee Retail", 0.09); - ratesPerPurpose2_2.put("Employee Traffic/Parcels", 0.1); - ratesPerPurpose2_2.put("Employee Tertiary Sector Rest", 0.09); - - ratesPerPurpose2_3.put("Inhabitants", 0.21); - ratesPerPurpose2_3.put("Employee", 0.0); - ratesPerPurpose2_3.put("Employee Primary Sector", 0.22); - ratesPerPurpose2_3.put("Employee Construction", 0.22); - ratesPerPurpose2_3.put("Employee Secondary Sector Rest", 0.22); - ratesPerPurpose2_3.put("Employee Retail", 0.22); - ratesPerPurpose2_3.put("Employee Traffic/Parcels", 0.29); - ratesPerPurpose2_3.put("Employee Tertiary Sector Rest", 0.22); - - ratesPerPurpose2_4.put("Inhabitants", 0.06); - ratesPerPurpose2_4.put("Employee", 0.0); - ratesPerPurpose2_4.put("Employee Primary Sector", 0.06); - ratesPerPurpose2_4.put("Employee Construction", 0.06); - ratesPerPurpose2_4.put("Employee Secondary Sector Rest", 0.06); - ratesPerPurpose2_4.put("Employee Retail", 0.06); - ratesPerPurpose2_4.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose2_4.put("Employee Tertiary Sector Rest", 0.06); - - ratesPerPurpose2_5.put("Inhabitants", 0.1); - ratesPerPurpose2_5.put("Employee", 0.0); - ratesPerPurpose2_5.put("Employee Primary Sector", 0.17); - ratesPerPurpose2_5.put("Employee Construction", 0.17); - ratesPerPurpose2_5.put("Employee Secondary Sector Rest", 0.17); - ratesPerPurpose2_5.put("Employee Retail", 0.17); - ratesPerPurpose2_5.put("Employee Traffic/Parcels", 0.27); - ratesPerPurpose2_5.put("Employee Tertiary Sector Rest", 0.17); - - ratesPerPurpose3_1.put("Inhabitants", 0.489); - ratesPerPurpose3_1.put("Employee", 0.0); - ratesPerPurpose3_1.put("Employee Primary Sector", 0.538); - ratesPerPurpose3_1.put("Employee Construction", 0.538); - ratesPerPurpose3_1.put("Employee Secondary Sector Rest", 0.538); - ratesPerPurpose3_1.put("Employee Retail", 0.538); - ratesPerPurpose3_1.put("Employee Traffic/Parcels", 0.59); - ratesPerPurpose3_1.put("Employee Tertiary Sector Rest", 0.538); - - ratesPerPurpose3_2.put("Inhabitants", 0.106); - ratesPerPurpose3_2.put("Employee", 0.0); - ratesPerPurpose3_2.put("Employee Primary Sector", 0.092); - ratesPerPurpose3_2.put("Employee Construction", 0.092); - ratesPerPurpose3_2.put("Employee Secondary Sector Rest", 0.092); - ratesPerPurpose3_2.put("Employee Retail", 0.092); - ratesPerPurpose3_2.put("Employee Traffic/Parcels", 0.03); - ratesPerPurpose3_2.put("Employee Tertiary Sector Rest", 0.092); - - ratesPerPurpose3_3.put("Inhabitants", 0.26); - ratesPerPurpose3_3.put("Employee", 0.0); - ratesPerPurpose3_3.put("Employee Primary Sector", 0.19); - ratesPerPurpose3_3.put("Employee Construction", 0.19); - ratesPerPurpose3_3.put("Employee Secondary Sector Rest", 0.19); - ratesPerPurpose3_3.put("Employee Retail", 0.19); - ratesPerPurpose3_3.put("Employee Traffic/Parcels", 0.102); - ratesPerPurpose3_3.put("Employee Tertiary Sector Rest", 0.19); - - ratesPerPurpose3_4.put("Inhabitants", 0.033); - ratesPerPurpose3_4.put("Employee", 0.0); - ratesPerPurpose3_4.put("Employee Primary Sector", 0.032); - ratesPerPurpose3_4.put("Employee Construction", 0.032); - ratesPerPurpose3_4.put("Employee Secondary Sector Rest", 0.032); - ratesPerPurpose3_4.put("Employee Retail", 0.032); - ratesPerPurpose3_4.put("Employee Traffic/Parcels", 0.058); - ratesPerPurpose3_4.put("Employee Tertiary Sector Rest", 0.032); - - ratesPerPurpose3_5.put("Inhabitants", 0.112); - ratesPerPurpose3_5.put("Employee", 0.0); - ratesPerPurpose3_5.put("Employee Primary Sector", 0.147); - ratesPerPurpose3_5.put("Employee Construction", 0.147); - ratesPerPurpose3_5.put("Employee Secondary Sector Rest", 0.147); - ratesPerPurpose3_5.put("Employee Retail", 0.147); - ratesPerPurpose3_5.put("Employee Traffic/Parcels", 0.219); - ratesPerPurpose3_5.put("Employee Tertiary Sector Rest", 0.147); - - ratesPerPurpose4_1.put("Inhabitants", 0.37); - ratesPerPurpose4_1.put("Employee", 0.0); - ratesPerPurpose4_1.put("Employee Primary Sector", 0.14); - ratesPerPurpose4_1.put("Employee Construction", 0.14); - ratesPerPurpose4_1.put("Employee Secondary Sector Rest", 0.14); - ratesPerPurpose4_1.put("Employee Retail", 0.14); - ratesPerPurpose4_1.put("Employee Traffic/Parcels", 0.06); - ratesPerPurpose4_1.put("Employee Tertiary Sector Rest", 0.14); - - ratesPerPurpose4_2.put("Inhabitants", 0.05); - ratesPerPurpose4_2.put("Employee", 0.0); - ratesPerPurpose4_2.put("Employee Primary Sector", 0.07); - ratesPerPurpose4_2.put("Employee Construction", 0.07); - ratesPerPurpose4_2.put("Employee Secondary Sector Rest", 0.07); - ratesPerPurpose4_2.put("Employee Retail", 0.07); - ratesPerPurpose4_2.put("Employee Traffic/Parcels", 0.07); - ratesPerPurpose4_2.put("Employee Tertiary Sector Rest", 0.07); - - ratesPerPurpose4_3.put("Inhabitants", 0.4); - ratesPerPurpose4_3.put("Employee", 0.0); - ratesPerPurpose4_3.put("Employee Primary Sector", 0.21); - ratesPerPurpose4_3.put("Employee Construction", 0.21); - ratesPerPurpose4_3.put("Employee Secondary Sector Rest", 0.21); - ratesPerPurpose4_3.put("Employee Retail", 0.21); - ratesPerPurpose4_3.put("Employee Traffic/Parcels", 0.19); - ratesPerPurpose4_3.put("Employee Tertiary Sector Rest", 0.21); - - ratesPerPurpose4_4.put("Inhabitants", 0.13); - ratesPerPurpose4_4.put("Employee", 0.0); - ratesPerPurpose4_4.put("Employee Primary Sector", 0.05); - ratesPerPurpose4_4.put("Employee Construction", 0.05); - ratesPerPurpose4_4.put("Employee Secondary Sector Rest", 0.05); - ratesPerPurpose4_4.put("Employee Retail", 0.05); - ratesPerPurpose4_4.put("Employee Traffic/Parcels", 0.08); - ratesPerPurpose4_4.put("Employee Tertiary Sector Rest", 0.05); - - ratesPerPurpose4_5.put("Inhabitants", 0.05); - ratesPerPurpose4_5.put("Employee", 0.0); - ratesPerPurpose4_5.put("Employee Primary Sector", 0.54); - ratesPerPurpose4_5.put("Employee Construction", 0.54); - ratesPerPurpose4_5.put("Employee Secondary Sector Rest", 0.54); - ratesPerPurpose4_5.put("Employee Retail", 0.54); - ratesPerPurpose4_5.put("Employee Traffic/Parcels", 0.61); - ratesPerPurpose4_5.put("Employee Tertiary Sector Rest", 0.54); - - ratesPerPurpose5_1.put("Inhabitants", 0.16); - ratesPerPurpose5_1.put("Employee", 0.0); - ratesPerPurpose5_1.put("Employee Primary Sector", 0.4); - ratesPerPurpose5_1.put("Employee Construction", 0.4); - ratesPerPurpose5_1.put("Employee Secondary Sector Rest", 0.4); - ratesPerPurpose5_1.put("Employee Retail", 0.4); - ratesPerPurpose5_1.put("Employee Traffic/Parcels", 0.14); - ratesPerPurpose5_1.put("Employee Tertiary Sector Rest", 0.4); - - ratesPerPurpose5_2.put("Inhabitants", 0.55); - ratesPerPurpose5_2.put("Employee", 0.11); - ratesPerPurpose5_2.put("Employee Primary Sector", 0.11); - ratesPerPurpose5_2.put("Employee Construction", 0.11); - ratesPerPurpose5_2.put("Employee Secondary Sector Rest", 0.11); - ratesPerPurpose5_2.put("Employee Retail", 0.11); - ratesPerPurpose5_2.put("Employee Traffic/Parcels", 0.06); - ratesPerPurpose5_2.put("Employee Tertiary Sector Rest", 0.11); - - ratesPerPurpose5_3.put("Inhabitants", 0.22); - ratesPerPurpose5_3.put("Employee", 0.0); - ratesPerPurpose5_3.put("Employee Primary Sector", 0.17); - ratesPerPurpose5_3.put("Employee Construction", 0.17); - ratesPerPurpose5_3.put("Employee Secondary Sector Rest", 0.17); - ratesPerPurpose5_3.put("Employee Retail", 0.17); - ratesPerPurpose5_3.put("Employee Traffic/Parcels", 0.21); - ratesPerPurpose5_3.put("Employee Tertiary Sector Rest", 0.17); - - ratesPerPurpose5_4.put("Inhabitants", 0.0); - ratesPerPurpose5_4.put("Employee", 0.0); - ratesPerPurpose5_4.put("Employee Primary Sector", 0.04); - ratesPerPurpose5_4.put("Employee Construction", 0.04); - ratesPerPurpose5_4.put("Employee Secondary Sector Rest", 0.04); - ratesPerPurpose5_4.put("Employee Retail", 0.04); - ratesPerPurpose5_4.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose5_4.put("Employee Tertiary Sector Rest", 0.04); - - ratesPerPurpose5_5.put("Inhabitants", 0.06); - ratesPerPurpose5_5.put("Employee", 0.0); - ratesPerPurpose5_5.put("Employee Primary Sector", 0.28); - ratesPerPurpose5_5.put("Employee Construction", 0.28); - ratesPerPurpose5_5.put("Employee Secondary Sector Rest", 0.28); - ratesPerPurpose5_5.put("Employee Retail", 0.28); - ratesPerPurpose5_5.put("Employee Traffic/Parcels", 0.58); - ratesPerPurpose5_5.put("Employee Tertiary Sector Rest", 0.28); - - ratesPerPurpose6_1.put("Inhabitants", 0.0); - ratesPerPurpose6_1.put("Employee", 0.0); - ratesPerPurpose6_1.put("Employee Primary Sector", 0.0); - ratesPerPurpose6_1.put("Employee Construction", 0.0); - ratesPerPurpose6_1.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose6_1.put("Employee Retail", 0.0); - ratesPerPurpose6_1.put("Employee Traffic/Parcels", 0.0); - ratesPerPurpose6_1.put("Employee Tertiary Sector Rest", 0.0); - - ratesPerPurpose6_2.put("Inhabitants", 0.85); - ratesPerPurpose6_2.put("Employee", 0.0); - ratesPerPurpose6_2.put("Employee Primary Sector", 0.21); - ratesPerPurpose6_2.put("Employee Construction", 0.21); - ratesPerPurpose6_2.put("Employee Secondary Sector Rest", 0.21); - ratesPerPurpose6_2.put("Employee Retail", 0.21); - ratesPerPurpose6_2.put("Employee Traffic/Parcels", 0.09); - ratesPerPurpose6_2.put("Employee Tertiary Sector Rest", 0.21); - - ratesPerPurpose6_3.put("Inhabitants", 0.15); - ratesPerPurpose6_3.put("Employee", 0.0); - ratesPerPurpose6_3.put("Employee Primary Sector", 0.58); - ratesPerPurpose6_3.put("Employee Construction", 0.58); - ratesPerPurpose6_3.put("Employee Secondary Sector Rest", 0.58); - ratesPerPurpose6_3.put("Employee Retail", 0.58); - ratesPerPurpose6_3.put("Employee Traffic/Parcels", 0.55); - ratesPerPurpose6_3.put("Employee Tertiary Sector Rest", 0.58); - - ratesPerPurpose6_4.put("Inhabitants", 0.0); - ratesPerPurpose6_4.put("Employee", 0.0); - ratesPerPurpose6_4.put("Employee Primary Sector", 0.21); - ratesPerPurpose6_4.put("Employee Construction", 0.21); - ratesPerPurpose6_4.put("Employee Secondary Sector Rest", 0.21); - ratesPerPurpose6_4.put("Employee Retail", 0.21); - ratesPerPurpose6_4.put("Employee Traffic/Parcels", 0.25); - ratesPerPurpose6_4.put("Employee Tertiary Sector Rest", 0.21); - - ratesPerPurpose6_5.put("Inhabitants", 0.0); - ratesPerPurpose6_5.put("Employee", 0.0); - ratesPerPurpose6_5.put("Employee Primary Sector", 0.0); - ratesPerPurpose6_5.put("Employee Construction", 0.0); - ratesPerPurpose6_5.put("Employee Secondary Sector Rest", 0.0); - ratesPerPurpose6_5.put("Employee Retail", 0.0); - ratesPerPurpose6_5.put("Employee Traffic/Parcels", 0.11); - ratesPerPurpose6_5.put("Employee Tertiary Sector Rest", 0.0); - } - commitmentRates.put("1_1", ratesPerPurpose1_1); - commitmentRates.put("1_2", ratesPerPurpose1_2); - commitmentRates.put("1_3", ratesPerPurpose1_3); - commitmentRates.put("1_4", ratesPerPurpose1_4); - commitmentRates.put("1_5", ratesPerPurpose1_5); - commitmentRates.put("2_1", ratesPerPurpose2_1); - commitmentRates.put("2_2", ratesPerPurpose2_2); - commitmentRates.put("2_3", ratesPerPurpose2_3); - commitmentRates.put("2_4", ratesPerPurpose2_4); - commitmentRates.put("2_5", ratesPerPurpose2_5); - commitmentRates.put("3_1", ratesPerPurpose3_1); - commitmentRates.put("3_2", ratesPerPurpose3_2); - commitmentRates.put("3_3", ratesPerPurpose3_3); - commitmentRates.put("3_4", ratesPerPurpose3_4); - commitmentRates.put("3_5", ratesPerPurpose3_5); - commitmentRates.put("4_1", ratesPerPurpose4_1); - commitmentRates.put("4_2", ratesPerPurpose4_2); - commitmentRates.put("4_3", ratesPerPurpose4_3); - commitmentRates.put("4_4", ratesPerPurpose4_4); - commitmentRates.put("4_5", ratesPerPurpose4_5); - commitmentRates.put("5_1", ratesPerPurpose5_1); - commitmentRates.put("5_2", ratesPerPurpose5_2); - commitmentRates.put("5_3", ratesPerPurpose5_3); - commitmentRates.put("5_4", ratesPerPurpose5_4); - commitmentRates.put("5_5", ratesPerPurpose5_5); - commitmentRates.put("6_1", ratesPerPurpose6_1); - commitmentRates.put("6_2", ratesPerPurpose6_2); - commitmentRates.put("6_3", ratesPerPurpose6_3); - commitmentRates.put("6_4", ratesPerPurpose6_4); - commitmentRates.put("6_5", ratesPerPurpose6_5); - } - return commitmentRates; - } } diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java new file mode 100644 index 00000000000..8fbd1aeb5b5 --- /dev/null +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java @@ -0,0 +1,31 @@ +package org.matsim.smallScaleCommercialTrafficGeneration; + +import it.unimi.dsi.fastutil.objects.Object2DoubleMap; +import org.matsim.api.core.v01.Id; +import org.matsim.api.core.v01.Scenario; +import org.matsim.api.core.v01.network.Link; +import org.matsim.facilities.ActivityFacility; +import org.matsim.smallScaleCommercialTrafficGeneration.data.GetCommercialTourSpecifications; + +import java.util.List; +import java.util.Map; + +/** + * Interface to generate carriers and demand needed by {@link GenerateSmallScaleCommercialTrafficDemand}. + * Standard implementation is {@link DefaultVehicleSelection}. + * Any configuration settings and external data-sources should be saved as attributes during initialization in the constructor of the class. + */ +public interface VehicleSelection{ + + /** + * Creates the carriers and the related demand. + * @param scenario Scenario (loaded from your config), where the carriers will be put into + */ + void createCarriers(Scenario scenario, + GetCommercialTourSpecifications getCommercialTourSpecifications, + Map>> facilitiesPerZone, + TripDistributionMatrix odMatrix, + String smallScaleCommercialTrafficType, + Map> resultingDataPerZone, + Map, Link>> linksPerZone); +} diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/data/GetGenerationRates.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/data/GetGenerationRates.java new file mode 100644 index 00000000000..5ed6ab36660 --- /dev/null +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/data/GetGenerationRates.java @@ -0,0 +1,856 @@ +package org.matsim.smallScaleCommercialTrafficGeneration.data; + +import java.util.HashMap; +import java.util.Map; + +public interface GetGenerationRates { + /** + * Sets the generation rates based on the IVV 2005 + * + * @param smallScaleCommercialTrafficType used trafficType (freight or business traffic) + * @param generationType start or stop rates + */ + static Map> setGenerationRates(String smallScaleCommercialTrafficType, + String generationType) { + + Map> generationRates = new HashMap<>(); + Map ratesPerPurpose1 = new HashMap<>(); + Map ratesPerPurpose2 = new HashMap<>(); + Map ratesPerPurpose3 = new HashMap<>(); + Map ratesPerPurpose4 = new HashMap<>(); + Map ratesPerPurpose5 = new HashMap<>(); + Map ratesPerPurpose6 = new HashMap<>(); + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + if (generationType.equals("start")) { + ratesPerPurpose1.put("Inhabitants", 0.0); + ratesPerPurpose1.put("Employee", 0.0); + ratesPerPurpose1.put("Employee Primary Sector", 0.0); + ratesPerPurpose1.put("Employee Construction", 0.0); + ratesPerPurpose1.put("Employee Secondary Sector Rest", 0.059); + ratesPerPurpose1.put("Employee Retail", 0.0); + ratesPerPurpose1.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose1.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose2.put("Inhabitants", 0.0); + ratesPerPurpose2.put("Employee", 0.029); + ratesPerPurpose2.put("Employee Primary Sector", 0.0); + ratesPerPurpose2.put("Employee Construction", 0.0); + ratesPerPurpose2.put("Employee Secondary Sector Rest", 0.045); + ratesPerPurpose2.put("Employee Retail", 0.0); + ratesPerPurpose2.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose2.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose3.put("Inhabitants", 0.0); + ratesPerPurpose3.put("Employee", 0.021); + ratesPerPurpose3.put("Employee Primary Sector", 0.0); + ratesPerPurpose3.put("Employee Construction", 0.0); + ratesPerPurpose3.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose3.put("Employee Retail", 0.0192); + ratesPerPurpose3.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose3.put("Employee Tertiary Sector Rest", 0.184); + + ratesPerPurpose4.put("Inhabitants", 0.0); + ratesPerPurpose4.put("Employee", 0.021); + ratesPerPurpose4.put("Employee Primary Sector", 0.0); + ratesPerPurpose4.put("Employee Construction", 0.0); + ratesPerPurpose4.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose4.put("Employee Retail", 0.0); + ratesPerPurpose4.put("Employee Traffic/Parcels", 0.203); + ratesPerPurpose4.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose5.put("Inhabitants", 0.0); + ratesPerPurpose5.put("Employee", 0.03); + ratesPerPurpose5.put("Employee Primary Sector", 0.0); + ratesPerPurpose5.put("Employee Construction", 0.29); + ratesPerPurpose5.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose5.put("Employee Retail", 0.0); + ratesPerPurpose5.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose5.put("Employee Tertiary Sector Rest", 0.0); + } else if (generationType.equals("stop")) { + ratesPerPurpose1.put("Inhabitants", 0.0); + ratesPerPurpose1.put("Employee", 0.0); + ratesPerPurpose1.put("Employee Primary Sector", 0.0); + ratesPerPurpose1.put("Employee Construction", 0.0); + ratesPerPurpose1.put("Employee Secondary Sector Rest", 0.02); + ratesPerPurpose1.put("Employee Retail", 0.0); + ratesPerPurpose1.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose1.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose2.put("Inhabitants", 0.002); + ratesPerPurpose2.put("Employee", 0.0); + ratesPerPurpose2.put("Employee Primary Sector", 0.029); + ratesPerPurpose2.put("Employee Construction", 0.029); + ratesPerPurpose2.put("Employee Secondary Sector Rest", 0.009); + ratesPerPurpose2.put("Employee Retail", 0.029); + ratesPerPurpose2.put("Employee Traffic/Parcels", 0.039); + ratesPerPurpose2.put("Employee Tertiary Sector Rest", 0.029); + + ratesPerPurpose3.put("Inhabitants", 0.025); + ratesPerPurpose3.put("Employee", 0.0); + ratesPerPurpose3.put("Employee Primary Sector", 0.0168); + ratesPerPurpose3.put("Employee Construction", 0.168); + ratesPerPurpose3.put("Employee Secondary Sector Rest", 0.0168); + ratesPerPurpose3.put("Employee Retail", 0.0168); + ratesPerPurpose3.put("Employee Traffic/Parcels", 0.097); + ratesPerPurpose3.put("Employee Tertiary Sector Rest", 0.168); + + ratesPerPurpose4.put("Inhabitants", 0.002); + ratesPerPurpose4.put("Employee", 0.0); + ratesPerPurpose4.put("Employee Primary Sector", 0.025); + ratesPerPurpose4.put("Employee Construction", 0.025); + ratesPerPurpose4.put("Employee Secondary Sector Rest", 0.025); + ratesPerPurpose4.put("Employee Retail", 0.025); + ratesPerPurpose4.put("Employee Traffic/Parcels", 0.075); + ratesPerPurpose4.put("Employee Tertiary Sector Rest", 0.025); + + ratesPerPurpose5.put("Inhabitants", 0.004); + ratesPerPurpose5.put("Employee", 0.0); + ratesPerPurpose5.put("Employee Primary Sector", 0.015); + ratesPerPurpose5.put("Employee Construction", 0.002); + ratesPerPurpose5.put("Employee Secondary Sector Rest", 0.015); + ratesPerPurpose5.put("Employee Retail", 0.015); + ratesPerPurpose5.put("Employee Traffic/Parcels", 0.02); + ratesPerPurpose5.put("Employee Tertiary Sector Rest", 0.015); + + } + } else if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { + if (generationType.equals("start")) { + ratesPerPurpose1.put("Inhabitants", 0.0); + ratesPerPurpose1.put("Employee", 0.0); + ratesPerPurpose1.put("Employee Primary Sector", 0.0); + ratesPerPurpose1.put("Employee Construction", 0.0); + ratesPerPurpose1.put("Employee Secondary Sector Rest", 0.023); + ratesPerPurpose1.put("Employee Retail", 0.0); + ratesPerPurpose1.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose1.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose2.put("Inhabitants", 0.0); + ratesPerPurpose2.put("Employee", 0.002); + ratesPerPurpose2.put("Employee Primary Sector", 0.0); + ratesPerPurpose2.put("Employee Construction", 0.0); + ratesPerPurpose2.put("Employee Secondary Sector Rest", 0.049); + ratesPerPurpose2.put("Employee Retail", 0.0); + ratesPerPurpose2.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose2.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose3.put("Inhabitants", 0.0); + ratesPerPurpose3.put("Employee", 0.002); + ratesPerPurpose3.put("Employee Primary Sector", 0.0); + ratesPerPurpose3.put("Employee Construction", 0.0); + ratesPerPurpose3.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose3.put("Employee Retail", 0.139); + ratesPerPurpose3.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose3.put("Employee Tertiary Sector Rest", 0.059); + + ratesPerPurpose4.put("Inhabitants", 0.0); + ratesPerPurpose4.put("Employee", 0.002); + ratesPerPurpose4.put("Employee Primary Sector", 0.0); + ratesPerPurpose4.put("Employee Construction", 0.0); + ratesPerPurpose4.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose4.put("Employee Retail", 0.0); + ratesPerPurpose4.put("Employee Traffic/Parcels", 0.333); + ratesPerPurpose4.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose5.put("Inhabitants", 0.0); + ratesPerPurpose5.put("Employee", 0.002); + ratesPerPurpose5.put("Employee Primary Sector", 0.0); + ratesPerPurpose5.put("Employee Construction", 0.220); + ratesPerPurpose5.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose5.put("Employee Retail", 0.0); + ratesPerPurpose5.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose5.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose6.put("Inhabitants", 0.009); + ratesPerPurpose6.put("Employee", 0.0); + ratesPerPurpose6.put("Employee Primary Sector", 0.0); + ratesPerPurpose6.put("Employee Construction", 0.0); + ratesPerPurpose6.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose6.put("Employee Retail", 0.0); + ratesPerPurpose6.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose6.put("Employee Tertiary Sector Rest", 0.0); + + } else if (generationType.equals("stop")) { + ratesPerPurpose1.put("Inhabitants", 0.0); + ratesPerPurpose1.put("Employee", 0.0); + ratesPerPurpose1.put("Employee Primary Sector", 0.0); + ratesPerPurpose1.put("Employee Construction", 0.0); + ratesPerPurpose1.put("Employee Secondary Sector Rest", 0.031); + ratesPerPurpose1.put("Employee Retail", 0.0); + ratesPerPurpose1.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose1.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose2.put("Inhabitants", 0.001); + ratesPerPurpose2.put("Employee", 0.0); + ratesPerPurpose2.put("Employee Primary Sector", 0.001); + ratesPerPurpose2.put("Employee Construction", 0.01); + ratesPerPurpose2.put("Employee Secondary Sector Rest", 0.011); + ratesPerPurpose2.put("Employee Retail", 0.021); + ratesPerPurpose2.put("Employee Traffic/Parcels", 0.001); + ratesPerPurpose2.put("Employee Tertiary Sector Rest", 0.001); + + ratesPerPurpose3.put("Inhabitants", 0.009); + ratesPerPurpose3.put("Employee", 0.0); + ratesPerPurpose3.put("Employee Primary Sector", 0.02); + ratesPerPurpose3.put("Employee Construction", 0.005); + ratesPerPurpose3.put("Employee Secondary Sector Rest", 0.029); + ratesPerPurpose3.put("Employee Retail", 0.055); + ratesPerPurpose3.put("Employee Traffic/Parcels", 0.02); + ratesPerPurpose3.put("Employee Tertiary Sector Rest", 0.02); + + ratesPerPurpose4.put("Inhabitants", 0.014); + ratesPerPurpose4.put("Employee", 0.0); + ratesPerPurpose4.put("Employee Primary Sector", 0.02); + ratesPerPurpose4.put("Employee Construction", 0.002); + ratesPerPurpose4.put("Employee Secondary Sector Rest", 0.11); + ratesPerPurpose4.put("Employee Retail", 0.154); + ratesPerPurpose4.put("Employee Traffic/Parcels", 0.02); + ratesPerPurpose4.put("Employee Tertiary Sector Rest", 0.02); + + ratesPerPurpose5.put("Inhabitants", 0.002); + ratesPerPurpose5.put("Employee", 0.0); + ratesPerPurpose5.put("Employee Primary Sector", 0.005); + ratesPerPurpose5.put("Employee Construction", 0.002); + ratesPerPurpose5.put("Employee Secondary Sector Rest", 0.01); + ratesPerPurpose5.put("Employee Retail", 0.01); + ratesPerPurpose5.put("Employee Traffic/Parcels", 0.005); + ratesPerPurpose5.put("Employee Tertiary Sector Rest", 0.005); + + ratesPerPurpose6.put("Inhabitants", 0.002); + ratesPerPurpose6.put("Employee", 0.0); + ratesPerPurpose6.put("Employee Primary Sector", 0.005); + ratesPerPurpose6.put("Employee Construction", 0.002); + ratesPerPurpose6.put("Employee Secondary Sector Rest", 0.01); + ratesPerPurpose6.put("Employee Retail", 0.01); + ratesPerPurpose6.put("Employee Traffic/Parcels", 0.005); + ratesPerPurpose6.put("Employee Tertiary Sector Rest", 0.005); + } + generationRates.put(6, ratesPerPurpose6); + } + generationRates.put(1, ratesPerPurpose1); + generationRates.put(2, ratesPerPurpose2); + generationRates.put(3, ratesPerPurpose3); + generationRates.put(4, ratesPerPurpose4); + generationRates.put(5, ratesPerPurpose5); + return generationRates; + } + + /** + * Sets the commitment rates based on the IVV 2005 for the goodsTraffic. The + * commitment rate for the commercialPersonTraffic is 1, because mode choice will be + * done in MATSim. + * + * @param smallScaleCommercialTrafficType used trafficType (freight or business traffic) + * @param commitmentType start or stop parameter + */ + static Map> setCommitmentRates(String smallScaleCommercialTrafficType, + String commitmentType) { + Map> commitmentRates = new HashMap<>(); + + if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { + + // the first number is the purpose; second number the vehicle type + Map ratesPerPurpose1_1 = new HashMap<>(); + Map ratesPerPurpose1_2 = new HashMap<>(); + Map ratesPerPurpose1_3 = new HashMap<>(); + Map ratesPerPurpose1_4 = new HashMap<>(); + Map ratesPerPurpose1_5 = new HashMap<>(); + Map ratesPerPurpose2_1 = new HashMap<>(); + Map ratesPerPurpose2_2 = new HashMap<>(); + Map ratesPerPurpose2_3 = new HashMap<>(); + Map ratesPerPurpose2_4 = new HashMap<>(); + Map ratesPerPurpose2_5 = new HashMap<>(); + Map ratesPerPurpose3_1 = new HashMap<>(); + Map ratesPerPurpose3_2 = new HashMap<>(); + Map ratesPerPurpose3_3 = new HashMap<>(); + Map ratesPerPurpose3_4 = new HashMap<>(); + Map ratesPerPurpose3_5 = new HashMap<>(); + Map ratesPerPurpose4_1 = new HashMap<>(); + Map ratesPerPurpose4_2 = new HashMap<>(); + Map ratesPerPurpose4_3 = new HashMap<>(); + Map ratesPerPurpose4_4 = new HashMap<>(); + Map ratesPerPurpose4_5 = new HashMap<>(); + Map ratesPerPurpose5_1 = new HashMap<>(); + Map ratesPerPurpose5_2 = new HashMap<>(); + Map ratesPerPurpose5_3 = new HashMap<>(); + Map ratesPerPurpose5_4 = new HashMap<>(); + Map ratesPerPurpose5_5 = new HashMap<>(); + Map ratesPerPurpose6_1 = new HashMap<>(); + Map ratesPerPurpose6_2 = new HashMap<>(); + Map ratesPerPurpose6_3 = new HashMap<>(); + Map ratesPerPurpose6_4 = new HashMap<>(); + Map ratesPerPurpose6_5 = new HashMap<>(); + if (commitmentType.equals("start")) { + ratesPerPurpose1_1.put("Inhabitants", 0.0); + ratesPerPurpose1_1.put("Employee", 0.8); + ratesPerPurpose1_1.put("Employee Primary Sector", 0.0); + ratesPerPurpose1_1.put("Employee Construction", 0.0); + ratesPerPurpose1_1.put("Employee Secondary Sector Rest", 0.44); + ratesPerPurpose1_1.put("Employee Retail", 0.0); + ratesPerPurpose1_1.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose1_1.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose1_2.put("Inhabitants", 0.0); + ratesPerPurpose1_2.put("Employee", 0.1); + ratesPerPurpose1_2.put("Employee Primary Sector", 0.0); + ratesPerPurpose1_2.put("Employee Construction", 0.0); + ratesPerPurpose1_2.put("Employee Secondary Sector Rest", 0.11); + ratesPerPurpose1_2.put("Employee Retail", 0.0); + ratesPerPurpose1_2.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose1_2.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose1_3.put("Inhabitants", 0.0); + ratesPerPurpose1_3.put("Employee", 0.1); + ratesPerPurpose1_3.put("Employee Primary Sector", 0.0); + ratesPerPurpose1_3.put("Employee Construction", 0.0); + ratesPerPurpose1_3.put("Employee Secondary Sector Rest", 0.22); + ratesPerPurpose1_3.put("Employee Retail", 0.0); + ratesPerPurpose1_3.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose1_3.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose1_4.put("Inhabitants", 0.0); + ratesPerPurpose1_4.put("Employee", 0.0); + ratesPerPurpose1_4.put("Employee Primary Sector", 0.0); + ratesPerPurpose1_4.put("Employee Construction", 0.0); + ratesPerPurpose1_4.put("Employee Secondary Sector Rest", 0.06); + ratesPerPurpose1_4.put("Employee Retail", 0.0); + ratesPerPurpose1_4.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose1_4.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose1_5.put("Inhabitants", 0.0); + ratesPerPurpose1_5.put("Employee", 0.0); + ratesPerPurpose1_5.put("Employee Primary Sector", 0.0); + ratesPerPurpose1_5.put("Employee Construction", 0.0); + ratesPerPurpose1_5.put("Employee Secondary Sector Rest", 0.16); + ratesPerPurpose1_5.put("Employee Retail", 0.0); + ratesPerPurpose1_5.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose1_5.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose2_1.put("Inhabitants", 0.0); + ratesPerPurpose2_1.put("Employee", 0.8); + ratesPerPurpose2_1.put("Employee Primary Sector", 0.0); + ratesPerPurpose2_1.put("Employee Construction", 0.0); + ratesPerPurpose2_1.put("Employee Secondary Sector Rest", 0.44); + ratesPerPurpose2_1.put("Employee Retail", 0.0); + ratesPerPurpose2_1.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose2_1.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose2_2.put("Inhabitants", 0.0); + ratesPerPurpose2_2.put("Employee", 0.1); + ratesPerPurpose2_2.put("Employee Primary Sector", 0.0); + ratesPerPurpose2_2.put("Employee Construction", 0.0); + ratesPerPurpose2_2.put("Employee Secondary Sector Rest", 0.11); + ratesPerPurpose2_2.put("Employee Retail", 0.0); + ratesPerPurpose2_2.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose2_2.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose2_3.put("Inhabitants", 0.0); + ratesPerPurpose2_3.put("Employee", 0.1); + ratesPerPurpose2_3.put("Employee Primary Sector", 0.0); + ratesPerPurpose2_3.put("Employee Construction", 0.0); + ratesPerPurpose2_3.put("Employee Secondary Sector Rest", 0.22); + ratesPerPurpose2_3.put("Employee Retail", 0.0); + ratesPerPurpose2_3.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose2_3.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose2_4.put("Inhabitants", 0.0); + ratesPerPurpose2_4.put("Employee", 0.0); + ratesPerPurpose2_4.put("Employee Primary Sector", 0.0); + ratesPerPurpose2_4.put("Employee Construction", 0.0); + ratesPerPurpose2_4.put("Employee Secondary Sector Rest", 0.06); + ratesPerPurpose2_4.put("Employee Retail", 0.0); + ratesPerPurpose2_4.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose2_4.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose2_5.put("Inhabitants", 0.0); + ratesPerPurpose2_5.put("Employee", 0.0); + ratesPerPurpose2_5.put("Employee Primary Sector", 0.0); + ratesPerPurpose2_5.put("Employee Construction", 0.0); + ratesPerPurpose2_5.put("Employee Secondary Sector Rest", 0.16); + ratesPerPurpose2_5.put("Employee Retail", 0.0); + ratesPerPurpose2_5.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose2_5.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose3_1.put("Inhabitants", 0.0); + ratesPerPurpose3_1.put("Employee", 0.8); + ratesPerPurpose3_1.put("Employee Primary Sector", 0.0); + ratesPerPurpose3_1.put("Employee Construction", 0.0); + ratesPerPurpose3_1.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose3_1.put("Employee Retail", 0.46); + ratesPerPurpose3_1.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose3_1.put("Employee Tertiary Sector Rest", 0.54); + + ratesPerPurpose3_2.put("Inhabitants", 0.0); + ratesPerPurpose3_2.put("Employee", 0.1); + ratesPerPurpose3_2.put("Employee Primary Sector", 0.0); + ratesPerPurpose3_2.put("Employee Construction", 0.0); + ratesPerPurpose3_2.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose3_2.put("Employee Retail", 0.1); + ratesPerPurpose3_2.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose3_2.put("Employee Tertiary Sector Rest", 0.1); + + ratesPerPurpose3_3.put("Inhabitants", 0.0); + ratesPerPurpose3_3.put("Employee", 0.1); + ratesPerPurpose3_3.put("Employee Primary Sector", 0.0); + ratesPerPurpose3_3.put("Employee Construction", 0.0); + ratesPerPurpose3_3.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose3_3.put("Employee Retail", 0.23); + ratesPerPurpose3_3.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose3_3.put("Employee Tertiary Sector Rest", 0.2); + + ratesPerPurpose3_4.put("Inhabitants", 0.0); + ratesPerPurpose3_4.put("Employee", 0.0); + ratesPerPurpose3_4.put("Employee Primary Sector", 0.0); + ratesPerPurpose3_4.put("Employee Construction", 0.0); + ratesPerPurpose3_4.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose3_4.put("Employee Retail", 0.06); + ratesPerPurpose3_4.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose3_4.put("Employee Tertiary Sector Rest", 0.02); + + ratesPerPurpose3_5.put("Inhabitants", 0.0); + ratesPerPurpose3_5.put("Employee", 0.0); + ratesPerPurpose3_5.put("Employee Primary Sector", 0.0); + ratesPerPurpose3_5.put("Employee Construction", 0.0); + ratesPerPurpose3_5.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose3_5.put("Employee Retail", 0.15); + ratesPerPurpose3_5.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose3_5.put("Employee Tertiary Sector Rest", 0.14); + + ratesPerPurpose4_1.put("Inhabitants", 0.009); + ratesPerPurpose4_1.put("Employee", 0.8); + ratesPerPurpose4_1.put("Employee Primary Sector", 0.0); + ratesPerPurpose4_1.put("Employee Construction", 0.0); + ratesPerPurpose4_1.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose4_1.put("Employee Retail", 0.0); + ratesPerPurpose4_1.put("Employee Traffic/Parcels", 0.18); + ratesPerPurpose4_1.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose4_2.put("Inhabitants", 0.0); + ratesPerPurpose4_2.put("Employee", 0.1); + ratesPerPurpose4_2.put("Employee Primary Sector", 0.0); + ratesPerPurpose4_2.put("Employee Construction", 0.0); + ratesPerPurpose4_2.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose4_2.put("Employee Retail", 0.0); + ratesPerPurpose4_2.put("Employee Traffic/Parcels", 0.06); + ratesPerPurpose4_2.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose4_3.put("Inhabitants", 0.0); + ratesPerPurpose4_3.put("Employee", 0.1); + ratesPerPurpose4_3.put("Employee Primary Sector", 0.0); + ratesPerPurpose4_3.put("Employee Construction", 0.0); + ratesPerPurpose4_3.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose4_3.put("Employee Retail", 0.0); + ratesPerPurpose4_3.put("Employee Traffic/Parcels", 0.25); + ratesPerPurpose4_3.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose4_4.put("Inhabitants", 0.0); + ratesPerPurpose4_4.put("Employee", 0.0); + ratesPerPurpose4_4.put("Employee Primary Sector", 0.0); + ratesPerPurpose4_4.put("Employee Construction", 0.0); + ratesPerPurpose4_4.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose4_4.put("Employee Retail", 0.0); + ratesPerPurpose4_4.put("Employee Traffic/Parcels", 0.08); + ratesPerPurpose4_4.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose4_5.put("Inhabitants", 0.0); + ratesPerPurpose4_5.put("Employee", 0.0); + ratesPerPurpose4_5.put("Employee Primary Sector", 0.0); + ratesPerPurpose4_5.put("Employee Construction", 0.0); + ratesPerPurpose4_5.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose4_5.put("Employee Retail", 0.0); + ratesPerPurpose4_5.put("Employee Traffic/Parcels", 0.43); + ratesPerPurpose4_5.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose5_1.put("Inhabitants", 0.0); + ratesPerPurpose5_1.put("Employee", 0.8); + ratesPerPurpose5_1.put("Employee Primary Sector", 0.0); + ratesPerPurpose5_1.put("Employee Construction", 0.25); + ratesPerPurpose5_1.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose5_1.put("Employee Retail", 0.0); + ratesPerPurpose5_1.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose5_1.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose5_2.put("Inhabitants", 0.0); + ratesPerPurpose5_2.put("Employee", 0.1); + ratesPerPurpose5_2.put("Employee Primary Sector", 0.0); + ratesPerPurpose5_2.put("Employee Construction", 0.2); + ratesPerPurpose5_2.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose5_2.put("Employee Retail", 0.0); + ratesPerPurpose5_2.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose5_2.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose5_3.put("Inhabitants", 0.0); + ratesPerPurpose5_3.put("Employee", 0.1); + ratesPerPurpose5_3.put("Employee Primary Sector", 0.0); + ratesPerPurpose5_3.put("Employee Construction", 0.25); + ratesPerPurpose5_3.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose5_3.put("Employee Retail", 0.139); + ratesPerPurpose5_3.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose5_3.put("Employee Tertiary Sector Rest", 0.059); + + ratesPerPurpose5_4.put("Inhabitants", 0.0); + ratesPerPurpose5_4.put("Employee", 0.0); + ratesPerPurpose5_4.put("Employee Primary Sector", 0.0); + ratesPerPurpose5_4.put("Employee Construction", 0.02); + ratesPerPurpose5_4.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose5_4.put("Employee Retail", 0.0); + ratesPerPurpose5_4.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose5_4.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose5_5.put("Inhabitants", 0.0); + ratesPerPurpose5_5.put("Employee", 0.0); + ratesPerPurpose5_5.put("Employee Primary Sector", 0.0); + ratesPerPurpose5_5.put("Employee Construction", 0.28); + ratesPerPurpose5_5.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose5_5.put("Employee Retail", 0.0); + ratesPerPurpose5_5.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose5_5.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose6_1.put("Inhabitants", 0.0); + ratesPerPurpose6_1.put("Employee", 0.0); + ratesPerPurpose6_1.put("Employee Primary Sector", 0.0); + ratesPerPurpose6_1.put("Employee Construction", 0.0); + ratesPerPurpose6_1.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose6_1.put("Employee Retail", 0.0); + ratesPerPurpose6_1.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose6_1.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose6_2.put("Inhabitants", 0.29); + ratesPerPurpose6_2.put("Employee", 0.0); + ratesPerPurpose6_2.put("Employee Primary Sector", 0.0); + ratesPerPurpose6_2.put("Employee Construction", 0.0); + ratesPerPurpose6_2.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose6_2.put("Employee Retail", 0.0); + ratesPerPurpose6_2.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose6_2.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose6_3.put("Inhabitants", 0.63); + ratesPerPurpose6_3.put("Employee", 0.0); + ratesPerPurpose6_3.put("Employee Primary Sector", 0.0); + ratesPerPurpose6_3.put("Employee Construction", 0.0); + ratesPerPurpose6_3.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose6_3.put("Employee Retail", 0.0); + ratesPerPurpose6_3.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose6_3.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose6_4.put("Inhabitants", 0.07); + ratesPerPurpose6_4.put("Employee", 0.0); + ratesPerPurpose6_4.put("Employee Primary Sector", 0.0); + ratesPerPurpose6_4.put("Employee Construction", 0.0); + ratesPerPurpose6_4.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose6_4.put("Employee Retail", 0.0); + ratesPerPurpose6_4.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose6_4.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose6_5.put("Inhabitants", 0.001); + ratesPerPurpose6_5.put("Employee", 0.0); + ratesPerPurpose6_5.put("Employee Primary Sector", 0.0); + ratesPerPurpose6_5.put("Employee Construction", 0.2); + ratesPerPurpose6_5.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose6_5.put("Employee Retail", 0.0); + ratesPerPurpose6_5.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose6_5.put("Employee Tertiary Sector Rest", 0.0); + } else if (commitmentType.equals("stop")) { + ratesPerPurpose1_1.put("Inhabitants", 0.0); + ratesPerPurpose1_1.put("Employee", 0.0); + ratesPerPurpose1_1.put("Employee Primary Sector", 0.0); + ratesPerPurpose1_1.put("Employee Construction", 0.0); + ratesPerPurpose1_1.put("Employee Secondary Sector Rest", 0.35); + ratesPerPurpose1_1.put("Employee Retail", 0.0); + ratesPerPurpose1_1.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose1_1.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose1_2.put("Inhabitants", 0.0); + ratesPerPurpose1_2.put("Employee", 0.0); + ratesPerPurpose1_2.put("Employee Primary Sector", 0.0); + ratesPerPurpose1_2.put("Employee Construction", 0.0); + ratesPerPurpose1_2.put("Employee Secondary Sector Rest", 0.1); + ratesPerPurpose1_2.put("Employee Retail", 0.0); + ratesPerPurpose1_2.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose1_2.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose1_3.put("Inhabitants", 0.0); + ratesPerPurpose1_3.put("Employee", 0.0); + ratesPerPurpose1_3.put("Employee Primary Sector", 0.0); + ratesPerPurpose1_3.put("Employee Construction", 0.0); + ratesPerPurpose1_3.put("Employee Secondary Sector Rest", 0.27); + ratesPerPurpose1_3.put("Employee Retail", 0.0); + ratesPerPurpose1_3.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose1_3.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose1_4.put("Inhabitants", 0.0); + ratesPerPurpose1_4.put("Employee", 0.0); + ratesPerPurpose1_4.put("Employee Primary Sector", 0.0); + ratesPerPurpose1_4.put("Employee Construction", 0.0); + ratesPerPurpose1_4.put("Employee Secondary Sector Rest", 0.01); + ratesPerPurpose1_4.put("Employee Retail", 0.0); + ratesPerPurpose1_4.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose1_4.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose1_5.put("Inhabitants", 0.0); + ratesPerPurpose1_5.put("Employee", 0.0); + ratesPerPurpose1_5.put("Employee Primary Sector", 0.0); + ratesPerPurpose1_5.put("Employee Construction", 0.0); + ratesPerPurpose1_5.put("Employee Secondary Sector Rest", 0.27); + ratesPerPurpose1_5.put("Employee Retail", 0.0); + ratesPerPurpose1_5.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose1_5.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose2_1.put("Inhabitants", 0.55); + ratesPerPurpose2_1.put("Employee", 0.0); + ratesPerPurpose2_1.put("Employee Primary Sector", 0.46); + ratesPerPurpose2_1.put("Employee Construction", 0.46); + ratesPerPurpose2_1.put("Employee Secondary Sector Rest", 0.46); + ratesPerPurpose2_1.put("Employee Retail", 0.46); + ratesPerPurpose2_1.put("Employee Traffic/Parcels", 0.34); + ratesPerPurpose2_1.put("Employee Tertiary Sector Rest", 0.46); + + ratesPerPurpose2_2.put("Inhabitants", 0.09); + ratesPerPurpose2_2.put("Employee", 0.0); + ratesPerPurpose2_2.put("Employee Primary Sector", 0.09); + ratesPerPurpose2_2.put("Employee Construction", 0.09); + ratesPerPurpose2_2.put("Employee Secondary Sector Rest", 0.09); + ratesPerPurpose2_2.put("Employee Retail", 0.09); + ratesPerPurpose2_2.put("Employee Traffic/Parcels", 0.1); + ratesPerPurpose2_2.put("Employee Tertiary Sector Rest", 0.09); + + ratesPerPurpose2_3.put("Inhabitants", 0.21); + ratesPerPurpose2_3.put("Employee", 0.0); + ratesPerPurpose2_3.put("Employee Primary Sector", 0.22); + ratesPerPurpose2_3.put("Employee Construction", 0.22); + ratesPerPurpose2_3.put("Employee Secondary Sector Rest", 0.22); + ratesPerPurpose2_3.put("Employee Retail", 0.22); + ratesPerPurpose2_3.put("Employee Traffic/Parcels", 0.29); + ratesPerPurpose2_3.put("Employee Tertiary Sector Rest", 0.22); + + ratesPerPurpose2_4.put("Inhabitants", 0.06); + ratesPerPurpose2_4.put("Employee", 0.0); + ratesPerPurpose2_4.put("Employee Primary Sector", 0.06); + ratesPerPurpose2_4.put("Employee Construction", 0.06); + ratesPerPurpose2_4.put("Employee Secondary Sector Rest", 0.06); + ratesPerPurpose2_4.put("Employee Retail", 0.06); + ratesPerPurpose2_4.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose2_4.put("Employee Tertiary Sector Rest", 0.06); + + ratesPerPurpose2_5.put("Inhabitants", 0.1); + ratesPerPurpose2_5.put("Employee", 0.0); + ratesPerPurpose2_5.put("Employee Primary Sector", 0.17); + ratesPerPurpose2_5.put("Employee Construction", 0.17); + ratesPerPurpose2_5.put("Employee Secondary Sector Rest", 0.17); + ratesPerPurpose2_5.put("Employee Retail", 0.17); + ratesPerPurpose2_5.put("Employee Traffic/Parcels", 0.27); + ratesPerPurpose2_5.put("Employee Tertiary Sector Rest", 0.17); + + ratesPerPurpose3_1.put("Inhabitants", 0.489); + ratesPerPurpose3_1.put("Employee", 0.0); + ratesPerPurpose3_1.put("Employee Primary Sector", 0.538); + ratesPerPurpose3_1.put("Employee Construction", 0.538); + ratesPerPurpose3_1.put("Employee Secondary Sector Rest", 0.538); + ratesPerPurpose3_1.put("Employee Retail", 0.538); + ratesPerPurpose3_1.put("Employee Traffic/Parcels", 0.59); + ratesPerPurpose3_1.put("Employee Tertiary Sector Rest", 0.538); + + ratesPerPurpose3_2.put("Inhabitants", 0.106); + ratesPerPurpose3_2.put("Employee", 0.0); + ratesPerPurpose3_2.put("Employee Primary Sector", 0.092); + ratesPerPurpose3_2.put("Employee Construction", 0.092); + ratesPerPurpose3_2.put("Employee Secondary Sector Rest", 0.092); + ratesPerPurpose3_2.put("Employee Retail", 0.092); + ratesPerPurpose3_2.put("Employee Traffic/Parcels", 0.03); + ratesPerPurpose3_2.put("Employee Tertiary Sector Rest", 0.092); + + ratesPerPurpose3_3.put("Inhabitants", 0.26); + ratesPerPurpose3_3.put("Employee", 0.0); + ratesPerPurpose3_3.put("Employee Primary Sector", 0.19); + ratesPerPurpose3_3.put("Employee Construction", 0.19); + ratesPerPurpose3_3.put("Employee Secondary Sector Rest", 0.19); + ratesPerPurpose3_3.put("Employee Retail", 0.19); + ratesPerPurpose3_3.put("Employee Traffic/Parcels", 0.102); + ratesPerPurpose3_3.put("Employee Tertiary Sector Rest", 0.19); + + ratesPerPurpose3_4.put("Inhabitants", 0.033); + ratesPerPurpose3_4.put("Employee", 0.0); + ratesPerPurpose3_4.put("Employee Primary Sector", 0.032); + ratesPerPurpose3_4.put("Employee Construction", 0.032); + ratesPerPurpose3_4.put("Employee Secondary Sector Rest", 0.032); + ratesPerPurpose3_4.put("Employee Retail", 0.032); + ratesPerPurpose3_4.put("Employee Traffic/Parcels", 0.058); + ratesPerPurpose3_4.put("Employee Tertiary Sector Rest", 0.032); + + ratesPerPurpose3_5.put("Inhabitants", 0.112); + ratesPerPurpose3_5.put("Employee", 0.0); + ratesPerPurpose3_5.put("Employee Primary Sector", 0.147); + ratesPerPurpose3_5.put("Employee Construction", 0.147); + ratesPerPurpose3_5.put("Employee Secondary Sector Rest", 0.147); + ratesPerPurpose3_5.put("Employee Retail", 0.147); + ratesPerPurpose3_5.put("Employee Traffic/Parcels", 0.219); + ratesPerPurpose3_5.put("Employee Tertiary Sector Rest", 0.147); + + ratesPerPurpose4_1.put("Inhabitants", 0.37); + ratesPerPurpose4_1.put("Employee", 0.0); + ratesPerPurpose4_1.put("Employee Primary Sector", 0.14); + ratesPerPurpose4_1.put("Employee Construction", 0.14); + ratesPerPurpose4_1.put("Employee Secondary Sector Rest", 0.14); + ratesPerPurpose4_1.put("Employee Retail", 0.14); + ratesPerPurpose4_1.put("Employee Traffic/Parcels", 0.06); + ratesPerPurpose4_1.put("Employee Tertiary Sector Rest", 0.14); + + ratesPerPurpose4_2.put("Inhabitants", 0.05); + ratesPerPurpose4_2.put("Employee", 0.0); + ratesPerPurpose4_2.put("Employee Primary Sector", 0.07); + ratesPerPurpose4_2.put("Employee Construction", 0.07); + ratesPerPurpose4_2.put("Employee Secondary Sector Rest", 0.07); + ratesPerPurpose4_2.put("Employee Retail", 0.07); + ratesPerPurpose4_2.put("Employee Traffic/Parcels", 0.07); + ratesPerPurpose4_2.put("Employee Tertiary Sector Rest", 0.07); + + ratesPerPurpose4_3.put("Inhabitants", 0.4); + ratesPerPurpose4_3.put("Employee", 0.0); + ratesPerPurpose4_3.put("Employee Primary Sector", 0.21); + ratesPerPurpose4_3.put("Employee Construction", 0.21); + ratesPerPurpose4_3.put("Employee Secondary Sector Rest", 0.21); + ratesPerPurpose4_3.put("Employee Retail", 0.21); + ratesPerPurpose4_3.put("Employee Traffic/Parcels", 0.19); + ratesPerPurpose4_3.put("Employee Tertiary Sector Rest", 0.21); + + ratesPerPurpose4_4.put("Inhabitants", 0.13); + ratesPerPurpose4_4.put("Employee", 0.0); + ratesPerPurpose4_4.put("Employee Primary Sector", 0.05); + ratesPerPurpose4_4.put("Employee Construction", 0.05); + ratesPerPurpose4_4.put("Employee Secondary Sector Rest", 0.05); + ratesPerPurpose4_4.put("Employee Retail", 0.05); + ratesPerPurpose4_4.put("Employee Traffic/Parcels", 0.08); + ratesPerPurpose4_4.put("Employee Tertiary Sector Rest", 0.05); + + ratesPerPurpose4_5.put("Inhabitants", 0.05); + ratesPerPurpose4_5.put("Employee", 0.0); + ratesPerPurpose4_5.put("Employee Primary Sector", 0.54); + ratesPerPurpose4_5.put("Employee Construction", 0.54); + ratesPerPurpose4_5.put("Employee Secondary Sector Rest", 0.54); + ratesPerPurpose4_5.put("Employee Retail", 0.54); + ratesPerPurpose4_5.put("Employee Traffic/Parcels", 0.61); + ratesPerPurpose4_5.put("Employee Tertiary Sector Rest", 0.54); + + ratesPerPurpose5_1.put("Inhabitants", 0.16); + ratesPerPurpose5_1.put("Employee", 0.0); + ratesPerPurpose5_1.put("Employee Primary Sector", 0.4); + ratesPerPurpose5_1.put("Employee Construction", 0.4); + ratesPerPurpose5_1.put("Employee Secondary Sector Rest", 0.4); + ratesPerPurpose5_1.put("Employee Retail", 0.4); + ratesPerPurpose5_1.put("Employee Traffic/Parcels", 0.14); + ratesPerPurpose5_1.put("Employee Tertiary Sector Rest", 0.4); + + ratesPerPurpose5_2.put("Inhabitants", 0.55); + ratesPerPurpose5_2.put("Employee", 0.11); + ratesPerPurpose5_2.put("Employee Primary Sector", 0.11); + ratesPerPurpose5_2.put("Employee Construction", 0.11); + ratesPerPurpose5_2.put("Employee Secondary Sector Rest", 0.11); + ratesPerPurpose5_2.put("Employee Retail", 0.11); + ratesPerPurpose5_2.put("Employee Traffic/Parcels", 0.06); + ratesPerPurpose5_2.put("Employee Tertiary Sector Rest", 0.11); + + ratesPerPurpose5_3.put("Inhabitants", 0.22); + ratesPerPurpose5_3.put("Employee", 0.0); + ratesPerPurpose5_3.put("Employee Primary Sector", 0.17); + ratesPerPurpose5_3.put("Employee Construction", 0.17); + ratesPerPurpose5_3.put("Employee Secondary Sector Rest", 0.17); + ratesPerPurpose5_3.put("Employee Retail", 0.17); + ratesPerPurpose5_3.put("Employee Traffic/Parcels", 0.21); + ratesPerPurpose5_3.put("Employee Tertiary Sector Rest", 0.17); + + ratesPerPurpose5_4.put("Inhabitants", 0.0); + ratesPerPurpose5_4.put("Employee", 0.0); + ratesPerPurpose5_4.put("Employee Primary Sector", 0.04); + ratesPerPurpose5_4.put("Employee Construction", 0.04); + ratesPerPurpose5_4.put("Employee Secondary Sector Rest", 0.04); + ratesPerPurpose5_4.put("Employee Retail", 0.04); + ratesPerPurpose5_4.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose5_4.put("Employee Tertiary Sector Rest", 0.04); + + ratesPerPurpose5_5.put("Inhabitants", 0.06); + ratesPerPurpose5_5.put("Employee", 0.0); + ratesPerPurpose5_5.put("Employee Primary Sector", 0.28); + ratesPerPurpose5_5.put("Employee Construction", 0.28); + ratesPerPurpose5_5.put("Employee Secondary Sector Rest", 0.28); + ratesPerPurpose5_5.put("Employee Retail", 0.28); + ratesPerPurpose5_5.put("Employee Traffic/Parcels", 0.58); + ratesPerPurpose5_5.put("Employee Tertiary Sector Rest", 0.28); + + ratesPerPurpose6_1.put("Inhabitants", 0.0); + ratesPerPurpose6_1.put("Employee", 0.0); + ratesPerPurpose6_1.put("Employee Primary Sector", 0.0); + ratesPerPurpose6_1.put("Employee Construction", 0.0); + ratesPerPurpose6_1.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose6_1.put("Employee Retail", 0.0); + ratesPerPurpose6_1.put("Employee Traffic/Parcels", 0.0); + ratesPerPurpose6_1.put("Employee Tertiary Sector Rest", 0.0); + + ratesPerPurpose6_2.put("Inhabitants", 0.85); + ratesPerPurpose6_2.put("Employee", 0.0); + ratesPerPurpose6_2.put("Employee Primary Sector", 0.21); + ratesPerPurpose6_2.put("Employee Construction", 0.21); + ratesPerPurpose6_2.put("Employee Secondary Sector Rest", 0.21); + ratesPerPurpose6_2.put("Employee Retail", 0.21); + ratesPerPurpose6_2.put("Employee Traffic/Parcels", 0.09); + ratesPerPurpose6_2.put("Employee Tertiary Sector Rest", 0.21); + + ratesPerPurpose6_3.put("Inhabitants", 0.15); + ratesPerPurpose6_3.put("Employee", 0.0); + ratesPerPurpose6_3.put("Employee Primary Sector", 0.58); + ratesPerPurpose6_3.put("Employee Construction", 0.58); + ratesPerPurpose6_3.put("Employee Secondary Sector Rest", 0.58); + ratesPerPurpose6_3.put("Employee Retail", 0.58); + ratesPerPurpose6_3.put("Employee Traffic/Parcels", 0.55); + ratesPerPurpose6_3.put("Employee Tertiary Sector Rest", 0.58); + + ratesPerPurpose6_4.put("Inhabitants", 0.0); + ratesPerPurpose6_4.put("Employee", 0.0); + ratesPerPurpose6_4.put("Employee Primary Sector", 0.21); + ratesPerPurpose6_4.put("Employee Construction", 0.21); + ratesPerPurpose6_4.put("Employee Secondary Sector Rest", 0.21); + ratesPerPurpose6_4.put("Employee Retail", 0.21); + ratesPerPurpose6_4.put("Employee Traffic/Parcels", 0.25); + ratesPerPurpose6_4.put("Employee Tertiary Sector Rest", 0.21); + + ratesPerPurpose6_5.put("Inhabitants", 0.0); + ratesPerPurpose6_5.put("Employee", 0.0); + ratesPerPurpose6_5.put("Employee Primary Sector", 0.0); + ratesPerPurpose6_5.put("Employee Construction", 0.0); + ratesPerPurpose6_5.put("Employee Secondary Sector Rest", 0.0); + ratesPerPurpose6_5.put("Employee Retail", 0.0); + ratesPerPurpose6_5.put("Employee Traffic/Parcels", 0.11); + ratesPerPurpose6_5.put("Employee Tertiary Sector Rest", 0.0); + } + commitmentRates.put("1_1", ratesPerPurpose1_1); + commitmentRates.put("1_2", ratesPerPurpose1_2); + commitmentRates.put("1_3", ratesPerPurpose1_3); + commitmentRates.put("1_4", ratesPerPurpose1_4); + commitmentRates.put("1_5", ratesPerPurpose1_5); + commitmentRates.put("2_1", ratesPerPurpose2_1); + commitmentRates.put("2_2", ratesPerPurpose2_2); + commitmentRates.put("2_3", ratesPerPurpose2_3); + commitmentRates.put("2_4", ratesPerPurpose2_4); + commitmentRates.put("2_5", ratesPerPurpose2_5); + commitmentRates.put("3_1", ratesPerPurpose3_1); + commitmentRates.put("3_2", ratesPerPurpose3_2); + commitmentRates.put("3_3", ratesPerPurpose3_3); + commitmentRates.put("3_4", ratesPerPurpose3_4); + commitmentRates.put("3_5", ratesPerPurpose3_5); + commitmentRates.put("4_1", ratesPerPurpose4_1); + commitmentRates.put("4_2", ratesPerPurpose4_2); + commitmentRates.put("4_3", ratesPerPurpose4_3); + commitmentRates.put("4_4", ratesPerPurpose4_4); + commitmentRates.put("4_5", ratesPerPurpose4_5); + commitmentRates.put("5_1", ratesPerPurpose5_1); + commitmentRates.put("5_2", ratesPerPurpose5_2); + commitmentRates.put("5_3", ratesPerPurpose5_3); + commitmentRates.put("5_4", ratesPerPurpose5_4); + commitmentRates.put("5_5", ratesPerPurpose5_5); + commitmentRates.put("6_1", ratesPerPurpose6_1); + commitmentRates.put("6_2", ratesPerPurpose6_2); + commitmentRates.put("6_3", ratesPerPurpose6_3); + commitmentRates.put("6_4", ratesPerPurpose6_4); + commitmentRates.put("6_5", ratesPerPurpose6_5); + } + return commitmentRates; + } +} From 90085fe845594a6ed9a2224a0a951ca823227c3c Mon Sep 17 00:00:00 2001 From: aleks Date: Wed, 4 Sep 2024 15:11:23 +0200 Subject: [PATCH 04/60] Implemented Allocator to resolve service duration problem (untested) --- .../DefaultVehicleAvailabilityAllocator.java | 58 +++++++++++++++++++ .../DefaultVehicleSelection.java | 18 ++++-- ...rateSmallScaleCommercialTrafficDemand.java | 2 +- 3 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleAvailabilityAllocator.java diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleAvailabilityAllocator.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleAvailabilityAllocator.java new file mode 100644 index 00000000000..97e8092322c --- /dev/null +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleAvailabilityAllocator.java @@ -0,0 +1,58 @@ +package org.matsim.smallScaleCommercialTrafficGeneration; + +import java.util.*; + +/** + * A small allocator to solve the time-window problems in the Vehicle and Service generation.
+ * This implementation uses a Best-Fit Allocator. + * NOTE: This class does not actually change anything in the scenario. It is just a tool to check if Service and Vehicle TimeWindows are + * compatible. + */ +public class DefaultVehicleAvailabilityAllocator{ + private List availableVehicleTime; + + /** + * Prepares the allocator. + * @param availableVehicleTime This Collection should contain the duration of available-time-frames of the vehicles. + * For example: 4x vehicles are available from 1:00 to 4:00 (3 hours), then the {@code availableVehicles} Collection should + * contain 4 entries with value: 3*3600=10800. If a vehicle has a non-coherent availability-time-frame, add it as two + * separate entries. + */ + public DefaultVehicleAvailabilityAllocator(List availableVehicleTime){ + this.availableVehicleTime = availableVehicleTime; + } + + /** + * Checks if a vehicle is available for the given amount of time. If not, then the time is set to the largest possible duration, + * which can be allocated. + * @return the reduced serviceDuration (unchanged, if a vehicle was found, that was available for the full duration) + */ + public int makeServiceDurationViable(int serviceDuration){ + for(Integer vehicleTime : availableVehicleTime){ + if(vehicleTime >= serviceDuration) return serviceDuration; + } + return Collections.max(availableVehicleTime); + } + + /** + * Tries to allocate a single vehicle to the service and reduces the allocated vehicle available time by the serviceDuration. + * If no vehicle is available nothing happens. You should then consider to reduce the duration with {@link DefaultVehicleAvailabilityAllocator#makeServiceDurationViable} + * @return true if a vehicle was allocated, false if no vehicle is available for the given duration + */ + public boolean scheduleServiceDuration(int serviceDuration){ + //Best-Fit Allocation + int bestFit = -1; + int bestRemaining = Integer.MAX_VALUE; + for(int i = 0; i < availableVehicleTime.size(); i++){ + int remaining = availableVehicleTime.get(i) - serviceDuration; + if(remaining > 0 && remaining < bestRemaining){ + bestFit = i; + bestRemaining = remaining; + } + } + if(bestFit == -1) return false; + //Allocate + availableVehicleTime.set(bestFit, availableVehicleTime.get(bestFit) - serviceDuration); + return true; + } +} diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java index d7bb9cded40..006d1508a1a 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java @@ -34,6 +34,7 @@ public class DefaultVehicleSelection implements VehicleSelection{ private final static Random rnd = MatsimRandom.getRandom(); //Needed for this computation + Map, DefaultVehicleAvailabilityAllocator> carrierId2vehicleAvailabilityScheduler; GetCommercialTourSpecifications getCommercialTourSpecifications; Map>> facilitiesPerZone; TripDistributionMatrix odMatrix; @@ -45,7 +46,7 @@ public class DefaultVehicleSelection implements VehicleSelection{ * @param jspritIterations Configuration: Number of jsprit iterations (Given in {@link GenerateSmallScaleCommercialTrafficDemand}) */ DefaultVehicleSelection(int jspritIterations) { - this.jspritIterations = jspritIterations; //TODO Whoever calls this class will not get any feedback about this variable. Check if this may cause problems + this.jspritIterations = jspritIterations; } /** @@ -272,13 +273,16 @@ private void createServices(Scenario scenario, String stopZone = serviceArea[0]; for (int i = 0; i < numberOfJobs; i++) { + //Allocate the vehicleTime. If there is not enough vehicle time, then reduce the service duration to a viable value + int serviceDuration = carrierId2vehicleAvailabilityScheduler.get(Id.create(carrierName, Carrier.class)).makeServiceDurationViable(serviceTimePerStop); + carrierId2vehicleAvailabilityScheduler.get(Id.create(carrierName, Carrier.class)).scheduleServiceDuration(serviceDuration); Id linkId = findPossibleLink(stopZone, selectedStopCategory, noPossibleLinks); Id idNewService = Id.create(carrierName + "_" + linkId + "_" + rnd.nextInt(10000), CarrierService.class); CarrierService thisService = CarrierService.Builder.newInstance(idNewService, linkId) - .setServiceDuration(serviceTimePerStop).setServiceStartTimeWindow(serviceTimeWindow).build(); + .setServiceDuration(serviceDuration).setServiceStartTimeWindow(serviceTimeWindow).build(); CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)).getServices() .put(thisService.getId(), thisService); } @@ -324,11 +328,13 @@ private void createNewCarrierAndAddVehicleTypes(Scenario scenario, vehicleDepots.add(linkId.toString()); } + List availableVehicles = new LinkedList<>(); + for (String singleDepot : vehicleDepots) { GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = tourStartTimeSelector.sample(); int vehicleStartTime = getVehicleStartTime(t); - int tourDuration = getVehicleTourDuration(t); //TODO### + int tourDuration = getVehicleTourDuration(t); int vehicleEndTime = vehicleStartTime + tourDuration; for (String thisVehicleType : vehicleTypes) { //TODO Flottenzusammensetzung anpassen. Momentan pro Depot alle Fahrzeugtypen 1x erzeugen VehicleType thisType = carrierVehicleTypes.getVehicleTypes() @@ -344,12 +350,15 @@ private void createNewCarrierAndAddVehicleTypes(Scenario scenario, Vehicle.class), Id.createLinkId(singleDepot), thisType) .setEarliestStart(vehicleStartTime).setLatestEnd(vehicleEndTime).build(); + availableVehicles.add(tourDuration); carrierCapabilities.getCarrierVehicles().put(newCarrierVehicle.getId(), newCarrierVehicle); if (!carrierCapabilities.getVehicleTypes().contains(thisType)) carrierCapabilities.getVehicleTypes().add(thisType); } } + if(carrierId2vehicleAvailabilityScheduler.containsKey(Id.create(carrierName, Carrier.class))) log.warn("It looks like {} was created twice. This should not happen!", carrierName); + carrierId2vehicleAvailabilityScheduler.put(Id.create(carrierName, Carrier.class), new DefaultVehicleAvailabilityAllocator(availableVehicles)); thisCarrier.setCarrierCapabilities(carrierCapabilities); } } @@ -378,13 +387,10 @@ else if (smallScaleCommercialTrafficType.equals(GenerateSmallScaleCommercialTraf return rnd.nextInt(serviceDurationLowerBound * 60, serviceDurationUpperBound * 60); } - - /** * Finds a possible link for a service or the vehicle location. */ private Id findPossibleLink(String zone, String selectedCategory, List noPossibleLinks) { - Id newLink = null; for (int a = 0; newLink == null && a < facilitiesPerZone.get(zone).get(selectedCategory).size() * 2; a++) { diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index bf0cac4313e..5b8fee55cc5 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -90,7 +90,7 @@ * * @author Ricardo Ewert */ -//TODO check if service duration is larger than tour duration +//TODO check if service duration is larger than tour duration -> (tried, untested) //TODO make vehicle selection (see method createCarriers()) configurable in separate class (use interface) -> (done, untested) //TODO move generationRates in class TrafficVolumeGeneration in separate class in package data (similar to GetCommercialTourSpecifications) -> (done, untested) @CommandLine.Command(name = "generate-small-scale-commercial-traffic", description = "Generates plans for a small scale commercial traffic model", showDefaultValues = true) From 5bdb4c8124834436c5eeb8a44a7050930fb14aa1 Mon Sep 17 00:00:00 2001 From: aleks Date: Thu, 5 Sep 2024 15:37:53 +0200 Subject: [PATCH 05/60] Resolved null error --- .../DefaultVehicleSelection.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java index 006d1508a1a..2e688c489c1 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java @@ -34,7 +34,7 @@ public class DefaultVehicleSelection implements VehicleSelection{ private final static Random rnd = MatsimRandom.getRandom(); //Needed for this computation - Map, DefaultVehicleAvailabilityAllocator> carrierId2vehicleAvailabilityScheduler; + Map, DefaultVehicleAvailabilityAllocator> carrierId2vehicleAvailabilityScheduler = new HashMap<>(); GetCommercialTourSpecifications getCommercialTourSpecifications; Map>> facilitiesPerZone; TripDistributionMatrix odMatrix; @@ -76,8 +76,6 @@ public void createCarriers(Scenario scenario, this.resultingDataPerZone = resultingDataPerZone; this.linksPerZone = linksPerZone; - //TODO configuration with both smallScaleCommercialTrafficType - int maxNumberOfCarrier = odMatrix.getListOfPurposes().size() * odMatrix.getListOfZones().size() * odMatrix.getListOfModesOrVehTypes().size(); int createdCarrier = 0; From a173fd17d8562aa5f9e4117188d1a38c7088cc6a Mon Sep 17 00:00:00 2001 From: aleks Date: Thu, 5 Sep 2024 16:12:15 +0200 Subject: [PATCH 06/60] Fixed jspritIteration value-initialization bug --- .../DefaultVehicleSelection.java | 13 ++++--------- .../GenerateSmallScaleCommercialTrafficDemand.java | 5 +++-- .../VehicleSelection.java | 1 + 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java index 2e688c489c1..3f6358840da 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java @@ -28,7 +28,7 @@ public class DefaultVehicleSelection implements VehicleSelection{ private static final Logger log = LogManager.getLogger(GenerateSmallScaleCommercialTrafficDemand.class); //Configurations - private final int jspritIterations; + private int jspritIterations = 0; //Needed for all computations (static) private final static Random rnd = MatsimRandom.getRandom(); @@ -41,20 +41,13 @@ public class DefaultVehicleSelection implements VehicleSelection{ Map> resultingDataPerZone; Map, Link>> linksPerZone; - /** - * Prepares the Vehicle Selection. - * @param jspritIterations Configuration: Number of jsprit iterations (Given in {@link GenerateSmallScaleCommercialTrafficDemand}) - */ - DefaultVehicleSelection(int jspritIterations) { - this.jspritIterations = jspritIterations; - } - /** * Creates the carriers and the related demand, based on the generated * TripDistributionMatrix. * @param scenario Scenario (loaded from your config), where the carriers will be put into * @param getCommercialTourSpecifications * @param facilitiesPerZone + * @param jspritIterations * @param odMatrix Can be generated in {@link GenerateSmallScaleCommercialTrafficDemand} * @param smallScaleCommercialTrafficType Selected traffic types. Options: commercialPersonTraffic, goodsTraffic * @param resultingDataPerZone Data distribution to zones (Given in {@link GenerateSmallScaleCommercialTrafficDemand} @@ -64,6 +57,7 @@ public class DefaultVehicleSelection implements VehicleSelection{ public void createCarriers(Scenario scenario, GetCommercialTourSpecifications getCommercialTourSpecifications, Map>> facilitiesPerZone, + int jspritIterations, TripDistributionMatrix odMatrix, String smallScaleCommercialTrafficType, Map> resultingDataPerZone, @@ -72,6 +66,7 @@ public void createCarriers(Scenario scenario, RandomGenerator rng = new MersenneTwister(scenario.getConfig().global().getRandomSeed()); this.getCommercialTourSpecifications = getCommercialTourSpecifications; this.facilitiesPerZone = facilitiesPerZone; + this.jspritIterations = jspritIterations; this.odMatrix = odMatrix; this.resultingDataPerZone = resultingDataPerZone; this.linksPerZone = linksPerZone; diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 5b8fee55cc5..b25517af922 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -179,7 +179,7 @@ public GenerateSmallScaleCommercialTrafficDemand() { log.info("Using default {} if existing models are integrated!", DefaultIntegrateExistingTrafficToSmallScaleCommercialImpl.class.getSimpleName()); this.getCommercialTourSpecifications = new DefaultTourSpecificationsByUsingKID2002(); log.info("Using default {} for tour specifications!", DefaultTourSpecificationsByUsingKID2002.class.getSimpleName()); - this.vehicleSelection = new DefaultVehicleSelection(jspritIterations); + this.vehicleSelection = new DefaultVehicleSelection(); log.info("Using default {} for tour vehicle-selection!", DefaultVehicleSelection.class.getSimpleName()); } public GenerateSmallScaleCommercialTrafficDemand(IntegrateExistingTrafficToSmallScaleCommercial integrateExistingTrafficToSmallScaleCommercial, GetCommercialTourSpecifications getCommercialTourSpecifications, VehicleSelection vehicleSelection) { @@ -198,7 +198,7 @@ public GenerateSmallScaleCommercialTrafficDemand(IntegrateExistingTrafficToSmall log.info("Using {} for tour specifications!", getCommercialTourSpecifications.getClass().getSimpleName()); } if(vehicleSelection == null){ - this.vehicleSelection = new DefaultVehicleSelection(jspritIterations); + this.vehicleSelection = new DefaultVehicleSelection(); log.info("Using default {} for tour vehicle-selection!", DefaultVehicleSelection.class.getSimpleName()); } else { this.vehicleSelection = vehicleSelection; @@ -492,6 +492,7 @@ else if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) scenario, getCommercialTourSpecifications, facilitiesPerZone, + jspritIterations, odMatrix, smallScaleCommercialTrafficType, resultingDataPerZone, diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java index 8fbd1aeb5b5..d9f11db6917 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java @@ -24,6 +24,7 @@ public interface VehicleSelection{ void createCarriers(Scenario scenario, GetCommercialTourSpecifications getCommercialTourSpecifications, Map>> facilitiesPerZone, + int jspritIterations, TripDistributionMatrix odMatrix, String smallScaleCommercialTrafficType, Map> resultingDataPerZone, From 8627fa3eac2a2dd21987f03e0adaf73c0723b431 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Tue, 10 Sep 2024 11:59:20 +0200 Subject: [PATCH 07/60] change inputs of class by using globFile --- .../analysis/CarrierLoadAnalysis.java | 5 ++- .../analysis/CarrierPlanAnalysis.java | 5 ++- ...tTimeAndDistanceAnalysisEventsHandler.java | 9 ++-- .../RunFreightAnalysisEventBased.java | 43 ++++++++++--------- .../FreightAnalysisEventBasedTest.java | 3 +- 5 files changed, 36 insertions(+), 29 deletions(-) diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java index 7e858ee725d..bc89be5b06c 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java @@ -37,6 +37,7 @@ import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; +import java.nio.file.Path; import java.util.Comparator; import java.util.LinkedHashMap; import java.util.LinkedList; @@ -92,10 +93,10 @@ private void handleDelivery(Event event) { vehicle2Load.put(vehicleId, list); } - void writeLoadPerVehicle(String analysisOutputDirectory, Scenario scenario) throws IOException { + void writeLoadPerVehicle(Path analysisOutputDirectory, Scenario scenario) throws IOException { log.info("Writing out vehicle load analysis ..."); //Load per vehicle - String fileName = analysisOutputDirectory + "Load_perVehicle.tsv"; + String fileName = analysisOutputDirectory.resolve("Load_perVehicle.tsv").toString(); BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java index 4b57935373a..baa2912ea0c 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java @@ -32,6 +32,7 @@ import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; +import java.nio.file.Path; import java.util.TreeMap; /** @@ -55,10 +56,10 @@ public CarrierPlanAnalysis(Carriers carriers) { this.carriers = carriers; } - public void runAnalysisAndWriteStats(String analysisOutputDirectory) throws IOException { + public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOException { log.info("Writing out carrier analysis ..."); //Load per vehicle - String fileName = analysisOutputDirectory + "Carrier_stats.tsv"; + String fileName = analysisOutputDirectory.resolve("Carrier_stats.tsv").toString(); BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java index 3037716368c..d4b1248700b 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java @@ -43,6 +43,7 @@ import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; +import java.nio.file.Path; import java.util.LinkedHashMap; import java.util.Map; import java.util.TreeMap; @@ -156,10 +157,10 @@ private void handleEvent(VehicleEntersTrafficEvent event){ } } - void writeTravelTimeAndDistancePerVehicle(String analysisOutputDirectory, Scenario scenario) throws IOException { + void writeTravelTimeAndDistancePerVehicle(Path analysisOutputDirectory, Scenario scenario) throws IOException { log.info("Writing out Time & Distance & Costs ... perVehicle"); //Travel time and distance per vehicle - String fileName = analysisOutputDirectory + "TimeDistance_perVehicle.tsv"; + String fileName = analysisOutputDirectory.resolve("TimeDistance_perVehicle.tsv").toString(); BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); @@ -216,7 +217,7 @@ void writeTravelTimeAndDistancePerVehicle(String analysisOutputDirectory, Scenar } - void writeTravelTimeAndDistancePerVehicleType(String analysisOutputDirectory, Scenario scenario) throws IOException { + void writeTravelTimeAndDistancePerVehicleType(Path analysisOutputDirectory, Scenario scenario) throws IOException { log.info("Writing out Time & Distance & Costs ... perVehicleType"); //----- All VehicleTypes in CarriervehicleTypes container. Used so that even unused vehTypes appear in the output @@ -226,7 +227,7 @@ void writeTravelTimeAndDistancePerVehicleType(String analysisOutputDirectory, Sc vehicleTypesMap.putIfAbsent(vehicleType.getId(), vehicleType); } - String fileName = analysisOutputDirectory + "TimeDistance_perVehicleType.tsv"; + String fileName = analysisOutputDirectory.resolve("TimeDistance_perVehicleType.tsv").toString(); BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); //Write headline: diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java index 44374d18dd7..b0b4dfc84f4 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java @@ -36,6 +36,9 @@ import java.io.File; import java.io.IOException; +import java.nio.file.Path; + +import static org.matsim.application.ApplicationUtils.globFile; /** @@ -53,16 +56,16 @@ public class RunFreightAnalysisEventBased { private static final Logger log = LogManager.getLogger(RunFreightAnalysisEventBased.class); //Were is your simulation output, that should be analysed? - private final String SIM_OUTPUT_PATH ; - private final String ANALYSIS_OUTPUT_PATH; + private final Path SIM_OUTPUT_PATH ; + private final Path ANALYSIS_OUTPUT_PATH; private final String GLOBAL_CRS; /** - * @param simOutputPath The output directory of the simulation run - * @param analysisOutputPath The directory where the result of the analysis should go to - * @param globalCrs + * @param simOutputPath The output directory of the simulation run + * @param analysisOutputPath The directory where the result of the analysis should go to + * @param globalCrs The CRS of the simulation */ - public RunFreightAnalysisEventBased(String simOutputPath, String analysisOutputPath, String globalCrs) { + public RunFreightAnalysisEventBased(Path simOutputPath, Path analysisOutputPath, String globalCrs) { this.SIM_OUTPUT_PATH = simOutputPath; this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; this.GLOBAL_CRS = globalCrs; @@ -71,8 +74,8 @@ public RunFreightAnalysisEventBased(String simOutputPath, String analysisOutputP public void runAnalysis() throws IOException { Config config = ConfigUtils.createConfig(); - config.vehicles().setVehiclesFile(SIM_OUTPUT_PATH + "output_allVehicles.xml.gz"); - config.network().setInputFile(SIM_OUTPUT_PATH + "output_network.xml.gz"); + config.vehicles().setVehiclesFile(globFile(SIM_OUTPUT_PATH, "*output_allVehicles.*").toString()); + config.network().setInputFile(globFile(SIM_OUTPUT_PATH, "*output_network.*").toString()); config.global().setCoordinateSystem(GLOBAL_CRS); config.plans().setInputFile(null); config.eventsManager().setNumberOfThreads(null); @@ -80,18 +83,18 @@ public void runAnalysis() throws IOException { config.global().setNumberOfThreads(1); //freight settings FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule( config, FreightCarriersConfigGroup.class ) ; - freightCarriersConfigGroup.setCarriersFile( SIM_OUTPUT_PATH + "output_carriers.xml.gz"); - freightCarriersConfigGroup.setCarriersVehicleTypesFile(SIM_OUTPUT_PATH + "output_carriersVehicleTypes.xml.gz"); + freightCarriersConfigGroup.setCarriersFile(globFile(SIM_OUTPUT_PATH, "*output_carriers.*").toString()); + freightCarriersConfigGroup.setCarriersVehicleTypesFile(globFile(SIM_OUTPUT_PATH, "*output_carriersVehicleTypes.*").toString()); //Were to store the analysis output? - String analysisOutputDirectory = ANALYSIS_OUTPUT_PATH; - if (!analysisOutputDirectory.endsWith("/")) { - analysisOutputDirectory = analysisOutputDirectory + "/"; - } - File folder = new File(analysisOutputDirectory); +// String analysisOutputDirectory = ANALYSIS_OUTPUT_PATH; +// if (!analysisOutputDirectory.endsWith("/")) { +// analysisOutputDirectory = analysisOutputDirectory + "/"; +// } + File folder = new File(String.valueOf(ANALYSIS_OUTPUT_PATH)); folder.mkdirs(); - final String eventsFile = SIM_OUTPUT_PATH + "output_events.xml.gz"; + final String eventsFile = globFile(SIM_OUTPUT_PATH, "*output_events.*").toString(); Scenario scenario = ScenarioUtils.loadScenario(config); @@ -101,7 +104,7 @@ public void runAnalysis() throws IOException { // CarrierPlanAnalysis CarrierPlanAnalysis carrierPlanAnalysis = new CarrierPlanAnalysis(CarriersUtils.getCarriers(scenario)); - carrierPlanAnalysis.runAnalysisAndWriteStats(analysisOutputDirectory); + carrierPlanAnalysis.runAnalysisAndWriteStats(ANALYSIS_OUTPUT_PATH); // Prepare eventsManager - start of event based Analysis; EventsManager eventsManager = EventsUtils.createEventsManager(); @@ -120,9 +123,9 @@ public void runAnalysis() throws IOException { log.info("Analysis completed."); log.info("Writing output..."); - freightTimeAndDistanceAnalysisEventsHandler.writeTravelTimeAndDistancePerVehicle(analysisOutputDirectory, scenario); - freightTimeAndDistanceAnalysisEventsHandler.writeTravelTimeAndDistancePerVehicleType(analysisOutputDirectory, scenario); - carrierLoadAnalysis.writeLoadPerVehicle(analysisOutputDirectory, scenario); + freightTimeAndDistanceAnalysisEventsHandler.writeTravelTimeAndDistancePerVehicle(ANALYSIS_OUTPUT_PATH, scenario); + freightTimeAndDistanceAnalysisEventsHandler.writeTravelTimeAndDistancePerVehicleType(ANALYSIS_OUTPUT_PATH, scenario); + carrierLoadAnalysis.writeLoadPerVehicle(ANALYSIS_OUTPUT_PATH, scenario); } } diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java index 75986b3e94c..985e912c4ff 100644 --- a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java @@ -26,6 +26,7 @@ import org.matsim.testcases.MatsimTestUtils; import java.io.IOException; +import java.nio.file.Path; public class FreightAnalysisEventBasedTest { @@ -35,7 +36,7 @@ public class FreightAnalysisEventBasedTest { @Test void runFreightAnalysisEventBasedTest() throws IOException { - RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased(testUtils.getClassInputDirectory(), testUtils.getOutputDirectory(),null); + RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased(Path.of(testUtils.getClassInputDirectory()), Path.of(testUtils.getOutputDirectory()),null); analysisEventBased.runAnalysis(); MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Carrier_stats.tsv", testUtils.getOutputDirectory() + "Carrier_stats.tsv"); From 14d70ad608d4c5e9d0c40808f391ae0c17ec0182 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Tue, 10 Sep 2024 12:00:09 +0200 Subject: [PATCH 08/60] add carrier analysis to small scale commercial generation --- contribs/small-scale-traffic-generation/pom.xml | 6 ++++++ .../GenerateSmallScaleCommercialTrafficDemand.java | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/contribs/small-scale-traffic-generation/pom.xml b/contribs/small-scale-traffic-generation/pom.xml index 46ea6a80936..98d11767cd0 100644 --- a/contribs/small-scale-traffic-generation/pom.xml +++ b/contribs/small-scale-traffic-generation/pom.xml @@ -24,6 +24,12 @@ 2025.0-SNAPSHOT + + org.matsim.contrib + vsp + 2025.0-SNAPSHOT + + diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index b25517af922..f63f8358b5d 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -67,6 +67,7 @@ import org.matsim.core.utils.geometry.CoordinateTransformation; import org.matsim.facilities.ActivityFacility; import org.matsim.freight.carriers.*; +import org.matsim.freight.carriers.analysis.RunFreightAnalysisEventBased; import org.matsim.freight.carriers.controler.*; import org.matsim.freight.carriers.usecases.chessboard.CarrierTravelDisutilities; import org.matsim.smallScaleCommercialTrafficGeneration.data.DefaultTourSpecificationsByUsingKID2002; @@ -306,6 +307,12 @@ public Integer call() throws Exception { controler.run(); + //Analysis + System.out.println("Starting Analysis for Carriers of small scale commercial traffic."); + RunFreightAnalysisEventBased freightAnalysis = new RunFreightAnalysisEventBased(output, output.resolve("Carrier_Analysis"), controler.getConfig().global().getCoordinateSystem()); + freightAnalysis.runAnalysis(); + System.out.println("Finishing Analysis of Carrier."); + SmallScaleCommercialTrafficUtils.createPlansBasedOnCarrierPlans(controler.getScenario(), usedSmallScaleCommercialTrafficType.toString(), output, modelName, sampleName, nameOutputPopulation, numberOfPlanVariantsPerAgent); From c3fcf76030f246b3c7337cbd779ab5634d53c2d4 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 12 Sep 2024 09:07:46 +0200 Subject: [PATCH 09/60] format log massages --- .../matsim/freight/carriers/analysis/CarrierLoadAnalysis.java | 2 +- .../matsim/freight/carriers/analysis/CarrierPlanAnalysis.java | 2 +- .../analysis/FreightTimeAndDistanceAnalysisEventsHandler.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java index bc89be5b06c..28f9ec33da7 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java @@ -120,6 +120,6 @@ void writeLoadPerVehicle(Path analysisOutputDirectory, Scenario scenario) throws } bw1.close(); - log.info("Output written to " + fileName); + log.info("Output written to {}", fileName); } } diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java index baa2912ea0c..a8dd6c42f21 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java @@ -85,6 +85,6 @@ public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOExce } bw1.close(); - log.info("Output written to " + fileName); + log.info("Output written to {}", fileName); } } diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java index d4b1248700b..91b911ac212 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java @@ -213,7 +213,7 @@ void writeTravelTimeAndDistancePerVehicle(Path analysisOutputDirectory, Scenario } bw1.close(); - log.info("Output written to " + fileName); + log.info("Output written to {}", fileName); } @@ -275,6 +275,6 @@ void writeTravelTimeAndDistancePerVehicleType(Path analysisOutputDirectory, Scen } bw1.close(); - log.info("Output written to " + fileName); + log.info("Output written to {}", fileName); } } From 3555b3f2fe448b04d372612487ae6e0c1a161796 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 12 Sep 2024 09:08:35 +0200 Subject: [PATCH 10/60] add more general carrier analysis --- .../analysis/CarrierPlanAnalysis.java | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java index a8dd6c42f21..a4cf2389527 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java @@ -25,9 +25,7 @@ import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.core.utils.misc.Time; -import org.matsim.freight.carriers.Carrier; -import org.matsim.freight.carriers.Carriers; -import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.*; import java.io.BufferedWriter; import java.io.FileWriter; @@ -64,18 +62,47 @@ public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOExce BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); //Write headline: - bw1.write("carrierId \t MATSimScoreSelectedPlan \t jSpritScoreSelectedPlan \t nuOfTours \t nuOfShipments(input) \t nuOfServices(input) \t jspritComputationTime[HH:mm:ss]"); + bw1.write("carrierId \t MATSimScoreSelectedPlan \t jSpritScoreSelectedPlan \t nuOfTours \t nuOfShipments(input) \t nuOfShipments(handled) \t nuOfServices(input) \t nuOfServices(handled) \t nuOfPlanedDemandSize \t nuOfHandledDemandSize \t jspritComputationTime[HH:mm:ss]"); bw1.newLine(); final TreeMap, Carrier> sortedCarrierMap = new TreeMap<>(carriers.getCarriers()); for (Carrier carrier : sortedCarrierMap.values()) { + + int numberOfPlanedShipments = carrier.getShipments().size(); + int numberOfPlanedServices = carrier.getServices().size(); + int numberOfHandledPickups = (int)carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Pickup).count()).sum(); + int numberOfHandledDeliveries = (int)carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Delivery).count()).sum(); + int nuOfServiceHandled = (int)carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.ServiceActivity).count()).sum(); + int numberOfPlanedDemandSize; + int numberOfHandledDemandSize; + if (numberOfPlanedShipments > 0) { + numberOfPlanedDemandSize = carrier.getShipments().values().stream().mapToInt(CarrierShipment::getSize).sum(); + numberOfHandledDemandSize = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Pickup).mapToInt(te -> ( ((Tour.Pickup) te).getShipment().getSize())).sum()).sum(); + } else { + numberOfPlanedDemandSize = carrier.getServices().values().stream().mapToInt(CarrierService::getCapacityDemand).sum(); + numberOfHandledDemandSize = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.ServiceActivity).mapToInt(te -> ((Tour.ServiceActivity) te).getService().getCapacityDemand()).sum()).sum(); + } + + if(numberOfPlanedServices != nuOfServiceHandled) { + log.warn("Number of services in input and handled are not equal for carrier {}. Jobs Input: {}, Jobs Handled: {}", carrier.getId(), numberOfPlanedServices, nuOfServiceHandled); + } + if (numberOfPlanedShipments != numberOfHandledPickups) { + log.warn("Number of shipments in input and handled are not equal for carrier {}. Jobs Input: {}, Jobs Handled: {}", carrier.getId(), numberOfPlanedShipments, numberOfHandledPickups); + } + if (numberOfHandledDeliveries != numberOfHandledPickups) { + log.warn("Number of handled pickups and deliveries are not equal for carrier {}. Pickups: {}, Deliveries: {}. This should not happen!!", carrier.getId(), numberOfHandledPickups, numberOfHandledDeliveries); + } bw1.write(carrier.getId().toString()); bw1.write("\t" + carrier.getSelectedPlan().getScore()); bw1.write("\t" + carrier.getSelectedPlan().getJspritScore()); bw1.write("\t" + carrier.getSelectedPlan().getScheduledTours().size()); - bw1.write("\t" + carrier.getShipments().size()); - bw1.write("\t" + carrier.getServices().size()); + bw1.write("\t" + numberOfPlanedShipments); + bw1.write("\t" + numberOfHandledPickups); + bw1.write("\t" + numberOfPlanedServices); + bw1.write("\t" + nuOfServiceHandled); + bw1.write("\t" + numberOfPlanedDemandSize); + bw1.write("\t" + numberOfHandledDemandSize); if (CarriersUtils.getJspritComputationTime(carrier) != Integer.MIN_VALUE) bw1.write("\t" + Time.writeTime(CarriersUtils.getJspritComputationTime(carrier), Time.TIMEFORMAT_HHMMSS)); else From b70c48213fe87b7ac8af3e607b6dcddbdda8c5c3 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 12 Sep 2024 09:08:58 +0200 Subject: [PATCH 11/60] clean up --- .../carriers/analysis/RunFreightAnalysisEventBased.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java index b0b4dfc84f4..af3d6fc6041 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java @@ -87,10 +87,6 @@ public void runAnalysis() throws IOException { freightCarriersConfigGroup.setCarriersVehicleTypesFile(globFile(SIM_OUTPUT_PATH, "*output_carriersVehicleTypes.*").toString()); //Were to store the analysis output? -// String analysisOutputDirectory = ANALYSIS_OUTPUT_PATH; -// if (!analysisOutputDirectory.endsWith("/")) { -// analysisOutputDirectory = analysisOutputDirectory + "/"; -// } File folder = new File(String.valueOf(ANALYSIS_OUTPUT_PATH)); folder.mkdirs(); From f2a187595dc8707364882e89800ce67e9c76b8cc Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 12 Sep 2024 09:35:22 +0200 Subject: [PATCH 12/60] update carrier_stats to new version --- .../runFreightAnalysisEventBasedTest/Carrier_stats.tsv | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv deleted file mode 100644 index d9ee80ea968..00000000000 --- a/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv +++ /dev/null @@ -1,2 +0,0 @@ -carrierId MATSimScoreSelectedPlan jSpritScoreSelectedPlan nuOfTours nuOfShipments(input) nuOfServices(input) jspritComputationTime[HH:mm:ss] -carrier1 -263.4 null 2 0 7 null From 95dd98c5e7ae48f9757f5bb559c19d9746c5c12a Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 12 Sep 2024 09:52:40 +0200 Subject: [PATCH 13/60] update carrier_stats to new version --- .../runFreightAnalysisEventBasedTest/Carrier_stats.tsv | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv diff --git a/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv new file mode 100644 index 00000000000..fc9ba4ea543 --- /dev/null +++ b/contribs/vsp/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv @@ -0,0 +1,2 @@ +carrierId MATSimScoreSelectedPlan jSpritScoreSelectedPlan nuOfTours nuOfShipments(input) nuOfShipments(handled) nuOfServices(input) nuOfServices(handled) nuOfPlanedDemandSize nuOfHandledDemandSize jspritComputationTime[HH:mm:ss] +carrier1 -263.4 null 2 0 0 7 7 7 7 null From a938a6fb459d7643acd84cc66b4c97e1e6a11988 Mon Sep 17 00:00:00 2001 From: aleks Date: Tue, 17 Sep 2024 10:31:08 +0200 Subject: [PATCH 14/60] Created a viability assurance for carrier plans with small vehicle fleet --- .../DefaultVehicleAvailabilityAllocator.java | 58 -------- .../DefaultVehicleSelection.java | 13 +- ...rateSmallScaleCommercialTrafficDemand.java | 129 +++++++++++++++++- .../VehicleAvailabilityAllocator.java | 106 ++++++++++++++ 4 files changed, 235 insertions(+), 71 deletions(-) delete mode 100644 contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleAvailabilityAllocator.java create mode 100644 contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleAvailabilityAllocator.java diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleAvailabilityAllocator.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleAvailabilityAllocator.java deleted file mode 100644 index 97e8092322c..00000000000 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleAvailabilityAllocator.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.matsim.smallScaleCommercialTrafficGeneration; - -import java.util.*; - -/** - * A small allocator to solve the time-window problems in the Vehicle and Service generation.
- * This implementation uses a Best-Fit Allocator. - * NOTE: This class does not actually change anything in the scenario. It is just a tool to check if Service and Vehicle TimeWindows are - * compatible. - */ -public class DefaultVehicleAvailabilityAllocator{ - private List availableVehicleTime; - - /** - * Prepares the allocator. - * @param availableVehicleTime This Collection should contain the duration of available-time-frames of the vehicles. - * For example: 4x vehicles are available from 1:00 to 4:00 (3 hours), then the {@code availableVehicles} Collection should - * contain 4 entries with value: 3*3600=10800. If a vehicle has a non-coherent availability-time-frame, add it as two - * separate entries. - */ - public DefaultVehicleAvailabilityAllocator(List availableVehicleTime){ - this.availableVehicleTime = availableVehicleTime; - } - - /** - * Checks if a vehicle is available for the given amount of time. If not, then the time is set to the largest possible duration, - * which can be allocated. - * @return the reduced serviceDuration (unchanged, if a vehicle was found, that was available for the full duration) - */ - public int makeServiceDurationViable(int serviceDuration){ - for(Integer vehicleTime : availableVehicleTime){ - if(vehicleTime >= serviceDuration) return serviceDuration; - } - return Collections.max(availableVehicleTime); - } - - /** - * Tries to allocate a single vehicle to the service and reduces the allocated vehicle available time by the serviceDuration. - * If no vehicle is available nothing happens. You should then consider to reduce the duration with {@link DefaultVehicleAvailabilityAllocator#makeServiceDurationViable} - * @return true if a vehicle was allocated, false if no vehicle is available for the given duration - */ - public boolean scheduleServiceDuration(int serviceDuration){ - //Best-Fit Allocation - int bestFit = -1; - int bestRemaining = Integer.MAX_VALUE; - for(int i = 0; i < availableVehicleTime.size(); i++){ - int remaining = availableVehicleTime.get(i) - serviceDuration; - if(remaining > 0 && remaining < bestRemaining){ - bestFit = i; - bestRemaining = remaining; - } - } - if(bestFit == -1) return false; - //Allocate - availableVehicleTime.set(bestFit, availableVehicleTime.get(bestFit) - serviceDuration); - return true; - } -} diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java index 3f6358840da..c4f524db787 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java @@ -34,7 +34,6 @@ public class DefaultVehicleSelection implements VehicleSelection{ private final static Random rnd = MatsimRandom.getRandom(); //Needed for this computation - Map, DefaultVehicleAvailabilityAllocator> carrierId2vehicleAvailabilityScheduler = new HashMap<>(); GetCommercialTourSpecifications getCommercialTourSpecifications; Map>> facilitiesPerZone; TripDistributionMatrix odMatrix; @@ -266,16 +265,12 @@ private void createServices(Scenario scenario, String stopZone = serviceArea[0]; for (int i = 0; i < numberOfJobs; i++) { - //Allocate the vehicleTime. If there is not enough vehicle time, then reduce the service duration to a viable value - int serviceDuration = carrierId2vehicleAvailabilityScheduler.get(Id.create(carrierName, Carrier.class)).makeServiceDurationViable(serviceTimePerStop); - carrierId2vehicleAvailabilityScheduler.get(Id.create(carrierName, Carrier.class)).scheduleServiceDuration(serviceDuration); - Id linkId = findPossibleLink(stopZone, selectedStopCategory, noPossibleLinks); Id idNewService = Id.create(carrierName + "_" + linkId + "_" + rnd.nextInt(10000), CarrierService.class); CarrierService thisService = CarrierService.Builder.newInstance(idNewService, linkId) - .setServiceDuration(serviceDuration).setServiceStartTimeWindow(serviceTimeWindow).build(); + .setServiceDuration(serviceTimePerStop).setServiceStartTimeWindow(serviceTimeWindow).build(); CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)).getServices() .put(thisService.getId(), thisService); } @@ -321,7 +316,7 @@ private void createNewCarrierAndAddVehicleTypes(Scenario scenario, vehicleDepots.add(linkId.toString()); } - List availableVehicles = new LinkedList<>(); + List availableVehicles = new LinkedList<>(); for (String singleDepot : vehicleDepots) { GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = tourStartTimeSelector.sample(); @@ -343,15 +338,13 @@ private void createNewCarrierAndAddVehicleTypes(Scenario scenario, Vehicle.class), Id.createLinkId(singleDepot), thisType) .setEarliestStart(vehicleStartTime).setLatestEnd(vehicleEndTime).build(); - availableVehicles.add(tourDuration); + availableVehicles.add((double) (tourDuration)); carrierCapabilities.getCarrierVehicles().put(newCarrierVehicle.getId(), newCarrierVehicle); if (!carrierCapabilities.getVehicleTypes().contains(thisType)) carrierCapabilities.getVehicleTypes().add(thisType); } } - if(carrierId2vehicleAvailabilityScheduler.containsKey(Id.create(carrierName, Carrier.class))) log.warn("It looks like {} was created twice. This should not happen!", carrierName); - carrierId2vehicleAvailabilityScheduler.put(Id.create(carrierName, Carrier.class), new DefaultVehicleAvailabilityAllocator(availableVehicles)); thisCarrier.setCarrierCapabilities(carrierCapabilities); } } diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index b25517af922..69b4a86d06e 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -90,9 +90,7 @@ * * @author Ricardo Ewert */ -//TODO check if service duration is larger than tour duration -> (tried, untested) -//TODO make vehicle selection (see method createCarriers()) configurable in separate class (use interface) -> (done, untested) -//TODO move generationRates in class TrafficVolumeGeneration in separate class in package data (similar to GetCommercialTourSpecifications) -> (done, untested) +//TODO make vehicle selection (see method createCarriers()) configurable in separate class (use interface) @CommandLine.Command(name = "generate-small-scale-commercial-traffic", description = "Generates plans for a small scale commercial traffic model", showDefaultValues = true) public class GenerateSmallScaleCommercialTrafficDemand implements MATSimAppCommand { // freight traffic from extern: @@ -135,6 +133,9 @@ public enum SmallScaleCommercialTrafficType { @CommandLine.Option(names = "--jspritIterations", description = "Set number of jsprit iterations", required = true) private int jspritIterations; + @CommandLine.Option(names = "--avgDrivingTime", description = "This average driving time is used for service-route-planning. If set too low, carriers may not serve all their services.", defaultValue = "1800") + private int avgDrivingTime; + @CommandLine.Option(names = "--creationOption", description = "Set option of mode differentiation: useExistingCarrierFileWithSolution, createNewCarrierFile, useExistingCarrierFileWithoutSolution") private CreationOption usedCreationOption; @@ -434,11 +435,14 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map handleServiceBatch(VehicleAvailabilityAllocator allocator, List lastServices, double serviceDuration, int serviceAmount){ + //Make duration viable and allocate vehicle Time + double viableDuration = allocator.makeMultipleServiceDurationsBalancedViable(serviceAmount, serviceDuration+avgDrivingTime); + //double viableDuration = serviceDuration+avgDrivingTime; + for(int i = 0; i < serviceAmount; i++) assert allocator.allocateServiceDuration(viableDuration-avgDrivingTime); + + List newServices = new LinkedList<>(); + + //Check if duration has changed and create new Services if it did + if(viableDuration != serviceDuration+avgDrivingTime){ + for(CarrierService lastService : lastServices){ + //the service duration is not viable, change its duration + if(viableDuration-avgDrivingTime < 0){ + /* If this happens, the serviceDuration must be negative in order to ensure, that the carrier can serve it. + * This however does not make sense, so we just leave the value as it is. It will result in unhandled services, but it leaves + * the scenario somehow plausible. + */ + log.warn("The carrier has too many services to handle! It is impossible to ensure full serving. This may be cause by a to high avgDrivingTime or incorrect source-data."); + viableDuration = serviceDuration+avgDrivingTime; + } + CarrierService newService = CarrierService.Builder.newInstance(lastService.getId(), lastService.getLocationLinkId()) + .setServiceDuration(viableDuration-avgDrivingTime).setServiceStartTimeWindow(lastService.getServiceStartTimeWindow()).build(); + + newServices.add(newService); + + log.info("Reduced serviceDuration (with avg driving time) from {} to {} of service {}", lastService.getServiceDuration()+avgDrivingTime, viableDuration, newService.getId()); + } + } + + return newServices; + } + + private void makeSubCarrierPlansViable(Collection subCarriers) { + for(Carrier carrier : subCarriers) { + List newServices = new LinkedList<>(); + + List carrierVehicleTimes = new ArrayList<>(carrier.getCarrierCapabilities().getCarrierVehicles().size()); + for (CarrierVehicle vehicle : carrier.getCarrierCapabilities().getCarrierVehicles().values()) + carrierVehicleTimes.add(vehicle.getLatestEndTime() - vehicle.getEarliestStartTime()); + VehicleAvailabilityAllocator allocator = new VehicleAvailabilityAllocator(carrierVehicleTimes); + + double lastServiceDuration = 0; + int lastServiceBatchAmount = 0; + List lastServices = new LinkedList<>(); + for (CarrierService service : carrier.getServices().values()) { + if (service.getServiceDuration() != lastServiceDuration) { + log.info("Retiming services of {}", carrier.getId()); + newServices.addAll(handleServiceBatch(allocator, lastServices, lastServiceDuration, lastServiceBatchAmount)); + lastServiceDuration = service.getServiceDuration(); + lastServiceBatchAmount = 0; + lastServices = new LinkedList<>(); + } + lastServiceBatchAmount++; + lastServices.add(service); + } + newServices.addAll(handleServiceBatch(allocator, lastServices, lastServiceDuration, lastServiceBatchAmount)); + + for (CarrierService newService : newServices) { + carrier.getServices().put(newService.getId(), newService); + } + } + } + + private void checkCarrierPlans(Scenario scenario){ + int successful = 0; + for(Carrier carrier : CarriersUtils.getCarriers(scenario).getCarriers().values()){ + CarrierPlan plan = carrier.getSelectedPlan(); + double totalVehicleTime = 0; + double totalServiceDuration = 0; + double totalTravelDuration = 0; + + for(CarrierVehicle vehicle : carrier.getCarrierCapabilities().getCarrierVehicles().values()){ + totalVehicleTime += vehicle.getLatestEndTime() - vehicle.getEarliestStartTime(); + } + + List handledServices = new LinkedList<>(); + //Check if all services have been handled + for(ScheduledTour tour : plan.getScheduledTours()){ + //DEBUG + double thisVehicleTime = tour.getVehicle().getLatestEndTime() - tour.getVehicle().getEarliestStartTime(); + double thisTourTime = 0; + + for(Tour.TourElement element : tour.getTour().getTourElements()){ + if(element instanceof Tour.Leg){ + totalTravelDuration += ((Tour.Leg) element).getExpectedTransportTime(); + thisTourTime += ((Tour.Leg) element).getExpectedTransportTime(); + } + if(element instanceof Tour.ServiceActivity){ + handledServices.add(((Tour.ServiceActivity) element).getService()); + totalServiceDuration += ((Tour.ServiceActivity) element).getDuration(); + thisTourTime += ((Tour.ServiceActivity) element).getDuration(); + } + } + + log.info("Tour {} used {} out of {} available vehicle time", tour.getTour().getId(), thisTourTime, thisVehicleTime); + } + + int i = 0; + for(CarrierService handled : handledServices){ + if(carrier.getServices().containsValue(handled)) i++; + } + + if(i != carrier.getServices().values().size()){ + log.warn("Carrier {}: {} of {} services were not handled! The total vehicle time is: {} ({}); The total serviceDuration is: {} ({}); The total travelDuration is : {}", + carrier.getId(), + carrier.getServices().size() - i, + carrier.getServices().size(), + totalVehicleTime, carrier.getCarrierCapabilities().getCarrierVehicles().size(), + totalServiceDuration, carrier.getServices().size(), + totalTravelDuration + ); + } else { + successful++; + } + } + + log.info("{} of {} carriers were fully served!", successful, CarriersUtils.getCarriers(scenario).getCarriers().size()); + } + private void createCarriersAndDemand(Path output, Scenario scenario, Map> resultingDataPerZone, Map, Link>> linksPerZone, String smallScaleCommercialTrafficType, diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleAvailabilityAllocator.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleAvailabilityAllocator.java new file mode 100644 index 00000000000..e13cce7efcf --- /dev/null +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleAvailabilityAllocator.java @@ -0,0 +1,106 @@ +package org.matsim.smallScaleCommercialTrafficGeneration; + +import java.util.*; + +/** + * A small allocator to solve the time-window problems in the Vehicle and Service generation using a Best-Fit Allocator.
+ * NOTE: This class does not actually change anything in the scenario. It is just a tool to check if Service and Vehicle TimeWindows are + * compatible. + */ +public class VehicleAvailabilityAllocator { + private List availableVehicleTime; + + /** + * Prepares the allocator for a vehicle fleet. + * @param availableVehicleTime This Collection should contain the duration of available-time-frames of the vehicles. + * For example: 4x vehicles are available from 1:00 to 4:00 (3 hours), then the {@code availableVehicles} Collection should + * contain 4 entries with value: 3*3600=10800. If a vehicle has a non-coherent availability-time-frame, add it as two + * separate entries. + */ + public VehicleAvailabilityAllocator(List availableVehicleTime){ + this.availableVehicleTime = availableVehicleTime; + } + + /** + * Prepares the allocator for one vehicle. + * @param availableVehicleTime This Collection should contain the duration of available-time-frames of the vehicle. + */ + public VehicleAvailabilityAllocator(double availableVehicleTime){ + this.availableVehicleTime = new ArrayList<>(1); + this.availableVehicleTime.add(availableVehicleTime); + } + + /** + * Checks if a vehicle is available for the given amount of time. If not, then the time is set to the largest possible duration, + * which can be allocated. + * @return the reduced serviceDuration (unchanged, if a vehicle was found, that was available for the full duration) + */ + public double makeServiceDurationViable(double serviceDuration){ + for(Double vehicleTime : availableVehicleTime){ + if(vehicleTime >= serviceDuration) return serviceDuration; + } + return availableVehicleTime.stream().mapToDouble(v -> v).max().orElseThrow(); + } + + /** + * Tries to allocate a single vehicle to the service and reduces the allocated vehicle available time by the serviceDuration. + * If no vehicle is available nothing happens. You should then consider to reduce the duration with {@link VehicleAvailabilityAllocator#makeServiceDurationViable} + * @return true if a vehicle was allocated, false if no vehicle is available for the given duration + */ + public boolean allocateServiceDuration(double serviceDuration){ + //Best-Fit Allocation + int bestFit = -1; + double bestRemaining = Double.MAX_VALUE; + for(int i = 0; i < availableVehicleTime.size(); i++){ + double remaining = availableVehicleTime.get(i) - serviceDuration; + if(remaining >= 0 && remaining < bestRemaining){ + bestFit = i; + bestRemaining = remaining; + } + } + if(bestFit == -1) return false; + //Allocate + availableVehicleTime.set(bestFit, availableVehicleTime.get(bestFit) - serviceDuration); + return true; + } + + /** + * This method checks for a given amount of same serviceDurations, whether you can allocate a vehicle to all of them or not. + * If not, the Allocator reduces the serviceDurations in a balanced way, so that the duration-cutoff is distributed across all given services. + * If you do not care if some services get much more time than others, you can use the {@link VehicleAvailabilityAllocator#makeServiceDurationViable} method. + * @param serviceDuration The duration of the services. + * @return An array which contains the maximum possible service durations (reverse order) + */ + public double makeMultipleServiceDurationsBalancedViable(int serviceAmount, double serviceDuration){ + //Check for serviceDuration first + int allocatedServices = 0; + for (Double d : availableVehicleTime) { + allocatedServices += (int) Math.floor(d / serviceDuration); + } + + if(allocatedServices >= serviceAmount){ + return serviceDuration; + } + + //If not found yet, get the best next value + double lastValue = Double.POSITIVE_INFINITY; + while(true){ + //Get largest value below lastValue + double thisValue = 0; + for(double d : availableVehicleTime){ + if(d > thisValue && d < lastValue) thisValue = d; + } + + allocatedServices = 0; + for (Double d : availableVehicleTime) { + allocatedServices += (int) Math.floor(d / thisValue); + } + + if(allocatedServices >= serviceAmount){ + return thisValue; + } + + lastValue = thisValue; + } + } +} From 0e0bc7ff408d2b4da3c69807cea452954cd33f7b Mon Sep 17 00:00:00 2001 From: aleks Date: Tue, 17 Sep 2024 11:11:36 +0200 Subject: [PATCH 15/60] Put the carrier-creation back into the main class --- .../DefaultVehicleSelection.java | 394 +----------------- ...rateSmallScaleCommercialTrafficDemand.java | 360 +++++++++++++++- .../VehicleSelection.java | 34 +- 3 files changed, 387 insertions(+), 401 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java index c4f524db787..8e35d70e494 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java @@ -1,399 +1,27 @@ package org.matsim.smallScaleCommercialTrafficGeneration; -import it.unimi.dsi.fastutil.objects.Object2DoubleMap; -import org.apache.commons.math3.distribution.EnumeratedDistribution; -import org.apache.commons.math3.random.MersenneTwister; -import org.apache.commons.math3.random.RandomGenerator; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -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.Link; -import org.matsim.core.gbl.MatsimRandom; -import org.matsim.facilities.ActivityFacility; -import org.matsim.freight.carriers.*; -import org.matsim.smallScaleCommercialTrafficGeneration.data.GetCommercialTourSpecifications; -import org.matsim.vehicles.CostInformation; -import org.matsim.vehicles.Vehicle; -import org.matsim.vehicles.VehicleType; -import org.matsim.vehicles.VehicleUtils; - -import java.util.*; -import static org.matsim.smallScaleCommercialTrafficGeneration.GenerateSmallScaleCommercialTrafficDemand.getVehicleStartTime; -import static org.matsim.smallScaleCommercialTrafficGeneration.GenerateSmallScaleCommercialTrafficDemand.getVehicleTourDuration; +import java.util.ArrayList; +import java.util.List; public class DefaultVehicleSelection implements VehicleSelection{ private static final Logger log = LogManager.getLogger(GenerateSmallScaleCommercialTrafficDemand.class); - //Configurations - private int jspritIterations = 0; - - //Needed for all computations (static) - private final static Random rnd = MatsimRandom.getRandom(); - - //Needed for this computation - GetCommercialTourSpecifications getCommercialTourSpecifications; - Map>> facilitiesPerZone; - TripDistributionMatrix odMatrix; - Map> resultingDataPerZone; - Map, Link>> linksPerZone; - - /** - * Creates the carriers and the related demand, based on the generated - * TripDistributionMatrix. - * @param scenario Scenario (loaded from your config), where the carriers will be put into - * @param getCommercialTourSpecifications - * @param facilitiesPerZone - * @param jspritIterations - * @param odMatrix Can be generated in {@link GenerateSmallScaleCommercialTrafficDemand} - * @param smallScaleCommercialTrafficType Selected traffic types. Options: commercialPersonTraffic, goodsTraffic - * @param resultingDataPerZone Data distribution to zones (Given in {@link GenerateSmallScaleCommercialTrafficDemand} - * @param linksPerZone - */ @Override - public void createCarriers(Scenario scenario, - GetCommercialTourSpecifications getCommercialTourSpecifications, - Map>> facilitiesPerZone, - int jspritIterations, - TripDistributionMatrix odMatrix, - String smallScaleCommercialTrafficType, - Map> resultingDataPerZone, - Map, Link>> linksPerZone){ - //Save the given data - RandomGenerator rng = new MersenneTwister(scenario.getConfig().global().getRandomSeed()); - this.getCommercialTourSpecifications = getCommercialTourSpecifications; - this.facilitiesPerZone = facilitiesPerZone; - this.jspritIterations = jspritIterations; - this.odMatrix = odMatrix; - this.resultingDataPerZone = resultingDataPerZone; - this.linksPerZone = linksPerZone; - - int maxNumberOfCarrier = odMatrix.getListOfPurposes().size() * odMatrix.getListOfZones().size() - * odMatrix.getListOfModesOrVehTypes().size(); - int createdCarrier = 0; - int fixedNumberOfVehiclePerTypeAndLocation = 1; //TODO possible improvement, perhaps check KiD - - EnumeratedDistribution tourDistribution = getCommercialTourSpecifications.createTourDistribution(smallScaleCommercialTrafficType, rng); - - Map> stopDurationTimeSelector = getCommercialTourSpecifications.createStopDurationDistributionPerCategory(smallScaleCommercialTrafficType, rng); - - CarrierVehicleTypes carrierVehicleTypes = CarriersUtils.getCarrierVehicleTypes(scenario); - Map, VehicleType> additionalCarrierVehicleTypes = scenario.getVehicles().getVehicleTypes(); - - // Only a vehicle with cost information will work properly - additionalCarrierVehicleTypes.values().stream() - .filter(vehicleType -> vehicleType.getCostInformation().getCostsPerSecond() != null) - .forEach(vehicleType -> carrierVehicleTypes.getVehicleTypes().putIfAbsent(vehicleType.getId(), vehicleType)); - - for (VehicleType vehicleType : carrierVehicleTypes.getVehicleTypes().values()) { - CostInformation costInformation = vehicleType.getCostInformation(); - VehicleUtils.setCostsPerSecondInService(costInformation, costInformation.getCostsPerSecond()); - VehicleUtils.setCostsPerSecondWaiting(costInformation, costInformation.getCostsPerSecond()); - } - - for (Integer purpose : odMatrix.getListOfPurposes()) { - for (String startZone : odMatrix.getListOfZones()) { - for (String modeORvehType : odMatrix.getListOfModesOrVehTypes()) { - boolean isStartingLocation = false; - checkIfIsStartingPosition: - { - for (String possibleStopZone : odMatrix.getListOfZones()) { - if (!modeORvehType.equals("pt") && !modeORvehType.equals("op")) - if (odMatrix.getTripDistributionValue(startZone, possibleStopZone, modeORvehType, - purpose, smallScaleCommercialTrafficType) != 0) { - isStartingLocation = true; - break checkIfIsStartingPosition; - } - } - } - - if (isStartingLocation) { - double occupancyRate = 0; - String[] possibleVehicleTypes = null; - ArrayList startCategory = new ArrayList<>(); - ArrayList stopCategory = new ArrayList<>(); - stopCategory.add("Employee Primary Sector"); - stopCategory.add("Employee Construction"); - stopCategory.add("Employee Secondary Sector Rest"); - stopCategory.add("Employee Retail"); - stopCategory.add("Employee Traffic/Parcels"); - stopCategory.add("Employee Tertiary Sector Rest"); - stopCategory.add("Inhabitants"); - if (purpose == 1) { - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; - occupancyRate = 1.5; - } - startCategory.add("Employee Secondary Sector Rest"); - stopCategory.clear(); - stopCategory.add("Employee Secondary Sector Rest"); - } else if (purpose == 2) { - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; - occupancyRate = 1.6; - } - startCategory.add("Employee Secondary Sector Rest"); - } else if (purpose == 3) { - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - possibleVehicleTypes = new String[]{"golf1.4", "c_zero"}; - occupancyRate = 1.2; - } - startCategory.add("Employee Retail"); - startCategory.add("Employee Tertiary Sector Rest"); - } else if (purpose == 4) { - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - possibleVehicleTypes = new String[]{"golf1.4", "c_zero"}; - occupancyRate = 1.2; - } - startCategory.add("Employee Traffic/Parcels"); - } else if (purpose == 5) { - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - possibleVehicleTypes = new String[]{"mercedes313", "e_SpaceTourer"}; - occupancyRate = 1.7; - } - startCategory.add("Employee Construction"); - } else if (purpose == 6) { - startCategory.add("Inhabitants"); - } - if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { - occupancyRate = 1.; - switch (modeORvehType) { - case "vehTyp1" -> - possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; // possible to add more types, see source - case "vehTyp2" -> - possibleVehicleTypes = new String[]{"mercedes313", "e_SpaceTourer"}; - case "vehTyp3", "vehTyp4" -> - possibleVehicleTypes = new String[]{"light8t", "light8t_electro"}; - case "vehTyp5" -> - possibleVehicleTypes = new String[]{"medium18t", "medium18t_electro", "heavy40t", "heavy40t_electro"}; - } - } - - // use only types of the possibleTypes which are in the given types file - List vehicleTypes = new ArrayList<>(); - assert possibleVehicleTypes != null; - - for (String possibleVehicleType : possibleVehicleTypes) { - if (CarriersUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().containsKey( - Id.create(possibleVehicleType, VehicleType.class))) - vehicleTypes.add(possibleVehicleType); - } - // find a start category with existing employees in this zone - Collections.shuffle(startCategory, rnd); - String selectedStartCategory = startCategory.getFirst(); - for (int count = 1; resultingDataPerZone.get(startZone).getDouble(selectedStartCategory) == 0; count++) { - if (count <= startCategory.size()) - selectedStartCategory = startCategory.get(rnd.nextInt(startCategory.size())); - else - selectedStartCategory = stopCategory.get(rnd.nextInt(stopCategory.size())); - } - String carrierName = null; - if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { - carrierName = "Carrier_Goods_" + startZone + "_purpose_" + purpose + "_" + modeORvehType; - } else if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) - carrierName = "Carrier_Business_" + startZone + "_purpose_" + purpose; - int numberOfDepots = odMatrix.getSumOfServicesForStartZone(startZone, modeORvehType, purpose, - smallScaleCommercialTrafficType); - CarrierCapabilities.FleetSize fleetSize = CarrierCapabilities.FleetSize.FINITE; - ArrayList vehicleDepots = new ArrayList<>(); - createdCarrier++; - log.info("Create carrier number {} of a maximum Number of {} carriers.", createdCarrier, maxNumberOfCarrier); - log.info("Carrier: {}; depots: {}; services: {}", carrierName, numberOfDepots, - (int) Math.ceil(odMatrix.getSumOfServicesForStartZone(startZone, modeORvehType, - purpose, smallScaleCommercialTrafficType) / occupancyRate)); - createNewCarrierAndAddVehicleTypes(scenario, purpose, startZone, - selectedStartCategory, carrierName, vehicleTypes, numberOfDepots, fleetSize, - fixedNumberOfVehiclePerTypeAndLocation, vehicleDepots, smallScaleCommercialTrafficType, - tourDistribution); - log.info("Create services for carrier: {}", carrierName); - for (String stopZone : odMatrix.getListOfZones()) { - int trafficVolumeForOD = Math.round((float)odMatrix.getTripDistributionValue(startZone, - stopZone, modeORvehType, purpose, smallScaleCommercialTrafficType)); - int numberOfJobs = (int) Math.ceil(trafficVolumeForOD / occupancyRate); - if (numberOfJobs == 0) - continue; - // find a category for the tour stop with existing employees in this zone - String selectedStopCategory = stopCategory.get(rnd.nextInt(stopCategory.size())); - while (resultingDataPerZone.get(stopZone).getDouble(selectedStopCategory) == 0) - selectedStopCategory = stopCategory.get(rnd.nextInt(stopCategory.size())); - String[] serviceArea = new String[]{stopZone}; - int serviceTimePerStop; - if (selectedStartCategory.equals("Inhabitants")) - serviceTimePerStop = getServiceTimePerStop(stopDurationTimeSelector, startCategory.getFirst(), modeORvehType, smallScaleCommercialTrafficType); - else - serviceTimePerStop = getServiceTimePerStop(stopDurationTimeSelector, selectedStartCategory, modeORvehType, smallScaleCommercialTrafficType); - - TimeWindow serviceTimeWindow = TimeWindow.newInstance(0, 36 * 3600); // extended time window, so that late tours can handle it - createServices(scenario, vehicleDepots, selectedStopCategory, carrierName, - numberOfJobs, serviceArea, serviceTimePerStop, serviceTimeWindow); - } - } - } - } - } - -// System.out.println("Final results for the start time distribution"); -// tourStartTimeSelector.writeResults(); - -// System.out.println("Final results for the tour duration distribution"); -// tourDurationTimeSelector.writeResults(); - -// for (StopDurationGoodTrafficKey sector : stopDurationTimeSelector.keySet()) { -// System.out.println("Final results for the stop duration distribution in sector " + sector); -// stopDurationTimeSelector.get(sector); -// } - - log.warn("The jspritIterations are now set to {} in this simulation!", jspritIterations); - log.info("Finished creating {} carriers including related services.", createdCarrier); - + public List getAllCategories() { + return null; } - /** - * Creates the services for one carrier. - */ - private void createServices(Scenario scenario, - ArrayList noPossibleLinks, - String selectedStopCategory, - String carrierName, - int numberOfJobs, - String[] serviceArea, - Integer serviceTimePerStop, - TimeWindow serviceTimeWindow) { - - String stopZone = serviceArea[0]; - - for (int i = 0; i < numberOfJobs; i++) { - Id linkId = findPossibleLink(stopZone, selectedStopCategory, noPossibleLinks); - Id idNewService = Id.create(carrierName + "_" + linkId + "_" + rnd.nextInt(10000), - CarrierService.class); - - CarrierService thisService = CarrierService.Builder.newInstance(idNewService, linkId) - .setServiceDuration(serviceTimePerStop).setServiceStartTimeWindow(serviceTimeWindow).build(); - CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)).getServices() - .put(thisService.getId(), thisService); - } - } - - /** - * Creates the carrier and the related vehicles. - */ - private void createNewCarrierAndAddVehicleTypes(Scenario scenario, - Integer purpose, - String startZone, - String selectedStartCategory, - String carrierName, - List vehicleTypes, - int numberOfDepots, - CarrierCapabilities.FleetSize fleetSize, - int fixedNumberOfVehiclePerTypeAndLocation, - List vehicleDepots, - String smallScaleCommercialTrafficType, - EnumeratedDistribution tourStartTimeSelector) { - - Carriers carriers = CarriersUtils.addOrGetCarriers(scenario); - CarrierVehicleTypes carrierVehicleTypes = CarriersUtils.getCarrierVehicleTypes(scenario); - - CarrierCapabilities carrierCapabilities; - - Carrier thisCarrier = CarriersUtils.createCarrier(Id.create(carrierName, Carrier.class)); - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic") && purpose == 3) - thisCarrier.getAttributes().putAttribute("subpopulation", smallScaleCommercialTrafficType + "_service"); - else - thisCarrier.getAttributes().putAttribute("subpopulation", smallScaleCommercialTrafficType); - - thisCarrier.getAttributes().putAttribute("purpose", purpose); - thisCarrier.getAttributes().putAttribute("tourStartArea", startZone); - if (jspritIterations > 0) - CarriersUtils.setJspritIterations(thisCarrier, jspritIterations); - carrierCapabilities = CarrierCapabilities.Builder.newInstance().setFleetSize(fleetSize).build(); - - carriers.addCarrier(thisCarrier); - - while (vehicleDepots.size() < numberOfDepots) { - Id linkId = findPossibleLink(startZone, selectedStartCategory, null); - vehicleDepots.add(linkId.toString()); - } - - List availableVehicles = new LinkedList<>(); - - for (String singleDepot : vehicleDepots) { - GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = tourStartTimeSelector.sample(); - - int vehicleStartTime = getVehicleStartTime(t); - int tourDuration = getVehicleTourDuration(t); - int vehicleEndTime = vehicleStartTime + tourDuration; - for (String thisVehicleType : vehicleTypes) { //TODO Flottenzusammensetzung anpassen. Momentan pro Depot alle Fahrzeugtypen 1x erzeugen - VehicleType thisType = carrierVehicleTypes.getVehicleTypes() - .get(Id.create(thisVehicleType, VehicleType.class)); - if (fixedNumberOfVehiclePerTypeAndLocation == 0) - fixedNumberOfVehiclePerTypeAndLocation = 1; - for (int i = 0; i < fixedNumberOfVehiclePerTypeAndLocation; i++) { - CarrierVehicle newCarrierVehicle = CarrierVehicle.Builder - .newInstance( - Id.create( - thisCarrier.getId().toString() + "_" - + (carrierCapabilities.getCarrierVehicles().size() + 1), - Vehicle.class), - Id.createLinkId(singleDepot), thisType) - .setEarliestStart(vehicleStartTime).setLatestEnd(vehicleEndTime).build(); - availableVehicles.add((double) (tourDuration)); - carrierCapabilities.getCarrierVehicles().put(newCarrierVehicle.getId(), newCarrierVehicle); - if (!carrierCapabilities.getVehicleTypes().contains(thisType)) - carrierCapabilities.getVehicleTypes().add(thisType); - } - } - - thisCarrier.setCarrierCapabilities(carrierCapabilities); - } - } - - /** - * Give a service duration based on the purpose and the trafficType under a given probability - * - * @param serviceDurationTimeSelector the selector for the service duration - * @param employeeCategory the category of the employee - * @param modeORvehType the mode or vehicle type - * @return the service duration - */ - private Integer getServiceTimePerStop(Map> serviceDurationTimeSelector, - String employeeCategory, - String modeORvehType, - String smallScaleCommercialTrafficType) { - GenerateSmallScaleCommercialTrafficDemand.StopDurationGoodTrafficKey key = null; - if (smallScaleCommercialTrafficType.equals(GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString())) - key = GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey(employeeCategory, null); - else if (smallScaleCommercialTrafficType.equals(GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString())) { - key = GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey(employeeCategory, modeORvehType); - } - GenerateSmallScaleCommercialTrafficDemand.DurationsBounds serviceDurationBounds = serviceDurationTimeSelector.get(key).sample(); - int serviceDurationLowerBound = serviceDurationBounds.minDuration(); - int serviceDurationUpperBound = serviceDurationBounds.maxDuration(); - return rnd.nextInt(serviceDurationLowerBound * 60, serviceDurationUpperBound * 60); + @Override + public PurposeInformation getPurposeInformation(int purpose) { + return null; } - /** - * Finds a possible link for a service or the vehicle location. - */ - private Id findPossibleLink(String zone, String selectedCategory, List noPossibleLinks) { - Id newLink = null; - for (int a = 0; newLink == null && a < facilitiesPerZone.get(zone).get(selectedCategory).size() * 2; a++) { - - ActivityFacility possibleBuilding = facilitiesPerZone.get(zone).get(selectedCategory) - .get(rnd.nextInt(facilitiesPerZone.get(zone).get(selectedCategory).size())); //TODO Wkt für die Auswahl anpassen - Coord centroidPointOfBuildingPolygon = possibleBuilding.getCoord(); - - int numberOfPossibleLinks = linksPerZone.get(zone).size(); - - // searches and selects the nearest link of the possible links in this zone - newLink = SmallScaleCommercialTrafficUtils.findNearestPossibleLink(zone, noPossibleLinks, linksPerZone, newLink, - centroidPointOfBuildingPolygon, numberOfPossibleLinks); - } - if (newLink == null) - throw new RuntimeException("No possible link for buildings with type '" + selectedCategory + "' in zone '" - + zone + "' found. buildings in category: " + facilitiesPerZone.get(zone).get(selectedCategory) - + "; possibleLinks in zone: " + linksPerZone.get(zone).size()); - return newLink; + @Override + public String[] getPossibleVehicleTypes(String modeORvehType) { + return new String[0]; } } diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 6e61eb1c32b..b74f9a89e75 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -22,6 +22,7 @@ import com.google.inject.Inject; import com.google.inject.Provider; import it.unimi.dsi.fastutil.objects.Object2DoubleMap; +import org.apache.commons.math3.distribution.EnumeratedDistribution; import org.apache.commons.math3.random.MersenneTwister; import org.apache.commons.math3.random.RandomGenerator; import org.apache.logging.log4j.Level; @@ -72,8 +73,10 @@ import org.matsim.freight.carriers.usecases.chessboard.CarrierTravelDisutilities; import org.matsim.smallScaleCommercialTrafficGeneration.data.DefaultTourSpecificationsByUsingKID2002; import org.matsim.smallScaleCommercialTrafficGeneration.data.GetCommercialTourSpecifications; +import org.matsim.vehicles.CostInformation; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; +import org.matsim.vehicles.VehicleUtils; import picocli.CommandLine; import java.io.File; @@ -618,14 +621,11 @@ else if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) } final TripDistributionMatrix odMatrix = createTripDistribution(trafficVolumePerTypeAndZone_start, trafficVolumePerTypeAndZone_stop, smallScaleCommercialTrafficType, scenario, output, linksPerZone); - vehicleSelection.createCarriers( + createCarriers( scenario, - getCommercialTourSpecifications, - facilitiesPerZone, - jspritIterations, odMatrix, - smallScaleCommercialTrafficType, resultingDataPerZone, + smallScaleCommercialTrafficType, linksPerZone); } @@ -702,21 +702,367 @@ public void install() { return controler; } + /** + * Creates the carriers and the related demand, based on the generated + * TripDistributionMatrix. + * @param scenario Scenario (loaded from your config), where the carriers will be put into + * @param odMatrix Can be generated in {@link GenerateSmallScaleCommercialTrafficDemand} + * @param resultingDataPerZone Data distribution to zones (Given in {@link GenerateSmallScaleCommercialTrafficDemand} + * @param smallScaleCommercialTrafficType Selected traffic types. Options: commercialPersonTraffic, goodsTraffic + * @param linksPerZone + */ + public void createCarriers(Scenario scenario, + TripDistributionMatrix odMatrix, + Map> resultingDataPerZone, + String smallScaleCommercialTrafficType, + Map, Link>> linksPerZone){ + //Save the given data + RandomGenerator rng = new MersenneTwister(scenario.getConfig().global().getRandomSeed()); + + int maxNumberOfCarrier = odMatrix.getListOfPurposes().size() * odMatrix.getListOfZones().size() + * odMatrix.getListOfModesOrVehTypes().size(); + int createdCarrier = 0; + int fixedNumberOfVehiclePerTypeAndLocation = 1; //TODO possible improvement, perhaps check KiD + + EnumeratedDistribution tourDistribution = getCommercialTourSpecifications.createTourDistribution(smallScaleCommercialTrafficType, rng); + + Map> stopDurationTimeSelector = getCommercialTourSpecifications.createStopDurationDistributionPerCategory(smallScaleCommercialTrafficType, rng); + + CarrierVehicleTypes carrierVehicleTypes = CarriersUtils.getCarrierVehicleTypes(scenario); + Map, VehicleType> additionalCarrierVehicleTypes = scenario.getVehicles().getVehicleTypes(); + + // Only a vehicle with cost information will work properly + additionalCarrierVehicleTypes.values().stream() + .filter(vehicleType -> vehicleType.getCostInformation().getCostsPerSecond() != null) + .forEach(vehicleType -> carrierVehicleTypes.getVehicleTypes().putIfAbsent(vehicleType.getId(), vehicleType)); + + for (VehicleType vehicleType : carrierVehicleTypes.getVehicleTypes().values()) { + CostInformation costInformation = vehicleType.getCostInformation(); + VehicleUtils.setCostsPerSecondInService(costInformation, costInformation.getCostsPerSecond()); + VehicleUtils.setCostsPerSecondWaiting(costInformation, costInformation.getCostsPerSecond()); + } + + for (Integer purpose : odMatrix.getListOfPurposes()) { + for (String startZone : odMatrix.getListOfZones()) { + for (String modeORvehType : odMatrix.getListOfModesOrVehTypes()) { + boolean isStartingLocation = false; + checkIfIsStartingPosition: + { + for (String possibleStopZone : odMatrix.getListOfZones()) { + if (!modeORvehType.equals("pt") && !modeORvehType.equals("op")) + if (odMatrix.getTripDistributionValue(startZone, possibleStopZone, modeORvehType, + purpose, smallScaleCommercialTrafficType) != 0) { + isStartingLocation = true; + break checkIfIsStartingPosition; + } + } + } + + if (isStartingLocation) { + double occupancyRate = 0; + String[] possibleVehicleTypes = null; + ArrayList startCategory = new ArrayList<>(); + ArrayList stopCategory = new ArrayList<>(); + stopCategory.add("Employee Primary Sector"); + stopCategory.add("Employee Construction"); + stopCategory.add("Employee Secondary Sector Rest"); + stopCategory.add("Employee Retail"); + stopCategory.add("Employee Traffic/Parcels"); + stopCategory.add("Employee Tertiary Sector Rest"); + stopCategory.add("Inhabitants"); + if (purpose == 1) { + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; + occupancyRate = 1.5; + } + startCategory.add("Employee Secondary Sector Rest"); + stopCategory.clear(); + stopCategory.add("Employee Secondary Sector Rest"); + } else if (purpose == 2) { + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; + occupancyRate = 1.6; + } + startCategory.add("Employee Secondary Sector Rest"); + } else if (purpose == 3) { + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + possibleVehicleTypes = new String[]{"golf1.4", "c_zero"}; + occupancyRate = 1.2; + } + startCategory.add("Employee Retail"); + startCategory.add("Employee Tertiary Sector Rest"); + } else if (purpose == 4) { + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + possibleVehicleTypes = new String[]{"golf1.4", "c_zero"}; + occupancyRate = 1.2; + } + startCategory.add("Employee Traffic/Parcels"); + } else if (purpose == 5) { + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + possibleVehicleTypes = new String[]{"mercedes313", "e_SpaceTourer"}; + occupancyRate = 1.7; + } + startCategory.add("Employee Construction"); + } else if (purpose == 6) { + startCategory.add("Inhabitants"); + } + if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { + occupancyRate = 1.; + switch (modeORvehType) { + case "vehTyp1" -> + possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; // possible to add more types, see source + case "vehTyp2" -> + possibleVehicleTypes = new String[]{"mercedes313", "e_SpaceTourer"}; + case "vehTyp3", "vehTyp4" -> + possibleVehicleTypes = new String[]{"light8t", "light8t_electro"}; + case "vehTyp5" -> + possibleVehicleTypes = new String[]{"medium18t", "medium18t_electro", "heavy40t", "heavy40t_electro"}; + } + } + + // use only types of the possibleTypes which are in the given types file + List vehicleTypes = new ArrayList<>(); + assert possibleVehicleTypes != null; + + for (String possibleVehicleType : possibleVehicleTypes) { + if (CarriersUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().containsKey( + Id.create(possibleVehicleType, VehicleType.class))) + vehicleTypes.add(possibleVehicleType); + } + // find a start category with existing employees in this zone + Collections.shuffle(startCategory, rnd); + String selectedStartCategory = startCategory.getFirst(); + for (int count = 1; resultingDataPerZone.get(startZone).getDouble(selectedStartCategory) == 0; count++) { + if (count <= startCategory.size()) + selectedStartCategory = startCategory.get(rnd.nextInt(startCategory.size())); + else + selectedStartCategory = stopCategory.get(rnd.nextInt(stopCategory.size())); + } + String carrierName = null; + if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { + carrierName = "Carrier_Goods_" + startZone + "_purpose_" + purpose + "_" + modeORvehType; + } else if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) + carrierName = "Carrier_Business_" + startZone + "_purpose_" + purpose; + int numberOfDepots = odMatrix.getSumOfServicesForStartZone(startZone, modeORvehType, purpose, + smallScaleCommercialTrafficType); + CarrierCapabilities.FleetSize fleetSize = CarrierCapabilities.FleetSize.FINITE; + ArrayList vehicleDepots = new ArrayList<>(); + createdCarrier++; + log.info("Create carrier number {} of a maximum Number of {} carriers.", createdCarrier, maxNumberOfCarrier); + log.info("Carrier: {}; depots: {}; services: {}", carrierName, numberOfDepots, + (int) Math.ceil(odMatrix.getSumOfServicesForStartZone(startZone, modeORvehType, + purpose, smallScaleCommercialTrafficType) / occupancyRate)); + createNewCarrierAndAddVehicleTypes(scenario, purpose, startZone, + selectedStartCategory, carrierName, vehicleTypes, numberOfDepots, fleetSize, + fixedNumberOfVehiclePerTypeAndLocation, vehicleDepots, linksPerZone, smallScaleCommercialTrafficType, + tourDistribution); + log.info("Create services for carrier: {}", carrierName); + for (String stopZone : odMatrix.getListOfZones()) { + int trafficVolumeForOD = Math.round((float)odMatrix.getTripDistributionValue(startZone, + stopZone, modeORvehType, purpose, smallScaleCommercialTrafficType)); + int numberOfJobs = (int) Math.ceil(trafficVolumeForOD / occupancyRate); + if (numberOfJobs == 0) + continue; + // find a category for the tour stop with existing employees in this zone + String selectedStopCategory = stopCategory.get(rnd.nextInt(stopCategory.size())); + while (resultingDataPerZone.get(stopZone).getDouble(selectedStopCategory) == 0) + selectedStopCategory = stopCategory.get(rnd.nextInt(stopCategory.size())); + String[] serviceArea = new String[]{stopZone}; + int serviceTimePerStop; + if (selectedStartCategory.equals("Inhabitants")) + serviceTimePerStop = getServiceTimePerStop(stopDurationTimeSelector, startCategory.getFirst(), modeORvehType, smallScaleCommercialTrafficType); + else + serviceTimePerStop = getServiceTimePerStop(stopDurationTimeSelector, selectedStartCategory, modeORvehType, smallScaleCommercialTrafficType); + + TimeWindow serviceTimeWindow = TimeWindow.newInstance(0, 36 * 3600); // extended time window, so that late tours can handle it + createServices(scenario, vehicleDepots, selectedStopCategory, carrierName, + numberOfJobs, serviceArea, serviceTimePerStop, serviceTimeWindow, linksPerZone); + } + } + } + } + } + +// System.out.println("Final results for the start time distribution"); +// tourStartTimeSelector.writeResults(); + +// System.out.println("Final results for the tour duration distribution"); +// tourDurationTimeSelector.writeResults(); + +// for (StopDurationGoodTrafficKey sector : stopDurationTimeSelector.keySet()) { +// System.out.println("Final results for the stop duration distribution in sector " + sector); +// stopDurationTimeSelector.get(sector); +// } + + log.warn("The jspritIterations are now set to {} in this simulation!", jspritIterations); + log.info("Finished creating {} carriers including related services.", createdCarrier); + + } + + /** + * Creates the services for one carrier. + */ + private void createServices(Scenario scenario, + ArrayList noPossibleLinks, + String selectedStopCategory, + String carrierName, + int numberOfJobs, + String[] serviceArea, + Integer serviceTimePerStop, + TimeWindow serviceTimeWindow, + Map, Link>> linksPerZone) { + + String stopZone = serviceArea[0]; + + for (int i = 0; i < numberOfJobs; i++) { + Id linkId = findPossibleLink(stopZone, selectedStopCategory, noPossibleLinks, linksPerZone); + Id idNewService = Id.create(carrierName + "_" + linkId + "_" + rnd.nextInt(10000), + CarrierService.class); + + CarrierService thisService = CarrierService.Builder.newInstance(idNewService, linkId) + .setServiceDuration(serviceTimePerStop).setServiceStartTimeWindow(serviceTimeWindow).build(); + CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)).getServices() + .put(thisService.getId(), thisService); + } + } + + /** + * Creates the carrier and the related vehicles. + */ + private void createNewCarrierAndAddVehicleTypes(Scenario scenario, + Integer purpose, + String startZone, + String selectedStartCategory, + String carrierName, + List vehicleTypes, + int numberOfDepots, + CarrierCapabilities.FleetSize fleetSize, + int fixedNumberOfVehiclePerTypeAndLocation, + List vehicleDepots, + Map, Link>> linksPerZone, + String smallScaleCommercialTrafficType, + EnumeratedDistribution tourStartTimeSelector) { + + Carriers carriers = CarriersUtils.addOrGetCarriers(scenario); + CarrierVehicleTypes carrierVehicleTypes = CarriersUtils.getCarrierVehicleTypes(scenario); + + CarrierCapabilities carrierCapabilities; + + Carrier thisCarrier = CarriersUtils.createCarrier(Id.create(carrierName, Carrier.class)); + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic") && purpose == 3) + thisCarrier.getAttributes().putAttribute("subpopulation", smallScaleCommercialTrafficType + "_service"); + else + thisCarrier.getAttributes().putAttribute("subpopulation", smallScaleCommercialTrafficType); + + thisCarrier.getAttributes().putAttribute("purpose", purpose); + thisCarrier.getAttributes().putAttribute("tourStartArea", startZone); + if (jspritIterations > 0) + CarriersUtils.setJspritIterations(thisCarrier, jspritIterations); + carrierCapabilities = CarrierCapabilities.Builder.newInstance().setFleetSize(fleetSize).build(); + + carriers.addCarrier(thisCarrier); + + while (vehicleDepots.size() < numberOfDepots) { + Id linkId = findPossibleLink(startZone, selectedStartCategory, null, linksPerZone); + vehicleDepots.add(linkId.toString()); + } + + List availableVehicles = new LinkedList<>(); + + for (String singleDepot : vehicleDepots) { + GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = tourStartTimeSelector.sample(); + + int vehicleStartTime = getVehicleStartTime(t); + int tourDuration = getVehicleTourDuration(t); + int vehicleEndTime = vehicleStartTime + tourDuration; + for (String thisVehicleType : vehicleTypes) { //TODO Flottenzusammensetzung anpassen. Momentan pro Depot alle Fahrzeugtypen 1x erzeugen + VehicleType thisType = carrierVehicleTypes.getVehicleTypes() + .get(Id.create(thisVehicleType, VehicleType.class)); + if (fixedNumberOfVehiclePerTypeAndLocation == 0) + fixedNumberOfVehiclePerTypeAndLocation = 1; + for (int i = 0; i < fixedNumberOfVehiclePerTypeAndLocation; i++) { + CarrierVehicle newCarrierVehicle = CarrierVehicle.Builder + .newInstance( + Id.create( + thisCarrier.getId().toString() + "_" + + (carrierCapabilities.getCarrierVehicles().size() + 1), + Vehicle.class), + Id.createLinkId(singleDepot), thisType) + .setEarliestStart(vehicleStartTime).setLatestEnd(vehicleEndTime).build(); + availableVehicles.add((double) (tourDuration)); + carrierCapabilities.getCarrierVehicles().put(newCarrierVehicle.getId(), newCarrierVehicle); + if (!carrierCapabilities.getVehicleTypes().contains(thisType)) + carrierCapabilities.getVehicleTypes().add(thisType); + } + } + + thisCarrier.setCarrierCapabilities(carrierCapabilities); + } + } + /** * Gives a duration for the created tour under the given probability. * */ - static int getVehicleTourDuration(TourStartAndDuration t) { + private int getVehicleTourDuration(TourStartAndDuration t) { return (int) rnd.nextDouble(t.minDuration * 60, t.maxDuration * 60); } /** * Gives a tour start time for the created tour under the given probability. */ - static int getVehicleStartTime(TourStartAndDuration t) { + private int getVehicleStartTime(TourStartAndDuration t) { return rnd.nextInt(t.hourLower * 3600, t.hourUpper * 3600); } + /** + * Give a service duration based on the purpose and the trafficType under a given probability + * + * @param serviceDurationTimeSelector the selector for the service duration + * @param employeeCategory the category of the employee + * @param modeORvehType the mode or vehicle type + * @return the service duration + */ + private Integer getServiceTimePerStop(Map> serviceDurationTimeSelector, + String employeeCategory, + String modeORvehType, + String smallScaleCommercialTrafficType) { + GenerateSmallScaleCommercialTrafficDemand.StopDurationGoodTrafficKey key = null; + if (smallScaleCommercialTrafficType.equals(GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString())) + key = GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey(employeeCategory, null); + else if (smallScaleCommercialTrafficType.equals(GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString())) { + key = GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey(employeeCategory, modeORvehType); + } + GenerateSmallScaleCommercialTrafficDemand.DurationsBounds serviceDurationBounds = serviceDurationTimeSelector.get(key).sample(); + int serviceDurationLowerBound = serviceDurationBounds.minDuration(); + int serviceDurationUpperBound = serviceDurationBounds.maxDuration(); + return rnd.nextInt(serviceDurationLowerBound * 60, serviceDurationUpperBound * 60); + } + + /** + * Finds a possible link for a service or the vehicle location. + */ + private Id findPossibleLink(String zone, String selectedCategory, List noPossibleLinks, Map, Link>> linksPerZone) { + Id newLink = null; + for (int a = 0; newLink == null && a < facilitiesPerZone.get(zone).get(selectedCategory).size() * 2; a++) { + + ActivityFacility possibleBuilding = facilitiesPerZone.get(zone).get(selectedCategory) + .get(rnd.nextInt(facilitiesPerZone.get(zone).get(selectedCategory).size())); //TODO Wkt für die Auswahl anpassen + Coord centroidPointOfBuildingPolygon = possibleBuilding.getCoord(); + + int numberOfPossibleLinks = linksPerZone.get(zone).size(); + + // searches and selects the nearest link of the possible links in this zone + newLink = SmallScaleCommercialTrafficUtils.findNearestPossibleLink(zone, noPossibleLinks, linksPerZone, newLink, + centroidPointOfBuildingPolygon, numberOfPossibleLinks); + } + if (newLink == null) + throw new RuntimeException("No possible link for buildings with type '" + selectedCategory + "' in zone '" + + zone + "' found. buildings in category: " + facilitiesPerZone.get(zone).get(selectedCategory) + + "; possibleLinks in zone: " + linksPerZone.get(zone).size()); + return newLink; + } + /** * Filters links by used mode "car" and creates Map with all links in each zone */ diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java index d9f11db6917..746c1d07a0b 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java @@ -7,26 +7,38 @@ import org.matsim.facilities.ActivityFacility; import org.matsim.smallScaleCommercialTrafficGeneration.data.GetCommercialTourSpecifications; +import java.util.ArrayList; import java.util.List; import java.util.Map; /** - * Interface to generate carriers and demand needed by {@link GenerateSmallScaleCommercialTrafficDemand}. + * Interface to set the categories needed by {@link GenerateSmallScaleCommercialTrafficDemand}. * Standard implementation is {@link DefaultVehicleSelection}. * Any configuration settings and external data-sources should be saved as attributes during initialization in the constructor of the class. */ public interface VehicleSelection{ + class PurposeInformation { + double occupancyRate; + String[] possibleVehicleTypes; + List startCategory = new ArrayList<>(); + List stopCategory = new ArrayList<>(); + } + + /** + * @return all possible stop/start-categories. + */ + List getAllCategories(); + + /** + * @param purpose entry from {@link TripDistributionMatrix#getListOfPurposes()} + * @return class holding the information that is specified by the purpose. + */ + PurposeInformation getPurposeInformation(int purpose); + /** - * Creates the carriers and the related demand. - * @param scenario Scenario (loaded from your config), where the carriers will be put into + * @param modeORvehType mode- or vehicle-type from the {@link TripDistributionMatrix} + * @return possible CarrierVehicleTypes for given attribute */ - void createCarriers(Scenario scenario, - GetCommercialTourSpecifications getCommercialTourSpecifications, - Map>> facilitiesPerZone, - int jspritIterations, - TripDistributionMatrix odMatrix, - String smallScaleCommercialTrafficType, - Map> resultingDataPerZone, - Map, Link>> linksPerZone); + String[] getPossibleVehicleTypes(String modeORvehType); } From 696fd645ae6e0dc0584e130b6198678574c75495 Mon Sep 17 00:00:00 2001 From: aleks Date: Tue, 17 Sep 2024 11:29:35 +0200 Subject: [PATCH 16/60] Outsourced VehicleSelection --- .../DefaultVehicleSelection.java | 80 ++++++++++++++--- ...rateSmallScaleCommercialTrafficDemand.java | 88 +++---------------- .../VehicleSelection.java | 23 ++--- 3 files changed, 85 insertions(+), 106 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java index 8e35d70e494..2b01e4a7abb 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java @@ -1,27 +1,81 @@ package org.matsim.smallScaleCommercialTrafficGeneration; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - import java.util.ArrayList; import java.util.List; public class DefaultVehicleSelection implements VehicleSelection{ - private static final Logger log = LogManager.getLogger(GenerateSmallScaleCommercialTrafficDemand.class); - @Override public List getAllCategories() { - return null; + ArrayList categories = new ArrayList<>(7); + categories.add("Employee Primary Sector"); + categories.add("Employee Construction"); + categories.add("Employee Secondary Sector Rest"); + categories.add("Employee Retail"); + categories.add("Employee Traffic/Parcels"); + categories.add("Employee Tertiary Sector Rest"); + categories.add("Inhabitants"); + return categories; } @Override - public PurposeInformation getPurposeInformation(int purpose) { - return null; - } + public OdMatrixEntryInformation getOdMatrixEntryInformation(int purpose, String modeORvehType, String smallScaleCommercialTrafficType) { + VehicleSelection.OdMatrixEntryInformation information = new OdMatrixEntryInformation(); + information.occupancyRate = 0; + information.possibleVehicleTypes = null; + information.startCategory = new ArrayList<>(); + information.stopCategory = new ArrayList<>(getAllCategories()); - @Override - public String[] getPossibleVehicleTypes(String modeORvehType) { - return new String[0]; + if (purpose == 1) { + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + information.possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; + information.occupancyRate = 1.5; + } + information.startCategory.add("Employee Secondary Sector Rest"); + information.stopCategory.clear(); + information.stopCategory.add("Employee Secondary Sector Rest"); + } else if (purpose == 2) { + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + information.possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; + information.occupancyRate = 1.6; + } + information.startCategory.add("Employee Secondary Sector Rest"); + } else if (purpose == 3) { + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + information.possibleVehicleTypes = new String[]{"golf1.4", "c_zero"}; + information.occupancyRate = 1.2; + } + information.startCategory.add("Employee Retail"); + information.startCategory.add("Employee Tertiary Sector Rest"); + } else if (purpose == 4) { + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + information.possibleVehicleTypes = new String[]{"golf1.4", "c_zero"}; + information.occupancyRate = 1.2; + } + information.startCategory.add("Employee Traffic/Parcels"); + } else if (purpose == 5) { + if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { + information.possibleVehicleTypes = new String[]{"mercedes313", "e_SpaceTourer"}; + information.occupancyRate = 1.7; + } + information.startCategory.add("Employee Construction"); + } else if (purpose == 6) { + information.startCategory.add("Inhabitants"); + } + + if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { + information.occupancyRate = 1.; + switch (modeORvehType) { + case "vehTyp1" -> + information.possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; // possible to add more types, see source + case "vehTyp2" -> + information.possibleVehicleTypes = new String[]{"mercedes313", "e_SpaceTourer"}; + case "vehTyp3", "vehTyp4" -> + information.possibleVehicleTypes = new String[]{"light8t", "light8t_electro"}; + case "vehTyp5" -> + information.possibleVehicleTypes = new String[]{"medium18t", "medium18t_electro", "heavy40t", "heavy40t_electro"}; + } + } + + return information; } } diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index b74f9a89e75..278a481508f 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -759,84 +759,25 @@ public void createCarriers(Scenario scenario, } if (isStartingLocation) { - double occupancyRate = 0; - String[] possibleVehicleTypes = null; - ArrayList startCategory = new ArrayList<>(); - ArrayList stopCategory = new ArrayList<>(); - stopCategory.add("Employee Primary Sector"); - stopCategory.add("Employee Construction"); - stopCategory.add("Employee Secondary Sector Rest"); - stopCategory.add("Employee Retail"); - stopCategory.add("Employee Traffic/Parcels"); - stopCategory.add("Employee Tertiary Sector Rest"); - stopCategory.add("Inhabitants"); - if (purpose == 1) { - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; - occupancyRate = 1.5; - } - startCategory.add("Employee Secondary Sector Rest"); - stopCategory.clear(); - stopCategory.add("Employee Secondary Sector Rest"); - } else if (purpose == 2) { - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; - occupancyRate = 1.6; - } - startCategory.add("Employee Secondary Sector Rest"); - } else if (purpose == 3) { - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - possibleVehicleTypes = new String[]{"golf1.4", "c_zero"}; - occupancyRate = 1.2; - } - startCategory.add("Employee Retail"); - startCategory.add("Employee Tertiary Sector Rest"); - } else if (purpose == 4) { - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - possibleVehicleTypes = new String[]{"golf1.4", "c_zero"}; - occupancyRate = 1.2; - } - startCategory.add("Employee Traffic/Parcels"); - } else if (purpose == 5) { - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { - possibleVehicleTypes = new String[]{"mercedes313", "e_SpaceTourer"}; - occupancyRate = 1.7; - } - startCategory.add("Employee Construction"); - } else if (purpose == 6) { - startCategory.add("Inhabitants"); - } - if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { - occupancyRate = 1.; - switch (modeORvehType) { - case "vehTyp1" -> - possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; // possible to add more types, see source - case "vehTyp2" -> - possibleVehicleTypes = new String[]{"mercedes313", "e_SpaceTourer"}; - case "vehTyp3", "vehTyp4" -> - possibleVehicleTypes = new String[]{"light8t", "light8t_electro"}; - case "vehTyp5" -> - possibleVehicleTypes = new String[]{"medium18t", "medium18t_electro", "heavy40t", "heavy40t_electro"}; - } - } + VehicleSelection.OdMatrixEntryInformation information = vehicleSelection.getOdMatrixEntryInformation(purpose, modeORvehType, smallScaleCommercialTrafficType); // use only types of the possibleTypes which are in the given types file List vehicleTypes = new ArrayList<>(); - assert possibleVehicleTypes != null; + assert information.possibleVehicleTypes != null; - for (String possibleVehicleType : possibleVehicleTypes) { + for (String possibleVehicleType : information.possibleVehicleTypes) { if (CarriersUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().containsKey( Id.create(possibleVehicleType, VehicleType.class))) vehicleTypes.add(possibleVehicleType); } // find a start category with existing employees in this zone - Collections.shuffle(startCategory, rnd); - String selectedStartCategory = startCategory.getFirst(); + Collections.shuffle(information.startCategory, rnd); + String selectedStartCategory = information.startCategory.getFirst(); for (int count = 1; resultingDataPerZone.get(startZone).getDouble(selectedStartCategory) == 0; count++) { - if (count <= startCategory.size()) - selectedStartCategory = startCategory.get(rnd.nextInt(startCategory.size())); + if (count <= information.startCategory.size()) + selectedStartCategory = information.startCategory.get(rnd.nextInt(information.startCategory.size())); else - selectedStartCategory = stopCategory.get(rnd.nextInt(stopCategory.size())); + selectedStartCategory = information.stopCategory.get(rnd.nextInt(information.stopCategory.size())); } String carrierName = null; if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { @@ -851,7 +792,7 @@ public void createCarriers(Scenario scenario, log.info("Create carrier number {} of a maximum Number of {} carriers.", createdCarrier, maxNumberOfCarrier); log.info("Carrier: {}; depots: {}; services: {}", carrierName, numberOfDepots, (int) Math.ceil(odMatrix.getSumOfServicesForStartZone(startZone, modeORvehType, - purpose, smallScaleCommercialTrafficType) / occupancyRate)); + purpose, smallScaleCommercialTrafficType) / information.occupancyRate)); createNewCarrierAndAddVehicleTypes(scenario, purpose, startZone, selectedStartCategory, carrierName, vehicleTypes, numberOfDepots, fleetSize, fixedNumberOfVehiclePerTypeAndLocation, vehicleDepots, linksPerZone, smallScaleCommercialTrafficType, @@ -860,17 +801,17 @@ public void createCarriers(Scenario scenario, for (String stopZone : odMatrix.getListOfZones()) { int trafficVolumeForOD = Math.round((float)odMatrix.getTripDistributionValue(startZone, stopZone, modeORvehType, purpose, smallScaleCommercialTrafficType)); - int numberOfJobs = (int) Math.ceil(trafficVolumeForOD / occupancyRate); + int numberOfJobs = (int) Math.ceil(trafficVolumeForOD / information.occupancyRate); if (numberOfJobs == 0) continue; // find a category for the tour stop with existing employees in this zone - String selectedStopCategory = stopCategory.get(rnd.nextInt(stopCategory.size())); + String selectedStopCategory = information.stopCategory.get(rnd.nextInt(information.stopCategory.size())); while (resultingDataPerZone.get(stopZone).getDouble(selectedStopCategory) == 0) - selectedStopCategory = stopCategory.get(rnd.nextInt(stopCategory.size())); + selectedStopCategory = information.stopCategory.get(rnd.nextInt(information.stopCategory.size())); String[] serviceArea = new String[]{stopZone}; int serviceTimePerStop; if (selectedStartCategory.equals("Inhabitants")) - serviceTimePerStop = getServiceTimePerStop(stopDurationTimeSelector, startCategory.getFirst(), modeORvehType, smallScaleCommercialTrafficType); + serviceTimePerStop = getServiceTimePerStop(stopDurationTimeSelector, information.startCategory.getFirst(), modeORvehType, smallScaleCommercialTrafficType); else serviceTimePerStop = getServiceTimePerStop(stopDurationTimeSelector, selectedStartCategory, modeORvehType, smallScaleCommercialTrafficType); @@ -967,8 +908,6 @@ private void createNewCarrierAndAddVehicleTypes(Scenario scenario, vehicleDepots.add(linkId.toString()); } - List availableVehicles = new LinkedList<>(); - for (String singleDepot : vehicleDepots) { GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = tourStartTimeSelector.sample(); @@ -989,7 +928,6 @@ private void createNewCarrierAndAddVehicleTypes(Scenario scenario, Vehicle.class), Id.createLinkId(singleDepot), thisType) .setEarliestStart(vehicleStartTime).setLatestEnd(vehicleEndTime).build(); - availableVehicles.add((double) (tourDuration)); carrierCapabilities.getCarrierVehicles().put(newCarrierVehicle.getId(), newCarrierVehicle); if (!carrierCapabilities.getVehicleTypes().contains(thisType)) carrierCapabilities.getVehicleTypes().add(thisType); diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java index 746c1d07a0b..c8a3cf25b2a 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java @@ -1,16 +1,7 @@ package org.matsim.smallScaleCommercialTrafficGeneration; -import it.unimi.dsi.fastutil.objects.Object2DoubleMap; -import org.matsim.api.core.v01.Id; -import org.matsim.api.core.v01.Scenario; -import org.matsim.api.core.v01.network.Link; -import org.matsim.facilities.ActivityFacility; -import org.matsim.smallScaleCommercialTrafficGeneration.data.GetCommercialTourSpecifications; - import java.util.ArrayList; import java.util.List; -import java.util.Map; - /** * Interface to set the categories needed by {@link GenerateSmallScaleCommercialTrafficDemand}. * Standard implementation is {@link DefaultVehicleSelection}. @@ -18,7 +9,7 @@ */ public interface VehicleSelection{ - class PurposeInformation { + class OdMatrixEntryInformation { double occupancyRate; String[] possibleVehicleTypes; List startCategory = new ArrayList<>(); @@ -32,13 +23,9 @@ class PurposeInformation { /** * @param purpose entry from {@link TripDistributionMatrix#getListOfPurposes()} - * @return class holding the information that is specified by the purpose. - */ - PurposeInformation getPurposeInformation(int purpose); - - /** - * @param modeORvehType mode- or vehicle-type from the {@link TripDistributionMatrix} - * @return possible CarrierVehicleTypes for given attribute + * @param modeORvehType entry from {@link TripDistributionMatrix#getListOfModesOrVehTypes()} + * @param smallScaleCommercialTrafficType Selected traffic types. Options: commercialPersonTraffic, goodsTraffic + * @return class holding the information that is specified by the given entry. */ - String[] getPossibleVehicleTypes(String modeORvehType); + OdMatrixEntryInformation getOdMatrixEntryInformation(int purpose, String modeORvehType, String smallScaleCommercialTrafficType); } From 292327e08759a7c6b9177b75e370a53541d40a22 Mon Sep 17 00:00:00 2001 From: aleks Date: Tue, 17 Sep 2024 15:05:26 +0200 Subject: [PATCH 17/60] Specified event-classes --- .../analysis/CarrierLoadAnalysis.java | 21 +++---- ...tTimeAndDistanceAnalysisEventsHandler.java | 59 +++++++++---------- .../RunFreightAnalysisEventBased.java | 1 - 3 files changed, 36 insertions(+), 45 deletions(-) diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java index 28f9ec33da7..376f931df4c 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java @@ -25,11 +25,11 @@ import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.api.core.v01.events.Event; import org.matsim.freight.carriers.Carriers; import org.matsim.freight.carriers.events.CarrierShipmentDeliveryStartEvent; import org.matsim.freight.carriers.events.CarrierShipmentPickupStartEvent; -import org.matsim.core.events.handler.BasicEventHandler; +import org.matsim.freight.carriers.events.eventhandler.CarrierShipmentDeliveryStartEventHandler; +import org.matsim.freight.carriers.events.eventhandler.CarrierShipmentPickupStartEventHandler; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; @@ -48,7 +48,7 @@ /** * @author Kai Martins-Turner (kturner) */ -public class CarrierLoadAnalysis implements BasicEventHandler { +public class CarrierLoadAnalysis implements CarrierShipmentPickupStartEventHandler, CarrierShipmentDeliveryStartEventHandler { private static final Logger log = LogManager.getLogger(CarrierLoadAnalysis.class); @@ -60,15 +60,8 @@ public CarrierLoadAnalysis(Carriers carriers) { this.carriers = carriers; } - @Override public void handleEvent(Event event) { - if (event.getEventType().equals(CarrierShipmentPickupStartEvent.EVENT_TYPE)) { - handlePickup( event); - } if (event.getEventType().equals(CarrierShipmentDeliveryStartEvent.EVENT_TYPE)) { - handleDelivery(event); - } - } - - private void handlePickup(Event event) { + @Override + public void handleEvent(CarrierShipmentPickupStartEvent event) { Id vehicleId = Id.createVehicleId(event.getAttributes().get("vehicle")); Integer demand = Integer.valueOf(event.getAttributes().get(ATTRIBUTE_CAPACITYDEMAND)); @@ -83,8 +76,8 @@ private void handlePickup(Event event) { vehicle2Load.put(vehicleId, list); } - - private void handleDelivery(Event event) { + @Override + public void handleEvent(CarrierShipmentDeliveryStartEvent event) { Id vehicleId = Id.createVehicleId(event.getAttributes().get("vehicle")); Integer demand = Integer.valueOf(event.getAttributes().get(ATTRIBUTE_CAPACITYDEMAND)); diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java index 91b911ac212..2cc4e8473f7 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java @@ -25,17 +25,21 @@ import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; -import org.matsim.api.core.v01.events.Event; import org.matsim.api.core.v01.events.LinkEnterEvent; import org.matsim.api.core.v01.events.LinkLeaveEvent; import org.matsim.api.core.v01.events.VehicleEntersTrafficEvent; import org.matsim.api.core.v01.events.VehicleLeavesTrafficEvent; +import org.matsim.api.core.v01.events.handler.LinkEnterEventHandler; +import org.matsim.api.core.v01.events.handler.LinkLeaveEventHandler; +import org.matsim.api.core.v01.events.handler.VehicleEntersTrafficEventHandler; +import org.matsim.api.core.v01.events.handler.VehicleLeavesTrafficEventHandler; import org.matsim.freight.carriers.Carrier; import org.matsim.freight.carriers.CarriersUtils; import org.matsim.freight.carriers.Tour; import org.matsim.freight.carriers.events.CarrierTourEndEvent; import org.matsim.freight.carriers.events.CarrierTourStartEvent; -import org.matsim.core.events.handler.BasicEventHandler; +import org.matsim.freight.carriers.events.eventhandler.CarrierTourEndEventHandler; +import org.matsim.freight.carriers.events.eventhandler.CarrierTourStartEventHandler; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; @@ -51,7 +55,13 @@ /** * @author Kai Martins-Turner (kturner) */ -public class FreightTimeAndDistanceAnalysisEventsHandler implements BasicEventHandler { +public class FreightTimeAndDistanceAnalysisEventsHandler implements + CarrierTourStartEventHandler, + CarrierTourEndEventHandler, + LinkEnterEventHandler, + LinkLeaveEventHandler, + VehicleEntersTrafficEventHandler, + VehicleLeavesTrafficEventHandler { private final static Logger log = LogManager.getLogger(FreightTimeAndDistanceAnalysisEventsHandler.class); @@ -79,17 +89,19 @@ public FreightTimeAndDistanceAnalysisEventsHandler(Scenario scenario) { this.scenario = scenario; } - private void handleEvent(CarrierTourStartEvent event) { + @Override + public void handleEvent(CarrierTourStartEvent event) { // Save time of freight tour start final String key = event.getCarrierId().toString() + "_" + event.getTourId().toString(); tourStartTime.put(key, event.getTime()); } //Fix costs for vehicle usage - private void handleEvent(CarrierTourEndEvent event) { + @Override + public void handleEvent(CarrierTourEndEvent event) { final String key = event.getCarrierId().toString() + "_" + event.getTourId().toString(); double tourDuration = event.getTime() - tourStartTime.get(key); - vehicleId2TourDuration.put(event.getVehicleId(), tourDuration); + vehicleId2TourDuration.put(event.getVehicleId(), tourDuration); //TODO, check if this may overwrite old data and if this is intended to do so VehicleType vehType = VehicleUtils.findVehicle(event.getVehicleId(), scenario).getType(); vehicleTypeId2SumOfTourDuration.merge(vehType.getId(), tourDuration, Double::sum); @@ -100,7 +112,13 @@ private void handleEvent(CarrierTourEndEvent event) { vehicleId2VehicleType.putIfAbsent(event.getVehicleId(), vehType); } - private void handleEvent(LinkEnterEvent event) { + @Override + public void handleEvent(VehicleEntersTrafficEvent event){ + vehicleEnteredLinkTime.put(event.getVehicleId(), event.getTime()); + } + + @Override + public void handleEvent(LinkEnterEvent event) { final double distance = scenario.getNetwork().getLinks().get(event.getLinkId()).getLength(); vehicleId2TourLength.merge(event.getVehicleId(), distance, Double::sum); vehicleEnteredLinkTime.put(event.getVehicleId(), event.getTime()); //Safe time when entering the link. @@ -110,7 +128,8 @@ private void handleEvent(LinkEnterEvent event) { } //If the vehicle leaves a link at the end, the travelTime is calculated and stored. - private void handleEvent(LinkLeaveEvent event){ + @Override + public void handleEvent(LinkLeaveEvent event){ final Id vehicleId = event.getVehicleId(); if (vehicleEnteredLinkTime.containsKey(vehicleId)){ double tt = event.getTime() - vehicleEnteredLinkTime.get(vehicleId); @@ -124,7 +143,8 @@ private void handleEvent(LinkLeaveEvent event){ } //If the vehicle leaves a link because it reached its destination, the travelTime is calculated and stored. - private void handleEvent(VehicleLeavesTrafficEvent event){ + @Override + public void handleEvent(VehicleLeavesTrafficEvent event){ final Id vehicleId = event.getVehicleId(); if (vehicleEnteredLinkTime.containsKey(vehicleId)){ double tt = event.getTime() - vehicleEnteredLinkTime.get(vehicleId); @@ -137,26 +157,6 @@ private void handleEvent(VehicleLeavesTrafficEvent event){ } } - private void handleEvent(VehicleEntersTrafficEvent event){ - vehicleEnteredLinkTime.put(event.getVehicleId(), event.getTime()); - } - - @Override public void handleEvent(Event event) { - if (event instanceof CarrierTourStartEvent carrierTourStartEvent) { - handleEvent(carrierTourStartEvent); - } else if (event instanceof CarrierTourEndEvent carrierTourEndEvent) { - handleEvent(carrierTourEndEvent); - } else if (event instanceof LinkEnterEvent linkEnterEvent) { - handleEvent(linkEnterEvent); - } else if (event instanceof LinkLeaveEvent linkLeaveEvent) { - handleEvent(linkLeaveEvent); - } else if (event instanceof VehicleLeavesTrafficEvent vehicleLeavesTrafficEvent) { - handleEvent(vehicleLeavesTrafficEvent); - } else if (event instanceof VehicleEntersTrafficEvent vehicleEntersTrafficEvent) { - handleEvent(vehicleEntersTrafficEvent); - } - } - void writeTravelTimeAndDistancePerVehicle(Path analysisOutputDirectory, Scenario scenario) throws IOException { log.info("Writing out Time & Distance & Costs ... perVehicle"); //Travel time and distance per vehicle @@ -216,7 +216,6 @@ void writeTravelTimeAndDistancePerVehicle(Path analysisOutputDirectory, Scenario log.info("Output written to {}", fileName); } - void writeTravelTimeAndDistancePerVehicleType(Path analysisOutputDirectory, Scenario scenario) throws IOException { log.info("Writing out Time & Distance & Costs ... perVehicleType"); diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java index af3d6fc6041..edbb7310b02 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java @@ -72,7 +72,6 @@ public RunFreightAnalysisEventBased(Path simOutputPath, Path analysisOutputPath, } public void runAnalysis() throws IOException { - Config config = ConfigUtils.createConfig(); config.vehicles().setVehiclesFile(globFile(SIM_OUTPUT_PATH, "*output_allVehicles.*").toString()); config.network().setInputFile(globFile(SIM_OUTPUT_PATH, "*output_network.*").toString()); From 83de8beb371aeb7055384df40961782d4613c6ce Mon Sep 17 00:00:00 2001 From: aleks Date: Wed, 18 Sep 2024 13:35:59 +0200 Subject: [PATCH 18/60] Refactored carrier-analysis and created tests --- .../analysis/CarrierLoadAnalysis.java | 118 ++++++++ .../analysis/CarrierPlanAnalysis.java | 117 ++++++++ ...tTimeAndDistanceAnalysisEventsHandler.java | 279 ++++++++++++++++++ .../freight/carriers/analysis/Readme.md | 18 ++ .../RunFreightAnalysisEventBased.java | 174 +++++++++++ .../FreightAnalysisEventBasedTest.java | 78 +++++ .../runServiceEventTest/Carrier_stats.tsv | 2 + .../runServiceEventTest/Load_perVehicle.tsv | 1 + .../TimeDistance_perVehicle.tsv | 3 + .../TimeDistance_perVehicleType.tsv | 2 + .../in/carrierVehicles.xml | 26 ++ .../in/carrierWithServices.xml | 64 ++++ .../in/serviceBasedEvents.xml | 213 +++++++++++++ .../runShipmentEventTest/Load_perVehicle.tsv | 2 + .../TimeDistance_perVehicle.tsv | 2 + .../TimeDistance_perVehicleType.tsv | 2 + .../in/carrierVehicles.xml | 25 ++ .../in/carrierWithShipments.xml | 26 ++ .../in/shipmentBasedEvents.xml | 193 ++++++++++++ 19 files changed, 1345 insertions(+) create mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java create mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java create mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java create mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/Readme.md create mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java create mode 100644 contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Carrier_stats.tsv create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Load_perVehicle.tsv create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicle.tsv create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicleType.tsv create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierVehicles.xml create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierWithServices.xml create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/serviceBasedEvents.xml create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Load_perVehicle.tsv create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicle.tsv create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicleType.tsv create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierVehicles.xml create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierWithShipments.xml create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/shipmentBasedEvents.xml diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java new file mode 100644 index 00000000000..376f931df4c --- /dev/null +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java @@ -0,0 +1,118 @@ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.analysis; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.matsim.api.core.v01.Id; +import org.matsim.api.core.v01.Scenario; +import org.matsim.freight.carriers.Carriers; +import org.matsim.freight.carriers.events.CarrierShipmentDeliveryStartEvent; +import org.matsim.freight.carriers.events.CarrierShipmentPickupStartEvent; +import org.matsim.freight.carriers.events.eventhandler.CarrierShipmentDeliveryStartEventHandler; +import org.matsim.freight.carriers.events.eventhandler.CarrierShipmentPickupStartEventHandler; +import org.matsim.vehicles.Vehicle; +import org.matsim.vehicles.VehicleType; +import org.matsim.vehicles.VehicleUtils; + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.file.Path; +import java.util.Comparator; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.Map; + +import static org.matsim.freight.carriers.events.CarrierEventAttributes.ATTRIBUTE_CAPACITYDEMAND; + +/** + * @author Kai Martins-Turner (kturner) + */ +public class CarrierLoadAnalysis implements CarrierShipmentPickupStartEventHandler, CarrierShipmentDeliveryStartEventHandler { + + private static final Logger log = LogManager.getLogger(CarrierLoadAnalysis.class); + + Carriers carriers; + + private final Map, LinkedList> vehicle2Load = new LinkedHashMap<>(); + + public CarrierLoadAnalysis(Carriers carriers) { + this.carriers = carriers; + } + + @Override + public void handleEvent(CarrierShipmentPickupStartEvent event) { + Id vehicleId = Id.createVehicleId(event.getAttributes().get("vehicle")); + Integer demand = Integer.valueOf(event.getAttributes().get(ATTRIBUTE_CAPACITYDEMAND)); + + LinkedList list; + if (! vehicle2Load.containsKey(vehicleId)){ + list = new LinkedList<>(); + list.add(demand); + } else { + list = vehicle2Load.get(vehicleId); + list.add(list.getLast() + demand); + } + vehicle2Load.put(vehicleId, list); + } + + @Override + public void handleEvent(CarrierShipmentDeliveryStartEvent event) { + Id vehicleId = Id.createVehicleId(event.getAttributes().get("vehicle")); + Integer demand = Integer.valueOf(event.getAttributes().get(ATTRIBUTE_CAPACITYDEMAND)); + + var list = vehicle2Load.get(vehicleId); + list.add(list.getLast() - demand); + vehicle2Load.put(vehicleId, list); + } + + void writeLoadPerVehicle(Path analysisOutputDirectory, Scenario scenario) throws IOException { + log.info("Writing out vehicle load analysis ..."); + //Load per vehicle + String fileName = analysisOutputDirectory.resolve("Load_perVehicle.tsv").toString(); + + BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); + + //Write headline: + bw1.write("vehicleId \t capacity \t maxLoad \t load state during tour"); + bw1.newLine(); + + for (Id vehicleId : vehicle2Load.keySet()) { + + final LinkedList load = vehicle2Load.get(vehicleId); + final Integer maxLoad = load.stream().max(Comparator.naturalOrder()).get(); + + final VehicleType vehicleType = VehicleUtils.findVehicle(vehicleId, scenario).getType(); + final Double capacity = vehicleType.getCapacity().getOther(); + + bw1.write(vehicleId.toString()); + bw1.write("\t" + capacity); + bw1.write("\t" + maxLoad); + bw1.write("\t" + load); + bw1.newLine(); + } + + bw1.close(); + log.info("Output written to {}", fileName); + } +} diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java new file mode 100644 index 00000000000..a4cf2389527 --- /dev/null +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java @@ -0,0 +1,117 @@ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.analysis; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.matsim.api.core.v01.Id; +import org.matsim.core.utils.misc.Time; +import org.matsim.freight.carriers.*; + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.file.Path; +import java.util.TreeMap; + +/** + * Some basic analysis / data collection for {@link Carriers}(files) + *

+ * For all carriers it writes out the: + * - score of the selected plan + * - number of tours (= vehicles) of the selected plan + * - number of Services (input) + * - number of shipments (input) + * to a tsv-file. + * @author Kai Martins-Turner (kturner) + */ +public class CarrierPlanAnalysis { + + private static final Logger log = LogManager.getLogger(CarrierPlanAnalysis.class); + + Carriers carriers; + + public CarrierPlanAnalysis(Carriers carriers) { + this.carriers = carriers; + } + + public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOException { + log.info("Writing out carrier analysis ..."); + //Load per vehicle + String fileName = analysisOutputDirectory.resolve("Carrier_stats.tsv").toString(); + + BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); + + //Write headline: + bw1.write("carrierId \t MATSimScoreSelectedPlan \t jSpritScoreSelectedPlan \t nuOfTours \t nuOfShipments(input) \t nuOfShipments(handled) \t nuOfServices(input) \t nuOfServices(handled) \t nuOfPlanedDemandSize \t nuOfHandledDemandSize \t jspritComputationTime[HH:mm:ss]"); + bw1.newLine(); + + final TreeMap, Carrier> sortedCarrierMap = new TreeMap<>(carriers.getCarriers()); + + for (Carrier carrier : sortedCarrierMap.values()) { + + int numberOfPlanedShipments = carrier.getShipments().size(); + int numberOfPlanedServices = carrier.getServices().size(); + int numberOfHandledPickups = (int)carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Pickup).count()).sum(); + int numberOfHandledDeliveries = (int)carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Delivery).count()).sum(); + int nuOfServiceHandled = (int)carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.ServiceActivity).count()).sum(); + int numberOfPlanedDemandSize; + int numberOfHandledDemandSize; + if (numberOfPlanedShipments > 0) { + numberOfPlanedDemandSize = carrier.getShipments().values().stream().mapToInt(CarrierShipment::getSize).sum(); + numberOfHandledDemandSize = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Pickup).mapToInt(te -> ( ((Tour.Pickup) te).getShipment().getSize())).sum()).sum(); + } else { + numberOfPlanedDemandSize = carrier.getServices().values().stream().mapToInt(CarrierService::getCapacityDemand).sum(); + numberOfHandledDemandSize = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.ServiceActivity).mapToInt(te -> ((Tour.ServiceActivity) te).getService().getCapacityDemand()).sum()).sum(); + } + + if(numberOfPlanedServices != nuOfServiceHandled) { + log.warn("Number of services in input and handled are not equal for carrier {}. Jobs Input: {}, Jobs Handled: {}", carrier.getId(), numberOfPlanedServices, nuOfServiceHandled); + } + if (numberOfPlanedShipments != numberOfHandledPickups) { + log.warn("Number of shipments in input and handled are not equal for carrier {}. Jobs Input: {}, Jobs Handled: {}", carrier.getId(), numberOfPlanedShipments, numberOfHandledPickups); + } + if (numberOfHandledDeliveries != numberOfHandledPickups) { + log.warn("Number of handled pickups and deliveries are not equal for carrier {}. Pickups: {}, Deliveries: {}. This should not happen!!", carrier.getId(), numberOfHandledPickups, numberOfHandledDeliveries); + } + bw1.write(carrier.getId().toString()); + bw1.write("\t" + carrier.getSelectedPlan().getScore()); + bw1.write("\t" + carrier.getSelectedPlan().getJspritScore()); + bw1.write("\t" + carrier.getSelectedPlan().getScheduledTours().size()); + bw1.write("\t" + numberOfPlanedShipments); + bw1.write("\t" + numberOfHandledPickups); + bw1.write("\t" + numberOfPlanedServices); + bw1.write("\t" + nuOfServiceHandled); + bw1.write("\t" + numberOfPlanedDemandSize); + bw1.write("\t" + numberOfHandledDemandSize); + if (CarriersUtils.getJspritComputationTime(carrier) != Integer.MIN_VALUE) + bw1.write("\t" + Time.writeTime(CarriersUtils.getJspritComputationTime(carrier), Time.TIMEFORMAT_HHMMSS)); + else + bw1.write("\t" + "null"); + + bw1.newLine(); + } + + bw1.close(); + log.info("Output written to {}", fileName); + } +} diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java new file mode 100644 index 00000000000..2cc4e8473f7 --- /dev/null +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java @@ -0,0 +1,279 @@ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.analysis; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.matsim.api.core.v01.Id; +import org.matsim.api.core.v01.Scenario; +import org.matsim.api.core.v01.events.LinkEnterEvent; +import org.matsim.api.core.v01.events.LinkLeaveEvent; +import org.matsim.api.core.v01.events.VehicleEntersTrafficEvent; +import org.matsim.api.core.v01.events.VehicleLeavesTrafficEvent; +import org.matsim.api.core.v01.events.handler.LinkEnterEventHandler; +import org.matsim.api.core.v01.events.handler.LinkLeaveEventHandler; +import org.matsim.api.core.v01.events.handler.VehicleEntersTrafficEventHandler; +import org.matsim.api.core.v01.events.handler.VehicleLeavesTrafficEventHandler; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.Tour; +import org.matsim.freight.carriers.events.CarrierTourEndEvent; +import org.matsim.freight.carriers.events.CarrierTourStartEvent; +import org.matsim.freight.carriers.events.eventhandler.CarrierTourEndEventHandler; +import org.matsim.freight.carriers.events.eventhandler.CarrierTourStartEventHandler; +import org.matsim.vehicles.Vehicle; +import org.matsim.vehicles.VehicleType; +import org.matsim.vehicles.VehicleUtils; + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.file.Path; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.TreeMap; + +/** + * @author Kai Martins-Turner (kturner) + */ +public class FreightTimeAndDistanceAnalysisEventsHandler implements + CarrierTourStartEventHandler, + CarrierTourEndEventHandler, + LinkEnterEventHandler, + LinkLeaveEventHandler, + VehicleEntersTrafficEventHandler, + VehicleLeavesTrafficEventHandler { + + private final static Logger log = LogManager.getLogger(FreightTimeAndDistanceAnalysisEventsHandler.class); + + private final Scenario scenario; + private final Map, Double> vehicleId2TourDuration = new LinkedHashMap<>(); + private final Map, Double> vehicleId2TourLength = new LinkedHashMap<>(); + + private final Map, Double> vehicleId2TravelTime = new LinkedHashMap<>(); + + private final Map, Id> vehicleId2CarrierId = new LinkedHashMap<>(); + private final Map, Id> vehicleId2TourId = new LinkedHashMap<>(); + + private final Map, Double> vehicleTypeId2SumOfTourDuration = new LinkedHashMap<>(); + private final Map, Double> vehicleTypeId2Mileage = new LinkedHashMap<>(); + private final Map, Double> vehicleTypeId2TravelTime = new LinkedHashMap<>(); + + private final Map, VehicleType> vehicleId2VehicleType = new TreeMap<>(); + + private final Map tourStartTime = new LinkedHashMap<>(); + + private final Map, Double> vehicleEnteredLinkTime = new LinkedHashMap<>(); + + + public FreightTimeAndDistanceAnalysisEventsHandler(Scenario scenario) { + this.scenario = scenario; + } + + @Override + public void handleEvent(CarrierTourStartEvent event) { + // Save time of freight tour start + final String key = event.getCarrierId().toString() + "_" + event.getTourId().toString(); + tourStartTime.put(key, event.getTime()); + } + + //Fix costs for vehicle usage + @Override + public void handleEvent(CarrierTourEndEvent event) { + final String key = event.getCarrierId().toString() + "_" + event.getTourId().toString(); + double tourDuration = event.getTime() - tourStartTime.get(key); + vehicleId2TourDuration.put(event.getVehicleId(), tourDuration); //TODO, check if this may overwrite old data and if this is intended to do so + VehicleType vehType = VehicleUtils.findVehicle(event.getVehicleId(), scenario).getType(); + vehicleTypeId2SumOfTourDuration.merge(vehType.getId(), tourDuration, Double::sum); + + //Some general information for this vehicle + vehicleId2CarrierId.putIfAbsent(event.getVehicleId(), event.getCarrierId()); + vehicleId2TourId.putIfAbsent(event.getVehicleId(), event.getTourId()); + + vehicleId2VehicleType.putIfAbsent(event.getVehicleId(), vehType); + } + + @Override + public void handleEvent(VehicleEntersTrafficEvent event){ + vehicleEnteredLinkTime.put(event.getVehicleId(), event.getTime()); + } + + @Override + public void handleEvent(LinkEnterEvent event) { + final double distance = scenario.getNetwork().getLinks().get(event.getLinkId()).getLength(); + vehicleId2TourLength.merge(event.getVehicleId(), distance, Double::sum); + vehicleEnteredLinkTime.put(event.getVehicleId(), event.getTime()); //Safe time when entering the link. + + final Id vehTypeId = VehicleUtils.findVehicle(event.getVehicleId(), scenario).getType().getId(); + vehicleTypeId2Mileage.merge(vehTypeId, distance, Double::sum); + } + + //If the vehicle leaves a link at the end, the travelTime is calculated and stored. + @Override + public void handleEvent(LinkLeaveEvent event){ + final Id vehicleId = event.getVehicleId(); + if (vehicleEnteredLinkTime.containsKey(vehicleId)){ + double tt = event.getTime() - vehicleEnteredLinkTime.get(vehicleId); + vehicleId2TravelTime.merge(vehicleId, tt, Double::sum); //per vehicle + + final Id vehTypeId = VehicleUtils.findVehicle(event.getVehicleId(), scenario).getType().getId(); + vehicleTypeId2TravelTime.merge(vehTypeId, tt, Double::sum); // per VehType + + vehicleEnteredLinkTime.remove(vehicleId); //remove from that list. + } + } + + //If the vehicle leaves a link because it reached its destination, the travelTime is calculated and stored. + @Override + public void handleEvent(VehicleLeavesTrafficEvent event){ + final Id vehicleId = event.getVehicleId(); + if (vehicleEnteredLinkTime.containsKey(vehicleId)){ + double tt = event.getTime() - vehicleEnteredLinkTime.get(vehicleId); + vehicleId2TravelTime.merge(vehicleId, tt, Double::sum);//per vehicle + + final Id vehTypeId = VehicleUtils.findVehicle(event.getVehicleId(), scenario).getType().getId(); + vehicleTypeId2TravelTime.merge(vehTypeId, tt, Double::sum); // per VehType + + vehicleEnteredLinkTime.remove(vehicleId); //remove from that list. + } + } + + void writeTravelTimeAndDistancePerVehicle(Path analysisOutputDirectory, Scenario scenario) throws IOException { + log.info("Writing out Time & Distance & Costs ... perVehicle"); + //Travel time and distance per vehicle + String fileName = analysisOutputDirectory.resolve("TimeDistance_perVehicle.tsv").toString(); + + BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); + + //Write headline: + bw1.write("vehicleId \t carrierId \t vehicleTypeId \t tourId \t " + + "tourDuration[s] \t tourDuration[h] \t" + + "travelDistance[m] \t travelDistance[km] \t " + + "travelTime[s] \t travelTime[h] \t" + + "costPerSecond[EUR/s] \t costPerMeter[EUR/m] \t fixedCosts[EUR] \t varCostsTime[EUR] \t varCostsDist[EUR] \t totalCosts[EUR]"); + bw1.newLine(); + + for (Id vehicleId : vehicleId2VehicleType.keySet()) { + + final Double durationInSeconds = vehicleId2TourDuration.get(vehicleId); + final Double distanceInMeters = vehicleId2TourLength.get(vehicleId); + final Double travelTimeInSeconds = vehicleId2TravelTime.get(vehicleId); + + + final VehicleType vehicleType = VehicleUtils.findVehicle(vehicleId, scenario).getType(); + final Double costsPerSecond = vehicleType.getCostInformation().getCostsPerSecond(); + final Double costsPerMeter = vehicleType.getCostInformation().getCostsPerMeter(); + final Double fixedCost = vehicleType.getCostInformation().getFixedCosts(); + + final double varCostsTime = durationInSeconds * costsPerSecond; + final double varCostsDist = distanceInMeters * costsPerMeter; + final double totalVehCosts = fixedCost + varCostsTime + varCostsDist; + + bw1.write(vehicleId.toString()); + bw1.write("\t" + vehicleId2CarrierId.get(vehicleId)); + bw1.write("\t" + vehicleType.getId().toString()); + bw1.write("\t" + vehicleId2TourId.get(vehicleId)); + + bw1.write("\t" + durationInSeconds); + bw1.write("\t" + durationInSeconds /3600); + + bw1.write("\t" + distanceInMeters); + bw1.write("\t" + distanceInMeters/1000); + + bw1.write("\t" + travelTimeInSeconds); + bw1.write("\t" + travelTimeInSeconds /3600); + + bw1.write("\t" + costsPerSecond); + bw1.write("\t" + costsPerMeter); + bw1.write("\t" + fixedCost); + bw1.write("\t" + varCostsTime); + bw1.write("\t" + varCostsDist); + bw1.write("\t" + totalVehCosts); + + bw1.newLine(); + } + + bw1.close(); + log.info("Output written to {}", fileName); + } + + void writeTravelTimeAndDistancePerVehicleType(Path analysisOutputDirectory, Scenario scenario) throws IOException { + log.info("Writing out Time & Distance & Costs ... perVehicleType"); + + //----- All VehicleTypes in CarriervehicleTypes container. Used so that even unused vehTypes appear in the output + TreeMap, VehicleType> vehicleTypesMap = new TreeMap<>(CarriersUtils.getCarrierVehicleTypes(scenario).getVehicleTypes()); + //For the case that there are additional vehicle types found in the events. + for (VehicleType vehicleType : vehicleId2VehicleType.values()) { + vehicleTypesMap.putIfAbsent(vehicleType.getId(), vehicleType); + } + + String fileName = analysisOutputDirectory.resolve("TimeDistance_perVehicleType.tsv").toString(); + + BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); + //Write headline: + bw1.write("vehicleTypeId \t nuOfVehicles \t " + + "SumOfTourDuration[s] \t SumOfTourDuration[h] \t" + + "SumOfTravelDistances[m] \t SumOfTravelDistances[km] \t " + + "SumOfTravelTime[s] \t SumOfTravelTime[h] \t" + + "costPerSecond[EUR/s] \t costPerMeter[EUR/m] \t fixedCosts[EUR/veh] \t" + + "varCostsTime[EUR] \t varCostsDist[EUR] \t fixedCosts[EUR] \t totalCosts[EUR]"); + bw1.newLine(); + + for (VehicleType vehicleType : vehicleTypesMap.values()) { + long nuOfVehicles = vehicleId2VehicleType.values().stream().filter(vehType -> vehType.getId() == vehicleType.getId()).count(); + + final Double costRatePerSecond = vehicleType.getCostInformation().getCostsPerSecond(); + final Double costRatePerMeter = vehicleType.getCostInformation().getCostsPerMeter(); + final Double fixedCostPerVeh = vehicleType.getCostInformation().getFixedCosts(); + + final Double sumOfTourDurationInSeconds = vehicleTypeId2SumOfTourDuration.getOrDefault(vehicleType.getId(), 0.); + final Double sumOfDistanceInMeters = vehicleTypeId2Mileage.getOrDefault(vehicleType.getId(), 0.); + final Double sumOfTravelTimeInSeconds = vehicleTypeId2TravelTime.getOrDefault(vehicleType.getId(), 0.); + + final double sumOfVarCostsTime = sumOfTourDurationInSeconds * costRatePerSecond; + final double sumOfVarCostsDistance = sumOfDistanceInMeters * costRatePerMeter; + final double sumOfFixCosts = nuOfVehicles * fixedCostPerVeh; + + bw1.write(vehicleType.getId().toString()); + + bw1.write("\t" + nuOfVehicles); + bw1.write("\t" + sumOfTourDurationInSeconds); + bw1.write("\t" + sumOfTourDurationInSeconds / 3600); + bw1.write("\t" + sumOfDistanceInMeters); + bw1.write("\t" + sumOfDistanceInMeters / 1000); + bw1.write("\t" + sumOfTravelTimeInSeconds); + bw1.write("\t" + sumOfTravelTimeInSeconds / 3600); + bw1.write("\t" + costRatePerSecond); + bw1.write("\t" + costRatePerMeter); + bw1.write("\t" + fixedCostPerVeh); + bw1.write("\t" + sumOfVarCostsTime); + bw1.write("\t" + sumOfVarCostsDistance); + bw1.write("\t" + sumOfFixCosts); + bw1.write("\t" + (sumOfFixCosts + sumOfVarCostsTime + sumOfVarCostsDistance)); + + bw1.newLine(); + } + + bw1.close(); + log.info("Output written to {}", fileName); + } +} diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/Readme.md b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/Readme.md new file mode 100644 index 00000000000..06ab8f35407 --- /dev/null +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/Readme.md @@ -0,0 +1,18 @@ +**The package name (org.matsim.contrib.freight) was chosen on purpose.** +It should allow to move the stuff to the freight contrib later without breaking any code. + +This package contains some analysis stuff for freight outputs. +The content was created by Jakob Hanisch during the MATSim advanced class 2020/21. + +**It is untested and needs some kind of review --> be very careful when using it!** +(KMT, Sep 21) + +**Update April 2023 -> Event-based analysis (KMT)** +We do now have an (unfortunately!!!) untested new approach: +We now can base on freight events, that were introduce during the last year. +This avoids the _guessing_ of some information, like vehicleType or carrierId. + +This analysis is of course not perfect and can/should be extended (and then moved over to the freight contrib.) +Since I programmed it for the SimGV class, I believe it is a good option moving it to a more central place. + +I also deprecated the "old" guessing approach. \ No newline at end of file diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java new file mode 100644 index 00000000000..1e21634102d --- /dev/null +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java @@ -0,0 +1,174 @@ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.analysis; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.matsim.api.core.v01.Scenario; +import org.matsim.core.api.experimental.events.EventsManager; +import org.matsim.core.config.Config; +import org.matsim.core.config.ConfigUtils; +import org.matsim.core.events.EventsUtils; +import org.matsim.core.events.MatsimEventsReader; +import org.matsim.core.scenario.ScenarioUtils; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; +import org.matsim.freight.carriers.events.CarrierEventsReaders; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; + +//import static org.matsim.application.ApplicationUtils.globFile; //TODO, this introduces a circular dependency. Resolve it + +/** + * A first approach for some analysis based on the freight events introduced in 2022/23. + * This class comes from teaching SimGV in the winter term 2022/23. + *

+ * This class should get extended and prepared as a standardized analysis for freight output. + * This should also get aligned with the current development in Simwrapper. + * Todo: Add some tests. + * + * @author kturner (Kai Martins-Turner) + */ +public class RunFreightAnalysisEventBased { + + private static final Logger log = LogManager.getLogger(RunFreightAnalysisEventBased.class); + + //Where is your simulation output, that should be analysed? + private final Path SIM_OUTPUT_PATH; + private final Path EVENTS_PATH; + private final Path ANALYSIS_OUTPUT_PATH; + private final String GLOBAL_CRS; + + private final Scenario scenario; + + //Removed this temporarily, as the import of globFile() causes a circular dependency + /*/** + * This constructor automatically searches for the needed output file in a simulation run output. + * + * @param simOutputPath The output directory of the simulation run + * @param analysisOutputPath The directory where the result of the analysis should go to + * @param globalCrs The CRS of the simulation + */ + /*public RunFreightAnalysisEventBased(Path simOutputPath, Path analysisOutputPath, String globalCrs) { + this.SIM_OUTPUT_PATH = simOutputPath; + this.EVENTS_PATH = globFile(SIM_OUTPUT_PATH, "*output_events.*"); + this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; + this.GLOBAL_CRS = globalCrs; + + Config config = ConfigUtils.createConfig(); + config.vehicles().setVehiclesFile(globFile(SIM_OUTPUT_PATH, "*output_allVehicles.*").toString()); + config.network().setInputFile(globFile(SIM_OUTPUT_PATH, "*output_network.*").toString()); + //freight settings + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); + freightCarriersConfigGroup.setCarriersFile(globFile(SIM_OUTPUT_PATH, "*output_carriers.*").toString()); + freightCarriersConfigGroup.setCarriersVehicleTypesFile(globFile(SIM_OUTPUT_PATH, "*output_carriersVehicleTypes.*").toString()); + + prepareConfig(config); + scenario = ScenarioUtils.loadScenario(config); + }*/ + + /** + * Alternative if you want to set the paths to the needed resources directly. + * + * @param analysisOutputPath The directory where the result of the analysis should go to + * @param globalCrs The CRS of the simulation + */ + public RunFreightAnalysisEventBased(Path networkPath, //TODO Change to path object + Path vehiclesPath, + Path carriersPath, + Path carriersVehicleTypesPath, + Path eventsPath, + Path analysisOutputPath, + String globalCrs) { + this.SIM_OUTPUT_PATH = null; + this.EVENTS_PATH = eventsPath; + this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; + this.GLOBAL_CRS = globalCrs; + + Config config = ConfigUtils.createConfig(); + config.vehicles().setVehiclesFile(vehiclesPath.toString()); + config.network().setInputFile(networkPath.toString()); + //freight settings + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); + freightCarriersConfigGroup.setCarriersFile(carriersPath.toString()); + freightCarriersConfigGroup.setCarriersVehicleTypesFile(carriersVehicleTypesPath.toString()); + + prepareConfig(config); + scenario = ScenarioUtils.loadScenario(config); + } + + private void prepareConfig(Config config) { + config.plans().setInputFile(null); + config.eventsManager().setNumberOfThreads(null); + config.eventsManager().setEstimatedNumberOfEvents(null); + config.global().setNumberOfThreads(1); + config.global().setCoordinateSystem(GLOBAL_CRS); + } + + public void runAnalysis() throws IOException { + //Where to store the analysis output? + File folder = new File(String.valueOf(ANALYSIS_OUTPUT_PATH)); + folder.mkdirs(); + + //load carriers according to freight config + CarriersUtils.loadCarriersAccordingToFreightConfig(scenario); + + + // CarrierPlanAnalysis + if(allCarriersHavePlans()){ + CarrierPlanAnalysis carrierPlanAnalysis = new CarrierPlanAnalysis(CarriersUtils.getCarriers(scenario)); + carrierPlanAnalysis.runAnalysisAndWriteStats(ANALYSIS_OUTPUT_PATH); + } + + // Prepare eventsManager - start of event based Analysis; + EventsManager eventsManager = EventsUtils.createEventsManager(); + + FreightTimeAndDistanceAnalysisEventsHandler freightTimeAndDistanceAnalysisEventsHandler = new FreightTimeAndDistanceAnalysisEventsHandler(scenario); + eventsManager.addHandler(freightTimeAndDistanceAnalysisEventsHandler); + + CarrierLoadAnalysis carrierLoadAnalysis = new CarrierLoadAnalysis(CarriersUtils.getCarriers(scenario)); + eventsManager.addHandler(carrierLoadAnalysis); + + eventsManager.initProcessing(); + MatsimEventsReader matsimEventsReader = CarrierEventsReaders.createEventsReader(eventsManager); + + matsimEventsReader.readFile(EVENTS_PATH.toString()); + eventsManager.finishProcessing(); + + log.info("Analysis completed."); + log.info("Writing output..."); + freightTimeAndDistanceAnalysisEventsHandler.writeTravelTimeAndDistancePerVehicle(ANALYSIS_OUTPUT_PATH, scenario); + freightTimeAndDistanceAnalysisEventsHandler.writeTravelTimeAndDistancePerVehicleType(ANALYSIS_OUTPUT_PATH, scenario); + carrierLoadAnalysis.writeLoadPerVehicle(ANALYSIS_OUTPUT_PATH, scenario); + } + + private boolean allCarriersHavePlans() { + for (Carrier carrier : CarriersUtils.getCarriers(scenario).getCarriers().values()) + if (carrier.getSelectedPlan() == null) + return false; + + return true; + } +} diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java new file mode 100644 index 00000000000..127a3428284 --- /dev/null +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java @@ -0,0 +1,78 @@ +/* + * *********************************************************************** * + * project: org.matsim.* + * *********************************************************************** * + * * + * copyright : (C) by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** + * + */ + +package org.matsim.freight.carriers.analysis; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.matsim.examples.ExamplesUtils; +import org.matsim.testcases.MatsimTestUtils; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class FreightAnalysisEventBasedTest { + + @RegisterExtension + private MatsimTestUtils testUtils = new MatsimTestUtils(); + + @Test + void runServiceEventTest() throws IOException, URISyntaxException { + // Note: I had to manually change the files for this test to run, as I did not have access to the original input file of the events-file + // This results in the carrier-plans not being related to the actual events. This is however no problem for testing the core functionality, + // as those are two disjunct analysis outputs, which do not depend on each other. (aleks Sep'24) + + RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased( + Paths.get(new URL(ExamplesUtils.getTestScenarioURL("freight-chessboard-9x9"), "grid9x9.xml").toURI()), + Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), + Path.of(testUtils.getInputDirectory() + "in/carrierWithServices.xml"), + Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), + Path.of(testUtils.getInputDirectory() + "in/serviceBasedEvents.xml"), + Path.of(testUtils.getOutputDirectory()), + null); + analysisEventBased.runAnalysis(); + + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Carrier_stats.tsv", testUtils.getOutputDirectory() + "Carrier_stats.tsv"); + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Load_perVehicle.tsv", testUtils.getOutputDirectory() + "Load_perVehicle.tsv"); + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicle.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicle.tsv"); + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicleType.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicleType.tsv"); + } + + @Test + void runShipmentEventTest() throws IOException, URISyntaxException { + RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased( + Paths.get(new URL(ExamplesUtils.getTestScenarioURL("freight-chessboard-9x9"), "grid9x9.xml").toURI()), + Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), + Path.of(testUtils.getInputDirectory() + "in/carrierWithShipments.xml"), + Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), + Path.of(testUtils.getInputDirectory() + "in/shipmentBasedEvents.xml"), + Path.of(testUtils.getOutputDirectory()), + null); + analysisEventBased.runAnalysis(); + + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Load_perVehicle.tsv", testUtils.getOutputDirectory() + "Load_perVehicle.tsv"); + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicle.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicle.tsv"); + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicleType.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicleType.tsv"); + } +} diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Carrier_stats.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Carrier_stats.tsv new file mode 100644 index 00000000000..927953924fe --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Carrier_stats.tsv @@ -0,0 +1,2 @@ +carrierId MATSimScoreSelectedPlan jSpritScoreSelectedPlan nuOfTours nuOfShipments(input) nuOfShipments(handled) nuOfServices(input) nuOfServices(handled) nuOfPlanedDemandSize nuOfHandledDemandSize jspritComputationTime[HH:mm:ss] +carrier1 -210.81333333333333 null 1 0 0 7 7 7 7 null diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Load_perVehicle.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Load_perVehicle.tsv new file mode 100644 index 00000000000..8cff896d44c --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Load_perVehicle.tsv @@ -0,0 +1 @@ +vehicleId capacity maxLoad load state during tour diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicle.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicle.tsv new file mode 100644 index 00000000000..579bbbee4c9 --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicle.tsv @@ -0,0 +1,3 @@ +vehicleId carrierId vehicleTypeId tourId tourDuration[s] tourDuration[h] travelDistance[m] travelDistance[km] travelTime[s] travelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR] varCostsTime[EUR] varCostsDist[EUR] totalCosts[EUR] +freight_carrier1_veh_carrier_19_lightVehicle_1 carrier1 light 1 6689.0 1.8580555555555556 36000.0 36.0 4824.0 1.34 0.008 4.7E-4 84.0 53.512 16.919999999999998 154.432 +freight_carrier1_veh_carrier_19_lightVehicle_2 carrier1 light 2 3818.0 1.0605555555555555 24000.0 24.0 3216.0 0.8933333333333333 0.008 4.7E-4 84.0 30.544 11.28 125.824 diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicleType.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicleType.tsv new file mode 100644 index 00000000000..c6630cdb4d6 --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicleType.tsv @@ -0,0 +1,2 @@ +vehicleTypeId nuOfVehicles SumOfTourDuration[s] SumOfTourDuration[h] SumOfTravelDistances[m] SumOfTravelDistances[km] SumOfTravelTime[s] SumOfTravelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR/veh] varCostsTime[EUR] varCostsDist[EUR] fixedCosts[EUR] totalCosts[EUR] +light 2 10507.0 2.9186111111111113 60000.0 60.0 8040.0 2.2333333333333334 0.008 4.7E-4 84.0 84.056 28.2 168.0 280.256 diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierVehicles.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierVehicles.xml new file mode 100644 index 00000000000..904e5f9b006 --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierVehicles.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + 0.008 + 0.008 + + + + + + + + + + + diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierWithServices.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierWithServices.xml new file mode 100644 index 00000000000..80210d8f5a6 --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierWithServices.xml @@ -0,0 +1,64 @@ + + + + + 50 + + + + + + + + + + + + + + + + + + + + + + + i(1,0) j(1,1) j(1,2) i(2,2) i(3,2) i(4,2) + + + + i(4,1)R j(3,2) i(4,2) i(5,2) i(6,2) j(6,2)R + + + + i(7,0) i(8,0) i(9,0) j(9,1) + + + + j(9,3) j(9,4) j(9,5) j(9,6) + + + + i(9,7)R i(8,7)R + + + + i(6,7)R i(5,7)R j(4,7)R + + + + j(5,7) i(5,7)R i(4,7)R + + + + i(2,7)R i(1,7)R j(0,7)R j(0,6)R j(0,5)R j(0,4)R j(0,3)R j(0,2)R + + + + + + + + diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/serviceBasedEvents.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/serviceBasedEvents.xml new file mode 100644 index 00000000000..b4121096264 --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/serviceBasedEvents.xml @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Load_perVehicle.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Load_perVehicle.tsv new file mode 100644 index 00000000000..dca7a388d99 --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Load_perVehicle.tsv @@ -0,0 +1,2 @@ +vehicleId capacity maxLoad load state during tour +freight_carrier1_veh_heavyVehicle_1 Infinity 26 [3, 8, 18, 25, 26, 23, 13, 12, 7, 0] diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicle.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicle.tsv new file mode 100644 index 00000000000..8389fdb09dc --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicle.tsv @@ -0,0 +1,2 @@ +vehicleId carrierId vehicleTypeId tourId tourDuration[s] tourDuration[h] travelDistance[m] travelDistance[km] travelTime[s] travelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR] varCostsTime[EUR] varCostsDist[EUR] totalCosts[EUR] +freight_carrier1_veh_heavyVehicle_1 carrier1 heavy 1 6870.0 1.9083333333333334 40000.0 40.0 5360.0 1.488888888888889 0.016 5.7E-4 200.0 109.92 22.8 332.72 diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicleType.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicleType.tsv new file mode 100644 index 00000000000..54e31d3a5d0 --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicleType.tsv @@ -0,0 +1,2 @@ +vehicleTypeId nuOfVehicles SumOfTourDuration[s] SumOfTourDuration[h] SumOfTravelDistances[m] SumOfTravelDistances[km] SumOfTravelTime[s] SumOfTravelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR/veh] varCostsTime[EUR] varCostsDist[EUR] fixedCosts[EUR] totalCosts[EUR] +heavy 1 6870.0 1.9083333333333334 40000.0 40.0 5360.0 1.488888888888889 0.016 5.7E-4 200.0 109.92 22.8 200.0 332.72 diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierVehicles.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierVehicles.xml new file mode 100644 index 00000000000..44f7bb7b1e0 --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierVehicles.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + 0.016 + 0.016 + + + + + + + + + + diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierWithShipments.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierWithShipments.xml new file mode 100644 index 00000000000..b5e8cbe0bd5 --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierWithShipments.xml @@ -0,0 +1,26 @@ + + + + + 50 + + + + + + + + + + + + + + + + + + + + + diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/shipmentBasedEvents.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/shipmentBasedEvents.xml new file mode 100644 index 00000000000..ca675a9bcbf --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/shipmentBasedEvents.xml @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 9ec72435b3dd554cc7ad1088c0f44c73a30b5578 Mon Sep 17 00:00:00 2001 From: aleks Date: Wed, 18 Sep 2024 14:24:52 +0200 Subject: [PATCH 19/60] Resolved FileSystemError --- .../RunFreightAnalysisEventBased.java | 13 +- .../FreightAnalysisEventBasedTest.java | 12 +- .../runServiceEventTest/in/grid9x9.xml | 301 ++++++++++++++++++ .../runShipmentEventTest/in/grid9x9.xml | 301 ++++++++++++++++++ 4 files changed, 609 insertions(+), 18 deletions(-) create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/grid9x9.xml create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/grid9x9.xml diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java index 1e21634102d..7b6d72ce918 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java @@ -95,13 +95,7 @@ public class RunFreightAnalysisEventBased { * @param analysisOutputPath The directory where the result of the analysis should go to * @param globalCrs The CRS of the simulation */ - public RunFreightAnalysisEventBased(Path networkPath, //TODO Change to path object - Path vehiclesPath, - Path carriersPath, - Path carriersVehicleTypesPath, - Path eventsPath, - Path analysisOutputPath, - String globalCrs) { + public RunFreightAnalysisEventBased(Path networkPath, Path vehiclesPath, Path carriersPath, Path carriersVehicleTypesPath, Path eventsPath, Path analysisOutputPath, String globalCrs) { this.SIM_OUTPUT_PATH = null; this.EVENTS_PATH = eventsPath; this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; @@ -137,7 +131,7 @@ public void runAnalysis() throws IOException { // CarrierPlanAnalysis - if(allCarriersHavePlans()){ + if (allCarriersHavePlans()) { CarrierPlanAnalysis carrierPlanAnalysis = new CarrierPlanAnalysis(CarriersUtils.getCarriers(scenario)); carrierPlanAnalysis.runAnalysisAndWriteStats(ANALYSIS_OUTPUT_PATH); } @@ -166,8 +160,7 @@ public void runAnalysis() throws IOException { private boolean allCarriersHavePlans() { for (Carrier carrier : CarriersUtils.getCarriers(scenario).getCarriers().values()) - if (carrier.getSelectedPlan() == null) - return false; + if (carrier.getSelectedPlan() == null) return false; return true; } diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java index 127a3428284..e077d97f1fe 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java @@ -23,14 +23,10 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import org.matsim.examples.ExamplesUtils; import org.matsim.testcases.MatsimTestUtils; import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; import java.nio.file.Path; -import java.nio.file.Paths; public class FreightAnalysisEventBasedTest { @@ -38,13 +34,13 @@ public class FreightAnalysisEventBasedTest { private MatsimTestUtils testUtils = new MatsimTestUtils(); @Test - void runServiceEventTest() throws IOException, URISyntaxException { + void runServiceEventTest() throws IOException { // Note: I had to manually change the files for this test to run, as I did not have access to the original input file of the events-file // This results in the carrier-plans not being related to the actual events. This is however no problem for testing the core functionality, // as those are two disjunct analysis outputs, which do not depend on each other. (aleks Sep'24) RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased( - Paths.get(new URL(ExamplesUtils.getTestScenarioURL("freight-chessboard-9x9"), "grid9x9.xml").toURI()), + Path.of(testUtils.getInputDirectory() + "in/grid9x9.xml"), Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), Path.of(testUtils.getInputDirectory() + "in/carrierWithServices.xml"), Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), @@ -60,9 +56,9 @@ void runServiceEventTest() throws IOException, URISyntaxException { } @Test - void runShipmentEventTest() throws IOException, URISyntaxException { + void runShipmentEventTest() throws IOException { RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased( - Paths.get(new URL(ExamplesUtils.getTestScenarioURL("freight-chessboard-9x9"), "grid9x9.xml").toURI()), + Path.of(testUtils.getInputDirectory() + "in/grid9x9.xml"), Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), Path.of(testUtils.getInputDirectory() + "in/carrierWithShipments.xml"), Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/grid9x9.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/grid9x9.xml new file mode 100644 index 00000000000..c5009bdd7f2 --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/grid9x9.xml @@ -0,0 +1,301 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/grid9x9.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/grid9x9.xml new file mode 100644 index 00000000000..c5009bdd7f2 --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/grid9x9.xml @@ -0,0 +1,301 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 43f116e3eaae9066fcc4048a734ce1c047f2220d Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 11:34:18 +0200 Subject: [PATCH 20/60] add TODO --- .../matsim/freight/carriers/analysis/CarrierPlanAnalysis.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java index a4cf2389527..69844513999 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java @@ -53,7 +53,7 @@ public class CarrierPlanAnalysis { public CarrierPlanAnalysis(Carriers carriers) { this.carriers = carriers; } - + //TODO add added parameters to comment at the top public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOException { log.info("Writing out carrier analysis ..."); //Load per vehicle From cceee214d9d559e446a48d0a51bbc09cfd068b93 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 11:47:54 +0200 Subject: [PATCH 21/60] change pom for freight analysis --- contribs/freight/pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/contribs/freight/pom.xml b/contribs/freight/pom.xml index cfd34b6d514..6008f29d367 100644 --- a/contribs/freight/pom.xml +++ b/contribs/freight/pom.xml @@ -64,6 +64,18 @@ 2025.0-SNAPSHOT + + org.matsim.contrib + vsp + 2025.0-SNAPSHOT + + + + + + + + org.mockito mockito-core From 79db68963031e0b40df8770f4fb929840f96feb7 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 12:36:18 +0200 Subject: [PATCH 22/60] add two additional constructors and add separate carriers only analysis --- .../RunFreightAnalysisEventBased.java | 109 +++++++++++++----- 1 file changed, 80 insertions(+), 29 deletions(-) diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java index edbb7310b02..0d90d205030 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java @@ -24,15 +24,17 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; -import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.CarriersUtils; -import org.matsim.freight.carriers.events.CarrierEventsReaders; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.events.EventsUtils; import org.matsim.core.events.MatsimEventsReader; import org.matsim.core.scenario.ScenarioUtils; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.Carriers; +import org.matsim.freight.carriers.CarriersUtils; +import org.matsim.freight.carriers.FreightCarriersConfigGroup; +import org.matsim.freight.carriers.events.CarrierEventsReaders; import java.io.File; import java.io.IOException; @@ -55,51 +57,94 @@ public class RunFreightAnalysisEventBased { private static final Logger log = LogManager.getLogger(RunFreightAnalysisEventBased.class); - //Were is your simulation output, that should be analysed? - private final Path SIM_OUTPUT_PATH ; + //Where is your simulation output, that should be analysed? + private Path EVENTS_PATH = null; private final Path ANALYSIS_OUTPUT_PATH; - private final String GLOBAL_CRS; + private Scenario scenario = null; + private Carriers carriers = null; + //TODO discuss renaming without EventBased. If this becomes the standard carrier output /** - * @param simOutputPath The output directory of the simulation run - * @param analysisOutputPath The directory where the result of the analysis should go to - * @param globalCrs The CRS of the simulation + * This constructor automatically searches for the necessary output file in a simulation run output. + * + * @param simOutputPath The output directory of the simulation run + * @param analysisOutputPath The directory where the result of the analysis should go to + * @param globalCrs The CRS of the simulation */ public RunFreightAnalysisEventBased(Path simOutputPath, Path analysisOutputPath, String globalCrs) { - this.SIM_OUTPUT_PATH = simOutputPath; + this.EVENTS_PATH = globFile(simOutputPath, "*output_events.*"); + this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; + + Path vehiclesPath = globFile(simOutputPath, "*output_allVehicles.*"); + Path networkPath = globFile(simOutputPath, "*output_network.*"); + Path carriersPath = globFile(simOutputPath, "*output_carriers.*"); + Path carriersVehicleTypesPath = globFile(simOutputPath, "*output_carriersVehicleTypes.*"); + + createScenarioForFreightAnalysis(vehiclesPath, networkPath, carriersPath, carriersVehicleTypesPath, globalCrs); + } + + /** + * Alternative if you want to set the paths to the necessary resources directly. + * + * @param analysisOutputPath The directory where the result of the analysis should go to + * @param globalCrs The CRS of the simulation + */ + public RunFreightAnalysisEventBased(Path networkPath, Path vehiclesPath, Path carriersPath, Path carriersVehicleTypesPath, Path eventsPath, Path analysisOutputPath, String globalCrs) { + this.EVENTS_PATH = eventsPath; + this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; + + createScenarioForFreightAnalysis(vehiclesPath, networkPath, carriersPath, carriersVehicleTypesPath, globalCrs); + } + + /** + * Constructor, if you only want to have the carrier analysis. + * + * @param carriers The carriers to be analysed + * @param analysisOutputPath The directory where the result of the analysis should go to + */ + public RunFreightAnalysisEventBased(Carriers carriers, Path analysisOutputPath) { + this.carriers = carriers; this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; - this.GLOBAL_CRS = globalCrs; } - public void runAnalysis() throws IOException { + private void createScenarioForFreightAnalysis(Path vehiclesPath, Path networkPath, Path carriersPath, Path carriersVehicleTypesPath, + String globalCrs) { Config config = ConfigUtils.createConfig(); - config.vehicles().setVehiclesFile(globFile(SIM_OUTPUT_PATH, "*output_allVehicles.*").toString()); - config.network().setInputFile(globFile(SIM_OUTPUT_PATH, "*output_network.*").toString()); - config.global().setCoordinateSystem(GLOBAL_CRS); + config.vehicles().setVehiclesFile(vehiclesPath.toString()); + config.network().setInputFile(networkPath.toString()); config.plans().setInputFile(null); config.eventsManager().setNumberOfThreads(null); config.eventsManager().setEstimatedNumberOfEvents(null); config.global().setNumberOfThreads(1); - //freight settings - FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule( config, FreightCarriersConfigGroup.class ) ; - freightCarriersConfigGroup.setCarriersFile(globFile(SIM_OUTPUT_PATH, "*output_carriers.*").toString()); - freightCarriersConfigGroup.setCarriersVehicleTypesFile(globFile(SIM_OUTPUT_PATH, "*output_carriersVehicleTypes.*").toString()); - - //Were to store the analysis output? - File folder = new File(String.valueOf(ANALYSIS_OUTPUT_PATH)); - folder.mkdirs(); + config.global().setCoordinateSystem(globalCrs); - final String eventsFile = globFile(SIM_OUTPUT_PATH, "*output_events.*").toString(); + //freight settings + FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); + freightCarriersConfigGroup.setCarriersFile(carriersPath.toString()); + freightCarriersConfigGroup.setCarriersVehicleTypesFile(carriersVehicleTypesPath.toString()); - Scenario scenario = ScenarioUtils.loadScenario(config); + scenario = ScenarioUtils.loadScenario(config); //load carriers according to freight config CarriersUtils.loadCarriersAccordingToFreightConfig( scenario ); + this.carriers = CarriersUtils.addOrGetCarriers(scenario); + } + public void runCarriersAnalysis() throws IOException { - // CarrierPlanAnalysis - CarrierPlanAnalysis carrierPlanAnalysis = new CarrierPlanAnalysis(CarriersUtils.getCarriers(scenario)); - carrierPlanAnalysis.runAnalysisAndWriteStats(ANALYSIS_OUTPUT_PATH); + //Where to store the analysis output? + File folder = new File(String.valueOf(ANALYSIS_OUTPUT_PATH)); + folder.mkdirs(); + if (allCarriersHavePlans(carriers)) { + CarrierPlanAnalysis carrierPlanAnalysis = new CarrierPlanAnalysis(carriers); + carrierPlanAnalysis.runAnalysisAndWriteStats(ANALYSIS_OUTPUT_PATH); + } + else { + log.warn("########## Not all carriers have plans. Skipping CarrierPlanAnalysis."); //TODO perhaps skipp complete analysis + } + } + public void runCompleteAnalysis() throws IOException { + runCarriersAnalysis(); // Prepare eventsManager - start of event based Analysis; EventsManager eventsManager = EventsUtils.createEventsManager(); @@ -113,7 +158,7 @@ public void runAnalysis() throws IOException { eventsManager.initProcessing(); MatsimEventsReader matsimEventsReader = CarrierEventsReaders.createEventsReader(eventsManager); - matsimEventsReader.readFile(eventsFile); + matsimEventsReader.readFile(EVENTS_PATH.toString()); eventsManager.finishProcessing(); log.info("Analysis completed."); @@ -123,4 +168,10 @@ public void runAnalysis() throws IOException { carrierLoadAnalysis.writeLoadPerVehicle(ANALYSIS_OUTPUT_PATH, scenario); } + private boolean allCarriersHavePlans(Carriers carriers) { + for (Carrier carrier : carriers.getCarriers().values()) + if (carrier.getSelectedPlan() == null) return false; + + return true; + } } From 016cf47ded4c6d859221063eac58ee80f8e2b128 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 12:37:48 +0200 Subject: [PATCH 23/60] removed copied files to move the original files afterward --- .../analysis/CarrierLoadAnalysis.java | 118 -------- .../analysis/CarrierPlanAnalysis.java | 117 -------- ...tTimeAndDistanceAnalysisEventsHandler.java | 279 ------------------ .../freight/carriers/analysis/Readme.md | 18 -- .../RunFreightAnalysisEventBased.java | 167 ----------- .../FreightAnalysisEventBasedTest.java | 74 ----- 6 files changed, 773 deletions(-) delete mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java delete mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java delete mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java delete mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/Readme.md delete mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java delete mode 100644 contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java deleted file mode 100644 index 376f931df4c..00000000000 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** - * - */ - -package org.matsim.freight.carriers.analysis; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.matsim.api.core.v01.Id; -import org.matsim.api.core.v01.Scenario; -import org.matsim.freight.carriers.Carriers; -import org.matsim.freight.carriers.events.CarrierShipmentDeliveryStartEvent; -import org.matsim.freight.carriers.events.CarrierShipmentPickupStartEvent; -import org.matsim.freight.carriers.events.eventhandler.CarrierShipmentDeliveryStartEventHandler; -import org.matsim.freight.carriers.events.eventhandler.CarrierShipmentPickupStartEventHandler; -import org.matsim.vehicles.Vehicle; -import org.matsim.vehicles.VehicleType; -import org.matsim.vehicles.VehicleUtils; - -import java.io.BufferedWriter; -import java.io.FileWriter; -import java.io.IOException; -import java.nio.file.Path; -import java.util.Comparator; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.Map; - -import static org.matsim.freight.carriers.events.CarrierEventAttributes.ATTRIBUTE_CAPACITYDEMAND; - -/** - * @author Kai Martins-Turner (kturner) - */ -public class CarrierLoadAnalysis implements CarrierShipmentPickupStartEventHandler, CarrierShipmentDeliveryStartEventHandler { - - private static final Logger log = LogManager.getLogger(CarrierLoadAnalysis.class); - - Carriers carriers; - - private final Map, LinkedList> vehicle2Load = new LinkedHashMap<>(); - - public CarrierLoadAnalysis(Carriers carriers) { - this.carriers = carriers; - } - - @Override - public void handleEvent(CarrierShipmentPickupStartEvent event) { - Id vehicleId = Id.createVehicleId(event.getAttributes().get("vehicle")); - Integer demand = Integer.valueOf(event.getAttributes().get(ATTRIBUTE_CAPACITYDEMAND)); - - LinkedList list; - if (! vehicle2Load.containsKey(vehicleId)){ - list = new LinkedList<>(); - list.add(demand); - } else { - list = vehicle2Load.get(vehicleId); - list.add(list.getLast() + demand); - } - vehicle2Load.put(vehicleId, list); - } - - @Override - public void handleEvent(CarrierShipmentDeliveryStartEvent event) { - Id vehicleId = Id.createVehicleId(event.getAttributes().get("vehicle")); - Integer demand = Integer.valueOf(event.getAttributes().get(ATTRIBUTE_CAPACITYDEMAND)); - - var list = vehicle2Load.get(vehicleId); - list.add(list.getLast() - demand); - vehicle2Load.put(vehicleId, list); - } - - void writeLoadPerVehicle(Path analysisOutputDirectory, Scenario scenario) throws IOException { - log.info("Writing out vehicle load analysis ..."); - //Load per vehicle - String fileName = analysisOutputDirectory.resolve("Load_perVehicle.tsv").toString(); - - BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); - - //Write headline: - bw1.write("vehicleId \t capacity \t maxLoad \t load state during tour"); - bw1.newLine(); - - for (Id vehicleId : vehicle2Load.keySet()) { - - final LinkedList load = vehicle2Load.get(vehicleId); - final Integer maxLoad = load.stream().max(Comparator.naturalOrder()).get(); - - final VehicleType vehicleType = VehicleUtils.findVehicle(vehicleId, scenario).getType(); - final Double capacity = vehicleType.getCapacity().getOther(); - - bw1.write(vehicleId.toString()); - bw1.write("\t" + capacity); - bw1.write("\t" + maxLoad); - bw1.write("\t" + load); - bw1.newLine(); - } - - bw1.close(); - log.info("Output written to {}", fileName); - } -} diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java deleted file mode 100644 index a4cf2389527..00000000000 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** - * - */ - -package org.matsim.freight.carriers.analysis; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.matsim.api.core.v01.Id; -import org.matsim.core.utils.misc.Time; -import org.matsim.freight.carriers.*; - -import java.io.BufferedWriter; -import java.io.FileWriter; -import java.io.IOException; -import java.nio.file.Path; -import java.util.TreeMap; - -/** - * Some basic analysis / data collection for {@link Carriers}(files) - *

- * For all carriers it writes out the: - * - score of the selected plan - * - number of tours (= vehicles) of the selected plan - * - number of Services (input) - * - number of shipments (input) - * to a tsv-file. - * @author Kai Martins-Turner (kturner) - */ -public class CarrierPlanAnalysis { - - private static final Logger log = LogManager.getLogger(CarrierPlanAnalysis.class); - - Carriers carriers; - - public CarrierPlanAnalysis(Carriers carriers) { - this.carriers = carriers; - } - - public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOException { - log.info("Writing out carrier analysis ..."); - //Load per vehicle - String fileName = analysisOutputDirectory.resolve("Carrier_stats.tsv").toString(); - - BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); - - //Write headline: - bw1.write("carrierId \t MATSimScoreSelectedPlan \t jSpritScoreSelectedPlan \t nuOfTours \t nuOfShipments(input) \t nuOfShipments(handled) \t nuOfServices(input) \t nuOfServices(handled) \t nuOfPlanedDemandSize \t nuOfHandledDemandSize \t jspritComputationTime[HH:mm:ss]"); - bw1.newLine(); - - final TreeMap, Carrier> sortedCarrierMap = new TreeMap<>(carriers.getCarriers()); - - for (Carrier carrier : sortedCarrierMap.values()) { - - int numberOfPlanedShipments = carrier.getShipments().size(); - int numberOfPlanedServices = carrier.getServices().size(); - int numberOfHandledPickups = (int)carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Pickup).count()).sum(); - int numberOfHandledDeliveries = (int)carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Delivery).count()).sum(); - int nuOfServiceHandled = (int)carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.ServiceActivity).count()).sum(); - int numberOfPlanedDemandSize; - int numberOfHandledDemandSize; - if (numberOfPlanedShipments > 0) { - numberOfPlanedDemandSize = carrier.getShipments().values().stream().mapToInt(CarrierShipment::getSize).sum(); - numberOfHandledDemandSize = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Pickup).mapToInt(te -> ( ((Tour.Pickup) te).getShipment().getSize())).sum()).sum(); - } else { - numberOfPlanedDemandSize = carrier.getServices().values().stream().mapToInt(CarrierService::getCapacityDemand).sum(); - numberOfHandledDemandSize = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.ServiceActivity).mapToInt(te -> ((Tour.ServiceActivity) te).getService().getCapacityDemand()).sum()).sum(); - } - - if(numberOfPlanedServices != nuOfServiceHandled) { - log.warn("Number of services in input and handled are not equal for carrier {}. Jobs Input: {}, Jobs Handled: {}", carrier.getId(), numberOfPlanedServices, nuOfServiceHandled); - } - if (numberOfPlanedShipments != numberOfHandledPickups) { - log.warn("Number of shipments in input and handled are not equal for carrier {}. Jobs Input: {}, Jobs Handled: {}", carrier.getId(), numberOfPlanedShipments, numberOfHandledPickups); - } - if (numberOfHandledDeliveries != numberOfHandledPickups) { - log.warn("Number of handled pickups and deliveries are not equal for carrier {}. Pickups: {}, Deliveries: {}. This should not happen!!", carrier.getId(), numberOfHandledPickups, numberOfHandledDeliveries); - } - bw1.write(carrier.getId().toString()); - bw1.write("\t" + carrier.getSelectedPlan().getScore()); - bw1.write("\t" + carrier.getSelectedPlan().getJspritScore()); - bw1.write("\t" + carrier.getSelectedPlan().getScheduledTours().size()); - bw1.write("\t" + numberOfPlanedShipments); - bw1.write("\t" + numberOfHandledPickups); - bw1.write("\t" + numberOfPlanedServices); - bw1.write("\t" + nuOfServiceHandled); - bw1.write("\t" + numberOfPlanedDemandSize); - bw1.write("\t" + numberOfHandledDemandSize); - if (CarriersUtils.getJspritComputationTime(carrier) != Integer.MIN_VALUE) - bw1.write("\t" + Time.writeTime(CarriersUtils.getJspritComputationTime(carrier), Time.TIMEFORMAT_HHMMSS)); - else - bw1.write("\t" + "null"); - - bw1.newLine(); - } - - bw1.close(); - log.info("Output written to {}", fileName); - } -} diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java deleted file mode 100644 index 2cc4e8473f7..00000000000 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** - * - */ - -package org.matsim.freight.carriers.analysis; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.matsim.api.core.v01.Id; -import org.matsim.api.core.v01.Scenario; -import org.matsim.api.core.v01.events.LinkEnterEvent; -import org.matsim.api.core.v01.events.LinkLeaveEvent; -import org.matsim.api.core.v01.events.VehicleEntersTrafficEvent; -import org.matsim.api.core.v01.events.VehicleLeavesTrafficEvent; -import org.matsim.api.core.v01.events.handler.LinkEnterEventHandler; -import org.matsim.api.core.v01.events.handler.LinkLeaveEventHandler; -import org.matsim.api.core.v01.events.handler.VehicleEntersTrafficEventHandler; -import org.matsim.api.core.v01.events.handler.VehicleLeavesTrafficEventHandler; -import org.matsim.freight.carriers.Carrier; -import org.matsim.freight.carriers.CarriersUtils; -import org.matsim.freight.carriers.Tour; -import org.matsim.freight.carriers.events.CarrierTourEndEvent; -import org.matsim.freight.carriers.events.CarrierTourStartEvent; -import org.matsim.freight.carriers.events.eventhandler.CarrierTourEndEventHandler; -import org.matsim.freight.carriers.events.eventhandler.CarrierTourStartEventHandler; -import org.matsim.vehicles.Vehicle; -import org.matsim.vehicles.VehicleType; -import org.matsim.vehicles.VehicleUtils; - -import java.io.BufferedWriter; -import java.io.FileWriter; -import java.io.IOException; -import java.nio.file.Path; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.TreeMap; - -/** - * @author Kai Martins-Turner (kturner) - */ -public class FreightTimeAndDistanceAnalysisEventsHandler implements - CarrierTourStartEventHandler, - CarrierTourEndEventHandler, - LinkEnterEventHandler, - LinkLeaveEventHandler, - VehicleEntersTrafficEventHandler, - VehicleLeavesTrafficEventHandler { - - private final static Logger log = LogManager.getLogger(FreightTimeAndDistanceAnalysisEventsHandler.class); - - private final Scenario scenario; - private final Map, Double> vehicleId2TourDuration = new LinkedHashMap<>(); - private final Map, Double> vehicleId2TourLength = new LinkedHashMap<>(); - - private final Map, Double> vehicleId2TravelTime = new LinkedHashMap<>(); - - private final Map, Id> vehicleId2CarrierId = new LinkedHashMap<>(); - private final Map, Id> vehicleId2TourId = new LinkedHashMap<>(); - - private final Map, Double> vehicleTypeId2SumOfTourDuration = new LinkedHashMap<>(); - private final Map, Double> vehicleTypeId2Mileage = new LinkedHashMap<>(); - private final Map, Double> vehicleTypeId2TravelTime = new LinkedHashMap<>(); - - private final Map, VehicleType> vehicleId2VehicleType = new TreeMap<>(); - - private final Map tourStartTime = new LinkedHashMap<>(); - - private final Map, Double> vehicleEnteredLinkTime = new LinkedHashMap<>(); - - - public FreightTimeAndDistanceAnalysisEventsHandler(Scenario scenario) { - this.scenario = scenario; - } - - @Override - public void handleEvent(CarrierTourStartEvent event) { - // Save time of freight tour start - final String key = event.getCarrierId().toString() + "_" + event.getTourId().toString(); - tourStartTime.put(key, event.getTime()); - } - - //Fix costs for vehicle usage - @Override - public void handleEvent(CarrierTourEndEvent event) { - final String key = event.getCarrierId().toString() + "_" + event.getTourId().toString(); - double tourDuration = event.getTime() - tourStartTime.get(key); - vehicleId2TourDuration.put(event.getVehicleId(), tourDuration); //TODO, check if this may overwrite old data and if this is intended to do so - VehicleType vehType = VehicleUtils.findVehicle(event.getVehicleId(), scenario).getType(); - vehicleTypeId2SumOfTourDuration.merge(vehType.getId(), tourDuration, Double::sum); - - //Some general information for this vehicle - vehicleId2CarrierId.putIfAbsent(event.getVehicleId(), event.getCarrierId()); - vehicleId2TourId.putIfAbsent(event.getVehicleId(), event.getTourId()); - - vehicleId2VehicleType.putIfAbsent(event.getVehicleId(), vehType); - } - - @Override - public void handleEvent(VehicleEntersTrafficEvent event){ - vehicleEnteredLinkTime.put(event.getVehicleId(), event.getTime()); - } - - @Override - public void handleEvent(LinkEnterEvent event) { - final double distance = scenario.getNetwork().getLinks().get(event.getLinkId()).getLength(); - vehicleId2TourLength.merge(event.getVehicleId(), distance, Double::sum); - vehicleEnteredLinkTime.put(event.getVehicleId(), event.getTime()); //Safe time when entering the link. - - final Id vehTypeId = VehicleUtils.findVehicle(event.getVehicleId(), scenario).getType().getId(); - vehicleTypeId2Mileage.merge(vehTypeId, distance, Double::sum); - } - - //If the vehicle leaves a link at the end, the travelTime is calculated and stored. - @Override - public void handleEvent(LinkLeaveEvent event){ - final Id vehicleId = event.getVehicleId(); - if (vehicleEnteredLinkTime.containsKey(vehicleId)){ - double tt = event.getTime() - vehicleEnteredLinkTime.get(vehicleId); - vehicleId2TravelTime.merge(vehicleId, tt, Double::sum); //per vehicle - - final Id vehTypeId = VehicleUtils.findVehicle(event.getVehicleId(), scenario).getType().getId(); - vehicleTypeId2TravelTime.merge(vehTypeId, tt, Double::sum); // per VehType - - vehicleEnteredLinkTime.remove(vehicleId); //remove from that list. - } - } - - //If the vehicle leaves a link because it reached its destination, the travelTime is calculated and stored. - @Override - public void handleEvent(VehicleLeavesTrafficEvent event){ - final Id vehicleId = event.getVehicleId(); - if (vehicleEnteredLinkTime.containsKey(vehicleId)){ - double tt = event.getTime() - vehicleEnteredLinkTime.get(vehicleId); - vehicleId2TravelTime.merge(vehicleId, tt, Double::sum);//per vehicle - - final Id vehTypeId = VehicleUtils.findVehicle(event.getVehicleId(), scenario).getType().getId(); - vehicleTypeId2TravelTime.merge(vehTypeId, tt, Double::sum); // per VehType - - vehicleEnteredLinkTime.remove(vehicleId); //remove from that list. - } - } - - void writeTravelTimeAndDistancePerVehicle(Path analysisOutputDirectory, Scenario scenario) throws IOException { - log.info("Writing out Time & Distance & Costs ... perVehicle"); - //Travel time and distance per vehicle - String fileName = analysisOutputDirectory.resolve("TimeDistance_perVehicle.tsv").toString(); - - BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); - - //Write headline: - bw1.write("vehicleId \t carrierId \t vehicleTypeId \t tourId \t " - + "tourDuration[s] \t tourDuration[h] \t" - + "travelDistance[m] \t travelDistance[km] \t " + - "travelTime[s] \t travelTime[h] \t" + - "costPerSecond[EUR/s] \t costPerMeter[EUR/m] \t fixedCosts[EUR] \t varCostsTime[EUR] \t varCostsDist[EUR] \t totalCosts[EUR]"); - bw1.newLine(); - - for (Id vehicleId : vehicleId2VehicleType.keySet()) { - - final Double durationInSeconds = vehicleId2TourDuration.get(vehicleId); - final Double distanceInMeters = vehicleId2TourLength.get(vehicleId); - final Double travelTimeInSeconds = vehicleId2TravelTime.get(vehicleId); - - - final VehicleType vehicleType = VehicleUtils.findVehicle(vehicleId, scenario).getType(); - final Double costsPerSecond = vehicleType.getCostInformation().getCostsPerSecond(); - final Double costsPerMeter = vehicleType.getCostInformation().getCostsPerMeter(); - final Double fixedCost = vehicleType.getCostInformation().getFixedCosts(); - - final double varCostsTime = durationInSeconds * costsPerSecond; - final double varCostsDist = distanceInMeters * costsPerMeter; - final double totalVehCosts = fixedCost + varCostsTime + varCostsDist; - - bw1.write(vehicleId.toString()); - bw1.write("\t" + vehicleId2CarrierId.get(vehicleId)); - bw1.write("\t" + vehicleType.getId().toString()); - bw1.write("\t" + vehicleId2TourId.get(vehicleId)); - - bw1.write("\t" + durationInSeconds); - bw1.write("\t" + durationInSeconds /3600); - - bw1.write("\t" + distanceInMeters); - bw1.write("\t" + distanceInMeters/1000); - - bw1.write("\t" + travelTimeInSeconds); - bw1.write("\t" + travelTimeInSeconds /3600); - - bw1.write("\t" + costsPerSecond); - bw1.write("\t" + costsPerMeter); - bw1.write("\t" + fixedCost); - bw1.write("\t" + varCostsTime); - bw1.write("\t" + varCostsDist); - bw1.write("\t" + totalVehCosts); - - bw1.newLine(); - } - - bw1.close(); - log.info("Output written to {}", fileName); - } - - void writeTravelTimeAndDistancePerVehicleType(Path analysisOutputDirectory, Scenario scenario) throws IOException { - log.info("Writing out Time & Distance & Costs ... perVehicleType"); - - //----- All VehicleTypes in CarriervehicleTypes container. Used so that even unused vehTypes appear in the output - TreeMap, VehicleType> vehicleTypesMap = new TreeMap<>(CarriersUtils.getCarrierVehicleTypes(scenario).getVehicleTypes()); - //For the case that there are additional vehicle types found in the events. - for (VehicleType vehicleType : vehicleId2VehicleType.values()) { - vehicleTypesMap.putIfAbsent(vehicleType.getId(), vehicleType); - } - - String fileName = analysisOutputDirectory.resolve("TimeDistance_perVehicleType.tsv").toString(); - - BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); - //Write headline: - bw1.write("vehicleTypeId \t nuOfVehicles \t " + - "SumOfTourDuration[s] \t SumOfTourDuration[h] \t" + - "SumOfTravelDistances[m] \t SumOfTravelDistances[km] \t " + - "SumOfTravelTime[s] \t SumOfTravelTime[h] \t" + - "costPerSecond[EUR/s] \t costPerMeter[EUR/m] \t fixedCosts[EUR/veh] \t" + - "varCostsTime[EUR] \t varCostsDist[EUR] \t fixedCosts[EUR] \t totalCosts[EUR]"); - bw1.newLine(); - - for (VehicleType vehicleType : vehicleTypesMap.values()) { - long nuOfVehicles = vehicleId2VehicleType.values().stream().filter(vehType -> vehType.getId() == vehicleType.getId()).count(); - - final Double costRatePerSecond = vehicleType.getCostInformation().getCostsPerSecond(); - final Double costRatePerMeter = vehicleType.getCostInformation().getCostsPerMeter(); - final Double fixedCostPerVeh = vehicleType.getCostInformation().getFixedCosts(); - - final Double sumOfTourDurationInSeconds = vehicleTypeId2SumOfTourDuration.getOrDefault(vehicleType.getId(), 0.); - final Double sumOfDistanceInMeters = vehicleTypeId2Mileage.getOrDefault(vehicleType.getId(), 0.); - final Double sumOfTravelTimeInSeconds = vehicleTypeId2TravelTime.getOrDefault(vehicleType.getId(), 0.); - - final double sumOfVarCostsTime = sumOfTourDurationInSeconds * costRatePerSecond; - final double sumOfVarCostsDistance = sumOfDistanceInMeters * costRatePerMeter; - final double sumOfFixCosts = nuOfVehicles * fixedCostPerVeh; - - bw1.write(vehicleType.getId().toString()); - - bw1.write("\t" + nuOfVehicles); - bw1.write("\t" + sumOfTourDurationInSeconds); - bw1.write("\t" + sumOfTourDurationInSeconds / 3600); - bw1.write("\t" + sumOfDistanceInMeters); - bw1.write("\t" + sumOfDistanceInMeters / 1000); - bw1.write("\t" + sumOfTravelTimeInSeconds); - bw1.write("\t" + sumOfTravelTimeInSeconds / 3600); - bw1.write("\t" + costRatePerSecond); - bw1.write("\t" + costRatePerMeter); - bw1.write("\t" + fixedCostPerVeh); - bw1.write("\t" + sumOfVarCostsTime); - bw1.write("\t" + sumOfVarCostsDistance); - bw1.write("\t" + sumOfFixCosts); - bw1.write("\t" + (sumOfFixCosts + sumOfVarCostsTime + sumOfVarCostsDistance)); - - bw1.newLine(); - } - - bw1.close(); - log.info("Output written to {}", fileName); - } -} diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/Readme.md b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/Readme.md deleted file mode 100644 index 06ab8f35407..00000000000 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/Readme.md +++ /dev/null @@ -1,18 +0,0 @@ -**The package name (org.matsim.contrib.freight) was chosen on purpose.** -It should allow to move the stuff to the freight contrib later without breaking any code. - -This package contains some analysis stuff for freight outputs. -The content was created by Jakob Hanisch during the MATSim advanced class 2020/21. - -**It is untested and needs some kind of review --> be very careful when using it!** -(KMT, Sep 21) - -**Update April 2023 -> Event-based analysis (KMT)** -We do now have an (unfortunately!!!) untested new approach: -We now can base on freight events, that were introduce during the last year. -This avoids the _guessing_ of some information, like vehicleType or carrierId. - -This analysis is of course not perfect and can/should be extended (and then moved over to the freight contrib.) -Since I programmed it for the SimGV class, I believe it is a good option moving it to a more central place. - -I also deprecated the "old" guessing approach. \ No newline at end of file diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java deleted file mode 100644 index 7b6d72ce918..00000000000 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** - * - */ - -package org.matsim.freight.carriers.analysis; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.matsim.api.core.v01.Scenario; -import org.matsim.core.api.experimental.events.EventsManager; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.core.events.EventsUtils; -import org.matsim.core.events.MatsimEventsReader; -import org.matsim.core.scenario.ScenarioUtils; -import org.matsim.freight.carriers.Carrier; -import org.matsim.freight.carriers.CarriersUtils; -import org.matsim.freight.carriers.FreightCarriersConfigGroup; -import org.matsim.freight.carriers.events.CarrierEventsReaders; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; - -//import static org.matsim.application.ApplicationUtils.globFile; //TODO, this introduces a circular dependency. Resolve it - -/** - * A first approach for some analysis based on the freight events introduced in 2022/23. - * This class comes from teaching SimGV in the winter term 2022/23. - *

- * This class should get extended and prepared as a standardized analysis for freight output. - * This should also get aligned with the current development in Simwrapper. - * Todo: Add some tests. - * - * @author kturner (Kai Martins-Turner) - */ -public class RunFreightAnalysisEventBased { - - private static final Logger log = LogManager.getLogger(RunFreightAnalysisEventBased.class); - - //Where is your simulation output, that should be analysed? - private final Path SIM_OUTPUT_PATH; - private final Path EVENTS_PATH; - private final Path ANALYSIS_OUTPUT_PATH; - private final String GLOBAL_CRS; - - private final Scenario scenario; - - //Removed this temporarily, as the import of globFile() causes a circular dependency - /*/** - * This constructor automatically searches for the needed output file in a simulation run output. - * - * @param simOutputPath The output directory of the simulation run - * @param analysisOutputPath The directory where the result of the analysis should go to - * @param globalCrs The CRS of the simulation - */ - /*public RunFreightAnalysisEventBased(Path simOutputPath, Path analysisOutputPath, String globalCrs) { - this.SIM_OUTPUT_PATH = simOutputPath; - this.EVENTS_PATH = globFile(SIM_OUTPUT_PATH, "*output_events.*"); - this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; - this.GLOBAL_CRS = globalCrs; - - Config config = ConfigUtils.createConfig(); - config.vehicles().setVehiclesFile(globFile(SIM_OUTPUT_PATH, "*output_allVehicles.*").toString()); - config.network().setInputFile(globFile(SIM_OUTPUT_PATH, "*output_network.*").toString()); - //freight settings - FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); - freightCarriersConfigGroup.setCarriersFile(globFile(SIM_OUTPUT_PATH, "*output_carriers.*").toString()); - freightCarriersConfigGroup.setCarriersVehicleTypesFile(globFile(SIM_OUTPUT_PATH, "*output_carriersVehicleTypes.*").toString()); - - prepareConfig(config); - scenario = ScenarioUtils.loadScenario(config); - }*/ - - /** - * Alternative if you want to set the paths to the needed resources directly. - * - * @param analysisOutputPath The directory where the result of the analysis should go to - * @param globalCrs The CRS of the simulation - */ - public RunFreightAnalysisEventBased(Path networkPath, Path vehiclesPath, Path carriersPath, Path carriersVehicleTypesPath, Path eventsPath, Path analysisOutputPath, String globalCrs) { - this.SIM_OUTPUT_PATH = null; - this.EVENTS_PATH = eventsPath; - this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; - this.GLOBAL_CRS = globalCrs; - - Config config = ConfigUtils.createConfig(); - config.vehicles().setVehiclesFile(vehiclesPath.toString()); - config.network().setInputFile(networkPath.toString()); - //freight settings - FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); - freightCarriersConfigGroup.setCarriersFile(carriersPath.toString()); - freightCarriersConfigGroup.setCarriersVehicleTypesFile(carriersVehicleTypesPath.toString()); - - prepareConfig(config); - scenario = ScenarioUtils.loadScenario(config); - } - - private void prepareConfig(Config config) { - config.plans().setInputFile(null); - config.eventsManager().setNumberOfThreads(null); - config.eventsManager().setEstimatedNumberOfEvents(null); - config.global().setNumberOfThreads(1); - config.global().setCoordinateSystem(GLOBAL_CRS); - } - - public void runAnalysis() throws IOException { - //Where to store the analysis output? - File folder = new File(String.valueOf(ANALYSIS_OUTPUT_PATH)); - folder.mkdirs(); - - //load carriers according to freight config - CarriersUtils.loadCarriersAccordingToFreightConfig(scenario); - - - // CarrierPlanAnalysis - if (allCarriersHavePlans()) { - CarrierPlanAnalysis carrierPlanAnalysis = new CarrierPlanAnalysis(CarriersUtils.getCarriers(scenario)); - carrierPlanAnalysis.runAnalysisAndWriteStats(ANALYSIS_OUTPUT_PATH); - } - - // Prepare eventsManager - start of event based Analysis; - EventsManager eventsManager = EventsUtils.createEventsManager(); - - FreightTimeAndDistanceAnalysisEventsHandler freightTimeAndDistanceAnalysisEventsHandler = new FreightTimeAndDistanceAnalysisEventsHandler(scenario); - eventsManager.addHandler(freightTimeAndDistanceAnalysisEventsHandler); - - CarrierLoadAnalysis carrierLoadAnalysis = new CarrierLoadAnalysis(CarriersUtils.getCarriers(scenario)); - eventsManager.addHandler(carrierLoadAnalysis); - - eventsManager.initProcessing(); - MatsimEventsReader matsimEventsReader = CarrierEventsReaders.createEventsReader(eventsManager); - - matsimEventsReader.readFile(EVENTS_PATH.toString()); - eventsManager.finishProcessing(); - - log.info("Analysis completed."); - log.info("Writing output..."); - freightTimeAndDistanceAnalysisEventsHandler.writeTravelTimeAndDistancePerVehicle(ANALYSIS_OUTPUT_PATH, scenario); - freightTimeAndDistanceAnalysisEventsHandler.writeTravelTimeAndDistancePerVehicleType(ANALYSIS_OUTPUT_PATH, scenario); - carrierLoadAnalysis.writeLoadPerVehicle(ANALYSIS_OUTPUT_PATH, scenario); - } - - private boolean allCarriersHavePlans() { - for (Carrier carrier : CarriersUtils.getCarriers(scenario).getCarriers().values()) - if (carrier.getSelectedPlan() == null) return false; - - return true; - } -} diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java deleted file mode 100644 index e077d97f1fe..00000000000 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** - * - */ - -package org.matsim.freight.carriers.analysis; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.matsim.testcases.MatsimTestUtils; - -import java.io.IOException; -import java.nio.file.Path; - -public class FreightAnalysisEventBasedTest { - - @RegisterExtension - private MatsimTestUtils testUtils = new MatsimTestUtils(); - - @Test - void runServiceEventTest() throws IOException { - // Note: I had to manually change the files for this test to run, as I did not have access to the original input file of the events-file - // This results in the carrier-plans not being related to the actual events. This is however no problem for testing the core functionality, - // as those are two disjunct analysis outputs, which do not depend on each other. (aleks Sep'24) - - RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased( - Path.of(testUtils.getInputDirectory() + "in/grid9x9.xml"), - Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), - Path.of(testUtils.getInputDirectory() + "in/carrierWithServices.xml"), - Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), - Path.of(testUtils.getInputDirectory() + "in/serviceBasedEvents.xml"), - Path.of(testUtils.getOutputDirectory()), - null); - analysisEventBased.runAnalysis(); - - MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Carrier_stats.tsv", testUtils.getOutputDirectory() + "Carrier_stats.tsv"); - MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Load_perVehicle.tsv", testUtils.getOutputDirectory() + "Load_perVehicle.tsv"); - MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicle.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicle.tsv"); - MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicleType.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicleType.tsv"); - } - - @Test - void runShipmentEventTest() throws IOException { - RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased( - Path.of(testUtils.getInputDirectory() + "in/grid9x9.xml"), - Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), - Path.of(testUtils.getInputDirectory() + "in/carrierWithShipments.xml"), - Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), - Path.of(testUtils.getInputDirectory() + "in/shipmentBasedEvents.xml"), - Path.of(testUtils.getOutputDirectory()), - null); - analysisEventBased.runAnalysis(); - - MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Load_perVehicle.tsv", testUtils.getOutputDirectory() + "Load_perVehicle.tsv"); - MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicle.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicle.tsv"); - MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicleType.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicleType.tsv"); - } -} From 979dd02f21b07e3589fdc9cdcbca6c5ed391a09e Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 12:48:07 +0200 Subject: [PATCH 24/60] update simple tests --- .../FreightAnalysisEventBasedTest.java | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java index 985e912c4ff..2c37f03415b 100644 --- a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java +++ b/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java @@ -34,14 +34,41 @@ public class FreightAnalysisEventBasedTest { private MatsimTestUtils testUtils = new MatsimTestUtils(); @Test - void runFreightAnalysisEventBasedTest() throws IOException { + void runServiceEventTest() throws IOException { + // Note: I had to manually change the files for this test to run, as I did not have access to the original input file of the events-file + // This results in the carrier-plans not being related to the actual events. This is however no problem for testing the core functionality, + // as those are two disjunct analysis outputs, which do not depend on each other. (aleks Sep'24) - RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased(Path.of(testUtils.getClassInputDirectory()), Path.of(testUtils.getOutputDirectory()),null); - analysisEventBased.runAnalysis(); + RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased( + Path.of(testUtils.getInputDirectory() + "in/grid9x9.xml"), + Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), + Path.of(testUtils.getInputDirectory() + "in/carrierWithServices.xml"), + Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), + Path.of(testUtils.getInputDirectory() + "in/serviceBasedEvents.xml"), + Path.of(testUtils.getOutputDirectory()), + null); + analysisEventBased.runCompleteAnalysis(); MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Carrier_stats.tsv", testUtils.getOutputDirectory() + "Carrier_stats.tsv"); MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Load_perVehicle.tsv", testUtils.getOutputDirectory() + "Load_perVehicle.tsv"); MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicle.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicle.tsv"); MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicleType.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicleType.tsv"); } + + @Test + void runShipmentEventTest() throws IOException { + RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased( + Path.of(testUtils.getInputDirectory() + "in/grid9x9.xml"), + Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), + Path.of(testUtils.getInputDirectory() + "in/carrierWithShipments.xml"), + Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), + Path.of(testUtils.getInputDirectory() + "in/shipmentBasedEvents.xml"), + Path.of(testUtils.getOutputDirectory()), + null); + analysisEventBased.runCompleteAnalysis(); + + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Load_perVehicle.tsv", testUtils.getOutputDirectory() + "Load_perVehicle.tsv"); + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicle.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicle.tsv"); + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicleType.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicleType.tsv"); + } } From 7d1d2ccb7b90058446b60aa1d9484fe6760d0872 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 12:49:00 +0200 Subject: [PATCH 25/60] make class independent of application contrib --- .../RunFreightAnalysisEventBased.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java index 0d90d205030..79538664795 100644 --- a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java +++ b/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java @@ -40,7 +40,7 @@ import java.io.IOException; import java.nio.file.Path; -import static org.matsim.application.ApplicationUtils.globFile; +//import static org.matsim.application.ApplicationUtils.globFile; /** @@ -72,13 +72,19 @@ public class RunFreightAnalysisEventBased { * @param globalCrs The CRS of the simulation */ public RunFreightAnalysisEventBased(Path simOutputPath, Path analysisOutputPath, String globalCrs) { - this.EVENTS_PATH = globFile(simOutputPath, "*output_events.*"); - this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; - Path vehiclesPath = globFile(simOutputPath, "*output_allVehicles.*"); - Path networkPath = globFile(simOutputPath, "*output_network.*"); - Path carriersPath = globFile(simOutputPath, "*output_carriers.*"); - Path carriersVehicleTypesPath = globFile(simOutputPath, "*output_carriersVehicleTypes.*"); + this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; +// this.EVENTS_PATH = globFile(simOutputPath, "*output_events.*"); +// Path vehiclesPath = globFile(simOutputPath, "*output_allVehicles.*"); +// Path networkPath = globFile(simOutputPath, "*output_network.*"); +// Path carriersPath = globFile(simOutputPath, "*output_carriers.*"); +// Path carriersVehicleTypesPath = globFile(simOutputPath, "*output_carriersVehicleTypes.*"); + + this.EVENTS_PATH = simOutputPath.resolve("*output_events.xml.gz"); + Path vehiclesPath = simOutputPath.resolve("*output_allVehicles.xml.gz"); + Path networkPath = simOutputPath.resolve("*output_network.xml.gz"); + Path carriersPath = simOutputPath.resolve("*output_carriers.xml.gz"); + Path carriersVehicleTypesPath = simOutputPath.resolve("*output_carriersVehicleTypes.xml.gz"); createScenarioForFreightAnalysis(vehiclesPath, networkPath, carriersPath, carriersVehicleTypesPath, globalCrs); } From 3627d9d4f4f79f460ca1644b84ea55baf45fb155 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 12:57:14 +0200 Subject: [PATCH 26/60] move freight analysis into freight contrib --- contribs/freight/pom.xml | 6 +----- .../freight/carriers/analysis/CarrierLoadAnalysis.java | 0 .../freight/carriers/analysis/CarrierPlanAnalysis.java | 0 .../FreightTimeAndDistanceAnalysisEventsHandler.java | 0 .../carriers/analysis/RunFreightAnalysisEventBased.java | 0 .../carriers/analysis/FreightAnalysisEventBasedTest.java | 0 contribs/small-scale-traffic-generation/pom.xml | 6 ------ 7 files changed, 1 insertion(+), 11 deletions(-) rename contribs/{vsp => freight}/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java (100%) rename contribs/{vsp => freight}/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java (100%) rename contribs/{vsp => freight}/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java (100%) rename contribs/{vsp => freight}/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java (100%) rename contribs/{vsp => freight}/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java (100%) diff --git a/contribs/freight/pom.xml b/contribs/freight/pom.xml index 6008f29d367..d6dd0d20b65 100644 --- a/contribs/freight/pom.xml +++ b/contribs/freight/pom.xml @@ -64,11 +64,7 @@ 2025.0-SNAPSHOT - - org.matsim.contrib - vsp - 2025.0-SNAPSHOT - + diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java similarity index 100% rename from contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java similarity index 100% rename from contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java similarity index 100% rename from contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java diff --git a/contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java similarity index 100% rename from contribs/vsp/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java rename to contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java diff --git a/contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java similarity index 100% rename from contribs/vsp/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java rename to contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java diff --git a/contribs/small-scale-traffic-generation/pom.xml b/contribs/small-scale-traffic-generation/pom.xml index 98d11767cd0..46ea6a80936 100644 --- a/contribs/small-scale-traffic-generation/pom.xml +++ b/contribs/small-scale-traffic-generation/pom.xml @@ -24,12 +24,6 @@ 2025.0-SNAPSHOT - - org.matsim.contrib - vsp - 2025.0-SNAPSHOT - - From 8eb44a5457d321868613b3a931606eb3b8543943 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 13:15:22 +0200 Subject: [PATCH 27/60] add buffer try catch --- .../freight/carriers/analysis/CarrierPlanAnalysis.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java index 69844513999..404031dc5e3 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java @@ -59,7 +59,7 @@ public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOExce //Load per vehicle String fileName = analysisOutputDirectory.resolve("Carrier_stats.tsv").toString(); - BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); + try (BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName))) { //Write headline: bw1.write("carrierId \t MATSimScoreSelectedPlan \t jSpritScoreSelectedPlan \t nuOfTours \t nuOfShipments(input) \t nuOfShipments(handled) \t nuOfServices(input) \t nuOfServices(handled) \t nuOfPlanedDemandSize \t nuOfHandledDemandSize \t jspritComputationTime[HH:mm:ss]"); @@ -111,7 +111,11 @@ public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOExce bw1.newLine(); } - bw1.close(); - log.info("Output written to {}", fileName); + bw1.close(); + log.info("Output written to {}", fileName); + } catch (IOException e) { + log.error("Error writing output to file: {}", fileName); + throw e; + } } } From 8389cab64332441a64070c76cefb106f015a1944 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 13:15:44 +0200 Subject: [PATCH 28/60] add comments --- .../analysis/RunFreightAnalysisEventBased.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java index 79538664795..ca8fa9bbebf 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java @@ -92,10 +92,16 @@ public RunFreightAnalysisEventBased(Path simOutputPath, Path analysisOutputPath, /** * Alternative if you want to set the paths to the necessary resources directly. * - * @param analysisOutputPath The directory where the result of the analysis should go to - * @param globalCrs The CRS of the simulation + * @param networkPath Path to the network file + * @param vehiclesPath Path to the vehicle file + * @param carriersPath Path to the carriers file + * @param carriersVehicleTypesPath Path to the carriersVehicleTypes file + * @param eventsPath Path to the events file + * @param analysisOutputPath Path to the output directory + * @param globalCrs The CRS of the simulation */ - public RunFreightAnalysisEventBased(Path networkPath, Path vehiclesPath, Path carriersPath, Path carriersVehicleTypesPath, Path eventsPath, Path analysisOutputPath, String globalCrs) { + public RunFreightAnalysisEventBased(Path networkPath, Path vehiclesPath, Path carriersPath, Path carriersVehicleTypesPath, Path eventsPath, + Path analysisOutputPath, String globalCrs) { this.EVENTS_PATH = eventsPath; this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; From 6b4bb3d617fb90efe5e5f1058a7c9ba39db0d978 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 13:18:19 +0200 Subject: [PATCH 29/60] add number of not handled jobs --- .../analysis/CarrierPlanAnalysis.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java index 404031dc5e3..b3bf8b7d018 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java @@ -62,8 +62,20 @@ public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOExce try (BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName))) { //Write headline: - bw1.write("carrierId \t MATSimScoreSelectedPlan \t jSpritScoreSelectedPlan \t nuOfTours \t nuOfShipments(input) \t nuOfShipments(handled) \t nuOfServices(input) \t nuOfServices(handled) \t nuOfPlanedDemandSize \t nuOfHandledDemandSize \t jspritComputationTime[HH:mm:ss]"); - bw1.newLine(); + bw1.write(String.join("\t", + "carrierId", + "MATSimScoreSelectedPlan", + "jSpritScoreSelectedPlan", + "nuOfTours", + "nuOfShipments(input)", + "nuOfShipments(handled)", + "nuOfServices(input)", + "nuOfServices(handled)", + "noOfNotHandledJobs", + "nuOfPlanedDemandSize", + "nuOfHandledDemandSize", + "jspritComputationTime[HH:mm:ss]" + )); bw1.newLine(); final TreeMap, Carrier> sortedCarrierMap = new TreeMap<>(carriers.getCarriers()); @@ -76,12 +88,15 @@ public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOExce int nuOfServiceHandled = (int)carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.ServiceActivity).count()).sum(); int numberOfPlanedDemandSize; int numberOfHandledDemandSize; + int notHandledJobs; if (numberOfPlanedShipments > 0) { numberOfPlanedDemandSize = carrier.getShipments().values().stream().mapToInt(CarrierShipment::getSize).sum(); numberOfHandledDemandSize = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Pickup).mapToInt(te -> ( ((Tour.Pickup) te).getShipment().getSize())).sum()).sum(); + notHandledJobs = numberOfPlanedShipments - numberOfHandledPickups; } else { numberOfPlanedDemandSize = carrier.getServices().values().stream().mapToInt(CarrierService::getCapacityDemand).sum(); numberOfHandledDemandSize = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.ServiceActivity).mapToInt(te -> ((Tour.ServiceActivity) te).getService().getCapacityDemand()).sum()).sum(); + notHandledJobs = numberOfPlanedServices - nuOfServiceHandled; } if(numberOfPlanedServices != nuOfServiceHandled) { @@ -101,6 +116,7 @@ public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOExce bw1.write("\t" + numberOfHandledPickups); bw1.write("\t" + numberOfPlanedServices); bw1.write("\t" + nuOfServiceHandled); + bw1.write("\t" + notHandledJobs); bw1.write("\t" + numberOfPlanedDemandSize); bw1.write("\t" + numberOfHandledDemandSize); if (CarriersUtils.getJspritComputationTime(carrier) != Integer.MIN_VALUE) From 9fe1900d760cb9e5d6627b2db6491c7ec4b0167f Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 13:19:03 +0200 Subject: [PATCH 30/60] formatting --- .../analysis/CarrierPlanAnalysis.java | 116 ++++++++++-------- 1 file changed, 65 insertions(+), 51 deletions(-) diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java index b3bf8b7d018..002d99b0544 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java @@ -42,9 +42,10 @@ * - number of Services (input) * - number of shipments (input) * to a tsv-file. + * * @author Kai Martins-Turner (kturner) */ -public class CarrierPlanAnalysis { +public class CarrierPlanAnalysis { private static final Logger log = LogManager.getLogger(CarrierPlanAnalysis.class); @@ -53,6 +54,7 @@ public class CarrierPlanAnalysis { public CarrierPlanAnalysis(Carriers carriers) { this.carriers = carriers; } + //TODO add added parameters to comment at the top public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOException { log.info("Writing out carrier analysis ..."); @@ -61,7 +63,7 @@ public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOExce try (BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName))) { - //Write headline: + //Write headline: bw1.write(String.join("\t", "carrierId", "MATSimScoreSelectedPlan", @@ -75,57 +77,69 @@ public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOExce "nuOfPlanedDemandSize", "nuOfHandledDemandSize", "jspritComputationTime[HH:mm:ss]" - )); bw1.newLine(); - - final TreeMap, Carrier> sortedCarrierMap = new TreeMap<>(carriers.getCarriers()); - - for (Carrier carrier : sortedCarrierMap.values()) { - - int numberOfPlanedShipments = carrier.getShipments().size(); - int numberOfPlanedServices = carrier.getServices().size(); - int numberOfHandledPickups = (int)carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Pickup).count()).sum(); - int numberOfHandledDeliveries = (int)carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Delivery).count()).sum(); - int nuOfServiceHandled = (int)carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.ServiceActivity).count()).sum(); - int numberOfPlanedDemandSize; - int numberOfHandledDemandSize; - int notHandledJobs; - if (numberOfPlanedShipments > 0) { - numberOfPlanedDemandSize = carrier.getShipments().values().stream().mapToInt(CarrierShipment::getSize).sum(); - numberOfHandledDemandSize = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Pickup).mapToInt(te -> ( ((Tour.Pickup) te).getShipment().getSize())).sum()).sum(); - notHandledJobs = numberOfPlanedShipments - numberOfHandledPickups; - } else { - numberOfPlanedDemandSize = carrier.getServices().values().stream().mapToInt(CarrierService::getCapacityDemand).sum(); - numberOfHandledDemandSize = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt(t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.ServiceActivity).mapToInt(te -> ((Tour.ServiceActivity) te).getService().getCapacityDemand()).sum()).sum(); - notHandledJobs = numberOfPlanedServices - nuOfServiceHandled; - } + )); + bw1.newLine(); - if(numberOfPlanedServices != nuOfServiceHandled) { - log.warn("Number of services in input and handled are not equal for carrier {}. Jobs Input: {}, Jobs Handled: {}", carrier.getId(), numberOfPlanedServices, nuOfServiceHandled); - } - if (numberOfPlanedShipments != numberOfHandledPickups) { - log.warn("Number of shipments in input and handled are not equal for carrier {}. Jobs Input: {}, Jobs Handled: {}", carrier.getId(), numberOfPlanedShipments, numberOfHandledPickups); - } - if (numberOfHandledDeliveries != numberOfHandledPickups) { - log.warn("Number of handled pickups and deliveries are not equal for carrier {}. Pickups: {}, Deliveries: {}. This should not happen!!", carrier.getId(), numberOfHandledPickups, numberOfHandledDeliveries); - } - bw1.write(carrier.getId().toString()); - bw1.write("\t" + carrier.getSelectedPlan().getScore()); - bw1.write("\t" + carrier.getSelectedPlan().getJspritScore()); - bw1.write("\t" + carrier.getSelectedPlan().getScheduledTours().size()); - bw1.write("\t" + numberOfPlanedShipments); - bw1.write("\t" + numberOfHandledPickups); - bw1.write("\t" + numberOfPlanedServices); - bw1.write("\t" + nuOfServiceHandled); - bw1.write("\t" + notHandledJobs); - bw1.write("\t" + numberOfPlanedDemandSize); - bw1.write("\t" + numberOfHandledDemandSize); - if (CarriersUtils.getJspritComputationTime(carrier) != Integer.MIN_VALUE) - bw1.write("\t" + Time.writeTime(CarriersUtils.getJspritComputationTime(carrier), Time.TIMEFORMAT_HHMMSS)); - else - bw1.write("\t" + "null"); + final TreeMap, Carrier> sortedCarrierMap = new TreeMap<>(carriers.getCarriers()); - bw1.newLine(); - } + for (Carrier carrier : sortedCarrierMap.values()) { + + int numberOfPlanedShipments = carrier.getShipments().size(); + int numberOfPlanedServices = carrier.getServices().size(); + int numberOfHandledPickups = (int) carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble( + t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Pickup).count()).sum(); + int numberOfHandledDeliveries = (int) carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble( + t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Delivery).count()).sum(); + int nuOfServiceHandled = (int) carrier.getSelectedPlan().getScheduledTours().stream().mapToDouble( + t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.ServiceActivity).count()).sum(); + int numberOfPlanedDemandSize; + int numberOfHandledDemandSize; + int notHandledJobs; + if (numberOfPlanedShipments > 0) { + numberOfPlanedDemandSize = carrier.getShipments().values().stream().mapToInt(CarrierShipment::getSize).sum(); + numberOfHandledDemandSize = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt( + t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.Pickup).mapToInt( + te -> (((Tour.Pickup) te).getShipment().getSize())).sum()).sum(); + notHandledJobs = numberOfPlanedShipments - numberOfHandledPickups; + } else { + numberOfPlanedDemandSize = carrier.getServices().values().stream().mapToInt(CarrierService::getCapacityDemand).sum(); + numberOfHandledDemandSize = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt( + t -> t.getTour().getTourElements().stream().filter(te -> te instanceof Tour.ServiceActivity).mapToInt( + te -> ((Tour.ServiceActivity) te).getService().getCapacityDemand()).sum()).sum(); + notHandledJobs = numberOfPlanedServices - nuOfServiceHandled; + } + + if (numberOfPlanedServices != nuOfServiceHandled) { + log.warn("Number of services in input and handled are not equal for carrier {}. Jobs Input: {}, Jobs Handled: {}", + carrier.getId(), numberOfPlanedServices, nuOfServiceHandled); + } + if (numberOfPlanedShipments != numberOfHandledPickups) { + log.warn("Number of shipments in input and handled are not equal for carrier {}. Jobs Input: {}, Jobs Handled: {}", + carrier.getId(), numberOfPlanedShipments, numberOfHandledPickups); + } + if (numberOfHandledDeliveries != numberOfHandledPickups) { + log.warn( + "Number of handled pickups and deliveries are not equal for carrier {}. Pickups: {}, Deliveries: {}. This should not happen!!", + carrier.getId(), numberOfHandledPickups, numberOfHandledDeliveries); + } + bw1.write(carrier.getId().toString()); + bw1.write("\t" + carrier.getSelectedPlan().getScore()); + bw1.write("\t" + carrier.getSelectedPlan().getJspritScore()); + bw1.write("\t" + carrier.getSelectedPlan().getScheduledTours().size()); + bw1.write("\t" + numberOfPlanedShipments); + bw1.write("\t" + numberOfHandledPickups); + bw1.write("\t" + numberOfPlanedServices); + bw1.write("\t" + nuOfServiceHandled); + bw1.write("\t" + notHandledJobs); + bw1.write("\t" + numberOfPlanedDemandSize); + bw1.write("\t" + numberOfHandledDemandSize); + if (CarriersUtils.getJspritComputationTime(carrier) != Integer.MIN_VALUE) + bw1.write("\t" + Time.writeTime(CarriersUtils.getJspritComputationTime(carrier), Time.TIMEFORMAT_HHMMSS)); + else + bw1.write("\t" + "null"); + + bw1.newLine(); + } bw1.close(); log.info("Output written to {}", fileName); From 0bcef4ed04fbdabf477490a069583f104d09c1a8 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 13:20:46 +0200 Subject: [PATCH 31/60] use the current analysis version --- .../GenerateSmallScaleCommercialTrafficDemand.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 278a481508f..ab066250bee 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -313,8 +313,9 @@ public Integer call() throws Exception { //Analysis System.out.println("Starting Analysis for Carriers of small scale commercial traffic."); - RunFreightAnalysisEventBased freightAnalysis = new RunFreightAnalysisEventBased(output, output.resolve("Carrier_Analysis"), controler.getConfig().global().getCoordinateSystem()); - freightAnalysis.runAnalysis(); + //TODO perhaps change to complete carrier analysis + RunFreightAnalysisEventBased freightAnalysis = new RunFreightAnalysisEventBased(CarriersUtils.addOrGetCarriers(scenario), output.resolve("CarrierAnalysis")); + freightAnalysis.runCarriersAnalysis(); System.out.println("Finishing Analysis of Carrier."); SmallScaleCommercialTrafficUtils.createPlansBasedOnCarrierPlans(controler.getScenario(), From 37c8d5a1b13811ad2f8f2107f5c8f847328e97a2 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 13:30:29 +0200 Subject: [PATCH 32/60] use delimiter and add comment --- .../analysis/CarrierPlanAnalysis.java | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java index 002d99b0544..330479fed61 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java @@ -40,14 +40,20 @@ * - score of the selected plan * - number of tours (= vehicles) of the selected plan * - number of Services (input) + * - number of Services (handled) * - number of shipments (input) + * - number of shipments (handled) + * - number of not handled jobs + * - number of planned demand size + * - number of handled demand size * to a tsv-file. * - * @author Kai Martins-Turner (kturner) + * @author Kai Martins-Turner (kturner), Ricardo Ewert */ public class CarrierPlanAnalysis { private static final Logger log = LogManager.getLogger(CarrierPlanAnalysis.class); + public static final String delimiter = "\t"; Carriers carriers; @@ -55,7 +61,6 @@ public CarrierPlanAnalysis(Carriers carriers) { this.carriers = carriers; } - //TODO add added parameters to comment at the top public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOException { log.info("Writing out carrier analysis ..."); //Load per vehicle @@ -64,7 +69,7 @@ public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOExce try (BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName))) { //Write headline: - bw1.write(String.join("\t", + bw1.write(String.join(delimiter, "carrierId", "MATSimScoreSelectedPlan", "jSpritScoreSelectedPlan", @@ -123,20 +128,20 @@ public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOExce carrier.getId(), numberOfHandledPickups, numberOfHandledDeliveries); } bw1.write(carrier.getId().toString()); - bw1.write("\t" + carrier.getSelectedPlan().getScore()); - bw1.write("\t" + carrier.getSelectedPlan().getJspritScore()); - bw1.write("\t" + carrier.getSelectedPlan().getScheduledTours().size()); - bw1.write("\t" + numberOfPlanedShipments); - bw1.write("\t" + numberOfHandledPickups); - bw1.write("\t" + numberOfPlanedServices); - bw1.write("\t" + nuOfServiceHandled); - bw1.write("\t" + notHandledJobs); - bw1.write("\t" + numberOfPlanedDemandSize); - bw1.write("\t" + numberOfHandledDemandSize); + bw1.write(delimiter + carrier.getSelectedPlan().getScore()); + bw1.write(delimiter + carrier.getSelectedPlan().getJspritScore()); + bw1.write(delimiter + carrier.getSelectedPlan().getScheduledTours().size()); + bw1.write(delimiter + numberOfPlanedShipments); + bw1.write(delimiter + numberOfHandledPickups); + bw1.write(delimiter + numberOfPlanedServices); + bw1.write(delimiter + nuOfServiceHandled); + bw1.write(delimiter + notHandledJobs); + bw1.write(delimiter + numberOfPlanedDemandSize); + bw1.write(delimiter + numberOfHandledDemandSize); if (CarriersUtils.getJspritComputationTime(carrier) != Integer.MIN_VALUE) - bw1.write("\t" + Time.writeTime(CarriersUtils.getJspritComputationTime(carrier), Time.TIMEFORMAT_HHMMSS)); + bw1.write(delimiter + Time.writeTime(CarriersUtils.getJspritComputationTime(carrier), Time.TIMEFORMAT_HHMMSS)); else - bw1.write("\t" + "null"); + bw1.write(delimiter + "null"); bw1.newLine(); } From 75b5a9b042d9b7ee5eaa6aa50aa0dfa8b35efa8e Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 13:35:03 +0200 Subject: [PATCH 33/60] update file for new carrier analysis --- .../runServiceEventTest/Carrier_stats.tsv | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Carrier_stats.tsv diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Carrier_stats.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Carrier_stats.tsv deleted file mode 100644 index 927953924fe..00000000000 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Carrier_stats.tsv +++ /dev/null @@ -1,2 +0,0 @@ -carrierId MATSimScoreSelectedPlan jSpritScoreSelectedPlan nuOfTours nuOfShipments(input) nuOfShipments(handled) nuOfServices(input) nuOfServices(handled) nuOfPlanedDemandSize nuOfHandledDemandSize jspritComputationTime[HH:mm:ss] -carrier1 -210.81333333333333 null 1 0 0 7 7 7 7 null From a6ec1507c55f2316d432750da8c0e024d62dccc2 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 13:41:05 +0200 Subject: [PATCH 34/60] update file for new carrier analysis --- .../runServiceEventTest/Carrier_stats.tsv | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Carrier_stats.tsv diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Carrier_stats.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Carrier_stats.tsv new file mode 100644 index 00000000000..8a1b8ff7b0e --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Carrier_stats.tsv @@ -0,0 +1,2 @@ +carrierId MATSimScoreSelectedPlan jSpritScoreSelectedPlan nuOfTours nuOfShipments(input) nuOfShipments(handled) nuOfServices(input) nuOfServices(handled) noOfNotHandledJobs nuOfPlanedDemandSize nuOfHandledDemandSize jspritComputationTime[HH:mm:ss] +carrier1 -210.81333333333333 null 1 0 0 7 7 0 7 7 null From 555578238fc9e2f83b1c82e53f42b631b82b790a Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 19 Sep 2024 14:05:23 +0200 Subject: [PATCH 35/60] use configurable delimiter for all classes --- .../analysis/CarrierLoadAnalysis.java | 16 ++- .../analysis/CarrierPlanAnalysis.java | 5 +- ...tTimeAndDistanceAnalysisEventsHandler.java | 106 +++++++++++------- .../RunFreightAnalysisEventBased.java | 7 +- .../runServiceEventTest/Load_perVehicle.tsv | 2 +- .../TimeDistance_perVehicle.tsv | 2 +- .../TimeDistance_perVehicleType.tsv | 2 +- .../runShipmentEventTest/Load_perVehicle.tsv | 2 +- .../TimeDistance_perVehicle.tsv | 2 +- .../TimeDistance_perVehicleType.tsv | 2 +- 10 files changed, 88 insertions(+), 58 deletions(-) diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java index 376f931df4c..8e2951d043e 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java @@ -51,12 +51,13 @@ public class CarrierLoadAnalysis implements CarrierShipmentPickupStartEventHandler, CarrierShipmentDeliveryStartEventHandler { private static final Logger log = LogManager.getLogger(CarrierLoadAnalysis.class); - + private final String delimiter; Carriers carriers; private final Map, LinkedList> vehicle2Load = new LinkedHashMap<>(); - public CarrierLoadAnalysis(Carriers carriers) { + public CarrierLoadAnalysis(String delimiter, Carriers carriers) { + this.delimiter = delimiter; this.carriers = carriers; } @@ -94,7 +95,10 @@ void writeLoadPerVehicle(Path analysisOutputDirectory, Scenario scenario) throws BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); //Write headline: - bw1.write("vehicleId \t capacity \t maxLoad \t load state during tour"); + bw1.write(String.join(delimiter,"vehicleId", + "capacity", + "maxLoad", + "load state during tour")); bw1.newLine(); for (Id vehicleId : vehicle2Load.keySet()) { @@ -106,9 +110,9 @@ void writeLoadPerVehicle(Path analysisOutputDirectory, Scenario scenario) throws final Double capacity = vehicleType.getCapacity().getOther(); bw1.write(vehicleId.toString()); - bw1.write("\t" + capacity); - bw1.write("\t" + maxLoad); - bw1.write("\t" + load); + bw1.write(delimiter + capacity); + bw1.write(delimiter + maxLoad); + bw1.write(delimiter + load); bw1.newLine(); } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java index 330479fed61..08b7c054790 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java @@ -53,11 +53,12 @@ public class CarrierPlanAnalysis { private static final Logger log = LogManager.getLogger(CarrierPlanAnalysis.class); - public static final String delimiter = "\t"; + public final String delimiter; Carriers carriers; - public CarrierPlanAnalysis(Carriers carriers) { + public CarrierPlanAnalysis(String delimiter, Carriers carriers) { + this.delimiter = delimiter; this.carriers = carriers; } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java index 2cc4e8473f7..a1682e6d8a3 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java @@ -64,6 +64,7 @@ public class FreightTimeAndDistanceAnalysisEventsHandler implements VehicleLeavesTrafficEventHandler { private final static Logger log = LogManager.getLogger(FreightTimeAndDistanceAnalysisEventsHandler.class); + private final String delimiter; private final Scenario scenario; private final Map, Double> vehicleId2TourDuration = new LinkedHashMap<>(); @@ -85,7 +86,8 @@ public class FreightTimeAndDistanceAnalysisEventsHandler implements private final Map, Double> vehicleEnteredLinkTime = new LinkedHashMap<>(); - public FreightTimeAndDistanceAnalysisEventsHandler(Scenario scenario) { + public FreightTimeAndDistanceAnalysisEventsHandler(String delimiter, Scenario scenario) { + this.delimiter = delimiter; this.scenario = scenario; } @@ -165,11 +167,23 @@ void writeTravelTimeAndDistancePerVehicle(Path analysisOutputDirectory, Scenario BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); //Write headline: - bw1.write("vehicleId \t carrierId \t vehicleTypeId \t tourId \t " - + "tourDuration[s] \t tourDuration[h] \t" - + "travelDistance[m] \t travelDistance[km] \t " + - "travelTime[s] \t travelTime[h] \t" + - "costPerSecond[EUR/s] \t costPerMeter[EUR/m] \t fixedCosts[EUR] \t varCostsTime[EUR] \t varCostsDist[EUR] \t totalCosts[EUR]"); + bw1.write(String.join(delimiter, + "vehicleId", + "carrierId", + "vehicleTypeId", + "tourId", + "tourDuration[s]", + "tourDuration[h]", + "travelDistance[m]", + "travelDistance[km]", + "travelTime[s]", + "travelTime[h]", + "costPerSecond[EUR/s]", + "costPerMeter[EUR/m]", + "fixedCosts[EUR]", + "varCostsTime[EUR]", + "varCostsDist[EUR]", + "totalCosts[EUR]")); bw1.newLine(); for (Id vehicleId : vehicleId2VehicleType.keySet()) { @@ -189,25 +203,25 @@ void writeTravelTimeAndDistancePerVehicle(Path analysisOutputDirectory, Scenario final double totalVehCosts = fixedCost + varCostsTime + varCostsDist; bw1.write(vehicleId.toString()); - bw1.write("\t" + vehicleId2CarrierId.get(vehicleId)); - bw1.write("\t" + vehicleType.getId().toString()); - bw1.write("\t" + vehicleId2TourId.get(vehicleId)); + bw1.write(delimiter + vehicleId2CarrierId.get(vehicleId)); + bw1.write(delimiter + vehicleType.getId().toString()); + bw1.write(delimiter + vehicleId2TourId.get(vehicleId)); - bw1.write("\t" + durationInSeconds); - bw1.write("\t" + durationInSeconds /3600); + bw1.write(delimiter + durationInSeconds); + bw1.write(delimiter + durationInSeconds /3600); - bw1.write("\t" + distanceInMeters); - bw1.write("\t" + distanceInMeters/1000); + bw1.write(delimiter + distanceInMeters); + bw1.write(delimiter + distanceInMeters/1000); - bw1.write("\t" + travelTimeInSeconds); - bw1.write("\t" + travelTimeInSeconds /3600); + bw1.write(delimiter + travelTimeInSeconds); + bw1.write(delimiter + travelTimeInSeconds /3600); - bw1.write("\t" + costsPerSecond); - bw1.write("\t" + costsPerMeter); - bw1.write("\t" + fixedCost); - bw1.write("\t" + varCostsTime); - bw1.write("\t" + varCostsDist); - bw1.write("\t" + totalVehCosts); + bw1.write(delimiter + costsPerSecond); + bw1.write(delimiter + costsPerMeter); + bw1.write(delimiter + fixedCost); + bw1.write(delimiter + varCostsTime); + bw1.write(delimiter + varCostsDist); + bw1.write(delimiter + totalVehCosts); bw1.newLine(); } @@ -230,12 +244,22 @@ void writeTravelTimeAndDistancePerVehicleType(Path analysisOutputDirectory, Scen BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); //Write headline: - bw1.write("vehicleTypeId \t nuOfVehicles \t " + - "SumOfTourDuration[s] \t SumOfTourDuration[h] \t" + - "SumOfTravelDistances[m] \t SumOfTravelDistances[km] \t " + - "SumOfTravelTime[s] \t SumOfTravelTime[h] \t" + - "costPerSecond[EUR/s] \t costPerMeter[EUR/m] \t fixedCosts[EUR/veh] \t" + - "varCostsTime[EUR] \t varCostsDist[EUR] \t fixedCosts[EUR] \t totalCosts[EUR]"); + bw1.write(String.join(delimiter, + "vehicleTypeId", + "nuOfVehicles", + "SumOfTourDuration[s]", + "SumOfTourDuration[h]", + "SumOfTravelDistances[m]", + "SumOfTravelDistances[km]", + "SumOfTravelTime[s]", + "SumOfTravelTime[h]", + "costPerSecond[EUR/s]", + "costPerMeter[EUR/m]", + "fixedCosts[EUR/veh]", + "varCostsTime[EUR]", + "varCostsDist[EUR]", + "fixedCosts[EUR]", + "totalCosts[EUR]")); bw1.newLine(); for (VehicleType vehicleType : vehicleTypesMap.values()) { @@ -255,20 +279,20 @@ void writeTravelTimeAndDistancePerVehicleType(Path analysisOutputDirectory, Scen bw1.write(vehicleType.getId().toString()); - bw1.write("\t" + nuOfVehicles); - bw1.write("\t" + sumOfTourDurationInSeconds); - bw1.write("\t" + sumOfTourDurationInSeconds / 3600); - bw1.write("\t" + sumOfDistanceInMeters); - bw1.write("\t" + sumOfDistanceInMeters / 1000); - bw1.write("\t" + sumOfTravelTimeInSeconds); - bw1.write("\t" + sumOfTravelTimeInSeconds / 3600); - bw1.write("\t" + costRatePerSecond); - bw1.write("\t" + costRatePerMeter); - bw1.write("\t" + fixedCostPerVeh); - bw1.write("\t" + sumOfVarCostsTime); - bw1.write("\t" + sumOfVarCostsDistance); - bw1.write("\t" + sumOfFixCosts); - bw1.write("\t" + (sumOfFixCosts + sumOfVarCostsTime + sumOfVarCostsDistance)); + bw1.write(delimiter + nuOfVehicles); + bw1.write(delimiter + sumOfTourDurationInSeconds); + bw1.write(delimiter + sumOfTourDurationInSeconds / 3600); + bw1.write(delimiter + sumOfDistanceInMeters); + bw1.write(delimiter + sumOfDistanceInMeters / 1000); + bw1.write(delimiter + sumOfTravelTimeInSeconds); + bw1.write(delimiter + sumOfTravelTimeInSeconds / 3600); + bw1.write(delimiter + costRatePerSecond); + bw1.write(delimiter + costRatePerMeter); + bw1.write(delimiter + fixedCostPerVeh); + bw1.write(delimiter + sumOfVarCostsTime); + bw1.write(delimiter + sumOfVarCostsDistance); + bw1.write(delimiter + sumOfFixCosts); + bw1.write(delimiter + (sumOfFixCosts + sumOfVarCostsTime + sumOfVarCostsDistance)); bw1.newLine(); } diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java index ca8fa9bbebf..3848b8a1ef6 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java @@ -62,6 +62,7 @@ public class RunFreightAnalysisEventBased { private final Path ANALYSIS_OUTPUT_PATH; private Scenario scenario = null; private Carriers carriers = null; + private final String delimiter = "\t"; //TODO discuss renaming without EventBased. If this becomes the standard carrier output /** @@ -148,7 +149,7 @@ public void runCarriersAnalysis() throws IOException { File folder = new File(String.valueOf(ANALYSIS_OUTPUT_PATH)); folder.mkdirs(); if (allCarriersHavePlans(carriers)) { - CarrierPlanAnalysis carrierPlanAnalysis = new CarrierPlanAnalysis(carriers); + CarrierPlanAnalysis carrierPlanAnalysis = new CarrierPlanAnalysis(delimiter, carriers); carrierPlanAnalysis.runAnalysisAndWriteStats(ANALYSIS_OUTPUT_PATH); } else { @@ -161,10 +162,10 @@ public void runCompleteAnalysis() throws IOException { // Prepare eventsManager - start of event based Analysis; EventsManager eventsManager = EventsUtils.createEventsManager(); - FreightTimeAndDistanceAnalysisEventsHandler freightTimeAndDistanceAnalysisEventsHandler = new FreightTimeAndDistanceAnalysisEventsHandler(scenario); + FreightTimeAndDistanceAnalysisEventsHandler freightTimeAndDistanceAnalysisEventsHandler = new FreightTimeAndDistanceAnalysisEventsHandler(delimiter, scenario); eventsManager.addHandler(freightTimeAndDistanceAnalysisEventsHandler); - CarrierLoadAnalysis carrierLoadAnalysis = new CarrierLoadAnalysis(CarriersUtils.getCarriers(scenario)); + CarrierLoadAnalysis carrierLoadAnalysis = new CarrierLoadAnalysis(delimiter, CarriersUtils.getCarriers(scenario)); eventsManager.addHandler(carrierLoadAnalysis); eventsManager.initProcessing(); diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Load_perVehicle.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Load_perVehicle.tsv index 8cff896d44c..67fb0e5f002 100644 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Load_perVehicle.tsv +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/Load_perVehicle.tsv @@ -1 +1 @@ -vehicleId capacity maxLoad load state during tour +vehicleId capacity maxLoad load state during tour diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicle.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicle.tsv index 579bbbee4c9..745925b9ec9 100644 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicle.tsv +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicle.tsv @@ -1,3 +1,3 @@ -vehicleId carrierId vehicleTypeId tourId tourDuration[s] tourDuration[h] travelDistance[m] travelDistance[km] travelTime[s] travelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR] varCostsTime[EUR] varCostsDist[EUR] totalCosts[EUR] +vehicleId carrierId vehicleTypeId tourId tourDuration[s] tourDuration[h] travelDistance[m] travelDistance[km] travelTime[s] travelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR] varCostsTime[EUR] varCostsDist[EUR] totalCosts[EUR] freight_carrier1_veh_carrier_19_lightVehicle_1 carrier1 light 1 6689.0 1.8580555555555556 36000.0 36.0 4824.0 1.34 0.008 4.7E-4 84.0 53.512 16.919999999999998 154.432 freight_carrier1_veh_carrier_19_lightVehicle_2 carrier1 light 2 3818.0 1.0605555555555555 24000.0 24.0 3216.0 0.8933333333333333 0.008 4.7E-4 84.0 30.544 11.28 125.824 diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicleType.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicleType.tsv index c6630cdb4d6..59136c389ff 100644 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicleType.tsv +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicleType.tsv @@ -1,2 +1,2 @@ -vehicleTypeId nuOfVehicles SumOfTourDuration[s] SumOfTourDuration[h] SumOfTravelDistances[m] SumOfTravelDistances[km] SumOfTravelTime[s] SumOfTravelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR/veh] varCostsTime[EUR] varCostsDist[EUR] fixedCosts[EUR] totalCosts[EUR] +vehicleTypeId nuOfVehicles SumOfTourDuration[s] SumOfTourDuration[h] SumOfTravelDistances[m] SumOfTravelDistances[km] SumOfTravelTime[s] SumOfTravelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR/veh] varCostsTime[EUR] varCostsDist[EUR] fixedCosts[EUR] totalCosts[EUR] light 2 10507.0 2.9186111111111113 60000.0 60.0 8040.0 2.2333333333333334 0.008 4.7E-4 84.0 84.056 28.2 168.0 280.256 diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Load_perVehicle.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Load_perVehicle.tsv index dca7a388d99..d1e9be97b45 100644 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Load_perVehicle.tsv +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Load_perVehicle.tsv @@ -1,2 +1,2 @@ -vehicleId capacity maxLoad load state during tour +vehicleId capacity maxLoad load state during tour freight_carrier1_veh_heavyVehicle_1 Infinity 26 [3, 8, 18, 25, 26, 23, 13, 12, 7, 0] diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicle.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicle.tsv index 8389fdb09dc..ba995b84f2f 100644 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicle.tsv +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicle.tsv @@ -1,2 +1,2 @@ -vehicleId carrierId vehicleTypeId tourId tourDuration[s] tourDuration[h] travelDistance[m] travelDistance[km] travelTime[s] travelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR] varCostsTime[EUR] varCostsDist[EUR] totalCosts[EUR] +vehicleId carrierId vehicleTypeId tourId tourDuration[s] tourDuration[h] travelDistance[m] travelDistance[km] travelTime[s] travelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR] varCostsTime[EUR] varCostsDist[EUR] totalCosts[EUR] freight_carrier1_veh_heavyVehicle_1 carrier1 heavy 1 6870.0 1.9083333333333334 40000.0 40.0 5360.0 1.488888888888889 0.016 5.7E-4 200.0 109.92 22.8 332.72 diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicleType.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicleType.tsv index 54e31d3a5d0..e7d74050a7a 100644 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicleType.tsv +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicleType.tsv @@ -1,2 +1,2 @@ -vehicleTypeId nuOfVehicles SumOfTourDuration[s] SumOfTourDuration[h] SumOfTravelDistances[m] SumOfTravelDistances[km] SumOfTravelTime[s] SumOfTravelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR/veh] varCostsTime[EUR] varCostsDist[EUR] fixedCosts[EUR] totalCosts[EUR] +vehicleTypeId nuOfVehicles SumOfTourDuration[s] SumOfTourDuration[h] SumOfTravelDistances[m] SumOfTravelDistances[km] SumOfTravelTime[s] SumOfTravelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR/veh] varCostsTime[EUR] varCostsDist[EUR] fixedCosts[EUR] totalCosts[EUR] heavy 1 6870.0 1.9083333333333334 40000.0 40.0 5360.0 1.488888888888889 0.016 5.7E-4 200.0 109.92 22.8 200.0 332.72 From 41dfb99d70c07708cba4e815eda22fbc72e9fce0 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Mon, 23 Sep 2024 09:22:58 +0200 Subject: [PATCH 36/60] formatting --- ...rateSmallScaleCommercialTrafficDemand.java | 39 +++++++------------ 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index ab066250bee..a62b91c4fed 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -844,14 +844,8 @@ public void createCarriers(Scenario scenario, /** * Creates the services for one carrier. */ - private void createServices(Scenario scenario, - ArrayList noPossibleLinks, - String selectedStopCategory, - String carrierName, - int numberOfJobs, - String[] serviceArea, - Integer serviceTimePerStop, - TimeWindow serviceTimeWindow, + private void createServices(Scenario scenario, ArrayList noPossibleLinks, String selectedStopCategory, String carrierName, + int numberOfJobs, String[] serviceArea, Integer serviceTimePerStop, TimeWindow serviceTimeWindow, Map, Link>> linksPerZone) { String stopZone = serviceArea[0]; @@ -871,17 +865,10 @@ private void createServices(Scenario scenario, /** * Creates the carrier and the related vehicles. */ - private void createNewCarrierAndAddVehicleTypes(Scenario scenario, - Integer purpose, - String startZone, - String selectedStartCategory, - String carrierName, - List vehicleTypes, - int numberOfDepots, - CarrierCapabilities.FleetSize fleetSize, - int fixedNumberOfVehiclePerTypeAndLocation, - List vehicleDepots, - Map, Link>> linksPerZone, + private void createNewCarrierAndAddVehicleTypes(Scenario scenario, Integer purpose, String startZone, String selectedStartCategory, + String carrierName, List vehicleTypes, int numberOfDepots, + CarrierCapabilities.FleetSize fleetSize, int fixedNumberOfVehiclePerTypeAndLocation, + List vehicleDepots, Map, Link>> linksPerZone, String smallScaleCommercialTrafficType, EnumeratedDistribution tourStartTimeSelector) { @@ -962,14 +949,16 @@ private int getVehicleStartTime(TourStartAndDuration t) { * @param modeORvehType the mode or vehicle type * @return the service duration */ - private Integer getServiceTimePerStop(Map> serviceDurationTimeSelector, - String employeeCategory, - String modeORvehType, - String smallScaleCommercialTrafficType) { + private Integer getServiceTimePerStop( + Map> serviceDurationTimeSelector, + String employeeCategory, String modeORvehType, String smallScaleCommercialTrafficType, double maxVehicleAvailability) { + GenerateSmallScaleCommercialTrafficDemand.StopDurationGoodTrafficKey key = null; - if (smallScaleCommercialTrafficType.equals(GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString())) + if (smallScaleCommercialTrafficType.equals( + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString())) key = GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey(employeeCategory, null); - else if (smallScaleCommercialTrafficType.equals(GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString())) { + else if (smallScaleCommercialTrafficType.equals( + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString())) { key = GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey(employeeCategory, modeORvehType); } GenerateSmallScaleCommercialTrafficDemand.DurationsBounds serviceDurationBounds = serviceDurationTimeSelector.get(key).sample(); From 2c804c90080e422f1156f9694d90e5c18f626ec3 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Tue, 24 Sep 2024 10:22:03 +0200 Subject: [PATCH 37/60] change parameters of method --- ...rateSmallScaleCommercialTrafficDemand.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index a62b91c4fed..0bd53bc30e5 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -816,9 +816,11 @@ public void createCarriers(Scenario scenario, else serviceTimePerStop = getServiceTimePerStop(stopDurationTimeSelector, selectedStartCategory, modeORvehType, smallScaleCommercialTrafficType); - TimeWindow serviceTimeWindow = TimeWindow.newInstance(0, 36 * 3600); // extended time window, so that late tours can handle it - createServices(scenario, vehicleDepots, selectedStopCategory, carrierName, - numberOfJobs, serviceArea, serviceTimePerStop, serviceTimeWindow, linksPerZone); + TimeWindow serviceTimeWindow = TimeWindow.newInstance(0, + 36 * 3600); // extended time window, so that late tours can handle it + createServices(newCarrier, vehicleDepots, selectedStopCategory, serviceArea, serviceTimePerStop, serviceTimeWindow, + linksPerZone); + } } } } @@ -844,22 +846,19 @@ public void createCarriers(Scenario scenario, /** * Creates the services for one carrier. */ - private void createServices(Scenario scenario, ArrayList noPossibleLinks, String selectedStopCategory, String carrierName, - int numberOfJobs, String[] serviceArea, Integer serviceTimePerStop, TimeWindow serviceTimeWindow, + private void createServices(Carrier newCarrier, ArrayList noPossibleLinks, String selectedStopCategory, String[] serviceArea, + Integer serviceTimePerStop, TimeWindow serviceTimeWindow, Map, Link>> linksPerZone) { String stopZone = serviceArea[0]; - for (int i = 0; i < numberOfJobs; i++) { Id linkId = findPossibleLink(stopZone, selectedStopCategory, noPossibleLinks, linksPerZone); - Id idNewService = Id.create(carrierName + "_" + linkId + "_" + rnd.nextInt(10000), + Id idNewService = Id.create(newCarrier.getId().toString() + "_" + linkId + "_" + rnd.nextInt(10000), CarrierService.class); CarrierService thisService = CarrierService.Builder.newInstance(idNewService, linkId) .setServiceDuration(serviceTimePerStop).setServiceStartTimeWindow(serviceTimeWindow).build(); - CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)).getServices() - .put(thisService.getId(), thisService); - } + newCarrier.getServices().put(thisService.getId(), thisService); } /** @@ -928,10 +927,12 @@ private void createNewCarrierAndAddVehicleTypes(Scenario scenario, Integer purpo /** * Gives a duration for the created tour under the given probability. - * */ private int getVehicleTourDuration(TourStartAndDuration t) { - return (int) rnd.nextDouble(t.minDuration * 60, t.maxDuration * 60); + if (t.minDuration == 0.) + return (int) t.maxDuration * 60; + else + return (int) rnd.nextDouble(t.minDuration * 60, t.maxDuration * 60); } /** From 9740e121c02c37f8c825d5827c3e1d1fb091d674 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Tue, 24 Sep 2024 10:27:55 +0200 Subject: [PATCH 38/60] add possible solution for serviceTime selection --- ...rateSmallScaleCommercialTrafficDemand.java | 95 +++++++++++++------ 1 file changed, 64 insertions(+), 31 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 0bd53bc30e5..b91dc4d5507 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -447,13 +447,13 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map> serviceDurationTimeSelector, - String employeeCategory, String modeORvehType, String smallScaleCommercialTrafficType, double maxVehicleAvailability) { + private Integer getServiceTimePerStop(Carrier newCarrier, + Map> serviceDurationTimeSelector, + EnumeratedDistribution tourDistribution, String employeeCategory, + String modeORvehType, String smallScaleCommercialTrafficType) { GenerateSmallScaleCommercialTrafficDemand.StopDurationGoodTrafficKey key = null; if (smallScaleCommercialTrafficType.equals( @@ -962,10 +955,50 @@ else if (smallScaleCommercialTrafficType.equals( GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString())) { key = GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey(employeeCategory, modeORvehType); } - GenerateSmallScaleCommercialTrafficDemand.DurationsBounds serviceDurationBounds = serviceDurationTimeSelector.get(key).sample(); - int serviceDurationLowerBound = serviceDurationBounds.minDuration(); - int serviceDurationUpperBound = serviceDurationBounds.maxDuration(); - return rnd.nextInt(serviceDurationLowerBound * 60, serviceDurationUpperBound * 60); + // old Version +// GenerateSmallScaleCommercialTrafficDemand.DurationsBounds serviceDurationBounds = serviceDurationTimeSelector.get(key).sample(); +// int serviceDurationLowerBound = serviceDurationBounds.minDuration(); +// int serviceDurationUpperBound = serviceDurationBounds.maxDuration(); +// return rnd.nextInt(serviceDurationLowerBound * 60, serviceDurationUpperBound * 60); + + //possible new Version by Ricardo + double maxVehicleAvailability = newCarrier.getCarrierCapabilities().getCarrierVehicles().values().stream().mapToDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime()).max().orElse(0); + int usedTravelTimeBuffer = 120 * 60; // 120 min buffer for the driving time + for (int j = 0; j < 200; j++) { + GenerateSmallScaleCommercialTrafficDemand.DurationsBounds serviceDurationBounds = serviceDurationTimeSelector.get(key).sample(); + + for (int i = 0; i < 10; i++) { + int serviceDurationLowerBound = serviceDurationBounds.minDuration(); + int serviceDurationUpperBound = serviceDurationBounds.maxDuration(); + int possibleValue = rnd.nextInt(serviceDurationLowerBound * 60, serviceDurationUpperBound * 60); + // checks if the service duration will not exceed the vehicle availability including the buffer + if (possibleValue + usedTravelTimeBuffer <= maxVehicleAvailability) + return possibleValue; + } + if (j > 100){ + CarrierVehicle carrierVehicleToChange = newCarrier.getCarrierCapabilities().getCarrierVehicles().values().stream().sorted(Comparator.comparingDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime())).toList().getFirst(); + log.info("Changing vehicle availability for carrier {}. Old maxVehicleAvailability: {}", newCarrier.getId(), maxVehicleAvailability); + int tourDuration = 0; + int vehicleStartTime = 0; + int vehicleEndTime = 0; + while (tourDuration < maxVehicleAvailability) { + GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = tourDistribution.sample(); + vehicleStartTime = getVehicleStartTime(t); + tourDuration = getVehicleTourDuration(t); + vehicleEndTime = vehicleStartTime + tourDuration; + } + CarrierVehicle newCarrierVehicle = CarrierVehicle.Builder.newInstance(carrierVehicleToChange.getId(), carrierVehicleToChange.getLinkId(), + carrierVehicleToChange.getType()).setEarliestStart(vehicleStartTime).setLatestEnd(vehicleEndTime).build(); + newCarrier.getCarrierCapabilities().getCarrierVehicles().remove(carrierVehicleToChange.getId()); + newCarrier.getCarrierCapabilities().getCarrierVehicles().put(newCarrierVehicle.getId(), newCarrierVehicle); + maxVehicleAvailability = newCarrier.getCarrierCapabilities().getCarrierVehicles().values().stream().mapToDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime()).max().orElse(0); + log.info("New maxVehicleAvailability: {}", maxVehicleAvailability); + } + } + + throw new RuntimeException("No possible service duration found for employee category '" + employeeCategory + "' and mode '" + + modeORvehType + "' in traffic type '" + smallScaleCommercialTrafficType + "'"); + } /** From 5f36d3e485d204c14a7a2287009b4a8d585903ed Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Tue, 24 Sep 2024 10:53:11 +0200 Subject: [PATCH 39/60] add TODO --- .../GenerateSmallScaleCommercialTrafficDemand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index b91dc4d5507..04c2ce5caf1 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -759,7 +759,7 @@ public void createCarriers(Scenario scenario, } } - if (isStartingLocation) { + if (isStartingLocation) { //TODO für Aleksander: bessere Bezeichnungen wählen VehicleSelection.OdMatrixEntryInformation information = vehicleSelection.getOdMatrixEntryInformation(purpose, modeORvehType, smallScaleCommercialTrafficType); // use only types of the possibleTypes which are in the given types file From f3f77e91b3efae209ec2f265b92e1d46810bb9a7 Mon Sep 17 00:00:00 2001 From: aleks Date: Tue, 24 Sep 2024 15:08:11 +0200 Subject: [PATCH 40/60] renamed variables --- .../DefaultVehicleSelection.java | 25 ++++----- ...rateSmallScaleCommercialTrafficDemand.java | 52 +++++++++++-------- .../VehicleSelection.java | 4 +- 3 files changed, 46 insertions(+), 35 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java index 2b01e4a7abb..c6221d61515 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultVehicleSelection.java @@ -17,49 +17,50 @@ public List getAllCategories() { return categories; } + @Override - public OdMatrixEntryInformation getOdMatrixEntryInformation(int purpose, String modeORvehType, String smallScaleCommercialTrafficType) { + public OdMatrixEntryInformation getOdMatrixEntryInformation(int purpose, String modeORvehType, String smallScaleCommercialTrafficType) { VehicleSelection.OdMatrixEntryInformation information = new OdMatrixEntryInformation(); information.occupancyRate = 0; information.possibleVehicleTypes = null; - information.startCategory = new ArrayList<>(); - information.stopCategory = new ArrayList<>(getAllCategories()); + information.possibleStartCategories = new ArrayList<>(); + information.possibleStopCategories = new ArrayList<>(getAllCategories()); if (purpose == 1) { if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { information.possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; information.occupancyRate = 1.5; } - information.startCategory.add("Employee Secondary Sector Rest"); - information.stopCategory.clear(); - information.stopCategory.add("Employee Secondary Sector Rest"); + information.possibleStartCategories.add("Employee Secondary Sector Rest"); + information.possibleStopCategories.clear(); + information.possibleStopCategories.add("Employee Secondary Sector Rest"); } else if (purpose == 2) { if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { information.possibleVehicleTypes = new String[]{"vwCaddy", "e_SpaceTourer"}; information.occupancyRate = 1.6; } - information.startCategory.add("Employee Secondary Sector Rest"); + information.possibleStartCategories.add("Employee Secondary Sector Rest"); } else if (purpose == 3) { if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { information.possibleVehicleTypes = new String[]{"golf1.4", "c_zero"}; information.occupancyRate = 1.2; } - information.startCategory.add("Employee Retail"); - information.startCategory.add("Employee Tertiary Sector Rest"); + information.possibleStartCategories.add("Employee Retail"); + information.possibleStartCategories.add("Employee Tertiary Sector Rest"); } else if (purpose == 4) { if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { information.possibleVehicleTypes = new String[]{"golf1.4", "c_zero"}; information.occupancyRate = 1.2; } - information.startCategory.add("Employee Traffic/Parcels"); + information.possibleStartCategories.add("Employee Traffic/Parcels"); } else if (purpose == 5) { if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) { information.possibleVehicleTypes = new String[]{"mercedes313", "e_SpaceTourer"}; information.occupancyRate = 1.7; } - information.startCategory.add("Employee Construction"); + information.possibleStartCategories.add("Employee Construction"); } else if (purpose == 6) { - information.startCategory.add("Inhabitants"); + information.possibleStartCategories.add("Inhabitants"); } if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 04c2ce5caf1..25b2a536087 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -746,6 +746,8 @@ public void createCarriers(Scenario scenario, for (Integer purpose : odMatrix.getListOfPurposes()) { for (String startZone : odMatrix.getListOfZones()) { for (String modeORvehType : odMatrix.getListOfModesOrVehTypes()) { + + // Check if this purpose, startZone, modeORvehType combination is a possiblr starting location (by looking if it has a trip-distribution-entry) boolean isStartingLocation = false; checkIfIsStartingPosition: { @@ -759,27 +761,31 @@ public void createCarriers(Scenario scenario, } } - if (isStartingLocation) { //TODO für Aleksander: bessere Bezeichnungen wählen - VehicleSelection.OdMatrixEntryInformation information = vehicleSelection.getOdMatrixEntryInformation(purpose, modeORvehType, smallScaleCommercialTrafficType); + if (isStartingLocation) { + // Get the vehicle-types and start/stop-categories + VehicleSelection.OdMatrixEntryInformation odMatrixEntry = vehicleSelection.getOdMatrixEntryInformation(purpose, modeORvehType, smallScaleCommercialTrafficType); // use only types of the possibleTypes which are in the given types file List vehicleTypes = new ArrayList<>(); - assert information.possibleVehicleTypes != null; + assert odMatrixEntry.possibleVehicleTypes != null; - for (String possibleVehicleType : information.possibleVehicleTypes) { + for (String possibleVehicleType : odMatrixEntry.possibleVehicleTypes) { if (CarriersUtils.getCarrierVehicleTypes(scenario).getVehicleTypes().containsKey( Id.create(possibleVehicleType, VehicleType.class))) vehicleTypes.add(possibleVehicleType); } - // find a start category with existing employees in this zone - Collections.shuffle(information.startCategory, rnd); - String selectedStartCategory = information.startCategory.getFirst(); + + // find a (random) start category with existing employees in this zone + Collections.shuffle(odMatrixEntry.possibleStartCategories, rnd); + String selectedStartCategory = odMatrixEntry.possibleStartCategories.getFirst(); for (int count = 1; resultingDataPerZone.get(startZone).getDouble(selectedStartCategory) == 0; count++) { - if (count <= information.startCategory.size()) - selectedStartCategory = information.startCategory.get(rnd.nextInt(information.startCategory.size())); + if (count <= odMatrixEntry.possibleStartCategories.size()) + selectedStartCategory = odMatrixEntry.possibleStartCategories.get(rnd.nextInt(odMatrixEntry.possibleStartCategories.size())); else - selectedStartCategory = information.stopCategory.get(rnd.nextInt(information.stopCategory.size())); + selectedStartCategory = odMatrixEntry.possibleStopCategories.get(rnd.nextInt(odMatrixEntry.possibleStopCategories.size())); } + + // Generate carrierName String carrierName = null; if (smallScaleCommercialTrafficType.equals("goodsTraffic")) { carrierName = "Carrier_Goods_" + startZone + "_purpose_" + purpose + "_" + modeORvehType; @@ -787,34 +793,38 @@ public void createCarriers(Scenario scenario, carrierName = "Carrier_Business_" + startZone + "_purpose_" + purpose; int numberOfDepots = odMatrix.getSumOfServicesForStartZone(startZone, modeORvehType, purpose, smallScaleCommercialTrafficType); + + // Create the Carrier CarrierCapabilities.FleetSize fleetSize = CarrierCapabilities.FleetSize.FINITE; ArrayList vehicleDepots = new ArrayList<>(); createdCarrier++; log.info("Create carrier number {} of a maximum Number of {} carriers.", createdCarrier, maxNumberOfCarrier); log.info("Carrier: {}; depots: {}; services: {}", carrierName, numberOfDepots, (int) Math.ceil(odMatrix.getSumOfServicesForStartZone(startZone, modeORvehType, - purpose, smallScaleCommercialTrafficType) / information.occupancyRate)); + purpose, smallScaleCommercialTrafficType) / odMatrixEntry.occupancyRate)); createNewCarrierAndAddVehicleTypes(scenario, purpose, startZone, selectedStartCategory, carrierName, vehicleTypes, numberOfDepots, fleetSize, fixedNumberOfVehiclePerTypeAndLocation, vehicleDepots, linksPerZone, smallScaleCommercialTrafficType, tourDistribution); + + // Now Create services for this carrier log.info("Create services for carrier: {}", carrierName); for (String stopZone : odMatrix.getListOfZones()) { int trafficVolumeForOD = Math.round((float)odMatrix.getTripDistributionValue(startZone, stopZone, modeORvehType, purpose, smallScaleCommercialTrafficType)); - int numberOfJobs = (int) Math.ceil(trafficVolumeForOD / information.occupancyRate); + int numberOfJobs = (int) Math.ceil(trafficVolumeForOD / odMatrixEntry.occupancyRate); if (numberOfJobs == 0) continue; // find a category for the tour stop with existing employees in this zone - String selectedStopCategory = information.stopCategory.get(rnd.nextInt(information.stopCategory.size())); + String selectedStopCategory = odMatrixEntry.possibleStopCategories.get(rnd.nextInt(odMatrixEntry.possibleStopCategories.size())); while (resultingDataPerZone.get(stopZone).getDouble(selectedStopCategory) == 0) - selectedStopCategory = information.stopCategory.get(rnd.nextInt(information.stopCategory.size())); + selectedStopCategory = odMatrixEntry.possibleStopCategories.get(rnd.nextInt(odMatrixEntry.possibleStopCategories.size())); String[] serviceArea = new String[]{stopZone}; Carrier newCarrier = CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)); for (int i = 0; i < numberOfJobs; i++) { int serviceTimePerStop; if (selectedStartCategory.equals("Inhabitants")) - serviceTimePerStop = getServiceTimePerStop(newCarrier, stopDurationTimeSelector, tourDistribution, information.startCategory.getFirst(), + serviceTimePerStop = getServiceTimePerStop(newCarrier, stopDurationTimeSelector, tourDistribution, odMatrixEntry.possibleStartCategories.getFirst(), modeORvehType, smallScaleCommercialTrafficType); else serviceTimePerStop = getServiceTimePerStop(newCarrier, stopDurationTimeSelector, tourDistribution, selectedStartCategory, modeORvehType, @@ -843,13 +853,13 @@ private void createServices(Carrier newCarrier, ArrayList noPossibleLink String stopZone = serviceArea[0]; - Id linkId = findPossibleLink(stopZone, selectedStopCategory, noPossibleLinks, linksPerZone); - Id idNewService = Id.create(newCarrier.getId().toString() + "_" + linkId + "_" + rnd.nextInt(10000), - CarrierService.class); + Id linkId = findPossibleLink(stopZone, selectedStopCategory, noPossibleLinks, linksPerZone); + Id idNewService = Id.create(newCarrier.getId().toString() + "_" + linkId + "_" + rnd.nextInt(10000), + CarrierService.class); - CarrierService thisService = CarrierService.Builder.newInstance(idNewService, linkId) - .setServiceDuration(serviceTimePerStop).setServiceStartTimeWindow(serviceTimeWindow).build(); - newCarrier.getServices().put(thisService.getId(), thisService); + CarrierService thisService = CarrierService.Builder.newInstance(idNewService, linkId) + .setServiceDuration(serviceTimePerStop).setServiceStartTimeWindow(serviceTimeWindow).build(); + newCarrier.getServices().put(thisService.getId(), thisService); } /** diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java index c8a3cf25b2a..fdcf721a98d 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/VehicleSelection.java @@ -12,8 +12,8 @@ public interface VehicleSelection{ class OdMatrixEntryInformation { double occupancyRate; String[] possibleVehicleTypes; - List startCategory = new ArrayList<>(); - List stopCategory = new ArrayList<>(); + List possibleStartCategories = new ArrayList<>(); + List possibleStopCategories = new ArrayList<>(); } /** From 6fa87bbee060484b1d3cbff94a191511e04dc8eb Mon Sep 17 00:00:00 2001 From: aleks Date: Wed, 25 Sep 2024 14:28:12 +0200 Subject: [PATCH 41/60] Implemented the replanning loop (still not fully working) --- ...rateSmallScaleCommercialTrafficDemand.java | 411 +++++++++++------- 1 file changed, 263 insertions(+), 148 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 25b2a536087..e0041e2daaf 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -85,6 +85,7 @@ import java.time.LocalDate; import java.time.LocalTime; import java.util.*; +import java.util.concurrent.ExecutionException; import static org.matsim.core.controler.OutputDirectoryHierarchy.OverwriteFileSetting.overwriteExistingFiles; import static org.matsim.smallScaleCommercialTrafficGeneration.SmallScaleCommercialTrafficUtils.readDataDistribution; @@ -176,6 +177,12 @@ public enum SmallScaleCommercialTrafficType { private static Random rnd; private RandomGenerator rng; private final Map>> facilitiesPerZone = new HashMap<>(); + private final Map, CarrierAttributes> carrierId2carrierAttributes = new HashMap<>(); + + //TODO Remove these attributes from all method-signatures + private TripDistributionMatrix odMatrix; + private Map> resultingDataPerZone; + private Map, Link>> linksPerZone; private Index indexZones; @@ -265,9 +272,9 @@ public Integer call() throws Exception { } indexZones = SmallScaleCommercialTrafficUtils.getIndexZones(shapeFileZonePath, shapeCRS, shapeFileZoneNameColumn); - Map> resultingDataPerZone = readDataDistribution(pathToDataDistributionToZones); + resultingDataPerZone = readDataDistribution(pathToDataDistributionToZones); filterFacilitiesForZones(scenario, facilitiesPerZone); - Map, Link>> linksPerZone = filterLinksForZones(scenario, indexZones, facilitiesPerZone, shapeFileZoneNameColumn); + linksPerZone = filterLinksForZones(scenario, indexZones, facilitiesPerZone, shapeFileZoneNameColumn); switch (usedSmallScaleCommercialTrafficType) { case commercialPersonTraffic, goodsTraffic -> @@ -343,6 +350,13 @@ private void filterFacilitiesForZones(Scenario scenario, Map, Link>> linksPerZone) throws Exception { + /* + TODO: Make a final fix for the unhandledServiceProblem using following procedure: + 1. solveVRPs + 2. check if carrierPlans are viable + 3. if some are not then loop: delete non-viable carrierPlans and execute 1. but with CarrierUtils.solutions#... (will be pushed later) + */ + boolean splitCarrier = true; boolean splitVRPs = false; int maxServicesPerCarrier = 100; @@ -350,6 +364,7 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map, Carrier> solvedCarriers = new HashMap<>(); List> keyList = new ArrayList<>(allCarriers.keySet()); + Map, List>> carrierId2subCarrierIds = new HashMap<>(); CarriersUtils.getCarriers(originalScenario).getCarriers().values().forEach(carrier -> { if (CarriersUtils.getJspritIterations(carrier) == 0) { allCarriers.remove(carrier.getId()); @@ -409,6 +424,9 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map newCarrier.getAttributes() .putAttribute(attribute, carrier.getAttributes().getAttribute(attribute))); + carrierId2subCarrierIds.putIfAbsent(carrier.getId(), new LinkedList<>()); + carrierId2subCarrierIds.get(carrier.getId()).add(newCarrier.getId()); + List> vehiclesForNewCarrier = new ArrayList<>( carrier.getCarrierCapabilities().getCarrierVehicles().keySet()); List> servicesForNewCarrier = new ArrayList<>( @@ -446,14 +464,20 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map oldCarrierId : carrierId2subCarrierIds.keySet()) { + for (Id newCarrierId : carrierId2subCarrierIds.get(oldCarrierId)) { + carrierId2carrierAttributes.put(newCarrierId, carrierId2carrierAttributes.get(oldCarrierId)); + } + } + log.info("Solving carriers {}-{} of all {} carriers. This are {} VRP to solve.", fromIndex + 1, toIndex, allCarriers.size(), subCarriers.size()); CarriersUtils.runJsprit(originalScenario); -// checkCarrierPlans(originalScenario); + makeAllCarrierPlansViable(originalScenario); solvedCarriers.putAll(CarriersUtils.getCarriers(originalScenario).getCarriers()); CarriersUtils.getCarriers(originalScenario).getCarriers().clear(); if (!splitVRPs) @@ -475,123 +499,135 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map handleServiceBatch(VehicleAvailabilityAllocator allocator, List lastServices, double serviceDuration, int serviceAmount){ - //Make duration viable and allocate vehicle Time - double viableDuration = allocator.makeMultipleServiceDurationsBalancedViable(serviceAmount, serviceDuration+avgDrivingTime); - //double viableDuration = serviceDuration+avgDrivingTime; - for(int i = 0; i < serviceAmount; i++) assert allocator.allocateServiceDuration(viableDuration-avgDrivingTime); - - List newServices = new LinkedList<>(); - - //Check if duration has changed and create new Services if it did - if(viableDuration != serviceDuration+avgDrivingTime){ - for(CarrierService lastService : lastServices){ - //the service duration is not viable, change its duration - if(viableDuration-avgDrivingTime < 0){ - /* If this happens, the serviceDuration must be negative in order to ensure, that the carrier can serve it. - * This however does not make sense, so we just leave the value as it is. It will result in unhandled services, but it leaves - * the scenario somehow plausible. - */ - log.warn("The carrier has too many services to handle! It is impossible to ensure full serving. This may be cause by a to high avgDrivingTime or incorrect source-data."); - viableDuration = serviceDuration+avgDrivingTime; + /** + * Checks and recalculates plans of carriers, which did not serve all services. + * This step may take a few minutes. + * @param scenario Scenario with carriers + */ + private void makeAllCarrierPlansViable(Scenario scenario) { + int maxIterations = 100; + + log.info("Starting with carrier-replanning loop."); + for(int i = 0; i < maxIterations; i++){ + log.info("carrier-replanning loop iteration: {}", i); + Collection allCarriers = CarriersUtils.getCarriers(scenario).getCarriers().values(); + + if (allCarriersViable(scenario)) break; + + for(Carrier carrier : allCarriers){ + if (isCarrierViable(carrier)) continue; + + // If we reach this point, the plan for this carrier is not viable. We will replan it + CarrierAttributes carrierAttributes = carrierId2carrierAttributes.get(carrier.getId()); + + // Generate new services. The new service batch should have a smaller sum of serviceDurations than before (or otherwise it will not change anything) + double oldSumOfServiceDurations = getSumOfServiceDurations(scenario, carrier.getId()); + int j = 0; + do { + if (j >= maxIterations) break; + + //TODO Remove old vehicles? + + // Create the new services + EnumeratedDistribution tourDistribution = getCommercialTourSpecifications.createTourDistribution(carrierAttributes.smallScaleCommercialTrafficType, rng); + Map> stopDurationTimeSelector = getCommercialTourSpecifications.createStopDurationDistributionPerCategory(carrierAttributes.smallScaleCommercialTrafficType, rng); + redrawAllServiceDurations(carrier, stopDurationTimeSelector, tourDistribution, carrierAttributes); + j++; + } while (getSumOfServiceDurations(scenario, carrier.getId()) > oldSumOfServiceDurations); + log.info("Carrer {}: Reduced summed serviceDuration from {} to {}", carrier.getId(), oldSumOfServiceDurations, getSumOfServiceDurations(scenario, carrier.getId())); + + try { + CarriersUtils.runJsprit(scenario, CarriersUtils.CarrierSelectionForSolution.solveOnlyForCarrierWithoutPlans); + } catch (ExecutionException e) { + throw new RuntimeException(e); + } catch (InterruptedException e) { + throw new RuntimeException(e); } - CarrierService newService = CarrierService.Builder.newInstance(lastService.getId(), lastService.getLocationLinkId()) - .setServiceDuration(viableDuration-avgDrivingTime).setServiceStartTimeWindow(lastService.getServiceStartTimeWindow()).build(); - - newServices.add(newService); - - log.info("Reduced serviceDuration (with avg driving time) from {} to {} of service {}", lastService.getServiceDuration()+avgDrivingTime, viableDuration, newService.getId()); } } - return newServices; + // Final check + if (!allCarriersViable(scenario)){ + log.warn("Not all services were handled!"); + } } - private void makeSubCarrierPlansViable(Collection subCarriers) { - for(Carrier carrier : subCarriers) { - List newServices = new LinkedList<>(); - - List carrierVehicleTimes = new ArrayList<>(carrier.getCarrierCapabilities().getCarrierVehicles().size()); - for (CarrierVehicle vehicle : carrier.getCarrierCapabilities().getCarrierVehicles().values()) - carrierVehicleTimes.add(vehicle.getLatestEndTime() - vehicle.getEarliestStartTime()); - VehicleAvailabilityAllocator allocator = new VehicleAvailabilityAllocator(carrierVehicleTimes); - - double lastServiceDuration = 0; - int lastServiceBatchAmount = 0; - List lastServices = new LinkedList<>(); - for (CarrierService service : carrier.getServices().values()) { - if (service.getServiceDuration() != lastServiceDuration) { - log.info("Retiming services of {}", carrier.getId()); - newServices.addAll(handleServiceBatch(allocator, lastServices, lastServiceDuration, lastServiceBatchAmount)); - lastServiceDuration = service.getServiceDuration(); - lastServiceBatchAmount = 0; - lastServices = new LinkedList<>(); - } - lastServiceBatchAmount++; - lastServices.add(service); - } - newServices.addAll(handleServiceBatch(allocator, lastServices, lastServiceDuration, lastServiceBatchAmount)); - - for (CarrierService newService : newServices) { - carrier.getServices().put(newService.getId(), newService); - } + private double getSumOfServiceDurations(Scenario scenario, Id carrierId) { + double sum = 0; + for (CarrierService service : CarriersUtils.getCarriers(scenario).getCarriers().get(carrierId).getServices().values()){ + sum += service.getServiceDuration(); } + return sum; } - private void checkCarrierPlans(Scenario scenario){ - int successful = 0; - for(Carrier carrier : CarriersUtils.getCarriers(scenario).getCarriers().values()){ - CarrierPlan plan = carrier.getSelectedPlan(); - double totalVehicleTime = 0; - double totalServiceDuration = 0; - double totalTravelDuration = 0; + private boolean isCarrierViable(Carrier carrier){ + CarrierPlan plan = carrier.getSelectedPlan(); + // TODO: remove these debug values + double totalVehicleTime = 0; + double totalServiceDuration = 0; + double totalTravelDuration = 0; - for(CarrierVehicle vehicle : carrier.getCarrierCapabilities().getCarrierVehicles().values()){ - totalVehicleTime += vehicle.getLatestEndTime() - vehicle.getEarliestStartTime(); - } + for(CarrierVehicle vehicle : carrier.getCarrierCapabilities().getCarrierVehicles().values()){ + totalVehicleTime += vehicle.getLatestEndTime() - vehicle.getEarliestStartTime(); + } - List handledServices = new LinkedList<>(); - //Check if all services have been handled - for(ScheduledTour tour : plan.getScheduledTours()){ - //DEBUG - double thisVehicleTime = tour.getVehicle().getLatestEndTime() - tour.getVehicle().getEarliestStartTime(); - double thisTourTime = 0; - - for(Tour.TourElement element : tour.getTour().getTourElements()){ - if(element instanceof Tour.Leg){ - totalTravelDuration += ((Tour.Leg) element).getExpectedTransportTime(); - thisTourTime += ((Tour.Leg) element).getExpectedTransportTime(); - } - if(element instanceof Tour.ServiceActivity){ - handledServices.add(((Tour.ServiceActivity) element).getService()); - totalServiceDuration += ((Tour.ServiceActivity) element).getDuration(); - thisTourTime += ((Tour.ServiceActivity) element).getDuration(); - } + List handledServices = new LinkedList<>(); + //Check if all services have been handled + for(ScheduledTour tour : plan.getScheduledTours()){ + //DEBUG + double thisVehicleTime = tour.getVehicle().getLatestEndTime() - tour.getVehicle().getEarliestStartTime(); + double thisTourTime = 0; + + for(Tour.TourElement element : tour.getTour().getTourElements()){ + if(element instanceof Tour.Leg){ + totalTravelDuration += ((Tour.Leg) element).getExpectedTransportTime(); + thisTourTime += ((Tour.Leg) element).getExpectedTransportTime(); + } + if(element instanceof Tour.ServiceActivity){ + handledServices.add(((Tour.ServiceActivity) element).getService()); + totalServiceDuration += ((Tour.ServiceActivity) element).getDuration(); + thisTourTime += ((Tour.ServiceActivity) element).getDuration(); } - - log.info("Tour {} used {} out of {} available vehicle time", tour.getTour().getId(), thisTourTime, thisVehicleTime); } - int i = 0; - for(CarrierService handled : handledServices){ - if(carrier.getServices().containsValue(handled)) i++; + //log.info("Tour {} used {} out of {} available vehicle time", tour.getTour().getId(), thisTourTime, thisVehicleTime); + } + + List unhandled = new LinkedList<>(); + for(CarrierService service : carrier.getServices().values()){ + if(!handledServices.contains(service)){ + unhandled.add(service); } + } - if(i != carrier.getServices().values().size()){ - log.warn("Carrier {}: {} of {} services were not handled! The total vehicle time is: {} ({}); The total serviceDuration is: {} ({}); The total travelDuration is : {}", - carrier.getId(), - carrier.getServices().size() - i, - carrier.getServices().size(), - totalVehicleTime, carrier.getCarrierCapabilities().getCarrierVehicles().size(), - totalServiceDuration, carrier.getServices().size(), - totalTravelDuration - ); - } else { - successful++; + if(!unhandled.isEmpty()){ + //TODO remove this message + log.warn("Carrier {}: {} of {} services were not handled! The total vehicle time is: {} ({}); The total serviceDuration is: {} ({}); The total travelDuration is : {}", + carrier.getId(), + unhandled.size(), + carrier.getServices().size(), + totalVehicleTime, carrier.getCarrierCapabilities().getCarrierVehicles().size(), + totalServiceDuration, carrier.getServices().size(), + totalTravelDuration + ); + for(CarrierService s : unhandled){ + log.warn("Service {} (duration={}) was not handled by carrier {}", s.getId(), s.getServiceDuration(), carrier.getId()); } + return false; + } else { + return true; + } + + } + + private boolean allCarriersViable(Scenario scenario){ + int successful = 0; + for(Carrier carrier : CarriersUtils.getCarriers(scenario).getCarriers().values()){ + if(isCarrierViable(carrier)) successful++; } log.info("{} of {} carriers were fully served!", successful, CarriersUtils.getCarriers(scenario).getCarriers().size()); + return successful == CarriersUtils.getCarriers(scenario).getCarriers().size(); } private void createCarriersAndDemand(Path output, Scenario scenario, @@ -620,7 +656,7 @@ else if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) integrateExistingTrafficToSmallScaleCommercial.reduceDemandBasedOnExistingCarriers(scenario, linksPerZone, smallScaleCommercialTrafficType, trafficVolumePerTypeAndZone_start, trafficVolumePerTypeAndZone_stop); } - final TripDistributionMatrix odMatrix = createTripDistribution(trafficVolumePerTypeAndZone_start, + odMatrix = createTripDistribution(trafficVolumePerTypeAndZone_start, trafficVolumePerTypeAndZone_stop, smallScaleCommercialTrafficType, scenario, output, linksPerZone); createCarriers( scenario, @@ -784,6 +820,7 @@ public void createCarriers(Scenario scenario, else selectedStartCategory = odMatrixEntry.possibleStopCategories.get(rnd.nextInt(odMatrixEntry.possibleStopCategories.size())); } + // TODO #1 // Generate carrierName String carrierName = null; @@ -808,34 +845,25 @@ public void createCarriers(Scenario scenario, tourDistribution); // Now Create services for this carrier - log.info("Create services for carrier: {}", carrierName); - for (String stopZone : odMatrix.getListOfZones()) { - int trafficVolumeForOD = Math.round((float)odMatrix.getTripDistributionValue(startZone, - stopZone, modeORvehType, purpose, smallScaleCommercialTrafficType)); - int numberOfJobs = (int) Math.ceil(trafficVolumeForOD / odMatrixEntry.occupancyRate); - if (numberOfJobs == 0) - continue; - // find a category for the tour stop with existing employees in this zone - String selectedStopCategory = odMatrixEntry.possibleStopCategories.get(rnd.nextInt(odMatrixEntry.possibleStopCategories.size())); - while (resultingDataPerZone.get(stopZone).getDouble(selectedStopCategory) == 0) - selectedStopCategory = odMatrixEntry.possibleStopCategories.get(rnd.nextInt(odMatrixEntry.possibleStopCategories.size())); - String[] serviceArea = new String[]{stopZone}; - Carrier newCarrier = CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)); - for (int i = 0; i < numberOfJobs; i++) { - int serviceTimePerStop; - if (selectedStartCategory.equals("Inhabitants")) - serviceTimePerStop = getServiceTimePerStop(newCarrier, stopDurationTimeSelector, tourDistribution, odMatrixEntry.possibleStartCategories.getFirst(), - modeORvehType, smallScaleCommercialTrafficType); - else - serviceTimePerStop = getServiceTimePerStop(newCarrier, stopDurationTimeSelector, tourDistribution, selectedStartCategory, modeORvehType, - smallScaleCommercialTrafficType); - - TimeWindow serviceTimeWindow = TimeWindow.newInstance(0, - 36 * 3600); // extended time window, so that late tours can handle it - createServices(newCarrier, vehicleDepots, selectedStopCategory, serviceArea, serviceTimePerStop, serviceTimeWindow, - linksPerZone); - } - } + Carrier newCarrier = CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)); + CarrierAttributes carrierAttributes = new CarrierAttributes( + purpose, + startZone, + selectedStartCategory, + modeORvehType, + smallScaleCommercialTrafficType, + vehicleDepots, + odMatrixEntry); + + carrierId2carrierAttributes.put(Id.create(carrierName, Carrier.class), carrierAttributes); + + createServices(newCarrier, + resultingDataPerZone, + stopDurationTimeSelector, + tourDistribution, + odMatrix, + linksPerZone, + carrierAttributes); } } } @@ -845,13 +873,68 @@ public void createCarriers(Scenario scenario, } /** - * Creates the services for one carrier. + * Generates and adds the services for the given carrier. + * TODO In-source this method back into create carriers */ - private void createServices(Carrier newCarrier, ArrayList noPossibleLinks, String selectedStopCategory, String[] serviceArea, - Integer serviceTimePerStop, TimeWindow serviceTimeWindow, - Map, Link>> linksPerZone) { + private void createServices(Carrier newCarrier, + Map> resultingDataPerZone, + Map> stopDurationTimeSelector, + EnumeratedDistribution tourDistribution, + TripDistributionMatrix odMatrix, + Map, Link>> linksPerZone, + CarrierAttributes carrierAttributes) { + log.info("Create services for carrier: {}", newCarrier.getId()); + for (String stopZone : odMatrix.getListOfZones()) { + int trafficVolumeForOD = Math.round((float)odMatrix.getTripDistributionValue(carrierAttributes.startZone, + stopZone, carrierAttributes.modeORvehType, carrierAttributes.purpose, carrierAttributes.smallScaleCommercialTrafficType)); + int numberOfJobs = (int) Math.ceil(trafficVolumeForOD / carrierAttributes.odMatrixEntry.occupancyRate); + if (numberOfJobs == 0) + continue; + // find a category for the tour stop with existing employees in this zone + String selectedStopCategory = carrierAttributes.odMatrixEntry.possibleStopCategories.get(rnd.nextInt(carrierAttributes.odMatrixEntry.possibleStopCategories.size())); + while (resultingDataPerZone.get(stopZone).getDouble(selectedStopCategory) == 0) + selectedStopCategory = carrierAttributes.odMatrixEntry.possibleStopCategories.get(rnd.nextInt(carrierAttributes.odMatrixEntry.possibleStopCategories.size())); + for (int i = 0; i < numberOfJobs; i++) { + int serviceTimePerStop; + if (carrierAttributes.selectedStartCategory.equals("Inhabitants")){ + //TODO This is a bit ugly. Do we even need the selectedStartCategory of the carrierAttributes in this case? Or can we just set it right at the beginning? (move it to TODO #1) + CarrierAttributes inhabitantAttributes = new CarrierAttributes( + carrierAttributes.purpose, + carrierAttributes.startZone, + carrierAttributes.odMatrixEntry.possibleStartCategories.getFirst(), + carrierAttributes.modeORvehType, + carrierAttributes.smallScaleCommercialTrafficType, + carrierAttributes.vehicleDepots, + carrierAttributes.odMatrixEntry); + serviceTimePerStop = getServiceTimePerStop(newCarrier, stopDurationTimeSelector, tourDistribution, inhabitantAttributes); - String stopZone = serviceArea[0]; + } + else { + serviceTimePerStop = getServiceTimePerStop( + newCarrier, + stopDurationTimeSelector, tourDistribution, + carrierAttributes); + } + + TimeWindow serviceTimeWindow = TimeWindow.newInstance(0, + 36 * 3600); // extended time window, so that late tours can handle it + createService(newCarrier, + carrierAttributes.vehicleDepots, + selectedStopCategory, + stopZone, + serviceTimePerStop, + serviceTimeWindow, + linksPerZone); + } + } + } + + /** + * Adds a service with the given attributes to the carrier. + */ + private void createService(Carrier newCarrier, ArrayList noPossibleLinks, String selectedStopCategory, String stopZone, + Integer serviceTimePerStop, TimeWindow serviceTimeWindow, + Map, Link>> linksPerZone) { Id linkId = findPossibleLink(stopZone, selectedStopCategory, noPossibleLinks, linksPerZone); Id idNewService = Id.create(newCarrier.getId().toString() + "_" + linkId + "_" + rnd.nextInt(10000), @@ -862,6 +945,21 @@ private void createServices(Carrier newCarrier, ArrayList noPossibleLink newCarrier.getServices().put(thisService.getId(), thisService); } + /** + * Redraws the service-durations of all {@link CarrierService}s of the given {@link Carrier}. + */ + private void redrawAllServiceDurations(Carrier carrier, + Map> stopDurationTimeSelector, + EnumeratedDistribution tourDistribution, + CarrierAttributes carrierAttributes) { + for (CarrierService service : carrier.getServices().values()) { + double newServiceDuration = getServiceTimePerStop(carrier, stopDurationTimeSelector, tourDistribution, carrierAttributes); + CarrierService redrawnService = CarrierService.Builder.newInstance(service.getId(), service.getLocationLinkId()) + .setServiceDuration(newServiceDuration).setServiceStartTimeWindow(service.getServiceStartTimeWindow()).build(); + carrier.getServices().put(redrawnService.getId(), redrawnService); + } + } + /** * Creates the carrier and the related vehicles. */ @@ -946,24 +1044,24 @@ private int getVehicleStartTime(TourStartAndDuration t) { /** * Give a service duration based on the purpose and the trafficType under a given probability * - * @param serviceDurationTimeSelector the selector for the service duration - * @param tourDistribution the distribution for the tour start and duration - * @param employeeCategory the category of the employee - * @param modeORvehType the mode or vehicle type + * @param newCarrier The carrier for which we generate the serviceTime + * @param serviceDurationTimeSelector the selector for the service duration + * @param tourDistribution the distribution for the tour start and duration + * @param carrierAttributes attributes of the carrier to generate the service time for. + * selectedStartCategory: the category of the employee * @return the service duration */ private Integer getServiceTimePerStop(Carrier newCarrier, Map> serviceDurationTimeSelector, - EnumeratedDistribution tourDistribution, String employeeCategory, - String modeORvehType, String smallScaleCommercialTrafficType) { + EnumeratedDistribution tourDistribution, CarrierAttributes carrierAttributes) { GenerateSmallScaleCommercialTrafficDemand.StopDurationGoodTrafficKey key = null; - if (smallScaleCommercialTrafficType.equals( + if (carrierAttributes.smallScaleCommercialTrafficType.equals( GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString())) - key = GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey(employeeCategory, null); - else if (smallScaleCommercialTrafficType.equals( + key = GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey(carrierAttributes.selectedStartCategory, null); + else if (carrierAttributes.smallScaleCommercialTrafficType.equals( GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString())) { - key = GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey(employeeCategory, modeORvehType); + key = GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey(carrierAttributes.selectedStartCategory, carrierAttributes.modeORvehType); } // old Version // GenerateSmallScaleCommercialTrafficDemand.DurationsBounds serviceDurationBounds = serviceDurationTimeSelector.get(key).sample(); @@ -1006,8 +1104,8 @@ else if (smallScaleCommercialTrafficType.equals( } } - throw new RuntimeException("No possible service duration found for employee category '" + employeeCategory + "' and mode '" - + modeORvehType + "' in traffic type '" + smallScaleCommercialTrafficType + "'"); + throw new RuntimeException("No possible service duration found for employee category '" + carrierAttributes.selectedStartCategory + "' and mode '" + + carrierAttributes.modeORvehType + "' in traffic type '" + carrierAttributes.smallScaleCommercialTrafficType + "'"); } @@ -1370,4 +1468,21 @@ public record TourStartAndDuration(int hourLower, int hourUpper, double minDurat public record DurationsBounds(int minDuration, int maxDuration) {} + /** + * The attributes of a carrier, used during the generation + * @param purpose purpose of this carrier denoted as an index. Can be used in {@link VehicleSelection} to get more information about this carrier. + * @param startZone start zone of this carrier, entry from {@link TripDistributionMatrix#getListOfZones()} + * @param selectedStartCategory start category of this carrier, selected randomly from {@link VehicleSelection.OdMatrixEntryInformation#possibleStartCategories} + * @param modeORvehType entry from {@link TripDistributionMatrix#getListOfModesOrVehTypes()} + * @param smallScaleCommercialTrafficType entry from {@link SmallScaleCommercialTrafficType} + * @param vehicleDepots Containing the depots of this carrier with linkIds as strings + */ + private record CarrierAttributes(int purpose, + String startZone, + String selectedStartCategory, + String modeORvehType, + String smallScaleCommercialTrafficType, + ArrayList vehicleDepots, + VehicleSelection.OdMatrixEntryInformation odMatrixEntry) {} + } From eeee11db640fb9bdbf8bdcb8e701cc187613f993 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Mon, 30 Sep 2024 09:42:13 +0200 Subject: [PATCH 42/60] restructure commercial specification interface --- ...rateSmallScaleCommercialTrafficDemand.java | 25 +- ...java => CommercialTourSpecifications.java} | 10 +- ...faultTourSpecificationsByUsingKID2002.java | 2948 ++++++++++------- 3 files changed, 1745 insertions(+), 1238 deletions(-) rename contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/data/{GetCommercialTourSpecifications.java => CommercialTourSpecifications.java} (71%) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index e0041e2daaf..4bbb7739544 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -71,8 +71,8 @@ import org.matsim.freight.carriers.analysis.RunFreightAnalysisEventBased; import org.matsim.freight.carriers.controler.*; import org.matsim.freight.carriers.usecases.chessboard.CarrierTravelDisutilities; +import org.matsim.smallScaleCommercialTrafficGeneration.data.CommercialTourSpecifications; import org.matsim.smallScaleCommercialTrafficGeneration.data.DefaultTourSpecificationsByUsingKID2002; -import org.matsim.smallScaleCommercialTrafficGeneration.data.GetCommercialTourSpecifications; import org.matsim.vehicles.CostInformation; import org.matsim.vehicles.Vehicle; import org.matsim.vehicles.VehicleType; @@ -109,7 +109,7 @@ public class GenerateSmallScaleCommercialTrafficDemand implements MATSimAppComma private static final Logger log = LogManager.getLogger(GenerateSmallScaleCommercialTrafficDemand.class); private final IntegrateExistingTrafficToSmallScaleCommercial integrateExistingTrafficToSmallScaleCommercial; - private final GetCommercialTourSpecifications getCommercialTourSpecifications; + private final CommercialTourSpecifications commercialTourSpecifications; private final VehicleSelection vehicleSelection; private enum CreationOption { @@ -178,7 +178,8 @@ public enum SmallScaleCommercialTrafficType { private RandomGenerator rng; private final Map>> facilitiesPerZone = new HashMap<>(); private final Map, CarrierAttributes> carrierId2carrierAttributes = new HashMap<>(); - + private Map> tourDistribution = null; + private Map> serviceDurationTimeSelector = null; //TODO Remove these attributes from all method-signatures private TripDistributionMatrix odMatrix; private Map> resultingDataPerZone; @@ -189,12 +190,12 @@ public enum SmallScaleCommercialTrafficType { public GenerateSmallScaleCommercialTrafficDemand() { this.integrateExistingTrafficToSmallScaleCommercial = new DefaultIntegrateExistingTrafficToSmallScaleCommercialImpl(); log.info("Using default {} if existing models are integrated!", DefaultIntegrateExistingTrafficToSmallScaleCommercialImpl.class.getSimpleName()); - this.getCommercialTourSpecifications = new DefaultTourSpecificationsByUsingKID2002(); + this.commercialTourSpecifications = new DefaultTourSpecificationsByUsingKID2002(); log.info("Using default {} for tour specifications!", DefaultTourSpecificationsByUsingKID2002.class.getSimpleName()); this.vehicleSelection = new DefaultVehicleSelection(); log.info("Using default {} for tour vehicle-selection!", DefaultVehicleSelection.class.getSimpleName()); } - public GenerateSmallScaleCommercialTrafficDemand(IntegrateExistingTrafficToSmallScaleCommercial integrateExistingTrafficToSmallScaleCommercial, GetCommercialTourSpecifications getCommercialTourSpecifications, VehicleSelection vehicleSelection) { + public GenerateSmallScaleCommercialTrafficDemand(IntegrateExistingTrafficToSmallScaleCommercial integrateExistingTrafficToSmallScaleCommercial, CommercialTourSpecifications getCommercialTourSpecifications, VehicleSelection vehicleSelection) { if (integrateExistingTrafficToSmallScaleCommercial == null){ this.integrateExistingTrafficToSmallScaleCommercial = new DefaultIntegrateExistingTrafficToSmallScaleCommercialImpl(); log.info("Using default {} if existing models are integrated!", DefaultIntegrateExistingTrafficToSmallScaleCommercialImpl.class.getSimpleName()); @@ -203,10 +204,10 @@ public GenerateSmallScaleCommercialTrafficDemand(IntegrateExistingTrafficToSmall log.info("Using {} if existing models are integrated!", integrateExistingTrafficToSmallScaleCommercial.getClass().getSimpleName()); } if (getCommercialTourSpecifications == null){ - this.getCommercialTourSpecifications = new DefaultTourSpecificationsByUsingKID2002(); + this.commercialTourSpecifications = new DefaultTourSpecificationsByUsingKID2002(); log.info("Using default {} for tour specifications!", DefaultTourSpecificationsByUsingKID2002.class.getSimpleName()); } else { - this.getCommercialTourSpecifications = getCommercialTourSpecifications; + this.commercialTourSpecifications = getCommercialTourSpecifications; log.info("Using {} for tour specifications!", getCommercialTourSpecifications.getClass().getSimpleName()); } if(vehicleSelection == null){ @@ -761,9 +762,9 @@ public void createCarriers(Scenario scenario, int createdCarrier = 0; int fixedNumberOfVehiclePerTypeAndLocation = 1; //TODO possible improvement, perhaps check KiD - EnumeratedDistribution tourDistribution = getCommercialTourSpecifications.createTourDistribution(smallScaleCommercialTrafficType, rng); + tourDistribution = commercialTourSpecifications.createTourDistribution(rng); - Map> stopDurationTimeSelector = getCommercialTourSpecifications.createStopDurationDistributionPerCategory(smallScaleCommercialTrafficType, rng); + serviceDurationTimeSelector = commercialTourSpecifications.createStopDurationDistributionPerCategory(rng); CarrierVehicleTypes carrierVehicleTypes = CarriersUtils.getCarrierVehicleTypes(scenario); Map, VehicleType> additionalCarrierVehicleTypes = scenario.getVehicles().getVehicleTypes(); @@ -968,7 +969,7 @@ private void createNewCarrierAndAddVehicleTypes(Scenario scenario, Integer purpo CarrierCapabilities.FleetSize fleetSize, int fixedNumberOfVehiclePerTypeAndLocation, List vehicleDepots, Map, Link>> linksPerZone, String smallScaleCommercialTrafficType, - EnumeratedDistribution tourStartTimeSelector) { + Map> tourStartTimeSelector) { Carriers carriers = CarriersUtils.addOrGetCarriers(scenario); CarrierVehicleTypes carrierVehicleTypes = CarriersUtils.getCarrierVehicleTypes(scenario); @@ -995,7 +996,7 @@ private void createNewCarrierAndAddVehicleTypes(Scenario scenario, Integer purpo } for (String singleDepot : vehicleDepots) { - GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = tourStartTimeSelector.sample(); + GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = tourStartTimeSelector.get(smallScaleCommercialTrafficType).sample(); int vehicleStartTime = getVehicleStartTime(t); int tourDuration = getVehicleTourDuration(t); @@ -1090,7 +1091,7 @@ else if (carrierAttributes.smallScaleCommercialTrafficType.equals( int vehicleStartTime = 0; int vehicleEndTime = 0; while (tourDuration < maxVehicleAvailability) { - GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = tourDistribution.sample(); + GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = tourDistribution.get(carrierAttributes.smallScaleCommercialTrafficType).sample(); vehicleStartTime = getVehicleStartTime(t); tourDuration = getVehicleTourDuration(t); vehicleEndTime = vehicleStartTime + tourDuration; diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/data/GetCommercialTourSpecifications.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/data/CommercialTourSpecifications.java similarity index 71% rename from contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/data/GetCommercialTourSpecifications.java rename to contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/data/CommercialTourSpecifications.java index ce6bce3c04c..5cd6256c1ea 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/data/GetCommercialTourSpecifications.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/data/CommercialTourSpecifications.java @@ -6,25 +6,23 @@ import java.util.Map; -public interface GetCommercialTourSpecifications { +public interface CommercialTourSpecifications { /** * Creates the probability distribution for the duration of the services. * The values are given in [min] and have an upperBound. * - * @param smallScaleCommercialTrafficType the type of small scale commercial traffic * @return the probability distribution for the duration of the services */ - Map> createStopDurationDistributionPerCategory( - String smallScaleCommercialTrafficType, RandomGenerator rng); + Map> createStopDurationDistributionPerCategory( + RandomGenerator rng); /** * Creates the distribution of the tour start and the related duration. * - * @param smallScaleCommercialTrafficType the type of the small scale commercial traffic * @return the distribution of the tour start and the related duration */ - EnumeratedDistribution createTourDistribution(String smallScaleCommercialTrafficType, RandomGenerator rng); + Map> createTourDistribution(RandomGenerator rng); /** * Creates the probability distribution for the tour start times for the day. diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/data/DefaultTourSpecificationsByUsingKID2002.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/data/DefaultTourSpecificationsByUsingKID2002.java index ec4bd9640ab..46f6887f0cd 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/data/DefaultTourSpecificationsByUsingKID2002.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/data/DefaultTourSpecificationsByUsingKID2002.java @@ -10,1279 +10,1787 @@ import java.util.List; import java.util.Map; -import static org.matsim.smallScaleCommercialTrafficGeneration.GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey; +import static org.matsim.smallScaleCommercialTrafficGeneration.GenerateSmallScaleCommercialTrafficDemand.makeServiceDurationPerCategoryKey; -public class DefaultTourSpecificationsByUsingKID2002 implements GetCommercialTourSpecifications { +public class DefaultTourSpecificationsByUsingKID2002 implements CommercialTourSpecifications { @Override - public Map> createStopDurationDistributionPerCategory(String smallScaleCommercialTrafficType, RandomGenerator rng) { - Map> stopDurationProbabilityDistribution = new HashMap<>(); + public Map> createStopDurationDistributionPerCategory( + RandomGenerator rng) { + Map> stopDurationProbabilityDistribution = new HashMap<>(); - if (smallScaleCommercialTrafficType.equals(GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString())) { - List> thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 30), 0.098)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 60), 0.17)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 90), 0.127)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.11)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 180), 0.17)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.076)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.057)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 360), 0.01)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(360, 420), 0.026)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 480), 0.045)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(480, 540), 0.064)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 600), 0.034)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(600, 720), 0.012)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(720, 840), 0.002)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Primary Sector",null), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + List> thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 30), 0.098)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 60), 0.17)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 90), 0.127)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.11)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 180), 0.17)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.076)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.057)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 360), 0.01)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(360, 420), 0.026)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 480), 0.045)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(480, 540), 0.064)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 600), 0.034)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(600, 720), 0.012)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(720, 840), 0.002)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Primary Sector", null, + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 30), 0.054)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 60), 0.164)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 90), 0.153)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.087)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 180), 0.12)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.055)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.044)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 360), 0.02)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(360, 420), 0.025)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 480), 0.069)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(480, 540), 0.132)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 600), 0.058)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(600, 720), 0.016)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(720, 840), 0.002)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Construction",null), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 30), 0.054)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 60), 0.164)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 90), 0.153)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.087)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 180), 0.12)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.055)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.044)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 360), 0.02)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(360, 420), 0.025)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 480), 0.069)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(480, 540), 0.132)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 600), 0.058)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(600, 720), 0.016)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(720, 840), 0.002)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Construction", null, + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 30), 0.13)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 60), 0.324)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 90), 0.178)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.108)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 180), 0.097)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.034)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.02)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 360), 0.018)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(360, 420), 0.02)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 480), 0.027)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(480, 540), 0.029)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 600), 0.008)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(600, 720), 0.006)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(720, 840), 0.001)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Secondary Sector Rest",null), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 30), 0.13)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 60), 0.324)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 90), 0.178)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.108)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 180), 0.097)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.034)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.02)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 360), 0.018)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(360, 420), 0.02)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 480), 0.027)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(480, 540), 0.029)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 600), 0.008)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(600, 720), 0.006)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(720, 840), 0.001)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Secondary Sector Rest", null, + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 30), 0.178)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 60), 0.301)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 90), 0.192)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.104)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 180), 0.092)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.043)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.013)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 360), 0.017)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(360, 420), 0.011)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 480), 0.016)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(480, 540), 0.016)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 600), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(600, 720), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(720, 840), 0.001)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Retail",null), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 30), 0.178)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 60), 0.301)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 90), 0.192)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.104)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 180), 0.092)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.043)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.013)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 360), 0.017)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(360, 420), 0.011)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 480), 0.016)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(480, 540), 0.016)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 600), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(600, 720), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(720, 840), 0.001)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Retail", null, + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 30), 0.144)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 60), 0.372)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 90), 0.203)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.069)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 180), 0.112)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.038)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.011)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 360), 0.011)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(360, 420), 0.011)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 480), 0.012)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(480, 540), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 600), 0.005)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(600, 720), 0.005)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Traffic/Parcels",null), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 30), 0.144)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 60), 0.372)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 90), 0.203)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.069)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 180), 0.112)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.038)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.011)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 360), 0.011)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(360, 420), 0.011)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 480), 0.012)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(480, 540), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 600), 0.005)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(600, 720), 0.005)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Traffic/Parcels", null, + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 30), 0.196)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 60), 0.292)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 90), 0.19)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.101)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 180), 0.105)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.034)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.017)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 360), 0.009)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(360, 420), 0.013)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 480), 0.019)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(480, 540), 0.014)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 600), 0.006)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(600, 720), 0.004)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(720, 840), 0.001)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Tertiary Sector Rest",null), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 30), 0.196)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 60), 0.292)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 90), 0.19)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.101)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 180), 0.105)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.034)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.017)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 360), 0.009)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(360, 420), 0.013)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 480), 0.019)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(480, 540), 0.014)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 600), 0.006)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(600, 720), 0.004)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(720, 840), 0.001)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Tertiary Sector Rest", null, + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - } else if (smallScaleCommercialTrafficType.equals(GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString())) { - List> thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.038)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.049)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.052)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.094)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.125)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.094)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.167)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.094)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.113)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.056)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.04)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.024)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.009)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.016)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.026)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.002)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Primary Sector", "vehTyp1"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.038)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.049)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.052)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.094)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.125)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.094)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.167)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.094)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.113)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.056)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.04)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.024)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.009)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.016)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.026)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.002)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Primary Sector", "vehTyp1", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.025)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.025)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.05)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.043)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.112)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.168)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.149)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.081)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.168)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.068)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.068)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.025)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.019)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Primary Sector", "vehTyp2"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.025)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.025)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.05)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.043)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.112)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.168)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.149)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.081)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.168)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.068)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.068)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.025)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.019)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Primary Sector", "vehTyp2", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.036)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.098)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.036)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.016)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.042)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.124)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.085)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.144)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.105)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.052)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.072)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.052)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.023)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.033)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.062)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.016)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(660, 780), 0.003)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Primary Sector", "vehTyp3"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.036)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.098)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.036)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.016)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.042)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.124)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.085)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.144)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.105)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.052)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.072)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.052)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.023)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.033)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.062)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.016)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(660, 780), 0.003)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Primary Sector", "vehTyp3", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.071)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.143)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.429)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.179)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.107)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.071)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Primary Sector", "vehTyp4"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.071)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.143)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.429)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.179)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.107)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.071)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Primary Sector", "vehTyp4", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.026)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.395)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.158)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.132)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.026)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.105)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.079)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.026)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.053)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Primary Sector", "vehTyp5"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.026)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.395)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.158)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.132)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.026)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.105)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.079)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.026)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.053)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Primary Sector", "vehTyp5", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.014)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.033)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.064)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.109)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.088)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.095)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.112)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.105)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.114)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.053)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.088)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.038)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.012)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.01)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.051)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.015)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Construction", "vehTyp1"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.014)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.033)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.064)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.109)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.088)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.095)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.112)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.105)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.114)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.053)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.088)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.038)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.012)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.01)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.051)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.015)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Construction", "vehTyp1", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.02)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.027)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.061)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.045)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.068)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.083)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.112)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.114)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.146)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.058)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.114)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.036)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.022)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.065)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.023)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Construction", "vehTyp2"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.02)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.027)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.061)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.045)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.068)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.083)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.112)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.114)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.146)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.058)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.114)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.036)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.022)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.065)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.023)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Construction", "vehTyp2", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.009)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.04)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.074)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.09)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.086)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.069)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.113)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.135)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.071)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.008)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.044)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.041)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.03)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.021)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.075)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.022)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Construction", "vehTyp3"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.009)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.04)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.074)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.09)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.086)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.069)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.113)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.135)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.071)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.008)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.044)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.041)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.03)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.021)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.075)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.022)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Construction", "vehTyp3", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.036)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.055)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.018)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.236)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.073)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.018)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.164)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.091)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.109)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.055)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.018)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.055)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.055)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.018)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Construction", "vehTyp4"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.036)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.055)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.018)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.236)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.073)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.018)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.164)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.091)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.109)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.055)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.018)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.055)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.055)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.018)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Construction", "vehTyp4", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.014)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.163)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.21)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.165)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.125)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.095)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.101)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.04)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.03)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.024)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.006)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.008)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.002)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.004)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.008)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.004)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Construction", "vehTyp5"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.014)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.163)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.21)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.165)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.125)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.095)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.101)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.04)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.03)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.024)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.006)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.008)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.002)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.004)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.008)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.004)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Construction", "vehTyp5", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.072)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.093)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.123)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.113)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.137)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.081)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.102)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.087)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.079)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.032)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.021)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.018)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.016)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.009)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.014)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 780), 0.002)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Secondary Sector Rest", "vehTyp1"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.072)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.093)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.123)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.113)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.137)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.081)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.102)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.087)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.079)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.032)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.021)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.018)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.016)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.009)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.014)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 780), 0.002)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Secondary Sector Rest", "vehTyp1", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.062)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.14)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.093)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.115)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.133)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.102)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.098)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.071)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.067)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.038)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.027)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.011)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.009)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.024)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.011)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Secondary Sector Rest", "vehTyp2"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.062)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.14)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.093)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.115)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.133)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.102)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.098)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.071)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.067)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.038)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.027)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.011)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.009)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.024)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.011)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Secondary Sector Rest", "vehTyp2", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.051)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.214)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.146)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.129)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.10)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.072)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.083)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.063)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.054)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.02)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.016)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.022)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.008)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.011)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 900), 0.003)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Secondary Sector Rest", "vehTyp3"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.051)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.214)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.146)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.129)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.10)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.072)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.083)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.063)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.054)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.02)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.016)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.022)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.008)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.011)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 900), 0.003)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Secondary Sector Rest", "vehTyp3", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.163)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.224)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.153)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.061)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.173)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.082)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.122)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.01)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.01)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Secondary Sector Rest", "vehTyp4"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.163)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.224)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.153)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.061)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.173)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.082)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.122)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.01)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.01)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Secondary Sector Rest", "vehTyp4", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.003)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.195)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.225)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.16)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.143)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.089)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.075)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.031)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.048)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.01)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.003)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 660), 0.009)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Secondary Sector Rest", "vehTyp5"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.003)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.195)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.225)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.16)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.143)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.089)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.075)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.031)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.048)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.01)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.003)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 660), 0.009)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Secondary Sector Rest", "vehTyp5", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.057)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.108)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.093)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.133)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.133)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.11)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.102)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.064)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.104)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.049)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.015)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.015)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.003)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.005)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.006)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.003)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Retail", "vehTyp1"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.057)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.108)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.093)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.133)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.133)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.11)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.102)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.064)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.104)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.049)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.015)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.015)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.003)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.005)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.006)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.003)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Retail", "vehTyp1", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.084)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.119)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.183)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.076)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.085)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.101)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.124)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.069)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.057)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.041)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.002)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.025)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.011)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.004)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(780, 900), 0.002)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Retail", "vehTyp2"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.084)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.119)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.183)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.076)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.085)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.101)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.124)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.069)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.057)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.041)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.002)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.025)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.011)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.004)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(780, 900), 0.002)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Retail", "vehTyp2", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.103)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.23)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.193)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.08)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.065)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.071)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.072)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.044)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.054)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.035)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.009)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.013)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.014)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.01)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.003)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.003)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Retail", "vehTyp3"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.103)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.23)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.193)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.08)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.065)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.071)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.072)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.044)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.054)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.035)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.009)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.013)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.014)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.01)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.003)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.003)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Retail", "vehTyp3", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.094)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.179)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.094)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.245)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.123)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.075)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.094)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.038)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.019)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.009)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.009)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.019)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Retail", "vehTyp4"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.094)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.179)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.094)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.245)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.123)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.075)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.094)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.038)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.019)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.009)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.009)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.019)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Retail", "vehTyp4", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.066)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.063)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.142)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.165)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.135)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.102)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.122)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.033)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.086)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.043)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.023)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.017)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.003)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Retail", "vehTyp5"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.066)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.063)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.142)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.165)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.135)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.102)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.122)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.033)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.086)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.043)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.023)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.017)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.003)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Retail", "vehTyp5", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.159)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.173)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.173)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.088)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.115)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.071)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.024)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.051)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.041)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.02)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.031)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.024)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.017)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.007)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Traffic/Parcels", "vehTyp1"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.159)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.173)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.173)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.088)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.115)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.071)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.024)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.051)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.041)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.02)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.031)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.024)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.017)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.007)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Traffic/Parcels", "vehTyp1", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.292)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.135)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.062)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.197)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.051)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.079)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.022)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.045)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.056)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.034)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.006)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.022)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Traffic/Parcels", "vehTyp2"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.292)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.135)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.062)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.197)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.051)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.079)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.022)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.045)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.056)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.034)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.006)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.022)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Traffic/Parcels", "vehTyp2", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.092)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.111)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.224)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.173)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.09)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.103)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.045)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.028)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.056)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.017)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.019)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.025)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.006)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.006)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Traffic/Parcels", "vehTyp3"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.092)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.111)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.224)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.173)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.09)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.103)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.045)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.028)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.056)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.017)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.019)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.025)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.006)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.006)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Traffic/Parcels", "vehTyp3", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.146)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.098)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.146)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.195)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.268)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.012)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.024)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.024)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.024)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.037)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.012)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.012)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Traffic/Parcels", "vehTyp4"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.146)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.098)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.146)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.195)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.268)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.012)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.024)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.024)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.024)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.037)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.012)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.012)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Traffic/Parcels", "vehTyp4", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.026)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.042)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.062)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.121)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.133)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.144)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.144)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.104)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.121)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.046)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.011)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.026)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.005)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 900), 0.008)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Traffic/Parcels", "vehTyp5"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.026)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.042)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.062)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.121)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.133)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.144)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.144)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.104)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.121)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.046)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.011)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.026)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.005)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 900), 0.008)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Traffic/Parcels", "vehTyp5", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.061)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.093)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.101)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.125)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.125)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.101)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.124)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.08)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.093)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.046)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.013)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.017)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.011)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.004)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.005)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Tertiary Sector Rest", "vehTyp1"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.061)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.093)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.101)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.125)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.125)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.101)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.124)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.08)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.093)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.046)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.013)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.017)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.011)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.004)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.005)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Tertiary Sector Rest", "vehTyp1", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.081)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.101)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.101)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.109)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.124)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.065)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.109)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.124)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.097)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.032)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.022)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.017)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.003)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.008)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Tertiary Sector Rest", "vehTyp2"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.081)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.101)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.101)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.109)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.124)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.065)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.109)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.124)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.097)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.032)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.022)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.017)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.003)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.008)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Tertiary Sector Rest", "vehTyp2", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.052)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.114)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.155)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.111)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.151)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.112)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.125)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.043)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.051)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.026)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.014)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.016)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.011)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.009)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(660, 780), 0.003)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Tertiary Sector Rest", "vehTyp3"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.052)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.114)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.155)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.111)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.151)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.112)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.125)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.043)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.051)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.026)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.014)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.016)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.011)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.009)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(660, 780), 0.003)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Tertiary Sector Rest", "vehTyp3", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.02)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.082)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.102)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.449)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.061)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.163)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.102)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.02)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Tertiary Sector Rest", "vehTyp4"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.02)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.082)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.102)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.449)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.061)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.163)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.102)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.02)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Tertiary Sector Rest", "vehTyp4", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.02)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.02)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.151)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.296)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.156)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.065)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.121)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.05)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.075)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.01)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.015)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.01)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.005)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.005)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Employee Tertiary Sector Rest", "vehTyp5"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.02)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.02)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.151)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.296)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.156)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.065)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.121)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.05)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.075)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.01)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.015)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.01)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.005)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.005)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Employee Tertiary Sector Rest", "vehTyp5", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - // because no data für private persons; use average numbers of all employee categories - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.056)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.084)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.095)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.118)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.12)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.096)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.112)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.083)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.095)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.045)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.033)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.022)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.011)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.018)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.004)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Inhabitants", "vehTyp1"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + // because no data für private persons; use average numbers of all employee categories + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.056)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.084)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.095)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.118)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.12)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.096)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.112)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.083)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.095)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.045)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.033)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.022)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.011)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.018)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.004)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Inhabitants", "vehTyp1", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.077)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.093)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.103)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.092)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.098)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.091)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.108)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.092)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.095)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.043)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.035)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.024)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.01)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.011)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.021)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.007)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Inhabitants", "vehTyp2"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.077)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.093)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.103)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.092)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.098)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.091)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.108)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.092)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.095)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.043)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.035)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.024)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.01)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.011)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.021)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.007)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Inhabitants", "vehTyp2", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.06)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.141)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.152)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.107)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.094)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.087)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.089)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.067)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.06)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.037)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.023)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.025)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.015)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.012)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.024)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.006)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(660, 780), 0.001)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Inhabitants", "vehTyp3"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.06)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.141)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.152)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.107)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.094)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.087)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.089)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.067)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.06)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.037)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.023)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.025)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.015)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.012)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.024)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.006)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(660, 780), 0.001)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Inhabitants", "vehTyp3", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.062)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.11)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.12)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.144)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.151)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.129)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.062)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.079)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.041)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.031)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.019)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.014)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.014)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.014)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.002)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Inhabitants", "vehTyp4"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.062)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.11)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.12)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.144)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.151)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.129)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.062)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.079)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.041)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.031)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.019)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.014)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.014)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 540), 0.014)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(540, 660), 0.002)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Inhabitants", "vehTyp4", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); + + thisStopDurationProbabilityDistribution = new ArrayList<>(); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.024)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.099)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.147)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.17)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.133)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.108)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.116)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.058)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.075)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.03)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.01)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.014)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.005)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.004)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 660), 0.007)); + thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(660, 900), 0.002)); + stopDurationProbabilityDistribution.put(makeServiceDurationPerCategoryKey("Inhabitants", "vehTyp5", + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString()), + new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); + thisStopDurationProbabilityDistribution.clear(); - thisStopDurationProbabilityDistribution = new ArrayList<>(); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(0, 10), 0.024)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(10, 20), 0.099)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(20, 30), 0.147)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(30, 40), 0.17)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(40, 50), 0.133)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(50, 60), 0.108)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(60, 75), 0.116)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(75, 90), 0.058)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(90, 120), 0.075)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(120, 150), 0.03)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(150, 180), 0.01)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(180, 240), 0.014)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(240, 300), 0.005)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(300, 420), 0.004)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(420, 660), 0.007)); - thisStopDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.DurationsBounds(660, 900), 0.002)); - stopDurationProbabilityDistribution.put(makeStopDurationGoodTrafficKey("Inhabitants", "vehTyp5"), - new EnumeratedDistribution<>(rng, thisStopDurationProbabilityDistribution)); - thisStopDurationProbabilityDistribution.clear(); - } return stopDurationProbabilityDistribution; } @Override - public EnumeratedDistribution createTourDistribution( - String smallScaleCommercialTrafficType, RandomGenerator rng) { + public Map> createTourDistribution( + RandomGenerator rng) { + Map> tourDistribution = new HashMap<>(); List> tourDurationProbabilityDistribution = new ArrayList<>(); - if (smallScaleCommercialTrafficType.equals(GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString())) { + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 0.0, 30.0), 0.0005917893035900173)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 30.0, 60.0), 0.00021859484237437887)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 90.0, 120.0), 0.00037490287407786324)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 120.0, 180.0), 0.0004337321926125666)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 180.0, 240.0), 0.0005834182239827621)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 240.0, 300.0), 0.0005116938323661723)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 300.0, 360.0), 0.0005027065159573272)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 360.0, 420.0), 0.0006719740164147071)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 420.0, 480.0), 0.00022375027665644004)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 480.0, 540.0), 0.00022103749529549306)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 540.0, 600.0), 0.00022119440831885122)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 600.0, 660.0), 0.0002732185104003396)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 660.0, 720.0), 7.287567629774946e-05)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 720.0, 780.0), 0.0005090670761685264)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 780.0, 840.0), 0.0002169454122557984)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 840.0, 1080.0), 0.0016947794402011696)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 0.0, 30.0), 0.00033050926084770643)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 30.0, 60.0), 0.0004963985976117265)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 60.0, 90.0), 0.0009458837608304906)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 90.0, 120.0), 0.0006507941771038976)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 120.0, 180.0), 0.0002949035696660126)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 180.0, 240.0), 0.0005812406149568905)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 240.0, 300.0), 0.00072666224822023)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 300.0, 360.0), 0.0006017750128936798)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 360.0, 420.0), 0.0007696491628020603)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 420.0, 480.0), 0.0006951014583380694)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 480.0, 540.0), 0.0006675367479652174)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 540.0, 600.0), 0.0009951412624367468)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 600.0, 660.0), 0.0006193958232902363)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 660.0, 720.0), 0.0005496335422364244)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 720.0, 780.0), 0.000963763774344583)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 780.0, 840.0), 0.001585152586657775)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 840.0, 1080.0), 0.0022779973751500433)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 0.0, 30.0), 0.003678291745870938)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 30.0, 60.0), 0.0037749680865755936)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 60.0, 90.0), 0.0021464058981758467)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 90.0, 120.0), 0.0010105726369455444)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 120.0, 180.0), 0.0017166729332290624)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 180.0, 240.0), 0.001218657902054598)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 240.0, 300.0), 0.0019212859349972463)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 300.0, 360.0), 0.0018498349748915703)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 360.0, 420.0), 0.0020820722844894844)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 420.0, 480.0), 0.0033255032578691536)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 480.0, 540.0), 0.004499580798913233)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 540.0, 600.0), 0.004508722079694882)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 600.0, 660.0), 0.009460453046374911)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 660.0, 720.0), 0.008632039128635343)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 720.0, 780.0), 0.005173130409039029)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 780.0, 840.0), 0.0021287189901771954)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 840.0, 1080.0), 0.002735246591728173)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 0.0, 30.0), 0.015534599731489868)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 30.0, 60.0), 0.009424737666749776)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 60.0, 90.0), 0.003979757502241877)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 90.0, 120.0), 0.0026219034509082214)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 120.0, 180.0), 0.004373894821911171)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 180.0, 240.0), 0.005349695968407728)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 240.0, 300.0), 0.008398668008895199)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 300.0, 360.0), 0.013017576110359298)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 360.0, 420.0), 0.013178466937493282)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 420.0, 480.0), 0.015799261066253244)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 480.0, 540.0), 0.031932993774084484)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 540.0, 600.0), 0.056976770375347194)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 600.0, 660.0), 0.03411514635058722)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 660.0, 720.0), 0.010952547256934878)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 720.0, 780.0), 0.005071677294689363)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 780.0, 840.0), 0.002758017802376135)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 840.0, 1080.0), 0.003182481371327368)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 0.0, 30.0), 0.018010507239762663)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 30.0, 60.0), 0.009246211080247332)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 60.0, 90.0), 0.006297103845359016)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 90.0, 120.0), 0.003415561088528113)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 120.0, 180.0), 0.010918022744746231)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 180.0, 240.0), 0.011371721163141522)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 240.0, 300.0), 0.01861910064916215)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 300.0, 360.0), 0.015443374909900384)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 360.0, 420.0), 0.020470726990450452)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 420.0, 480.0), 0.030727618880727087)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 480.0, 540.0), 0.07364088624635841)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 540.0, 600.0), 0.04082061588575034)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 600.0, 660.0), 0.012935881167590665)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 660.0, 720.0), 0.005469250367916343)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 720.0, 780.0), 0.0030030673084490513)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 780.0, 840.0), 0.0011042643367551329)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 840.0, 1080.0), 0.0011327583672022575)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 0.0, 30.0), 0.015589932735904798)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 30.0, 60.0), 0.007157798082590814)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 60.0, 90.0), 0.006563655710107534)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 90.0, 120.0), 0.004888423230467872)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 120.0, 180.0), 0.01261126944262904)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 180.0, 240.0), 0.013275311108363174)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 240.0, 300.0), 0.011059737216827653)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 300.0, 360.0), 0.00980644443311104)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 360.0, 420.0), 0.013476523854959467)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 420.0, 480.0), 0.01766932338862498)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 480.0, 540.0), 0.013855266610087914)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 540.0, 600.0), 0.006090238569895901)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 600.0, 660.0), 0.00326688741194661)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 660.0, 720.0), 0.0009742217966822537)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 720.0, 780.0), 0.0008462163162537791)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 780.0, 840.0), 0.0009357453082055104)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 840.0, 1080.0), 0.0006867783494497427)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 0.0, 30.0), 0.011836581569331607)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 30.0, 60.0), 0.0060475163532472224)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 60.0, 90.0), 0.006091033719221284)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 90.0, 120.0), 0.004870323217391879)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 120.0, 180.0), 0.009852214102720915)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 180.0, 240.0), 0.006649077724867284)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 240.0, 300.0), 0.006549809619698136)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 300.0, 360.0), 0.00743649188225418)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 360.0, 420.0), 0.008370330719772223)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 420.0, 480.0), 0.006055410372169952)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 480.0, 540.0), 0.003221026290023441)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 540.0, 600.0), 0.00270804359225063)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 600.0, 660.0), 0.0011328763880567346)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 660.0, 720.0), 0.0005295062815147344)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 720.0, 780.0), 0.0005244739409173669)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 780.0, 840.0), 0.00022261373811852168)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 840.0, 1080.0), 0.0002976820307410009)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 0.0, 30.0), 0.0072347359578799255)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 30.0, 60.0), 0.005528762818372258)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 60.0, 90.0), 0.004301874597910846)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 90.0, 120.0), 0.002706271535768685)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 120.0, 180.0), 0.004461225555303183)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 180.0, 240.0), 0.003289266637558867)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 240.0, 300.0), 0.004773112389257731)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 300.0, 360.0), 0.004153307715767419)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 360.0, 420.0), 0.0023002274828502435)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 420.0, 480.0), 0.002295722460734858)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 480.0, 540.0), 0.0008008191218782178)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 540.0, 600.0), 0.0005302938593833011)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 600.0, 660.0), 0.00012017333498779025)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 660.0, 720.0), 0.00029497120761336085)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 720.0, 780.0), 7.442207741095891e-05)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 780.0, 840.0), 7.491510042413546e-05)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 0.0, 30.0), 0.005979044848708125)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 30.0, 60.0), 0.0030727725862362003)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 60.0, 90.0), 0.0018328582061095421)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 90.0, 120.0), 0.0015730248216810105)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 120.0, 180.0), 0.0025909176745678485)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 180.0, 240.0), 0.0023584284876344117)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 240.0, 300.0), 0.002888683132930499)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 300.0, 360.0), 0.0026723295114103734)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 360.0, 420.0), 0.001368034507711622)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 420.0, 480.0), 0.001322142609646873)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 480.0, 540.0), 0.00014896322977011863)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 540.0, 600.0), 0.00036793050573151096)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 600.0, 660.0), 0.0003024749417379503)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 660.0, 720.0), 7.263766179594998e-05)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 720.0, 780.0), 7.737798495114381e-05)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 840.0, 1080.0), 7.360037219024495e-05)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 0.0, 30.0), 0.005442934607459622)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 30.0, 60.0), 0.0023099603288455053)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 60.0, 90.0), 0.0015476125810207045)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 90.0, 120.0), 0.0015690710859882222)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 120.0, 180.0), 0.003155552178314994)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 180.0, 240.0), 0.0024715148201473933)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 240.0, 300.0), 0.00214638868043489)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 300.0, 360.0), 0.0017134793037846727)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 360.0, 420.0), 0.0009684921868733149)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 420.0, 480.0), 0.0005519992558366529)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 480.0, 540.0), 0.0004441672064981391)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 540.0, 600.0), 0.00022332686365997108)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 600.0, 660.0), 0.00023780343565208111)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 660.0, 720.0), 0.00014898555439278127)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 0.0, 30.0), 0.0065652971880044205)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 30.0, 60.0), 0.0033645458423904226)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 60.0, 90.0), 0.002247264924524252)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 90.0, 120.0), 0.0021755851670695867)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 120.0, 180.0), 0.00292250684836152)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 180.0, 240.0), 0.0029939610328467135)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 240.0, 300.0), 0.0013771262994841458)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 300.0, 360.0), 0.0005929387919824101)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 360.0, 420.0), 0.0007299574379337656)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 420.0, 480.0), 0.00015161310680499916)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 480.0, 540.0), 0.00022326623210165028)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 540.0, 600.0), 0.00021908720500178134)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 0.0, 30.0), 0.004700575755513116)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 30.0, 60.0), 0.002876930233578738)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 60.0, 90.0), 0.0012326059557891803)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 90.0, 120.0), 0.001688513011030605)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 120.0, 180.0), 0.0024148215923521744)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 180.0, 240.0), 0.0009664823712470381)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 240.0, 300.0), 0.0008158516384741175)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 300.0, 360.0), 0.0005326476409500361)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 360.0, 420.0), 0.00037447250704764534)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 420.0, 480.0), 7.278074100962308e-05)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 480.0, 540.0), 0.00015460621875651884)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 540.0, 600.0), 0.00022625636961834557)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 840.0, 1080.0), 7.369704340227916e-05)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 0.0, 30.0), 0.005421542133242069)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 30.0, 60.0), 0.0028543297205245563)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 60.0, 90.0), 0.001320449445343739)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 90.0, 120.0), 0.0011372744623221703)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 120.0, 180.0), 0.0011175546229352943)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 180.0, 240.0), 0.0005212091408906178)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 240.0, 300.0), 0.00025063117439263165)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 300.0, 360.0), 0.0002906557976189996)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 360.0, 420.0), 6.934683987097806e-05)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 420.0, 480.0), 7.198332684426051e-05)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 0.0, 30.0), 0.005997678933359281)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 30.0, 60.0), 0.0014450238860978966)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 60.0, 90.0), 0.0008909835110546583)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 90.0, 120.0), 0.0008692603958852261)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 120.0, 180.0), 0.0004645626068627116)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 180.0, 240.0), 0.0005161866418057845)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 240.0, 300.0), 0.00047492492382272117)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 300.0, 360.0), 7.348989097075777e-05)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 360.0, 420.0), 0.0003000342936128893)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 0.0, 30.0), 0.004621906661329853)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 30.0, 60.0), 0.0015152391398060199)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 60.0, 90.0), 0.0006769045119123614)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 90.0, 120.0), 0.00044820275277284946)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 120.0, 180.0), 0.0007140653752077821)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 180.0, 240.0), 0.0001502672132808765)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 240.0, 300.0), 0.0003842231300012746)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 300.0, 360.0), 0.00021634404805889257)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 0.0, 30.0), 0.0034023082743939916)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 30.0, 60.0), 0.0006251774232962365)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 60.0, 90.0), 0.00022163965781205308)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 90.0, 120.0), 7.360037219024495e-05)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 120.0, 180.0), 0.00045934601255169126)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 180.0, 240.0), 7.511874968194916e-05)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 240.0, 300.0), 0.0001486019187134722)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 300.0, 360.0), 7.505084488366769e-05)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 420.0, 480.0), 7.594714627228585e-05)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 0.0, 30.0), 0.005137034953520923)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 30.0, 60.0), 0.0010774703023578233)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 60.0, 90.0), 0.00048539418673270443)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 90.0, 120.0), 0.0002988049182984063)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 120.0, 180.0), 0.00032644209078127245)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 180.0, 240.0), 0.0005357497395368892)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 240.0, 300.0), 0.0002944914928100358)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 300.0, 360.0), 0.00022851651374757815)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 0.0, 30.0), 0.0005917893035900173)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 30.0, 60.0), 0.00021859484237437887)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 90.0, 120.0), 0.00037490287407786324)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 120.0, 180.0), 0.0004337321926125666)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 180.0, 240.0), 0.0005834182239827621)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 240.0, 300.0), 0.0005116938323661723)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 300.0, 360.0), 0.0005027065159573272)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 360.0, 420.0), 0.0006719740164147071)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 420.0, 480.0), 0.00022375027665644004)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 480.0, 540.0), 0.00022103749529549306)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 540.0, 600.0), 0.00022119440831885122)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 600.0, 660.0), 0.0002732185104003396)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 660.0, 720.0), 7.287567629774946e-05)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 720.0, 780.0), 0.0005090670761685264)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 780.0, 840.0), 0.0002169454122557984)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 840.0, 1080.0), 0.0016947794402011696)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 0.0, 30.0), 0.00033050926084770643)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 30.0, 60.0), 0.0004963985976117265)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 60.0, 90.0), 0.0009458837608304906)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 90.0, 120.0), 0.0006507941771038976)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 120.0, 180.0), 0.0002949035696660126)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 180.0, 240.0), 0.0005812406149568905)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 240.0, 300.0), 0.00072666224822023)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 300.0, 360.0), 0.0006017750128936798)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 360.0, 420.0), 0.0007696491628020603)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 420.0, 480.0), 0.0006951014583380694)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 480.0, 540.0), 0.0006675367479652174)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 540.0, 600.0), 0.0009951412624367468)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 600.0, 660.0), 0.0006193958232902363)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 660.0, 720.0), 0.0005496335422364244)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 720.0, 780.0), 0.000963763774344583)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 780.0, 840.0), 0.001585152586657775)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 840.0, 1080.0), 0.0022779973751500433)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 0.0, 30.0), 0.003678291745870938)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 30.0, 60.0), 0.0037749680865755936)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 60.0, 90.0), 0.0021464058981758467)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 90.0, 120.0), 0.0010105726369455444)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 120.0, 180.0), 0.0017166729332290624)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 180.0, 240.0), 0.001218657902054598)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 240.0, 300.0), 0.0019212859349972463)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 300.0, 360.0), 0.0018498349748915703)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 360.0, 420.0), 0.0020820722844894844)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 420.0, 480.0), 0.0033255032578691536)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 480.0, 540.0), 0.004499580798913233)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 540.0, 600.0), 0.004508722079694882)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 600.0, 660.0), 0.009460453046374911)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 660.0, 720.0), 0.008632039128635343)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 720.0, 780.0), 0.005173130409039029)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 780.0, 840.0), 0.0021287189901771954)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 840.0, 1080.0), 0.002735246591728173)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 0.0, 30.0), 0.015534599731489868)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 30.0, 60.0), 0.009424737666749776)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 60.0, 90.0), 0.003979757502241877)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 90.0, 120.0), 0.0026219034509082214)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 120.0, 180.0), 0.004373894821911171)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 180.0, 240.0), 0.005349695968407728)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 240.0, 300.0), 0.008398668008895199)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 300.0, 360.0), 0.013017576110359298)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 360.0, 420.0), 0.013178466937493282)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 420.0, 480.0), 0.015799261066253244)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 480.0, 540.0), 0.031932993774084484)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 540.0, 600.0), 0.056976770375347194)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 600.0, 660.0), 0.03411514635058722)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 660.0, 720.0), 0.010952547256934878)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 720.0, 780.0), 0.005071677294689363)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 780.0, 840.0), 0.002758017802376135)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 840.0, 1080.0), 0.003182481371327368)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 0.0, 30.0), 0.018010507239762663)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 30.0, 60.0), 0.009246211080247332)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 60.0, 90.0), 0.006297103845359016)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 90.0, 120.0), 0.003415561088528113)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 120.0, 180.0), 0.010918022744746231)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 180.0, 240.0), 0.011371721163141522)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 240.0, 300.0), 0.01861910064916215)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 300.0, 360.0), 0.015443374909900384)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 360.0, 420.0), 0.020470726990450452)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 420.0, 480.0), 0.030727618880727087)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 480.0, 540.0), 0.07364088624635841)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 540.0, 600.0), 0.04082061588575034)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 600.0, 660.0), 0.012935881167590665)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 660.0, 720.0), 0.005469250367916343)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 720.0, 780.0), 0.0030030673084490513)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 780.0, 840.0), 0.0011042643367551329)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 840.0, 1080.0), 0.0011327583672022575)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 0.0, 30.0), 0.015589932735904798)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 30.0, 60.0), 0.007157798082590814)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 60.0, 90.0), 0.006563655710107534)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 90.0, 120.0), 0.004888423230467872)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 120.0, 180.0), 0.01261126944262904)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 180.0, 240.0), 0.013275311108363174)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 240.0, 300.0), 0.011059737216827653)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 300.0, 360.0), 0.00980644443311104)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 360.0, 420.0), 0.013476523854959467)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 420.0, 480.0), 0.01766932338862498)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 480.0, 540.0), 0.013855266610087914)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 540.0, 600.0), 0.006090238569895901)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 600.0, 660.0), 0.00326688741194661)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 660.0, 720.0), 0.0009742217966822537)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 720.0, 780.0), 0.0008462163162537791)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 780.0, 840.0), 0.0009357453082055104)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 840.0, 1080.0), 0.0006867783494497427)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 0.0, 30.0), 0.011836581569331607)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 30.0, 60.0), 0.0060475163532472224)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 60.0, 90.0), 0.006091033719221284)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 90.0, 120.0), 0.004870323217391879)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 120.0, 180.0), 0.009852214102720915)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 180.0, 240.0), 0.006649077724867284)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 240.0, 300.0), 0.006549809619698136)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 300.0, 360.0), 0.00743649188225418)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 360.0, 420.0), 0.008370330719772223)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 420.0, 480.0), 0.006055410372169952)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 480.0, 540.0), 0.003221026290023441)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 540.0, 600.0), 0.00270804359225063)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 600.0, 660.0), 0.0011328763880567346)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 660.0, 720.0), 0.0005295062815147344)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 720.0, 780.0), 0.0005244739409173669)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 780.0, 840.0), 0.00022261373811852168)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 840.0, 1080.0), 0.0002976820307410009)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 0.0, 30.0), 0.0072347359578799255)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 30.0, 60.0), 0.005528762818372258)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 60.0, 90.0), 0.004301874597910846)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 90.0, 120.0), 0.002706271535768685)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 120.0, 180.0), 0.004461225555303183)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 180.0, 240.0), 0.003289266637558867)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 240.0, 300.0), 0.004773112389257731)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 300.0, 360.0), 0.004153307715767419)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 360.0, 420.0), 0.0023002274828502435)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 420.0, 480.0), 0.002295722460734858)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 480.0, 540.0), 0.0008008191218782178)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 540.0, 600.0), 0.0005302938593833011)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 600.0, 660.0), 0.00012017333498779025)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 660.0, 720.0), 0.00029497120761336085)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 720.0, 780.0), 7.442207741095891e-05)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 780.0, 840.0), 7.491510042413546e-05)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 0.0, 30.0), 0.005979044848708125)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 30.0, 60.0), 0.0030727725862362003)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 60.0, 90.0), 0.0018328582061095421)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 90.0, 120.0), 0.0015730248216810105)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 120.0, 180.0), 0.0025909176745678485)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 180.0, 240.0), 0.0023584284876344117)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 240.0, 300.0), 0.002888683132930499)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 300.0, 360.0), 0.0026723295114103734)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 360.0, 420.0), 0.001368034507711622)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 420.0, 480.0), 0.001322142609646873)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 480.0, 540.0), 0.00014896322977011863)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 540.0, 600.0), 0.00036793050573151096)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 600.0, 660.0), 0.0003024749417379503)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 660.0, 720.0), 7.263766179594998e-05)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 720.0, 780.0), 7.737798495114381e-05)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 840.0, 1080.0), 7.360037219024495e-05)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 0.0, 30.0), 0.005442934607459622)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 30.0, 60.0), 0.0023099603288455053)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 60.0, 90.0), 0.0015476125810207045)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 90.0, 120.0), 0.0015690710859882222)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 120.0, 180.0), 0.003155552178314994)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 180.0, 240.0), 0.0024715148201473933)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 240.0, 300.0), 0.00214638868043489)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 300.0, 360.0), 0.0017134793037846727)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 360.0, 420.0), 0.0009684921868733149)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 420.0, 480.0), 0.0005519992558366529)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 480.0, 540.0), 0.0004441672064981391)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 540.0, 600.0), 0.00022332686365997108)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 600.0, 660.0), 0.00023780343565208111)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 660.0, 720.0), 0.00014898555439278127)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 0.0, 30.0), 0.0065652971880044205)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 30.0, 60.0), 0.0033645458423904226)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 60.0, 90.0), 0.002247264924524252)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 90.0, 120.0), 0.0021755851670695867)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 120.0, 180.0), 0.00292250684836152)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 180.0, 240.0), 0.0029939610328467135)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 240.0, 300.0), 0.0013771262994841458)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 300.0, 360.0), 0.0005929387919824101)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 360.0, 420.0), 0.0007299574379337656)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 420.0, 480.0), 0.00015161310680499916)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 480.0, 540.0), 0.00022326623210165028)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 540.0, 600.0), 0.00021908720500178134)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 0.0, 30.0), 0.004700575755513116)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 30.0, 60.0), 0.002876930233578738)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 60.0, 90.0), 0.0012326059557891803)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 90.0, 120.0), 0.001688513011030605)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 120.0, 180.0), 0.0024148215923521744)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 180.0, 240.0), 0.0009664823712470381)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 240.0, 300.0), 0.0008158516384741175)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 300.0, 360.0), 0.0005326476409500361)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 360.0, 420.0), 0.00037447250704764534)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 420.0, 480.0), 7.278074100962308e-05)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 480.0, 540.0), 0.00015460621875651884)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 540.0, 600.0), 0.00022625636961834557)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 840.0, 1080.0), 7.369704340227916e-05)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 0.0, 30.0), 0.005421542133242069)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 30.0, 60.0), 0.0028543297205245563)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 60.0, 90.0), 0.001320449445343739)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 90.0, 120.0), 0.0011372744623221703)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 120.0, 180.0), 0.0011175546229352943)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 180.0, 240.0), 0.0005212091408906178)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 240.0, 300.0), 0.00025063117439263165)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 300.0, 360.0), 0.0002906557976189996)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 360.0, 420.0), 6.934683987097806e-05)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 420.0, 480.0), 7.198332684426051e-05)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 0.0, 30.0), 0.005997678933359281)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 30.0, 60.0), 0.0014450238860978966)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 60.0, 90.0), 0.0008909835110546583)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 90.0, 120.0), 0.0008692603958852261)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 120.0, 180.0), 0.0004645626068627116)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 180.0, 240.0), 0.0005161866418057845)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 240.0, 300.0), 0.00047492492382272117)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 300.0, 360.0), 7.348989097075777e-05)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 360.0, 420.0), 0.0003000342936128893)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 0.0, 30.0), 0.004621906661329853)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 30.0, 60.0), 0.0015152391398060199)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 60.0, 90.0), 0.0006769045119123614)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 90.0, 120.0), 0.00044820275277284946)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 120.0, 180.0), 0.0007140653752077821)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 180.0, 240.0), 0.0001502672132808765)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 240.0, 300.0), 0.0003842231300012746)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 300.0, 360.0), 0.00021634404805889257)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 0.0, 30.0), 0.0034023082743939916)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 30.0, 60.0), 0.0006251774232962365)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 60.0, 90.0), 0.00022163965781205308)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 90.0, 120.0), 7.360037219024495e-05)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 120.0, 180.0), 0.00045934601255169126)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 180.0, 240.0), 7.511874968194916e-05)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 240.0, 300.0), 0.0001486019187134722)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 300.0, 360.0), 7.505084488366769e-05)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 420.0, 480.0), 7.594714627228585e-05)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 0.0, 30.0), 0.005137034953520923)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 30.0, 60.0), 0.0010774703023578233)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 60.0, 90.0), 0.00048539418673270443)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 90.0, 120.0), 0.0002988049182984063)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 120.0, 180.0), 0.00032644209078127245)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 180.0, 240.0), 0.0005357497395368892)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 240.0, 300.0), 0.0002944914928100358)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 300.0, 360.0), 0.00022851651374757815)); - } - else if (smallScaleCommercialTrafficType.equals(GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString())) { + tourDistribution.put(GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString(), + new EnumeratedDistribution<>(rng, tourDurationProbabilityDistribution)); + tourDurationProbabilityDistribution.clear(); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 0.0, 30.0), 0.0002666800577200411)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 30.0, 60.0), 0.0006395055678719748)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 60.0, 90.0), 0.0007110769046958423)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 90.0, 120.0), 0.0006665961628449491)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 120.0, 180.0), 0.0023195866923785575)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 180.0, 240.0), 0.00261751319938476)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 240.0, 300.0), 0.0021430032453503087)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 300.0, 360.0), 0.0029303876579925905)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 360.0, 420.0), 0.00283576618143643)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 420.0, 480.0), 0.0027188265347502893)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 480.0, 540.0), 0.002597768116531099)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 540.0, 600.0), 0.002659151494701916)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 600.0, 660.0), 0.0021738406044924437)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 660.0, 720.0), 0.0021949848461843176)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 720.0, 780.0), 0.0021801193011023083)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 780.0, 840.0), 0.001746033717539671)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 840.0, 1080.0), 0.00350888397405923)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 0.0, 30.0), 0.0006845643884312735)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 30.0, 60.0), 0.0004003126952082357)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 60.0, 90.0), 0.0008155012585632697)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 90.0, 120.0), 0.0010930534970200114)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 120.0, 180.0), 0.0011760353713952051)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 180.0, 240.0), 0.0019364061980548415)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 240.0, 300.0), 0.002953452881036028)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 300.0, 360.0), 0.002589370165068672)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 360.0, 420.0), 0.0025604405819583055)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 420.0, 480.0), 0.0034319041631081476)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 480.0, 540.0), 0.0033480025727905907)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 540.0, 600.0), 0.002175717502193024)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 600.0, 660.0), 0.0028036478238686957)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 660.0, 720.0), 0.0028759635193342887)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 720.0, 780.0), 0.0017584406503249872)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 780.0, 840.0), 0.0016742001219093045)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 840.0, 1080.0), 0.0020658205220468245)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 0.0, 30.0), 0.0017247403950228777)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 30.0, 60.0), 0.003090998236080484)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 60.0, 90.0), 0.0015209554995803177)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 90.0, 120.0), 0.0016533392810110293)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 120.0, 180.0), 0.003732306124403562)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 180.0, 240.0), 0.004106247357091271)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 240.0, 300.0), 0.003188442431357427)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 300.0, 360.0), 0.005929370570550301)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 360.0, 420.0), 0.005992695595693005)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 420.0, 480.0), 0.006390572360276255)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 480.0, 540.0), 0.00993732232424166)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 540.0, 600.0), 0.007917613781985494)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 600.0, 660.0), 0.00753055040114282)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 660.0, 720.0), 0.004839531706746983)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 720.0, 780.0), 0.003571294178536547)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 780.0, 840.0), 0.0022261075091276465)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 840.0, 1080.0), 0.0020123396391017526)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 0.0, 30.0), 0.00553085745500388)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 30.0, 60.0), 0.005164301035284355)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 60.0, 90.0), 0.0034287284279468384)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 90.0, 120.0), 0.003359657704287739)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 120.0, 180.0), 0.005963896679549981)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 180.0, 240.0), 0.006376396116305889)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 240.0, 300.0), 0.011553162434249647)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 300.0, 360.0), 0.01216390369869719)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 360.0, 420.0), 0.015303642980241483)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 420.0, 480.0), 0.01894502604909179)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 480.0, 540.0), 0.026995818384739457)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 540.0, 600.0), 0.03735238580259259)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 600.0, 660.0), 0.02007351137947408)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 660.0, 720.0), 0.007579189226621267)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 720.0, 780.0), 0.003806896198418994)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 780.0, 840.0), 0.0020371212990837376)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 840.0, 1080.0), 0.00246729057836831)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 0.0, 30.0), 0.007834929725170775)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 30.0, 60.0), 0.007875284751511802)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 60.0, 90.0), 0.0056369706407995695)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 90.0, 120.0), 0.007252792818630801)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 120.0, 180.0), 0.011595289158181222)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 180.0, 240.0), 0.01584695155572567)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 240.0, 300.0), 0.019385993489144607)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 300.0, 360.0), 0.01804569113072999)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 360.0, 420.0), 0.020338168968415053)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 420.0, 480.0), 0.03244941203821404)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 480.0, 540.0), 0.046986423884473)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 540.0, 600.0), 0.026127574804977814)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 600.0, 660.0), 0.006859707180170414)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 660.0, 720.0), 0.004053368732850601)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 720.0, 780.0), 0.0017728320836715625)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 780.0, 840.0), 0.0008117046283836942)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 840.0, 1080.0), 0.0014889766393137468)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 0.0, 30.0), 0.008702611915372131)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 30.0, 60.0), 0.009703391735884857)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 60.0, 90.0), 0.00833249802530372)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 90.0, 120.0), 0.008160824294542027)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 120.0, 180.0), 0.014522058792957903)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 180.0, 240.0), 0.019189639247661674)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 240.0, 300.0), 0.022628081955363144)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 300.0, 360.0), 0.018168175275565253)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 360.0, 420.0), 0.01830766579908246)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 420.0, 480.0), 0.022414786327228577)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 480.0, 540.0), 0.015454698179801149)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 540.0, 600.0), 0.00743339793333549)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 600.0, 660.0), 0.0028959167218627997)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 660.0, 720.0), 0.0011608823477359163)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 720.0, 780.0), 0.0006126324367099846)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 780.0, 840.0), 0.0007090395380022889)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 840.0, 1080.0), 0.0009650931773638335)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 0.0, 30.0), 0.010532384705529854)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 30.0, 60.0), 0.010106787618396446)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 60.0, 90.0), 0.007305519187631069)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 90.0, 120.0), 0.0065298278976416635)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 120.0, 180.0), 0.012991661099288086)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 180.0, 240.0), 0.011082392048301831)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 240.0, 300.0), 0.013735041027849332)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 300.0, 360.0), 0.012921165569106639)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 360.0, 420.0), 0.010187951930469277)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 420.0, 480.0), 0.0070071162811467125)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 480.0, 540.0), 0.003478434072337058)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 540.0, 600.0), 0.002487434148850001)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 600.0, 660.0), 0.0007617139935295275)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 660.0, 720.0), 0.0004794259473854554)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 720.0, 780.0), 0.00011828408353297643)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 780.0, 840.0), 0.0009221448817170415)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 0.0, 30.0), 0.0053803765038808364)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 30.0, 60.0), 0.00748440387556175)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 60.0, 90.0), 0.003817044622559703)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 90.0, 120.0), 0.0042559767658946045)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 120.0, 180.0), 0.004633517730561146)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 180.0, 240.0), 0.0040156278424527785)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 240.0, 300.0), 0.004097425621422603)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 300.0, 360.0), 0.00534407493573042)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 360.0, 420.0), 0.002849425985304954)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 420.0, 480.0), 0.0024443772372422234)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 480.0, 540.0), 0.0011258612568464076)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 540.0, 600.0), 0.0005966047093584399)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 600.0, 660.0), 0.0005779388889435179)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 660.0, 720.0), 0.0004527621290439082)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 720.0, 780.0), 0.00011727646428602624)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 780.0, 840.0), 0.00011130198744577025)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 0.0, 30.0), 0.0025301846046864363)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 30.0, 60.0), 0.002932856090944951)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 60.0, 90.0), 0.0015297442159744696)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 90.0, 120.0), 0.0016816440829740813)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 120.0, 180.0), 0.0023140070407952395)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 180.0, 240.0), 0.0013768767086426792)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 240.0, 300.0), 0.0019019317686819275)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 300.0, 360.0), 0.0015577691125463963)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 360.0, 420.0), 0.001499121306916632)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 420.0, 480.0), 0.0007361366421130972)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 480.0, 540.0), 0.0007423049940853575)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 540.0, 600.0), 0.00011130198744577025)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 660.0, 720.0), 0.00024243947114654707)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 720.0, 780.0), 0.000261579996858755)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 0.0, 30.0), 0.0021669594044717543)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 30.0, 60.0), 0.0033993161916113994)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 60.0, 90.0), 0.001870484877697732)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 90.0, 120.0), 0.0008448185262884799)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 120.0, 180.0), 0.002024573233571085)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 180.0, 240.0), 0.0021888099857994042)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 240.0, 300.0), 0.0021657834323017752)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 300.0, 360.0), 0.0010623089332746248)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 360.0, 420.0), 0.0006268095760401356)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 420.0, 480.0), 0.0005094532977538987)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 480.0, 540.0), 0.0004744090926784203)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 540.0, 600.0), 0.00016487328572417658)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 660.0, 720.0), 0.0001162996982120756)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 0.0, 30.0), 0.0033401411497772818)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 30.0, 60.0), 0.002492685695459365)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 60.0, 90.0), 0.0027064477589805068)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 90.0, 120.0), 0.0018052297053924354)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 120.0, 180.0), 0.0027984509294891498)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 180.0, 240.0), 0.0022758505657711914)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 240.0, 300.0), 0.0003535503655144059)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 300.0, 360.0), 0.0005890430396050117)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 360.0, 420.0), 0.0002319134363595028)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 420.0, 480.0), 0.00011617748025141993)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 480.0, 540.0), 0.0003690064941818713)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 540.0, 600.0), 0.0001650495071007077)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 600.0, 660.0), 0.00023113252306835525)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 840.0, 1080.0), 0.00017239206443126303)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 0.0, 30.0), 0.003543871129770451)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 30.0, 60.0), 0.0018407982276338393)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 60.0, 90.0), 0.0010649270862293423)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 90.0, 120.0), 0.0009538696044712171)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 120.0, 180.0), 0.0021318639289119572)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 180.0, 240.0), 0.0019740243143620277)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 240.0, 300.0), 0.0006157677659961421)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 300.0, 360.0), 0.0004035374922773149)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 360.0, 420.0), 0.00011607019237524387)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 420.0, 480.0), 0.0003938282727195195)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 480.0, 540.0), 0.00011130198744577025)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 600.0, 660.0), 0.00011942109323430472)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 0.0, 30.0), 0.00254340964132742)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 30.0, 60.0), 0.0017847751078888892)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 60.0, 90.0), 0.000841891386995212)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 90.0, 120.0), 0.0003543852337006742)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 120.0, 180.0), 0.0013974221085794884)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 180.0, 240.0), 0.0006229273683665316)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 240.0, 300.0), 0.00020579571489011056)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 300.0, 360.0), 0.0004809214516599411)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 360.0, 420.0), 0.00022514291890117063)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 420.0, 480.0), 0.00014748146383900364)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 720.0, 780.0), 0.00011605559293173729)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 0.0, 30.0), 0.0019634787835054656)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 30.0, 60.0), 0.000860670737476427)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 60.0, 90.0), 0.0003550148096943092)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 90.0, 120.0), 0.000855728546868917)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 120.0, 180.0), 0.0009283998993093458)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 180.0, 240.0), 0.00022795178106384156)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 240.0, 300.0), 0.00024119874825349313)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 420.0, 480.0), 0.00023429279224671318)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 480.0, 540.0), 0.00011727269965059726)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 660.0, 720.0), 0.00011130198744577025)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 0.0, 30.0), 0.0017099830161073832)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 30.0, 60.0), 0.0006015092064895483)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 60.0, 90.0), 0.00011819436012345105)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 90.0, 120.0), 0.0002279569151752547)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 120.0, 180.0), 0.0006440525787748041)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 180.0, 240.0), 0.0003142746964600832)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 300.0, 360.0), 0.00022788575876606104)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 360.0, 420.0), 0.0004761806298753505)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 480.0, 540.0), 0.00011727269965059726)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 0.0, 30.0), 0.0020011795184968267)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 30.0, 60.0), 0.00023620950461199452)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 60.0, 90.0), 0.00011935825257957617)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 90.0, 120.0), 0.00011130198744577025)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 120.0, 180.0), 0.00012222981614916706)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 180.0, 240.0), 0.0002377005397786721)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 240.0, 300.0), 0.00026373526728965034)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 300.0, 360.0), 0.000256086036315955)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 360.0, 420.0), 0.00011394287938236544)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 0.0, 30.0), 0.0021116872169622083)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 30.0, 60.0), 0.0003681765715703113)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 60.0, 90.0), 0.0004137833254678062)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 90.0, 120.0), 0.00025108497234833097)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 120.0, 180.0), 0.0007576827338029722)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 180.0, 240.0), 0.0005180490039062906)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 240.0, 300.0), 0.0004944106124208977)); - tourDurationProbabilityDistribution.add(Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 300.0, 360.0), 0.0002278857587658224)); - } else - throw new IllegalArgumentException("Unknown small scale commercial traffic type: " + smallScaleCommercialTrafficType); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 0.0, 30.0), 0.0002666800577200411)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 30.0, 60.0), 0.0006395055678719748)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 60.0, 90.0), 0.0007110769046958423)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 90.0, 120.0), 0.0006665961628449491)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 120.0, 180.0), 0.0023195866923785575)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 180.0, 240.0), 0.00261751319938476)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 240.0, 300.0), 0.0021430032453503087)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 300.0, 360.0), 0.0029303876579925905)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 360.0, 420.0), 0.00283576618143643)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 420.0, 480.0), 0.0027188265347502893)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 480.0, 540.0), 0.002597768116531099)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 540.0, 600.0), 0.002659151494701916)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 600.0, 660.0), 0.0021738406044924437)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 660.0, 720.0), 0.0021949848461843176)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 720.0, 780.0), 0.0021801193011023083)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 780.0, 840.0), 0.001746033717539671)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(0, 4, 840.0, 1080.0), 0.00350888397405923)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 0.0, 30.0), 0.0006845643884312735)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 30.0, 60.0), 0.0004003126952082357)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 60.0, 90.0), 0.0008155012585632697)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 90.0, 120.0), 0.0010930534970200114)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 120.0, 180.0), 0.0011760353713952051)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 180.0, 240.0), 0.0019364061980548415)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 240.0, 300.0), 0.002953452881036028)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 300.0, 360.0), 0.002589370165068672)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 360.0, 420.0), 0.0025604405819583055)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 420.0, 480.0), 0.0034319041631081476)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 480.0, 540.0), 0.0033480025727905907)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 540.0, 600.0), 0.002175717502193024)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 600.0, 660.0), 0.0028036478238686957)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 660.0, 720.0), 0.0028759635193342887)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 720.0, 780.0), 0.0017584406503249872)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 780.0, 840.0), 0.0016742001219093045)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(4, 5, 840.0, 1080.0), 0.0020658205220468245)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 0.0, 30.0), 0.0017247403950228777)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 30.0, 60.0), 0.003090998236080484)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 60.0, 90.0), 0.0015209554995803177)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 90.0, 120.0), 0.0016533392810110293)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 120.0, 180.0), 0.003732306124403562)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 180.0, 240.0), 0.004106247357091271)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 240.0, 300.0), 0.003188442431357427)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 300.0, 360.0), 0.005929370570550301)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 360.0, 420.0), 0.005992695595693005)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 420.0, 480.0), 0.006390572360276255)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 480.0, 540.0), 0.00993732232424166)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 540.0, 600.0), 0.007917613781985494)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 600.0, 660.0), 0.00753055040114282)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 660.0, 720.0), 0.004839531706746983)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 720.0, 780.0), 0.003571294178536547)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 780.0, 840.0), 0.0022261075091276465)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(5, 6, 840.0, 1080.0), 0.0020123396391017526)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 0.0, 30.0), 0.00553085745500388)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 30.0, 60.0), 0.005164301035284355)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 60.0, 90.0), 0.0034287284279468384)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 90.0, 120.0), 0.003359657704287739)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 120.0, 180.0), 0.005963896679549981)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 180.0, 240.0), 0.006376396116305889)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 240.0, 300.0), 0.011553162434249647)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 300.0, 360.0), 0.01216390369869719)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 360.0, 420.0), 0.015303642980241483)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 420.0, 480.0), 0.01894502604909179)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 480.0, 540.0), 0.026995818384739457)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 540.0, 600.0), 0.03735238580259259)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 600.0, 660.0), 0.02007351137947408)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 660.0, 720.0), 0.007579189226621267)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 720.0, 780.0), 0.003806896198418994)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 780.0, 840.0), 0.0020371212990837376)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(6, 7, 840.0, 1080.0), 0.00246729057836831)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 0.0, 30.0), 0.007834929725170775)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 30.0, 60.0), 0.007875284751511802)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 60.0, 90.0), 0.0056369706407995695)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 90.0, 120.0), 0.007252792818630801)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 120.0, 180.0), 0.011595289158181222)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 180.0, 240.0), 0.01584695155572567)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 240.0, 300.0), 0.019385993489144607)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 300.0, 360.0), 0.01804569113072999)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 360.0, 420.0), 0.020338168968415053)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 420.0, 480.0), 0.03244941203821404)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 480.0, 540.0), 0.046986423884473)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 540.0, 600.0), 0.026127574804977814)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 600.0, 660.0), 0.006859707180170414)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 660.0, 720.0), 0.004053368732850601)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 720.0, 780.0), 0.0017728320836715625)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 780.0, 840.0), 0.0008117046283836942)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(7, 8, 840.0, 1080.0), 0.0014889766393137468)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 0.0, 30.0), 0.008702611915372131)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 30.0, 60.0), 0.009703391735884857)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 60.0, 90.0), 0.00833249802530372)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 90.0, 120.0), 0.008160824294542027)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 120.0, 180.0), 0.014522058792957903)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 180.0, 240.0), 0.019189639247661674)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 240.0, 300.0), 0.022628081955363144)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 300.0, 360.0), 0.018168175275565253)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 360.0, 420.0), 0.01830766579908246)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 420.0, 480.0), 0.022414786327228577)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 480.0, 540.0), 0.015454698179801149)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 540.0, 600.0), 0.00743339793333549)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 600.0, 660.0), 0.0028959167218627997)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 660.0, 720.0), 0.0011608823477359163)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 720.0, 780.0), 0.0006126324367099846)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 780.0, 840.0), 0.0007090395380022889)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(8, 9, 840.0, 1080.0), 0.0009650931773638335)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 0.0, 30.0), 0.010532384705529854)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 30.0, 60.0), 0.010106787618396446)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 60.0, 90.0), 0.007305519187631069)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 90.0, 120.0), 0.0065298278976416635)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 120.0, 180.0), 0.012991661099288086)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 180.0, 240.0), 0.011082392048301831)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 240.0, 300.0), 0.013735041027849332)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 300.0, 360.0), 0.012921165569106639)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 360.0, 420.0), 0.010187951930469277)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 420.0, 480.0), 0.0070071162811467125)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 480.0, 540.0), 0.003478434072337058)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 540.0, 600.0), 0.002487434148850001)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 600.0, 660.0), 0.0007617139935295275)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 660.0, 720.0), 0.0004794259473854554)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 720.0, 780.0), 0.00011828408353297643)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(9, 10, 780.0, 840.0), 0.0009221448817170415)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 0.0, 30.0), 0.0053803765038808364)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 30.0, 60.0), 0.00748440387556175)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 60.0, 90.0), 0.003817044622559703)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 90.0, 120.0), 0.0042559767658946045)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 120.0, 180.0), 0.004633517730561146)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 180.0, 240.0), 0.0040156278424527785)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 240.0, 300.0), 0.004097425621422603)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 300.0, 360.0), 0.00534407493573042)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 360.0, 420.0), 0.002849425985304954)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 420.0, 480.0), 0.0024443772372422234)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 480.0, 540.0), 0.0011258612568464076)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 540.0, 600.0), 0.0005966047093584399)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 600.0, 660.0), 0.0005779388889435179)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 660.0, 720.0), 0.0004527621290439082)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 720.0, 780.0), 0.00011727646428602624)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(10, 11, 780.0, 840.0), 0.00011130198744577025)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 0.0, 30.0), 0.0025301846046864363)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 30.0, 60.0), 0.002932856090944951)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 60.0, 90.0), 0.0015297442159744696)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 90.0, 120.0), 0.0016816440829740813)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 120.0, 180.0), 0.0023140070407952395)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 180.0, 240.0), 0.0013768767086426792)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 240.0, 300.0), 0.0019019317686819275)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 300.0, 360.0), 0.0015577691125463963)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 360.0, 420.0), 0.001499121306916632)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 420.0, 480.0), 0.0007361366421130972)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 480.0, 540.0), 0.0007423049940853575)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 540.0, 600.0), 0.00011130198744577025)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 660.0, 720.0), 0.00024243947114654707)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(11, 12, 720.0, 780.0), 0.000261579996858755)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 0.0, 30.0), 0.0021669594044717543)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 30.0, 60.0), 0.0033993161916113994)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 60.0, 90.0), 0.001870484877697732)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 90.0, 120.0), 0.0008448185262884799)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 120.0, 180.0), 0.002024573233571085)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 180.0, 240.0), 0.0021888099857994042)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 240.0, 300.0), 0.0021657834323017752)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 300.0, 360.0), 0.0010623089332746248)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 360.0, 420.0), 0.0006268095760401356)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 420.0, 480.0), 0.0005094532977538987)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 480.0, 540.0), 0.0004744090926784203)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 540.0, 600.0), 0.00016487328572417658)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(12, 13, 660.0, 720.0), 0.0001162996982120756)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 0.0, 30.0), 0.0033401411497772818)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 30.0, 60.0), 0.002492685695459365)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 60.0, 90.0), 0.0027064477589805068)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 90.0, 120.0), 0.0018052297053924354)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 120.0, 180.0), 0.0027984509294891498)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 180.0, 240.0), 0.0022758505657711914)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 240.0, 300.0), 0.0003535503655144059)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 300.0, 360.0), 0.0005890430396050117)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 360.0, 420.0), 0.0002319134363595028)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 420.0, 480.0), 0.00011617748025141993)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 480.0, 540.0), 0.0003690064941818713)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 540.0, 600.0), 0.0001650495071007077)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 600.0, 660.0), 0.00023113252306835525)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(13, 14, 840.0, 1080.0), 0.00017239206443126303)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 0.0, 30.0), 0.003543871129770451)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 30.0, 60.0), 0.0018407982276338393)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 60.0, 90.0), 0.0010649270862293423)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 90.0, 120.0), 0.0009538696044712171)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 120.0, 180.0), 0.0021318639289119572)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 180.0, 240.0), 0.0019740243143620277)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 240.0, 300.0), 0.0006157677659961421)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 300.0, 360.0), 0.0004035374922773149)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 360.0, 420.0), 0.00011607019237524387)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 420.0, 480.0), 0.0003938282727195195)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 480.0, 540.0), 0.00011130198744577025)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(14, 15, 600.0, 660.0), 0.00011942109323430472)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 0.0, 30.0), 0.00254340964132742)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 30.0, 60.0), 0.0017847751078888892)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 60.0, 90.0), 0.000841891386995212)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 90.0, 120.0), 0.0003543852337006742)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 120.0, 180.0), 0.0013974221085794884)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 180.0, 240.0), 0.0006229273683665316)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 240.0, 300.0), 0.00020579571489011056)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 300.0, 360.0), 0.0004809214516599411)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 360.0, 420.0), 0.00022514291890117063)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 420.0, 480.0), 0.00014748146383900364)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(15, 16, 720.0, 780.0), 0.00011605559293173729)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 0.0, 30.0), 0.0019634787835054656)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 30.0, 60.0), 0.000860670737476427)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 60.0, 90.0), 0.0003550148096943092)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 90.0, 120.0), 0.000855728546868917)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 120.0, 180.0), 0.0009283998993093458)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 180.0, 240.0), 0.00022795178106384156)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 240.0, 300.0), 0.00024119874825349313)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 420.0, 480.0), 0.00023429279224671318)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 480.0, 540.0), 0.00011727269965059726)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(16, 17, 660.0, 720.0), 0.00011130198744577025)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 0.0, 30.0), 0.0017099830161073832)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 30.0, 60.0), 0.0006015092064895483)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 60.0, 90.0), 0.00011819436012345105)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 90.0, 120.0), 0.0002279569151752547)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 120.0, 180.0), 0.0006440525787748041)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 180.0, 240.0), 0.0003142746964600832)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 300.0, 360.0), 0.00022788575876606104)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 360.0, 420.0), 0.0004761806298753505)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(17, 18, 480.0, 540.0), 0.00011727269965059726)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 0.0, 30.0), 0.0020011795184968267)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 30.0, 60.0), 0.00023620950461199452)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 60.0, 90.0), 0.00011935825257957617)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 90.0, 120.0), 0.00011130198744577025)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 120.0, 180.0), 0.00012222981614916706)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 180.0, 240.0), 0.0002377005397786721)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 240.0, 300.0), 0.00026373526728965034)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 300.0, 360.0), 0.000256086036315955)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(18, 19, 360.0, 420.0), 0.00011394287938236544)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 0.0, 30.0), 0.0021116872169622083)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 30.0, 60.0), 0.0003681765715703113)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 60.0, 90.0), 0.0004137833254678062)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 90.0, 120.0), 0.00025108497234833097)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 120.0, 180.0), 0.0007576827338029722)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 180.0, 240.0), 0.0005180490039062906)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 240.0, 300.0), 0.0004944106124208977)); + tourDurationProbabilityDistribution.add( + Pair.create(new GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration(19, 24, 300.0, 360.0), 0.0002278857587658224)); - return new EnumeratedDistribution<>(rng, tourDurationProbabilityDistribution); + tourDistribution.put(GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString(), + new EnumeratedDistribution<>(rng, tourDurationProbabilityDistribution)); + return tourDistribution; } @Override From a004cd49cc2056430bafb1e1046bc05f00ab0918 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Mon, 30 Sep 2024 09:43:31 +0200 Subject: [PATCH 43/60] formatting --- ...rateSmallScaleCommercialTrafficDemand.java | 68 ++++--------------- 1 file changed, 15 insertions(+), 53 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 4bbb7739544..4ab564c4b40 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -659,12 +659,7 @@ else if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) } odMatrix = createTripDistribution(trafficVolumePerTypeAndZone_start, trafficVolumePerTypeAndZone_stop, smallScaleCommercialTrafficType, scenario, output, linksPerZone); - createCarriers( - scenario, - odMatrix, - resultingDataPerZone, - smallScaleCommercialTrafficType, - linksPerZone); + createCarriers(scenario, odMatrix, resultingDataPerZone, smallScaleCommercialTrafficType, linksPerZone); } /** @@ -749,11 +744,8 @@ public void install() { * @param smallScaleCommercialTrafficType Selected traffic types. Options: commercialPersonTraffic, goodsTraffic * @param linksPerZone */ - public void createCarriers(Scenario scenario, - TripDistributionMatrix odMatrix, - Map> resultingDataPerZone, - String smallScaleCommercialTrafficType, - Map, Link>> linksPerZone){ + public void createCarriers(Scenario scenario, TripDistributionMatrix odMatrix, Map> resultingDataPerZone, + String smallScaleCommercialTrafficType, Map, Link>> linksPerZone) { //Save the given data RandomGenerator rng = new MersenneTwister(scenario.getConfig().global().getRandomSeed()); @@ -847,23 +839,12 @@ public void createCarriers(Scenario scenario, // Now Create services for this carrier Carrier newCarrier = CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)); - CarrierAttributes carrierAttributes = new CarrierAttributes( - purpose, - startZone, - selectedStartCategory, - modeORvehType, - smallScaleCommercialTrafficType, - vehicleDepots, - odMatrixEntry); + CarrierAttributes carrierAttributes = new CarrierAttributes(purpose, startZone, selectedStartCategory, modeORvehType, + smallScaleCommercialTrafficType, vehicleDepots, odMatrixEntry); carrierId2carrierAttributes.put(Id.create(carrierName, Carrier.class), carrierAttributes); - createServices(newCarrier, - resultingDataPerZone, - stopDurationTimeSelector, - tourDistribution, - odMatrix, - linksPerZone, + createServices(newCarrier, resultingDataPerZone, odMatrix, linksPerZone, carrierAttributes); } } @@ -877,13 +858,8 @@ public void createCarriers(Scenario scenario, * Generates and adds the services for the given carrier. * TODO In-source this method back into create carriers */ - private void createServices(Carrier newCarrier, - Map> resultingDataPerZone, - Map> stopDurationTimeSelector, - EnumeratedDistribution tourDistribution, - TripDistributionMatrix odMatrix, - Map, Link>> linksPerZone, - CarrierAttributes carrierAttributes) { + private void createServices(Carrier newCarrier, Map> resultingDataPerZone, TripDistributionMatrix odMatrix, + Map, Link>> linksPerZone, CarrierAttributes carrierAttributes) { log.info("Create services for carrier: {}", newCarrier.getId()); for (String stopZone : odMatrix.getListOfZones()) { int trafficVolumeForOD = Math.round((float)odMatrix.getTripDistributionValue(carrierAttributes.startZone, @@ -899,15 +875,10 @@ private void createServices(Carrier newCarrier, int serviceTimePerStop; if (carrierAttributes.selectedStartCategory.equals("Inhabitants")){ //TODO This is a bit ugly. Do we even need the selectedStartCategory of the carrierAttributes in this case? Or can we just set it right at the beginning? (move it to TODO #1) - CarrierAttributes inhabitantAttributes = new CarrierAttributes( - carrierAttributes.purpose, - carrierAttributes.startZone, - carrierAttributes.odMatrixEntry.possibleStartCategories.getFirst(), - carrierAttributes.modeORvehType, - carrierAttributes.smallScaleCommercialTrafficType, - carrierAttributes.vehicleDepots, - carrierAttributes.odMatrixEntry); - serviceTimePerStop = getServiceTimePerStop(newCarrier, stopDurationTimeSelector, tourDistribution, inhabitantAttributes); + CarrierAttributes inhabitantAttributes = new CarrierAttributes(carrierAttributes.purpose, carrierAttributes.startZone, + carrierAttributes.odMatrixEntry.possibleStartCategories.getFirst(), carrierAttributes.modeORvehType, + carrierAttributes.smallScaleCommercialTrafficType, carrierAttributes.vehicleDepots, carrierAttributes.odMatrixEntry); + serviceTimePerStop = getServiceTimePerStop(newCarrier, inhabitantAttributes, 0); } else { @@ -949,10 +920,7 @@ private void createService(Carrier newCarrier, ArrayList noPossibleLinks /** * Redraws the service-durations of all {@link CarrierService}s of the given {@link Carrier}. */ - private void redrawAllServiceDurations(Carrier carrier, - Map> stopDurationTimeSelector, - EnumeratedDistribution tourDistribution, - CarrierAttributes carrierAttributes) { + private void redrawAllServiceDurations(Carrier carrier, CarrierAttributes carrierAttributes, int additionalTravelBufferPerIterationInMinutes) { for (CarrierService service : carrier.getServices().values()) { double newServiceDuration = getServiceTimePerStop(carrier, stopDurationTimeSelector, tourDistribution, carrierAttributes); CarrierService redrawnService = CarrierService.Builder.newInstance(service.getId(), service.getLocationLinkId()) @@ -1107,7 +1075,6 @@ else if (carrierAttributes.smallScaleCommercialTrafficType.equals( throw new RuntimeException("No possible service duration found for employee category '" + carrierAttributes.selectedStartCategory + "' and mode '" + carrierAttributes.modeORvehType + "' in traffic type '" + carrierAttributes.smallScaleCommercialTrafficType + "'"); - } /** @@ -1478,12 +1445,7 @@ public record DurationsBounds(int minDuration, int maxDuration) {} * @param smallScaleCommercialTrafficType entry from {@link SmallScaleCommercialTrafficType} * @param vehicleDepots Containing the depots of this carrier with linkIds as strings */ - private record CarrierAttributes(int purpose, - String startZone, - String selectedStartCategory, - String modeORvehType, - String smallScaleCommercialTrafficType, - ArrayList vehicleDepots, + private record CarrierAttributes(int purpose, String startZone, String selectedStartCategory, String modeORvehType, + String smallScaleCommercialTrafficType, ArrayList vehicleDepots, VehicleSelection.OdMatrixEntryInformation odMatrixEntry) {} - } From 8ff8b7f39ebfa5c00dcd79a1d554ac5d14bdd46b Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Mon, 30 Sep 2024 09:45:01 +0200 Subject: [PATCH 44/60] rename method --- ...rateSmallScaleCommercialTrafficDemand.java | 45 ++++++++++--------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 4ab564c4b40..ba714df5e81 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -1027,10 +1027,10 @@ private Integer getServiceTimePerStop(Carrier newCarrier, GenerateSmallScaleCommercialTrafficDemand.StopDurationGoodTrafficKey key = null; if (carrierAttributes.smallScaleCommercialTrafficType.equals( GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString())) - key = GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey(carrierAttributes.selectedStartCategory, null); + key = GenerateSmallScaleCommercialTrafficDemand.makeServiceDurationPerCategoryKey(carrierAttributes.selectedStartCategory, null, carrierAttributes.smallScaleCommercialTrafficType); else if (carrierAttributes.smallScaleCommercialTrafficType.equals( GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString())) { - key = GenerateSmallScaleCommercialTrafficDemand.makeStopDurationGoodTrafficKey(carrierAttributes.selectedStartCategory, carrierAttributes.modeORvehType); + key = GenerateSmallScaleCommercialTrafficDemand.makeServiceDurationPerCategoryKey(carrierAttributes.selectedStartCategory, carrierAttributes.modeORvehType, carrierAttributes.smallScaleCommercialTrafficType); } // old Version // GenerateSmallScaleCommercialTrafficDemand.DurationsBounds serviceDurationBounds = serviceDurationTimeSelector.get(key).sample(); @@ -1407,29 +1407,34 @@ public double getScore() { } - public record StopDurationGoodTrafficKey(String employeeCategory, String vehicleType) { + public record ServiceDurationPerCategoryKey(String employeeCategory, String vehicleType, String smallScaleCommercialTrafficType) { @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ServiceDurationPerCategoryKey other = (ServiceDurationPerCategoryKey) obj; + if (employeeCategory == null) { + if (other.employeeCategory != null) return false; - if (getClass() != obj.getClass()) + } else if (!employeeCategory.equals(other.employeeCategory)) + return false; + if (vehicleType == null) { + if (other.vehicleType != null) return false; - StopDurationGoodTrafficKey other = (StopDurationGoodTrafficKey) obj; - if (employeeCategory == null) { - if (other.employeeCategory != null) - return false; - } else if (!employeeCategory.equals(other.employeeCategory)) - return false; - if (vehicleType == null) { - return other.vehicleType == null; - } else return vehicleType.equals(other.vehicleType); - } + } else if (!vehicleType.equals(other.vehicleType)) + return false; + if (smallScaleCommercialTrafficType == null) { + return other.smallScaleCommercialTrafficType == null; + } else return smallScaleCommercialTrafficType.equals(other.smallScaleCommercialTrafficType); } - public static StopDurationGoodTrafficKey makeStopDurationGoodTrafficKey(String employeeCategory, String vehicleType) { - return new StopDurationGoodTrafficKey(employeeCategory, vehicleType); + } + public static ServiceDurationPerCategoryKey makeServiceDurationPerCategoryKey(String employeeCategory, String vehicleType, String smallScaleCommercialTrafficType) { + return new ServiceDurationPerCategoryKey(employeeCategory, vehicleType, smallScaleCommercialTrafficType); } public record TourStartAndDuration(int hourLower, int hourUpper, double minDuration, double maxDuration) {} From 9ac0810c29914d4f9a970900fa206fb0cb34bb10 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Mon, 30 Sep 2024 09:45:19 +0200 Subject: [PATCH 45/60] formatting --- .../GenerateSmallScaleCommercialTrafficDemand.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index ba714df5e81..7bf1b1965bd 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -882,20 +882,12 @@ private void createServices(Carrier newCarrier, Map Date: Mon, 30 Sep 2024 10:20:39 +0200 Subject: [PATCH 46/60] rename --- ...rateSmallScaleCommercialTrafficDemand.java | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 7bf1b1965bd..764d0865ffb 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -914,7 +914,7 @@ private void createService(Carrier newCarrier, ArrayList noPossibleLinks */ private void redrawAllServiceDurations(Carrier carrier, CarrierAttributes carrierAttributes, int additionalTravelBufferPerIterationInMinutes) { for (CarrierService service : carrier.getServices().values()) { - double newServiceDuration = getServiceTimePerStop(carrier, stopDurationTimeSelector, tourDistribution, carrierAttributes); + double newServiceDuration = getServiceTimePerStop(carrier, carrierAttributes, additionalTravelBufferPerIterationInMinutes); CarrierService redrawnService = CarrierService.Builder.newInstance(service.getId(), service.getLocationLinkId()) .setServiceDuration(newServiceDuration).setServiceStartTimeWindow(service.getServiceStartTimeWindow()).build(); carrier.getServices().put(redrawnService.getId(), redrawnService); @@ -1005,18 +1005,15 @@ private int getVehicleStartTime(TourStartAndDuration t) { /** * Give a service duration based on the purpose and the trafficType under a given probability * - * @param newCarrier The carrier for which we generate the serviceTime - * @param serviceDurationTimeSelector the selector for the service duration - * @param tourDistribution the distribution for the tour start and duration - * @param carrierAttributes attributes of the carrier to generate the service time for. - * selectedStartCategory: the category of the employee + * @param carrier The carrier for which we generate the serviceTime + * @param carrierAttributes attributes of the carrier to generate the service time for. + * selectedStartCategory: the category of the employee + * @param additionalTravelBufferPerIterationInMinutes additional buffer for the travel time * @return the service duration */ - private Integer getServiceTimePerStop(Carrier newCarrier, - Map> serviceDurationTimeSelector, - EnumeratedDistribution tourDistribution, CarrierAttributes carrierAttributes) { + private Integer getServiceTimePerStop(Carrier carrier, CarrierAttributes carrierAttributes, int additionalTravelBufferPerIterationInMinutes) { - GenerateSmallScaleCommercialTrafficDemand.StopDurationGoodTrafficKey key = null; + ServiceDurationPerCategoryKey key = null; if (carrierAttributes.smallScaleCommercialTrafficType.equals( GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString())) key = GenerateSmallScaleCommercialTrafficDemand.makeServiceDurationPerCategoryKey(carrierAttributes.selectedStartCategory, null, carrierAttributes.smallScaleCommercialTrafficType); @@ -1031,8 +1028,8 @@ else if (carrierAttributes.smallScaleCommercialTrafficType.equals( // return rnd.nextInt(serviceDurationLowerBound * 60, serviceDurationUpperBound * 60); //possible new Version by Ricardo - double maxVehicleAvailability = newCarrier.getCarrierCapabilities().getCarrierVehicles().values().stream().mapToDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime()).max().orElse(0); - int usedTravelTimeBuffer = 120 * 60; // 120 min buffer for the driving time + double maxVehicleAvailability = carrier.getCarrierCapabilities().getCarrierVehicles().values().stream().mapToDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime()).max().orElse(0); + int usedTravelTimeBuffer = additionalTravelBufferPerIterationInMinutes * 60; // buffer for the driving time; for unsolved carriers the buffer will be increased over time for (int j = 0; j < 200; j++) { GenerateSmallScaleCommercialTrafficDemand.DurationsBounds serviceDurationBounds = serviceDurationTimeSelector.get(key).sample(); @@ -1045,8 +1042,8 @@ else if (carrierAttributes.smallScaleCommercialTrafficType.equals( return possibleValue; } if (j > 100){ - CarrierVehicle carrierVehicleToChange = newCarrier.getCarrierCapabilities().getCarrierVehicles().values().stream().sorted(Comparator.comparingDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime())).toList().getFirst(); - log.info("Changing vehicle availability for carrier {}. Old maxVehicleAvailability: {}", newCarrier.getId(), maxVehicleAvailability); + CarrierVehicle carrierVehicleToChange = carrier.getCarrierCapabilities().getCarrierVehicles().values().stream().sorted(Comparator.comparingDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime())).toList().getFirst(); + log.info("Changing vehicle availability for carrier {}. Old maxVehicleAvailability: {}", carrier.getId(), maxVehicleAvailability); int tourDuration = 0; int vehicleStartTime = 0; int vehicleEndTime = 0; @@ -1058,9 +1055,9 @@ else if (carrierAttributes.smallScaleCommercialTrafficType.equals( } CarrierVehicle newCarrierVehicle = CarrierVehicle.Builder.newInstance(carrierVehicleToChange.getId(), carrierVehicleToChange.getLinkId(), carrierVehicleToChange.getType()).setEarliestStart(vehicleStartTime).setLatestEnd(vehicleEndTime).build(); - newCarrier.getCarrierCapabilities().getCarrierVehicles().remove(carrierVehicleToChange.getId()); - newCarrier.getCarrierCapabilities().getCarrierVehicles().put(newCarrierVehicle.getId(), newCarrierVehicle); - maxVehicleAvailability = newCarrier.getCarrierCapabilities().getCarrierVehicles().values().stream().mapToDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime()).max().orElse(0); + carrier.getCarrierCapabilities().getCarrierVehicles().remove(carrierVehicleToChange.getId()); + carrier.getCarrierCapabilities().getCarrierVehicles().put(newCarrierVehicle.getId(), newCarrierVehicle); + maxVehicleAvailability = carrier.getCarrierCapabilities().getCarrierVehicles().values().stream().mapToDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime()).max().orElse(0); log.info("New maxVehicleAvailability: {}", maxVehicleAvailability); } } From 605c7f670540549b9406724912a9805fcf2132b3 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Mon, 30 Sep 2024 10:36:59 +0200 Subject: [PATCH 47/60] add current version of solving all carriers --- ...rateSmallScaleCommercialTrafficDemand.java | 218 ++++++++++-------- 1 file changed, 121 insertions(+), 97 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 764d0865ffb..b22233aef50 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -468,7 +468,7 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map oldCarrierId : carrierId2subCarrierIds.keySet()) { for (Id newCarrierId : carrierId2subCarrierIds.get(oldCarrierId)) { carrierId2carrierAttributes.put(newCarrierId, carrierId2carrierAttributes.get(oldCarrierId)); @@ -478,7 +478,9 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map nonCompleteSolvedCarriers = createListOfCarrierWithUnhandledJobs(originalScenario); + if (!nonCompleteSolvedCarriers.isEmpty()) + tryToSolveAllCarriersCompletely(originalScenario, nonCompleteSolvedCarriers); solvedCarriers.putAll(CarriersUtils.getCarriers(originalScenario).getCarriers()); CarriersUtils.getCarriers(originalScenario).getCarriers().clear(); if (!splitVRPs) @@ -503,132 +505,154 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map nonCompleteSolvedCarriers) { int maxIterations = 100; - + int additionalTravelBufferPerIterationInMinutes = 10; + int startNumberOfCarriersWithUnhandledJobs = nonCompleteSolvedCarriers.size(); log.info("Starting with carrier-replanning loop."); for(int i = 0; i < maxIterations; i++){ log.info("carrier-replanning loop iteration: {}", i); - Collection allCarriers = CarriersUtils.getCarriers(scenario).getCarriers().values(); - - if (allCarriersViable(scenario)) break; - - for(Carrier carrier : allCarriers){ - if (isCarrierViable(carrier)) continue; - +// Collection allCarriers = CarriersUtils.getCarriers(scenario).getCarriers().values(); +// if (allCarriersViable(scenario)) break; + int numberOfCarriersWithUnhandledJobs = nonCompleteSolvedCarriers.size(); + for(Carrier nonCompleteSolvedCarrier : nonCompleteSolvedCarriers) { +// if (allJobsHandledCheck(carrier)) continue; + nonCompleteSolvedCarrier.clearPlans(); + nonCompleteSolvedCarrier.setSelectedPlan(null); // If we reach this point, the plan for this carrier is not viable. We will replan it - CarrierAttributes carrierAttributes = carrierId2carrierAttributes.get(carrier.getId()); + CarrierAttributes carrierAttributes = carrierId2carrierAttributes.get(nonCompleteSolvedCarrier.getId()); // Generate new services. The new service batch should have a smaller sum of serviceDurations than before (or otherwise it will not change anything) - double oldSumOfServiceDurations = getSumOfServiceDurations(scenario, carrier.getId()); - int j = 0; - do { - if (j >= maxIterations) break; - - //TODO Remove old vehicles? - - // Create the new services - EnumeratedDistribution tourDistribution = getCommercialTourSpecifications.createTourDistribution(carrierAttributes.smallScaleCommercialTrafficType, rng); - Map> stopDurationTimeSelector = getCommercialTourSpecifications.createStopDurationDistributionPerCategory(carrierAttributes.smallScaleCommercialTrafficType, rng); - redrawAllServiceDurations(carrier, stopDurationTimeSelector, tourDistribution, carrierAttributes); - j++; - } while (getSumOfServiceDurations(scenario, carrier.getId()) > oldSumOfServiceDurations); - log.info("Carrer {}: Reduced summed serviceDuration from {} to {}", carrier.getId(), oldSumOfServiceDurations, getSumOfServiceDurations(scenario, carrier.getId())); - +// double oldSumOfServiceDurations = getSumOfServiceDurations(scenario, carrier.getId()); +// int j = 0; +// do { +// if (i >= maxIterations) break; + //TODO Remove old vehicles? + + // Create the new services +// EnumeratedDistribution tourDistribution = commercialTourSpecifications.createTourDistribution(carrierAttributes.smallScaleCommercialTrafficType, rng); +// Map> serviceDurationTimeSelector = commercialTourSpecifications.createStopDurationDistributionPerCategory(carrierAttributes.smallScaleCommercialTrafficType, rng); + redrawAllServiceDurations(nonCompleteSolvedCarrier, carrierAttributes, (i + 1) * additionalTravelBufferPerIterationInMinutes); + Carrier carrier = CarriersUtils.getCarriers(scenario).getCarriers().get(nonCompleteSolvedCarrier.getId()); + log.info("Carrier should be changed..."); +// j++; +// } +// while (getSumOfServiceDurations(scenario, nonCompleteSolvedCarrier.getId()) > oldSumOfServiceDurations); +//// log.info("Carrer {}: Reduced summed serviceDuration from {} to {}", nonCompleteSolvedCarrier.getId(), oldSumOfServiceDurations, getSumOfServiceDurations(scenario, nonCompleteSolvedCarrier.getId())); + } try { CarriersUtils.runJsprit(scenario, CarriersUtils.CarrierSelectionForSolution.solveOnlyForCarrierWithoutPlans); - } catch (ExecutionException e) { - throw new RuntimeException(e); - } catch (InterruptedException e) { + } catch (ExecutionException | InterruptedException e) { throw new RuntimeException(e); } - } + + + nonCompleteSolvedCarriers = createListOfCarrierWithUnhandledJobs(scenario); + log.info( + "End of carrier-replanning loop iteration: {}. From the {} carriers with unhandled jobs ({} already solved), {} were solved in this iteration with an additionalBuffer of {} minutes.", + i, startNumberOfCarriersWithUnhandledJobs, startNumberOfCarriersWithUnhandledJobs - numberOfCarriersWithUnhandledJobs, + numberOfCarriersWithUnhandledJobs - nonCompleteSolvedCarriers.size(), (i + 1) * additionalTravelBufferPerIterationInMinutes); + if (nonCompleteSolvedCarriers.isEmpty()) break; } // Final check - if (!allCarriersViable(scenario)){ + if (!nonCompleteSolvedCarriers.isEmpty()){ log.warn("Not all services were handled!"); } } - private double getSumOfServiceDurations(Scenario scenario, Id carrierId) { - double sum = 0; - for (CarrierService service : CarriersUtils.getCarriers(scenario).getCarriers().get(carrierId).getServices().values()){ - sum += service.getServiceDuration(); - } - return sum; - } +// private double getSumOfServiceDurations(Scenario scenario, Id carrierId) { +// double sum = 0; +// for (CarrierService service : CarriersUtils.getCarriers(scenario).getCarriers().get(carrierId).getServices().values()){ +// sum += service.getServiceDuration(); +// } +// return sum; +// } - private boolean isCarrierViable(Carrier carrier){ - CarrierPlan plan = carrier.getSelectedPlan(); + private boolean allJobsHandledCheck(Carrier carrier){ +// CarrierPlan plan = carrier.getSelectedPlan(); // TODO: remove these debug values - double totalVehicleTime = 0; - double totalServiceDuration = 0; - double totalTravelDuration = 0; - - for(CarrierVehicle vehicle : carrier.getCarrierCapabilities().getCarrierVehicles().values()){ - totalVehicleTime += vehicle.getLatestEndTime() - vehicle.getEarliestStartTime(); - } - - List handledServices = new LinkedList<>(); +// double totalVehicleTime = 0; +// double totalServiceDuration = 0; +// double totalTravelDuration = 0; +// +// for(CarrierVehicle vehicle : carrier.getCarrierCapabilities().getCarrierVehicles().values()){ +// totalVehicleTime += vehicle.getLatestEndTime() - vehicle.getEarliestStartTime(); +// } + +// List handledServices = new LinkedList<>(); //Check if all services have been handled - for(ScheduledTour tour : plan.getScheduledTours()){ - //DEBUG - double thisVehicleTime = tour.getVehicle().getLatestEndTime() - tour.getVehicle().getEarliestStartTime(); - double thisTourTime = 0; - - for(Tour.TourElement element : tour.getTour().getTourElements()){ - if(element instanceof Tour.Leg){ - totalTravelDuration += ((Tour.Leg) element).getExpectedTransportTime(); - thisTourTime += ((Tour.Leg) element).getExpectedTransportTime(); - } - if(element instanceof Tour.ServiceActivity){ - handledServices.add(((Tour.ServiceActivity) element).getService()); - totalServiceDuration += ((Tour.ServiceActivity) element).getDuration(); - thisTourTime += ((Tour.ServiceActivity) element).getDuration(); - } - } - - //log.info("Tour {} used {} out of {} available vehicle time", tour.getTour().getId(), thisTourTime, thisVehicleTime); - } - - List unhandled = new LinkedList<>(); - for(CarrierService service : carrier.getServices().values()){ - if(!handledServices.contains(service)){ - unhandled.add(service); - } - } - - if(!unhandled.isEmpty()){ - //TODO remove this message - log.warn("Carrier {}: {} of {} services were not handled! The total vehicle time is: {} ({}); The total serviceDuration is: {} ({}); The total travelDuration is : {}", - carrier.getId(), - unhandled.size(), - carrier.getServices().size(), - totalVehicleTime, carrier.getCarrierCapabilities().getCarrierVehicles().size(), - totalServiceDuration, carrier.getServices().size(), - totalTravelDuration - ); - for(CarrierService s : unhandled){ - log.warn("Service {} (duration={}) was not handled by carrier {}", s.getId(), s.getServiceDuration(), carrier.getId()); - } + int planedJobs = carrier.getServices().size(); + int handledJobs = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt( + tour -> (int) tour.getTour().getTourElements().stream().filter(element -> element instanceof Tour.ServiceActivity).count()).sum(); + if (planedJobs != handledJobs){ + log.warn("Carrier {}: {} of {} services were not handled!", carrier.getId(), planedJobs - handledJobs, planedJobs); return false; } else { return true; } + // for(ScheduledTour tour : plan.getScheduledTours()){ +// //DEBUG +// double thisVehicleTime = tour.getVehicle().getLatestEndTime() - tour.getVehicle().getEarliestStartTime(); +// double thisTourTime = 0; +// +// for(Tour.TourElement element : tour.getTour().getTourElements()){ +// if(element instanceof Tour.Leg){ +// totalTravelDuration += ((Tour.Leg) element).getExpectedTransportTime(); +// thisTourTime += ((Tour.Leg) element).getExpectedTransportTime(); +// } +// if(element instanceof Tour.ServiceActivity){ +// handledServices.add(((Tour.ServiceActivity) element).getService()); +// totalServiceDuration += ((Tour.ServiceActivity) element).getDuration(); +// thisTourTime += ((Tour.ServiceActivity) element).getDuration(); +// } +// } +// +// //log.info("Tour {} used {} out of {} available vehicle time", tour.getTour().getId(), thisTourTime, thisVehicleTime); +// } +// +// List unhandled = new LinkedList<>(); +// for(CarrierService service : carrier.getServices().values()){ +// if(!handledServices.contains(service)){ +// unhandled.add(service); +// } +// } +// +// if(!unhandled.isEmpty()){ +// //TODO remove this message +// log.warn("Carrier {}: {} of {} services were not handled! The total vehicle time is: {} ({}); The total serviceDuration is: {} ({}); The total travelDuration is : {}", +// carrier.getId(), +// unhandled.size(), +// carrier.getServices().size(), +// totalVehicleTime, carrier.getCarrierCapabilities().getCarrierVehicles().size(), +// totalServiceDuration, carrier.getServices().size(), +// totalTravelDuration +// ); +// for(CarrierService s : unhandled){ +// log.warn("Service {} (duration={}) was not handled by carrier {}", s.getId(), s.getServiceDuration(), carrier.getId()); +// } +// return false; +// } else { +// return true; +// } } - private boolean allCarriersViable(Scenario scenario){ - int successful = 0; + private List createListOfCarrierWithUnhandledJobs(Scenario scenario){ + List carriersWithUnhandledJobs = new LinkedList<>(); +// int successful = 0; for(Carrier carrier : CarriersUtils.getCarriers(scenario).getCarriers().values()){ - if(isCarrierViable(carrier)) successful++; + if(!allJobsHandledCheck(carrier)) + carriersWithUnhandledJobs.add(carrier); } - log.info("{} of {} carriers were fully served!", successful, CarriersUtils.getCarriers(scenario).getCarriers().size()); - return successful == CarriersUtils.getCarriers(scenario).getCarriers().size(); +// log.info("{} of {} carriers were fully served!", successful, CarriersUtils.getCarriers(scenario).getCarriers().size()); +// return successful == CarriersUtils.getCarriers(scenario).getCarriers().size(); + return carriersWithUnhandledJobs; } private void createCarriersAndDemand(Path output, Scenario scenario, @@ -742,7 +766,7 @@ public void install() { * @param odMatrix Can be generated in {@link GenerateSmallScaleCommercialTrafficDemand} * @param resultingDataPerZone Data distribution to zones (Given in {@link GenerateSmallScaleCommercialTrafficDemand} * @param smallScaleCommercialTrafficType Selected traffic types. Options: commercialPersonTraffic, goodsTraffic - * @param linksPerZone + * @param linksPerZone Links per zone (Given in {@link GenerateSmallScaleCommercialTrafficDemand} */ public void createCarriers(Scenario scenario, TripDistributionMatrix odMatrix, Map> resultingDataPerZone, String smallScaleCommercialTrafficType, Map, Link>> linksPerZone) { From f6d6a9cc6a26d369c7249224870b4d06f25cd080 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Mon, 30 Sep 2024 13:15:40 +0200 Subject: [PATCH 48/60] use new CarrierUtils method --- ...rateSmallScaleCommercialTrafficDemand.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index b22233aef50..ec163076453 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -573,7 +573,7 @@ private void tryToSolveAllCarriersCompletely(Scenario scenario, List no // return sum; // } - private boolean allJobsHandledCheck(Carrier carrier){ +// private boolean allJobsHandledCheck(Carrier carrier){ // CarrierPlan plan = carrier.getSelectedPlan(); // TODO: remove these debug values // double totalVehicleTime = 0; @@ -586,15 +586,15 @@ private boolean allJobsHandledCheck(Carrier carrier){ // List handledServices = new LinkedList<>(); //Check if all services have been handled - int planedJobs = carrier.getServices().size(); - int handledJobs = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt( - tour -> (int) tour.getTour().getTourElements().stream().filter(element -> element instanceof Tour.ServiceActivity).count()).sum(); - if (planedJobs != handledJobs){ - log.warn("Carrier {}: {} of {} services were not handled!", carrier.getId(), planedJobs - handledJobs, planedJobs); - return false; - } else { - return true; - } +// int planedJobs = carrier.getServices().size(); +// int handledJobs = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt( +// tour -> (int) tour.getTour().getTourElements().stream().filter(element -> element instanceof Tour.ServiceActivity).count()).sum(); +// if (planedJobs != handledJobs){ +// log.warn("Carrier {}: {} of {} services were not handled!", carrier.getId(), planedJobs - handledJobs, planedJobs); +// return false; +// } else { +// return true; +// } // for(ScheduledTour tour : plan.getScheduledTours()){ // //DEBUG // double thisVehicleTime = tour.getVehicle().getLatestEndTime() - tour.getVehicle().getEarliestStartTime(); @@ -639,14 +639,14 @@ private boolean allJobsHandledCheck(Carrier carrier){ // } else { // return true; // } - - } +// +// } private List createListOfCarrierWithUnhandledJobs(Scenario scenario){ List carriersWithUnhandledJobs = new LinkedList<>(); // int successful = 0; for(Carrier carrier : CarriersUtils.getCarriers(scenario).getCarriers().values()){ - if(!allJobsHandledCheck(carrier)) + if(!CarriersUtils.allJobsHandledBySelectedPlan(carrier)) carriersWithUnhandledJobs.add(carrier); } From 14c7e8cb609a87cebbbba65c396456f411e4a17f Mon Sep 17 00:00:00 2001 From: aleks Date: Wed, 2 Oct 2024 14:11:23 +0200 Subject: [PATCH 49/60] Updated reference events file in test --- .../test.output_events.xml.gz | Bin 40003 -> 37243 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/contribs/small-scale-traffic-generation/test/input/org/matsim/smallScaleCommercialTrafficGeneration/test.output_events.xml.gz b/contribs/small-scale-traffic-generation/test/input/org/matsim/smallScaleCommercialTrafficGeneration/test.output_events.xml.gz index 6934ebcecc0d338863a9d7a3090d42214105a3e4..4cac3132da0c11f74d82c2a80388c2ce0c30e3a4 100644 GIT binary patch literal 37243 zcmX6^WmKC@6UE)3P^`FXaVhTZQrz9OIHkC|ySo#txVyWRLU4BreChk;SDurcWX|mF z%$(Z^G*lO}tfv;_nP>#v&Dl!cELy5ia2ODYfyg zBv{hu;{Pzfr1`t=9K|vJgFQ3MQc(z{1M~Q>hPcbu>wuyE+q2=v zacADUh#$$vb*GTt$KQ|Fhq8}{4fLM(hb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^nU;J57;8fsq^)ckw*1#&7fZe(ZmS3Yp$enq*pxda(GB+kz2^F!i9_p;z* z-flDPyLYIfFkLs2H(E?<^sw@Zi)nL;z+XyUb1!WUk-wFEZY6DICzFEiSG`PM*Ak{1 z(QKO=ESgcUnSC}R+U#<(sWyYht+N?J6rsRoM8!pJIm7~+5hvK=)=;lUyRyk84!5g-|e zwuO}u*#ume$Rtn)`h>_P;L0aoqUdTq9PRK686KR1%OKi?lf{s^Cv{$~@SapS zf7dk$1f}?LHS#gRafM&5IYr=|en=?%a?K&KFIR|Y^>S@+(qAvvtZqcVxYpiFz0TST z<($(gE|7PhPH{QzPnb?Y_d2s8(k)K Date: Wed, 2 Oct 2024 14:14:35 +0200 Subject: [PATCH 50/60] Removed old code/comments --- ...rateSmallScaleCommercialTrafficDemand.java | 142 +++--------------- 1 file changed, 20 insertions(+), 122 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index ec163076453..cc1963559e5 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -95,7 +95,6 @@ * * @author Ricardo Ewert */ -//TODO make vehicle selection (see method createCarriers()) configurable in separate class (use interface) @CommandLine.Command(name = "generate-small-scale-commercial-traffic", description = "Generates plans for a small scale commercial traffic model", showDefaultValues = true) public class GenerateSmallScaleCommercialTrafficDemand implements MATSimAppCommand { // freight traffic from extern: @@ -138,8 +137,11 @@ public enum SmallScaleCommercialTrafficType { @CommandLine.Option(names = "--jspritIterations", description = "Set number of jsprit iterations", required = true) private int jspritIterations; - @CommandLine.Option(names = "--avgDrivingTime", description = "This average driving time is used for service-route-planning. If set too low, carriers may not serve all their services.", defaultValue = "1800") - private int avgDrivingTime; + @CommandLine.Option(names = "--additionalTravelBufferPerIterationInMinutes", description = "This buffer/driving time is used for service-route-planning. If set too low, carriers may not serve all their services.", defaultValue = "10") + private int additionalTravelBufferPerIterationInMinutes; + + @CommandLine.Option(names = "--maxReplanningIterations", description = "Limit of carrier replanning iterations, where carriers with unhandled services get new plans. If your carrier-plans are still not fully served, increase this limit.", defaultValue = "100") + private int maxReplanningIterations; @CommandLine.Option(names = "--creationOption", description = "Set option of mode differentiation: useExistingCarrierFileWithSolution, createNewCarrierFile, useExistingCarrierFileWithoutSolution") private CreationOption usedCreationOption; @@ -509,46 +511,28 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map nonCompleteSolvedCarriers) { - int maxIterations = 100; - int additionalTravelBufferPerIterationInMinutes = 10; + private void tryToSolveAllCarriersCompletely(Scenario scenario, + List nonCompleteSolvedCarriers) { int startNumberOfCarriersWithUnhandledJobs = nonCompleteSolvedCarriers.size(); log.info("Starting with carrier-replanning loop."); - for(int i = 0; i < maxIterations; i++){ + for (int i = 0; i < maxReplanningIterations; i++) { log.info("carrier-replanning loop iteration: {}", i); -// Collection allCarriers = CarriersUtils.getCarriers(scenario).getCarriers().values(); -// if (allCarriersViable(scenario)) break; int numberOfCarriersWithUnhandledJobs = nonCompleteSolvedCarriers.size(); - for(Carrier nonCompleteSolvedCarrier : nonCompleteSolvedCarriers) { -// if (allJobsHandledCheck(carrier)) continue; + for (Carrier nonCompleteSolvedCarrier : nonCompleteSolvedCarriers) { + //Delete old plan of carrier nonCompleteSolvedCarrier.clearPlans(); nonCompleteSolvedCarrier.setSelectedPlan(null); - // If we reach this point, the plan for this carrier is not viable. We will replan it CarrierAttributes carrierAttributes = carrierId2carrierAttributes.get(nonCompleteSolvedCarrier.getId()); // Generate new services. The new service batch should have a smaller sum of serviceDurations than before (or otherwise it will not change anything) -// double oldSumOfServiceDurations = getSumOfServiceDurations(scenario, carrier.getId()); -// int j = 0; -// do { -// if (i >= maxIterations) break; - //TODO Remove old vehicles? - - // Create the new services -// EnumeratedDistribution tourDistribution = commercialTourSpecifications.createTourDistribution(carrierAttributes.smallScaleCommercialTrafficType, rng); -// Map> serviceDurationTimeSelector = commercialTourSpecifications.createStopDurationDistributionPerCategory(carrierAttributes.smallScaleCommercialTrafficType, rng); redrawAllServiceDurations(nonCompleteSolvedCarrier, carrierAttributes, (i + 1) * additionalTravelBufferPerIterationInMinutes); - Carrier carrier = CarriersUtils.getCarriers(scenario).getCarriers().get(nonCompleteSolvedCarrier.getId()); log.info("Carrier should be changed..."); -// j++; -// } -// while (getSumOfServiceDurations(scenario, nonCompleteSolvedCarrier.getId()) > oldSumOfServiceDurations); -//// log.info("Carrer {}: Reduced summed serviceDuration from {} to {}", nonCompleteSolvedCarrier.getId(), oldSumOfServiceDurations, getSumOfServiceDurations(scenario, nonCompleteSolvedCarrier.getId())); } - try { - CarriersUtils.runJsprit(scenario, CarriersUtils.CarrierSelectionForSolution.solveOnlyForCarrierWithoutPlans); - } catch (ExecutionException | InterruptedException e) { - throw new RuntimeException(e); - } + try { + CarriersUtils.runJsprit(scenario, CarriersUtils.CarrierSelectionForSolution.solveOnlyForCarrierWithoutPlans); + } catch (ExecutionException | InterruptedException e) { + throw new RuntimeException(e); + } nonCompleteSolvedCarriers = createListOfCarrierWithUnhandledJobs(scenario); @@ -560,98 +544,18 @@ private void tryToSolveAllCarriersCompletely(Scenario scenario, List no } // Final check - if (!nonCompleteSolvedCarriers.isEmpty()){ + if (!nonCompleteSolvedCarriers.isEmpty()) { log.warn("Not all services were handled!"); } } -// private double getSumOfServiceDurations(Scenario scenario, Id carrierId) { -// double sum = 0; -// for (CarrierService service : CarriersUtils.getCarriers(scenario).getCarriers().get(carrierId).getServices().values()){ -// sum += service.getServiceDuration(); -// } -// return sum; -// } - -// private boolean allJobsHandledCheck(Carrier carrier){ -// CarrierPlan plan = carrier.getSelectedPlan(); - // TODO: remove these debug values -// double totalVehicleTime = 0; -// double totalServiceDuration = 0; -// double totalTravelDuration = 0; -// -// for(CarrierVehicle vehicle : carrier.getCarrierCapabilities().getCarrierVehicles().values()){ -// totalVehicleTime += vehicle.getLatestEndTime() - vehicle.getEarliestStartTime(); -// } - -// List handledServices = new LinkedList<>(); - //Check if all services have been handled -// int planedJobs = carrier.getServices().size(); -// int handledJobs = carrier.getSelectedPlan().getScheduledTours().stream().mapToInt( -// tour -> (int) tour.getTour().getTourElements().stream().filter(element -> element instanceof Tour.ServiceActivity).count()).sum(); -// if (planedJobs != handledJobs){ -// log.warn("Carrier {}: {} of {} services were not handled!", carrier.getId(), planedJobs - handledJobs, planedJobs); -// return false; -// } else { -// return true; -// } - // for(ScheduledTour tour : plan.getScheduledTours()){ -// //DEBUG -// double thisVehicleTime = tour.getVehicle().getLatestEndTime() - tour.getVehicle().getEarliestStartTime(); -// double thisTourTime = 0; -// -// for(Tour.TourElement element : tour.getTour().getTourElements()){ -// if(element instanceof Tour.Leg){ -// totalTravelDuration += ((Tour.Leg) element).getExpectedTransportTime(); -// thisTourTime += ((Tour.Leg) element).getExpectedTransportTime(); -// } -// if(element instanceof Tour.ServiceActivity){ -// handledServices.add(((Tour.ServiceActivity) element).getService()); -// totalServiceDuration += ((Tour.ServiceActivity) element).getDuration(); -// thisTourTime += ((Tour.ServiceActivity) element).getDuration(); -// } -// } -// -// //log.info("Tour {} used {} out of {} available vehicle time", tour.getTour().getId(), thisTourTime, thisVehicleTime); -// } -// -// List unhandled = new LinkedList<>(); -// for(CarrierService service : carrier.getServices().values()){ -// if(!handledServices.contains(service)){ -// unhandled.add(service); -// } -// } -// -// if(!unhandled.isEmpty()){ -// //TODO remove this message -// log.warn("Carrier {}: {} of {} services were not handled! The total vehicle time is: {} ({}); The total serviceDuration is: {} ({}); The total travelDuration is : {}", -// carrier.getId(), -// unhandled.size(), -// carrier.getServices().size(), -// totalVehicleTime, carrier.getCarrierCapabilities().getCarrierVehicles().size(), -// totalServiceDuration, carrier.getServices().size(), -// totalTravelDuration -// ); -// for(CarrierService s : unhandled){ -// log.warn("Service {} (duration={}) was not handled by carrier {}", s.getId(), s.getServiceDuration(), carrier.getId()); -// } -// return false; -// } else { -// return true; -// } -// -// } - private List createListOfCarrierWithUnhandledJobs(Scenario scenario){ List carriersWithUnhandledJobs = new LinkedList<>(); -// int successful = 0; - for(Carrier carrier : CarriersUtils.getCarriers(scenario).getCarriers().values()){ - if(!CarriersUtils.allJobsHandledBySelectedPlan(carrier)) + for (Carrier carrier : CarriersUtils.getCarriers(scenario).getCarriers().values()) { + if (!CarriersUtils.allJobsHandledBySelectedPlan(carrier)) carriersWithUnhandledJobs.add(carrier); } -// log.info("{} of {} carriers were fully served!", successful, CarriersUtils.getCarriers(scenario).getCarriers().size()); -// return successful == CarriersUtils.getCarriers(scenario).getCarriers().size(); return carriersWithUnhandledJobs; } @@ -659,7 +563,6 @@ private void createCarriersAndDemand(Path output, Scenario scenario, Map> resultingDataPerZone, Map, Link>> linksPerZone, String smallScaleCommercialTrafficType, boolean includeExistingModels) throws Exception { - ArrayList modesORvehTypes; if (smallScaleCommercialTrafficType.equals("goodsTraffic")) modesORvehTypes = new ArrayList<>( @@ -880,7 +783,6 @@ public void createCarriers(Scenario scenario, TripDistributionMatrix odMatrix, M /** * Generates and adds the services for the given carrier. - * TODO In-source this method back into create carriers */ private void createServices(Carrier newCarrier, Map> resultingDataPerZone, TripDistributionMatrix odMatrix, Map, Link>> linksPerZone, CarrierAttributes carrierAttributes) { @@ -1045,11 +947,6 @@ else if (carrierAttributes.smallScaleCommercialTrafficType.equals( GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString())) { key = GenerateSmallScaleCommercialTrafficDemand.makeServiceDurationPerCategoryKey(carrierAttributes.selectedStartCategory, carrierAttributes.modeORvehType, carrierAttributes.smallScaleCommercialTrafficType); } - // old Version -// GenerateSmallScaleCommercialTrafficDemand.DurationsBounds serviceDurationBounds = serviceDurationTimeSelector.get(key).sample(); -// int serviceDurationLowerBound = serviceDurationBounds.minDuration(); -// int serviceDurationUpperBound = serviceDurationBounds.maxDuration(); -// return rnd.nextInt(serviceDurationLowerBound * 60, serviceDurationUpperBound * 60); //possible new Version by Ricardo double maxVehicleAvailability = carrier.getCarrierCapabilities().getCarrierVehicles().values().stream().mapToDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime()).max().orElse(0); @@ -1460,7 +1357,8 @@ public record DurationsBounds(int minDuration, int maxDuration) {} * @param startZone start zone of this carrier, entry from {@link TripDistributionMatrix#getListOfZones()} * @param selectedStartCategory start category of this carrier, selected randomly from {@link VehicleSelection.OdMatrixEntryInformation#possibleStartCategories} * @param modeORvehType entry from {@link TripDistributionMatrix#getListOfModesOrVehTypes()} - * @param smallScaleCommercialTrafficType entry from {@link SmallScaleCommercialTrafficType} + * @param smallScaleCommercialTrafficType Entry from {@link SmallScaleCommercialTrafficType} for this carrier + * (NOTE: This value only differs between carriers if {@link SmallScaleCommercialTrafficType#completeSmallScaleCommercialTraffic is selected) * @param vehicleDepots Containing the depots of this carrier with linkIds as strings */ private record CarrierAttributes(int purpose, String startZone, String selectedStartCategory, String modeORvehType, From c6d634d870a012732d0db6e813864d1c50b9d396 Mon Sep 17 00:00:00 2001 From: aleks Date: Wed, 2 Oct 2024 14:52:41 +0200 Subject: [PATCH 51/60] Moved odMatrix, resultingDataPerZone, linksPerZone into class attributes, for smaller method-headers --- ...rateSmallScaleCommercialTrafficDemand.java | 90 +++++++++---------- 1 file changed, 40 insertions(+), 50 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index cc1963559e5..8238256f102 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -266,7 +266,7 @@ public Integer call() throws Exception { readVehicleTypes.keySet().removeIf(vehicleType -> !usedCarrierVehicleTypes.contains(vehicleType)); if (Objects.requireNonNull(usedCreationOption) == CreationOption.useExistingCarrierFileWithoutSolution) { - solveSeparatedVRPs(scenario, null); + solveSeparatedVRPs(scenario); } } default -> { @@ -281,14 +281,14 @@ public Integer call() throws Exception { switch (usedSmallScaleCommercialTrafficType) { case commercialPersonTraffic, goodsTraffic -> - createCarriersAndDemand(output, scenario, resultingDataPerZone, linksPerZone, + createCarriersAndDemand(output, scenario, usedSmallScaleCommercialTrafficType.toString(), includeExistingModels); case completeSmallScaleCommercialTraffic -> { - createCarriersAndDemand(output, scenario, resultingDataPerZone, linksPerZone, "commercialPersonTraffic", + createCarriersAndDemand(output, scenario, "commercialPersonTraffic", includeExistingModels); includeExistingModels = false; // because already included in the step before - createCarriersAndDemand(output, scenario, resultingDataPerZone, linksPerZone, "goodsTraffic", + createCarriersAndDemand(output, scenario, "goodsTraffic", includeExistingModels); } default -> throw new RuntimeException("No traffic type selected."); @@ -300,7 +300,7 @@ public Integer call() throws Exception { new CarrierPlanWriter(CarriersUtils.addOrGetCarriers(scenario)) .write(scenario.getConfig().controller().getOutputDirectory() + "/" + scenario.getConfig().controller().getRunId() + ".output_CarrierDemand.xml"); - solveSeparatedVRPs(scenario, linksPerZone); + solveSeparatedVRPs(scenario); } } if (config.controller().getRunId() == null) @@ -349,9 +349,8 @@ private void filterFacilitiesForZones(Scenario scenario, Map, Link>> linksPerZone) throws Exception { + private void solveSeparatedVRPs(Scenario originalScenario) throws Exception { /* TODO: Make a final fix for the unhandledServiceProblem using following procedure: @@ -560,8 +559,7 @@ private List createListOfCarrierWithUnhandledJobs(Scenario scenario){ } private void createCarriersAndDemand(Path output, Scenario scenario, - Map> resultingDataPerZone, - Map, Link>> linksPerZone, String smallScaleCommercialTrafficType, + String smallScaleCommercialTrafficType, boolean includeExistingModels) throws Exception { ArrayList modesORvehTypes; if (smallScaleCommercialTrafficType.equals("goodsTraffic")) @@ -585,8 +583,8 @@ else if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) trafficVolumePerTypeAndZone_start, trafficVolumePerTypeAndZone_stop); } odMatrix = createTripDistribution(trafficVolumePerTypeAndZone_start, - trafficVolumePerTypeAndZone_stop, smallScaleCommercialTrafficType, scenario, output, linksPerZone); - createCarriers(scenario, odMatrix, resultingDataPerZone, smallScaleCommercialTrafficType, linksPerZone); + trafficVolumePerTypeAndZone_stop, smallScaleCommercialTrafficType, scenario, output); + createCarriers(scenario, smallScaleCommercialTrafficType); } /** @@ -666,13 +664,10 @@ public void install() { * Creates the carriers and the related demand, based on the generated * TripDistributionMatrix. * @param scenario Scenario (loaded from your config), where the carriers will be put into - * @param odMatrix Can be generated in {@link GenerateSmallScaleCommercialTrafficDemand} - * @param resultingDataPerZone Data distribution to zones (Given in {@link GenerateSmallScaleCommercialTrafficDemand} * @param smallScaleCommercialTrafficType Selected traffic types. Options: commercialPersonTraffic, goodsTraffic - * @param linksPerZone Links per zone (Given in {@link GenerateSmallScaleCommercialTrafficDemand} */ - public void createCarriers(Scenario scenario, TripDistributionMatrix odMatrix, Map> resultingDataPerZone, - String smallScaleCommercialTrafficType, Map, Link>> linksPerZone) { + public void createCarriers(Scenario scenario, + String smallScaleCommercialTrafficType) { //Save the given data RandomGenerator rng = new MersenneTwister(scenario.getConfig().global().getRandomSeed()); @@ -759,20 +754,20 @@ public void createCarriers(Scenario scenario, TripDistributionMatrix odMatrix, M log.info("Carrier: {}; depots: {}; services: {}", carrierName, numberOfDepots, (int) Math.ceil(odMatrix.getSumOfServicesForStartZone(startZone, modeORvehType, purpose, smallScaleCommercialTrafficType) / odMatrixEntry.occupancyRate)); - createNewCarrierAndAddVehicleTypes(scenario, purpose, startZone, - selectedStartCategory, carrierName, vehicleTypes, numberOfDepots, fleetSize, - fixedNumberOfVehiclePerTypeAndLocation, vehicleDepots, linksPerZone, smallScaleCommercialTrafficType, - tourDistribution); - // Now Create services for this carrier - Carrier newCarrier = CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)); CarrierAttributes carrierAttributes = new CarrierAttributes(purpose, startZone, selectedStartCategory, modeORvehType, smallScaleCommercialTrafficType, vehicleDepots, odMatrixEntry); - carrierId2carrierAttributes.put(Id.create(carrierName, Carrier.class), carrierAttributes); - createServices(newCarrier, resultingDataPerZone, odMatrix, linksPerZone, - carrierAttributes); + createNewCarrierAndAddVehicleTypes( + scenario, carrierName, carrierAttributes, + vehicleTypes, numberOfDepots, fleetSize, + fixedNumberOfVehiclePerTypeAndLocation); + + // Now Create services for this carrier + Carrier newCarrier = CarriersUtils.getCarriers(scenario).getCarriers().get(Id.create(carrierName, Carrier.class)); + + createServices(newCarrier, carrierAttributes); } } } @@ -784,8 +779,8 @@ public void createCarriers(Scenario scenario, TripDistributionMatrix odMatrix, M /** * Generates and adds the services for the given carrier. */ - private void createServices(Carrier newCarrier, Map> resultingDataPerZone, TripDistributionMatrix odMatrix, - Map, Link>> linksPerZone, CarrierAttributes carrierAttributes) { + private void createServices(Carrier newCarrier, + CarrierAttributes carrierAttributes) { log.info("Create services for carrier: {}", newCarrier.getId()); for (String stopZone : odMatrix.getListOfZones()) { int trafficVolumeForOD = Math.round((float)odMatrix.getTripDistributionValue(carrierAttributes.startZone, @@ -813,8 +808,7 @@ private void createServices(Carrier newCarrier, Map noPossibleLinks, String selectedStopCategory, String stopZone, - Integer serviceTimePerStop, TimeWindow serviceTimeWindow, - Map, Link>> linksPerZone) { + Integer serviceTimePerStop, TimeWindow serviceTimeWindow) { - Id linkId = findPossibleLink(stopZone, selectedStopCategory, noPossibleLinks, linksPerZone); + Id linkId = findPossibleLink(stopZone, selectedStopCategory, noPossibleLinks); Id idNewService = Id.create(newCarrier.getId().toString() + "_" + linkId + "_" + rnd.nextInt(10000), CarrierService.class); @@ -850,12 +843,9 @@ private void redrawAllServiceDurations(Carrier carrier, CarrierAttributes carrie /** * Creates the carrier and the related vehicles. */ - private void createNewCarrierAndAddVehicleTypes(Scenario scenario, Integer purpose, String startZone, String selectedStartCategory, - String carrierName, List vehicleTypes, int numberOfDepots, - CarrierCapabilities.FleetSize fleetSize, int fixedNumberOfVehiclePerTypeAndLocation, - List vehicleDepots, Map, Link>> linksPerZone, - String smallScaleCommercialTrafficType, - Map> tourStartTimeSelector) { + private void createNewCarrierAndAddVehicleTypes(Scenario scenario, String carrierName, CarrierAttributes carrierAttributes, + List vehicleTypes, int numberOfDepots, CarrierCapabilities.FleetSize fleetSize, + int fixedNumberOfVehiclePerTypeAndLocation) { Carriers carriers = CarriersUtils.addOrGetCarriers(scenario); CarrierVehicleTypes carrierVehicleTypes = CarriersUtils.getCarrierVehicleTypes(scenario); @@ -863,26 +853,26 @@ private void createNewCarrierAndAddVehicleTypes(Scenario scenario, Integer purpo CarrierCapabilities carrierCapabilities; Carrier thisCarrier = CarriersUtils.createCarrier(Id.create(carrierName, Carrier.class)); - if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic") && purpose == 3) - thisCarrier.getAttributes().putAttribute("subpopulation", smallScaleCommercialTrafficType + "_service"); + if (carrierAttributes.smallScaleCommercialTrafficType.equals("commercialPersonTraffic") && carrierAttributes.purpose == 3) + thisCarrier.getAttributes().putAttribute("subpopulation", carrierAttributes.smallScaleCommercialTrafficType + "_service"); else - thisCarrier.getAttributes().putAttribute("subpopulation", smallScaleCommercialTrafficType); + thisCarrier.getAttributes().putAttribute("subpopulation", carrierAttributes.smallScaleCommercialTrafficType); - thisCarrier.getAttributes().putAttribute("purpose", purpose); - thisCarrier.getAttributes().putAttribute("tourStartArea", startZone); + thisCarrier.getAttributes().putAttribute("purpose", carrierAttributes.purpose); + thisCarrier.getAttributes().putAttribute("tourStartArea", carrierAttributes.startZone); if (jspritIterations > 0) CarriersUtils.setJspritIterations(thisCarrier, jspritIterations); carrierCapabilities = CarrierCapabilities.Builder.newInstance().setFleetSize(fleetSize).build(); carriers.addCarrier(thisCarrier); - while (vehicleDepots.size() < numberOfDepots) { - Id linkId = findPossibleLink(startZone, selectedStartCategory, null, linksPerZone); - vehicleDepots.add(linkId.toString()); + while (carrierAttributes.vehicleDepots.size() < numberOfDepots) { + Id linkId = findPossibleLink(carrierAttributes.startZone, carrierAttributes.selectedStartCategory, null); + carrierAttributes.vehicleDepots.add(linkId.toString()); } - for (String singleDepot : vehicleDepots) { - GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = tourStartTimeSelector.get(smallScaleCommercialTrafficType).sample(); + for (String singleDepot : carrierAttributes.vehicleDepots) { + GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = tourDistribution.get(carrierAttributes.smallScaleCommercialTrafficType).sample(); int vehicleStartTime = getVehicleStartTime(t); int tourDuration = getVehicleTourDuration(t); @@ -990,7 +980,7 @@ else if (carrierAttributes.smallScaleCommercialTrafficType.equals( /** * Finds a possible link for a service or the vehicle location. */ - private Id findPossibleLink(String zone, String selectedCategory, List noPossibleLinks, Map, Link>> linksPerZone) { + private Id findPossibleLink(String zone, String selectedCategory, List noPossibleLinks) { Id newLink = null; for (int a = 0; newLink == null && a < facilitiesPerZone.get(zone).get(selectedCategory).size() * 2; a++) { @@ -1072,7 +1062,7 @@ private static void findNearestLinkForZonesWithoutLinks(Network networkToChange, private TripDistributionMatrix createTripDistribution( Map> trafficVolume_start, Map> trafficVolume_stop, - String smallScaleCommercialTrafficType, Scenario scenario, Path output, Map, Link>> linksPerZone) + String smallScaleCommercialTrafficType, Scenario scenario, Path output) throws Exception { ArrayList listOfZones = new ArrayList<>(); From aab4022c25d748a0ddfcc061247e16ccff11b54f Mon Sep 17 00:00:00 2001 From: aleks Date: Wed, 2 Oct 2024 15:03:15 +0200 Subject: [PATCH 52/60] Javadoc and formatting --- ...rateSmallScaleCommercialTrafficDemand.java | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 8238256f102..67b7a9ea151 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -17,6 +17,7 @@ * See also COPYING, LICENSE and WARRANTY file * * * * *********************************************************************** */ + package org.matsim.smallScaleCommercialTrafficGeneration; import com.google.inject.Inject; @@ -182,7 +183,7 @@ public enum SmallScaleCommercialTrafficType { private final Map, CarrierAttributes> carrierId2carrierAttributes = new HashMap<>(); private Map> tourDistribution = null; private Map> serviceDurationTimeSelector = null; - //TODO Remove these attributes from all method-signatures + private TripDistributionMatrix odMatrix; private Map> resultingDataPerZone; private Map, Link>> linksPerZone; @@ -197,6 +198,7 @@ public GenerateSmallScaleCommercialTrafficDemand() { this.vehicleSelection = new DefaultVehicleSelection(); log.info("Using default {} for tour vehicle-selection!", DefaultVehicleSelection.class.getSimpleName()); } + public GenerateSmallScaleCommercialTrafficDemand(IntegrateExistingTrafficToSmallScaleCommercial integrateExistingTrafficToSmallScaleCommercial, CommercialTourSpecifications getCommercialTourSpecifications, VehicleSelection vehicleSelection) { if (integrateExistingTrafficToSmallScaleCommercial == null){ this.integrateExistingTrafficToSmallScaleCommercial = new DefaultIntegrateExistingTrafficToSmallScaleCommercialImpl(); @@ -212,7 +214,7 @@ public GenerateSmallScaleCommercialTrafficDemand(IntegrateExistingTrafficToSmall this.commercialTourSpecifications = getCommercialTourSpecifications; log.info("Using {} for tour specifications!", getCommercialTourSpecifications.getClass().getSimpleName()); } - if(vehicleSelection == null){ + if (vehicleSelection == null){ this.vehicleSelection = new DefaultVehicleSelection(); log.info("Using default {} for tour vehicle-selection!", DefaultVehicleSelection.class.getSimpleName()); } else { @@ -334,7 +336,8 @@ public Integer call() throws Exception { return 0; } - /** Creates a map with the different facility types per building. + /** + * Creates a map with the different facility types per building. * @param scenario complete Scenario * @param facilitiesPerZone Map with facilities per zone */ @@ -348,17 +351,13 @@ private void filterFacilitiesForZones(Scenario scenario, Map nonCompleteSolvedCarriers) { + private void tryToSolveAllCarriersCompletely(Scenario scenario, List nonCompleteSolvedCarriers) { int startNumberOfCarriersWithUnhandledJobs = nonCompleteSolvedCarriers.size(); log.info("Starting with carrier-replanning loop."); for (int i = 0; i < maxReplanningIterations; i++) { @@ -735,7 +733,6 @@ public void createCarriers(Scenario scenario, else selectedStartCategory = odMatrixEntry.possibleStopCategories.get(rnd.nextInt(odMatrixEntry.possibleStopCategories.size())); } - // TODO #1 // Generate carrierName String carrierName = null; @@ -795,7 +792,6 @@ private void createServices(Carrier newCarrier, for (int i = 0; i < numberOfJobs; i++) { int serviceTimePerStop; if (carrierAttributes.selectedStartCategory.equals("Inhabitants")){ - //TODO This is a bit ugly. Do we even need the selectedStartCategory of the carrierAttributes in this case? Or can we just set it right at the beginning? (move it to TODO #1) CarrierAttributes inhabitantAttributes = new CarrierAttributes(carrierAttributes.purpose, carrierAttributes.startZone, carrierAttributes.odMatrixEntry.possibleStartCategories.getFirst(), carrierAttributes.modeORvehType, carrierAttributes.smallScaleCommercialTrafficType, carrierAttributes.vehicleDepots, carrierAttributes.odMatrixEntry); From 9a08faa3a2faddd2c67781e8e7ea92525988083a Mon Sep 17 00:00:00 2001 From: aleks Date: Tue, 8 Oct 2024 13:33:59 +0200 Subject: [PATCH 53/60] Outsourced methods for unhandled-services into UnhandledServicesSolution --- .../DefaultUnhandledServicesSolution.java | 142 +++++++++++++ ...rateSmallScaleCommercialTrafficDemand.java | 198 ++++-------------- .../UnhandledServicesSolution.java | 41 ++++ 3 files changed, 229 insertions(+), 152 deletions(-) create mode 100644 contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultUnhandledServicesSolution.java create mode 100644 contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/UnhandledServicesSolution.java diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultUnhandledServicesSolution.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultUnhandledServicesSolution.java new file mode 100644 index 00000000000..9740114dea8 --- /dev/null +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultUnhandledServicesSolution.java @@ -0,0 +1,142 @@ +package org.matsim.smallScaleCommercialTrafficGeneration; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.matsim.api.core.v01.Id; +import org.matsim.api.core.v01.Scenario; +import org.matsim.core.gbl.MatsimRandom; +import org.matsim.freight.carriers.Carrier; +import org.matsim.freight.carriers.CarrierService; +import org.matsim.freight.carriers.CarrierVehicle; +import org.matsim.freight.carriers.CarriersUtils; + +import java.util.*; +import java.util.concurrent.ExecutionException; + +public class DefaultUnhandledServicesSolution implements UnhandledServicesSolution { + private static final Logger log = LogManager.getLogger(DefaultUnhandledServicesSolution.class); + // Replanning configuration + private final int maxReplanningIterations; + private final int additionalTravelBufferPerIterationInMinutes; + + // Generation data + Random rnd; + private final GenerateSmallScaleCommercialTrafficDemand generator; + + DefaultUnhandledServicesSolution(GenerateSmallScaleCommercialTrafficDemand generator, int maxReplanningIterations, int additionalTravelBufferPerIterationInMinutes){ + rnd = MatsimRandom.getRandom(); + this.maxReplanningIterations = maxReplanningIterations; + this.additionalTravelBufferPerIterationInMinutes = additionalTravelBufferPerIterationInMinutes; + this.generator = generator; + } + + public List createListOfCarrierWithUnhandledJobs(Scenario scenario){ + List carriersWithUnhandledJobs = new LinkedList<>(); + for (Carrier carrier : CarriersUtils.getCarriers(scenario).getCarriers().values()) { + if (!CarriersUtils.allJobsHandledBySelectedPlan(carrier)) + carriersWithUnhandledJobs.add(carrier); + } + + return carriersWithUnhandledJobs; + } + + public int getServiceTimePerStop(Carrier carrier, GenerateSmallScaleCommercialTrafficDemand.CarrierAttributes carrierAttributes, int additionalTravelBufferPerIterationInMinutes) { + GenerateSmallScaleCommercialTrafficDemand.ServiceDurationPerCategoryKey key = null; + if (carrierAttributes.smallScaleCommercialTrafficType().equals( + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString())) + key = GenerateSmallScaleCommercialTrafficDemand.makeServiceDurationPerCategoryKey(carrierAttributes.selectedStartCategory(), null, carrierAttributes.smallScaleCommercialTrafficType()); + else if (carrierAttributes.smallScaleCommercialTrafficType().equals( + GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString())) { + key = GenerateSmallScaleCommercialTrafficDemand.makeServiceDurationPerCategoryKey(carrierAttributes.selectedStartCategory(), carrierAttributes.modeORvehType(), carrierAttributes.smallScaleCommercialTrafficType()); + } + + //possible new Version by Ricardo + double maxVehicleAvailability = carrier.getCarrierCapabilities().getCarrierVehicles().values().stream().mapToDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime()).max().orElse(0); + int usedTravelTimeBuffer = additionalTravelBufferPerIterationInMinutes * 60; // buffer for the driving time; for unsolved carriers the buffer will be increased over time + for (int j = 0; j < 200; j++) { + GenerateSmallScaleCommercialTrafficDemand.DurationsBounds serviceDurationBounds = generator.getServiceDurationTimeSelector().get(key).sample(); + + for (int i = 0; i < 10; i++) { + int serviceDurationLowerBound = serviceDurationBounds.minDuration(); + int serviceDurationUpperBound = serviceDurationBounds.maxDuration(); + int possibleValue = rnd.nextInt(serviceDurationLowerBound * 60, serviceDurationUpperBound * 60); + // checks if the service duration will not exceed the vehicle availability including the buffer + if (possibleValue + usedTravelTimeBuffer <= maxVehicleAvailability) + return possibleValue; + } + if (j > 100){ + CarrierVehicle carrierVehicleToChange = carrier.getCarrierCapabilities().getCarrierVehicles().values().stream().sorted(Comparator.comparingDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime())).toList().getFirst(); + log.info("Changing vehicle availability for carrier {}. Old maxVehicleAvailability: {}", carrier.getId(), maxVehicleAvailability); + int tourDuration = 0; + int vehicleStartTime = 0; + int vehicleEndTime = 0; + while (tourDuration < maxVehicleAvailability) { + GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = generator.getTourDistribution().get(carrierAttributes.smallScaleCommercialTrafficType()).sample(); + vehicleStartTime = t.getVehicleStartTime(); + tourDuration = t.getVehicleTourDuration(); + vehicleEndTime = vehicleStartTime + tourDuration; + } + CarrierVehicle newCarrierVehicle = CarrierVehicle.Builder.newInstance(carrierVehicleToChange.getId(), carrierVehicleToChange.getLinkId(), + carrierVehicleToChange.getType()).setEarliestStart(vehicleStartTime).setLatestEnd(vehicleEndTime).build(); + carrier.getCarrierCapabilities().getCarrierVehicles().remove(carrierVehicleToChange.getId()); + carrier.getCarrierCapabilities().getCarrierVehicles().put(newCarrierVehicle.getId(), newCarrierVehicle); + maxVehicleAvailability = carrier.getCarrierCapabilities().getCarrierVehicles().values().stream().mapToDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime()).max().orElse(0); + log.info("New maxVehicleAvailability: {}", maxVehicleAvailability); + } + } + + throw new RuntimeException("No possible service duration found for employee category '" + carrierAttributes.selectedStartCategory() + "' and mode '" + + carrierAttributes.modeORvehType() + "' in traffic type '" + carrierAttributes.smallScaleCommercialTrafficType() + "'"); + } + + /** + * Redraws the service-durations of all {@link CarrierService}s of the given {@link Carrier}. + */ + private void redrawAllServiceDurations(Carrier carrier, GenerateSmallScaleCommercialTrafficDemand.CarrierAttributes carrierAttributes, int additionalTravelBufferPerIterationInMinutes) { + for (CarrierService service : carrier.getServices().values()) { + double newServiceDuration = getServiceTimePerStop(carrier, carrierAttributes, additionalTravelBufferPerIterationInMinutes); + CarrierService redrawnService = CarrierService.Builder.newInstance(service.getId(), service.getLocationLinkId()) + .setServiceDuration(newServiceDuration).setServiceStartTimeWindow(service.getServiceStartTimeWindow()).build(); + carrier.getServices().put(redrawnService.getId(), redrawnService); + } + } + + @Override + public void tryToSolveAllCarriersCompletely(Scenario scenario, List nonCompleteSolvedCarriers, Map, GenerateSmallScaleCommercialTrafficDemand.CarrierAttributes> carrierId2carrierAttributes) { + int startNumberOfCarriersWithUnhandledJobs = nonCompleteSolvedCarriers.size(); + log.info("Starting with carrier-replanning loop."); + for (int i = 0; i < maxReplanningIterations; i++) { + log.info("carrier-replanning loop iteration: {}", i); + int numberOfCarriersWithUnhandledJobs = nonCompleteSolvedCarriers.size(); + for (Carrier nonCompleteSolvedCarrier : nonCompleteSolvedCarriers) { + //Delete old plan of carrier + nonCompleteSolvedCarrier.clearPlans(); + nonCompleteSolvedCarrier.setSelectedPlan(null); + GenerateSmallScaleCommercialTrafficDemand.CarrierAttributes carrierAttributes = carrierId2carrierAttributes.get(nonCompleteSolvedCarrier.getId()); + + // Generate new services. The new service batch should have a smaller sum of serviceDurations than before (or otherwise it will not change anything) + redrawAllServiceDurations(nonCompleteSolvedCarrier, carrierAttributes, (i + 1) * additionalTravelBufferPerIterationInMinutes); + log.info("Carrier should be changed..."); + } + try { + CarriersUtils.runJsprit(scenario, CarriersUtils.CarrierSelectionForSolution.solveOnlyForCarrierWithoutPlans); + } catch (ExecutionException | InterruptedException e) { + throw new RuntimeException(e); + } + + + nonCompleteSolvedCarriers = createListOfCarrierWithUnhandledJobs(scenario); + log.info( + "End of carrier-replanning loop iteration: {}. From the {} carriers with unhandled jobs ({} already solved), {} were solved in this iteration with an additionalBuffer of {} minutes.", + i, startNumberOfCarriersWithUnhandledJobs, startNumberOfCarriersWithUnhandledJobs - numberOfCarriersWithUnhandledJobs, + numberOfCarriersWithUnhandledJobs - nonCompleteSolvedCarriers.size(), (i + 1) * additionalTravelBufferPerIterationInMinutes); + if (nonCompleteSolvedCarriers.isEmpty()) break; + } + + // Final check + if (!nonCompleteSolvedCarriers.isEmpty()) { + log.warn("Not all services were handled!"); + } + } + +} diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 67b7a9ea151..834b57b48be 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -86,7 +86,6 @@ import java.time.LocalDate; import java.time.LocalTime; import java.util.*; -import java.util.concurrent.ExecutionException; import static org.matsim.core.controler.OutputDirectoryHierarchy.OverwriteFileSetting.overwriteExistingFiles; import static org.matsim.smallScaleCommercialTrafficGeneration.SmallScaleCommercialTrafficUtils.readDataDistribution; @@ -111,6 +110,7 @@ public class GenerateSmallScaleCommercialTrafficDemand implements MATSimAppComma private final IntegrateExistingTrafficToSmallScaleCommercial integrateExistingTrafficToSmallScaleCommercial; private final CommercialTourSpecifications commercialTourSpecifications; private final VehicleSelection vehicleSelection; + private final UnhandledServicesSolution unhandledServicesSolution; private enum CreationOption { useExistingCarrierFileWithSolution, createNewCarrierFile, useExistingCarrierFileWithoutSolution @@ -181,6 +181,7 @@ public enum SmallScaleCommercialTrafficType { private RandomGenerator rng; private final Map>> facilitiesPerZone = new HashMap<>(); private final Map, CarrierAttributes> carrierId2carrierAttributes = new HashMap<>(); + private Map> tourDistribution = null; private Map> serviceDurationTimeSelector = null; @@ -197,9 +198,11 @@ public GenerateSmallScaleCommercialTrafficDemand() { log.info("Using default {} for tour specifications!", DefaultTourSpecificationsByUsingKID2002.class.getSimpleName()); this.vehicleSelection = new DefaultVehicleSelection(); log.info("Using default {} for tour vehicle-selection!", DefaultVehicleSelection.class.getSimpleName()); + this.unhandledServicesSolution = new DefaultUnhandledServicesSolution(this, maxReplanningIterations, additionalTravelBufferPerIterationInMinutes); + log.info("Using default {} for tour unhandled-services-solution!", DefaultUnhandledServicesSolution.class.getSimpleName()); } - public GenerateSmallScaleCommercialTrafficDemand(IntegrateExistingTrafficToSmallScaleCommercial integrateExistingTrafficToSmallScaleCommercial, CommercialTourSpecifications getCommercialTourSpecifications, VehicleSelection vehicleSelection) { + public GenerateSmallScaleCommercialTrafficDemand(IntegrateExistingTrafficToSmallScaleCommercial integrateExistingTrafficToSmallScaleCommercial, CommercialTourSpecifications getCommercialTourSpecifications, VehicleSelection vehicleSelection, UnhandledServicesSolution unhandledServicesSolution) { if (integrateExistingTrafficToSmallScaleCommercial == null){ this.integrateExistingTrafficToSmallScaleCommercial = new DefaultIntegrateExistingTrafficToSmallScaleCommercialImpl(); log.info("Using default {} if existing models are integrated!", DefaultIntegrateExistingTrafficToSmallScaleCommercialImpl.class.getSimpleName()); @@ -221,6 +224,13 @@ public GenerateSmallScaleCommercialTrafficDemand(IntegrateExistingTrafficToSmall this.vehicleSelection = vehicleSelection; log.info("Using {} for tour vehicle-selection!", vehicleSelection.getClass().getSimpleName()); } + if (unhandledServicesSolution == null){ + this.unhandledServicesSolution = new DefaultUnhandledServicesSolution(this, maxReplanningIterations, additionalTravelBufferPerIterationInMinutes); + log.info("Using default {} for unhandled-services-solution", DefaultUnhandledServicesSolution.class.getSimpleName()); + } else { + this.unhandledServicesSolution = unhandledServicesSolution; + log.info("Using {} for unhandled-services-solution!", unhandledServicesSolution.getClass().getSimpleName()); + } } public static void main(String[] args) { @@ -478,9 +488,9 @@ private void solveSeparatedVRPs(Scenario originalScenario) throws Exception { log.info("Solving carriers {}-{} of all {} carriers. This are {} VRP to solve.", fromIndex + 1, toIndex, allCarriers.size(), subCarriers.size()); CarriersUtils.runJsprit(originalScenario); - List nonCompleteSolvedCarriers = createListOfCarrierWithUnhandledJobs(originalScenario); + List nonCompleteSolvedCarriers = unhandledServicesSolution.createListOfCarrierWithUnhandledJobs(originalScenario); if (!nonCompleteSolvedCarriers.isEmpty()) - tryToSolveAllCarriersCompletely(originalScenario, nonCompleteSolvedCarriers); + unhandledServicesSolution.tryToSolveAllCarriersCompletely(originalScenario, nonCompleteSolvedCarriers, carrierId2carrierAttributes); solvedCarriers.putAll(CarriersUtils.getCarriers(originalScenario).getCarriers()); CarriersUtils.getCarriers(originalScenario).getCarriers().clear(); if (!splitVRPs) @@ -502,60 +512,6 @@ private void solveSeparatedVRPs(Scenario originalScenario) throws Exception { }); } - /** - * Checks and recalculates plans of carriers, which did not serve all services. - * This step may take a few minutes. - * - * @param scenario Scenario with carriers - * @param nonCompleteSolvedCarriers List of carriers, which did not serve all services - */ - private void tryToSolveAllCarriersCompletely(Scenario scenario, List nonCompleteSolvedCarriers) { - int startNumberOfCarriersWithUnhandledJobs = nonCompleteSolvedCarriers.size(); - log.info("Starting with carrier-replanning loop."); - for (int i = 0; i < maxReplanningIterations; i++) { - log.info("carrier-replanning loop iteration: {}", i); - int numberOfCarriersWithUnhandledJobs = nonCompleteSolvedCarriers.size(); - for (Carrier nonCompleteSolvedCarrier : nonCompleteSolvedCarriers) { - //Delete old plan of carrier - nonCompleteSolvedCarrier.clearPlans(); - nonCompleteSolvedCarrier.setSelectedPlan(null); - CarrierAttributes carrierAttributes = carrierId2carrierAttributes.get(nonCompleteSolvedCarrier.getId()); - - // Generate new services. The new service batch should have a smaller sum of serviceDurations than before (or otherwise it will not change anything) - redrawAllServiceDurations(nonCompleteSolvedCarrier, carrierAttributes, (i + 1) * additionalTravelBufferPerIterationInMinutes); - log.info("Carrier should be changed..."); - } - try { - CarriersUtils.runJsprit(scenario, CarriersUtils.CarrierSelectionForSolution.solveOnlyForCarrierWithoutPlans); - } catch (ExecutionException | InterruptedException e) { - throw new RuntimeException(e); - } - - - nonCompleteSolvedCarriers = createListOfCarrierWithUnhandledJobs(scenario); - log.info( - "End of carrier-replanning loop iteration: {}. From the {} carriers with unhandled jobs ({} already solved), {} were solved in this iteration with an additionalBuffer of {} minutes.", - i, startNumberOfCarriersWithUnhandledJobs, startNumberOfCarriersWithUnhandledJobs - numberOfCarriersWithUnhandledJobs, - numberOfCarriersWithUnhandledJobs - nonCompleteSolvedCarriers.size(), (i + 1) * additionalTravelBufferPerIterationInMinutes); - if (nonCompleteSolvedCarriers.isEmpty()) break; - } - - // Final check - if (!nonCompleteSolvedCarriers.isEmpty()) { - log.warn("Not all services were handled!"); - } - } - - private List createListOfCarrierWithUnhandledJobs(Scenario scenario){ - List carriersWithUnhandledJobs = new LinkedList<>(); - for (Carrier carrier : CarriersUtils.getCarriers(scenario).getCarriers().values()) { - if (!CarriersUtils.allJobsHandledBySelectedPlan(carrier)) - carriersWithUnhandledJobs.add(carrier); - } - - return carriersWithUnhandledJobs; - } - private void createCarriersAndDemand(Path output, Scenario scenario, String smallScaleCommercialTrafficType, boolean includeExistingModels) throws Exception { @@ -589,7 +545,6 @@ else if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) * Reads and checks config if all necessary parameters are set. */ private Config readAndCheckConfig(Path configPath, String modelName, String sampleName, Path output) throws Exception { - Config config = ConfigUtils.loadConfig(configPath.toString()); if (output == null || output.toString().isEmpty()) config.controller().setOutputDirectory(Path.of(config.controller().getOutputDirectory()).resolve(modelName) @@ -795,11 +750,11 @@ private void createServices(Carrier newCarrier, CarrierAttributes inhabitantAttributes = new CarrierAttributes(carrierAttributes.purpose, carrierAttributes.startZone, carrierAttributes.odMatrixEntry.possibleStartCategories.getFirst(), carrierAttributes.modeORvehType, carrierAttributes.smallScaleCommercialTrafficType, carrierAttributes.vehicleDepots, carrierAttributes.odMatrixEntry); - serviceTimePerStop = getServiceTimePerStop(newCarrier, inhabitantAttributes, 0); + serviceTimePerStop = unhandledServicesSolution.getServiceTimePerStop(newCarrier, inhabitantAttributes, 0); } else { - serviceTimePerStop = getServiceTimePerStop(newCarrier, carrierAttributes, 0); + serviceTimePerStop = unhandledServicesSolution.getServiceTimePerStop(newCarrier, carrierAttributes, 0); } TimeWindow serviceTimeWindow = TimeWindow.newInstance(0, @@ -824,17 +779,7 @@ private void createService(Carrier newCarrier, ArrayList noPossibleLinks newCarrier.getServices().put(thisService.getId(), thisService); } - /** - * Redraws the service-durations of all {@link CarrierService}s of the given {@link Carrier}. - */ - private void redrawAllServiceDurations(Carrier carrier, CarrierAttributes carrierAttributes, int additionalTravelBufferPerIterationInMinutes) { - for (CarrierService service : carrier.getServices().values()) { - double newServiceDuration = getServiceTimePerStop(carrier, carrierAttributes, additionalTravelBufferPerIterationInMinutes); - CarrierService redrawnService = CarrierService.Builder.newInstance(service.getId(), service.getLocationLinkId()) - .setServiceDuration(newServiceDuration).setServiceStartTimeWindow(service.getServiceStartTimeWindow()).build(); - carrier.getServices().put(redrawnService.getId(), redrawnService); - } - } + /** * Creates the carrier and the related vehicles. @@ -870,8 +815,8 @@ private void createNewCarrierAndAddVehicleTypes(Scenario scenario, String carrie for (String singleDepot : carrierAttributes.vehicleDepots) { GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = tourDistribution.get(carrierAttributes.smallScaleCommercialTrafficType).sample(); - int vehicleStartTime = getVehicleStartTime(t); - int tourDuration = getVehicleTourDuration(t); + int vehicleStartTime = t.getVehicleStartTime(); + int tourDuration = t.getVehicleTourDuration(); int vehicleEndTime = vehicleStartTime + tourDuration; for (String thisVehicleType : vehicleTypes) { //TODO Flottenzusammensetzung anpassen. Momentan pro Depot alle Fahrzeugtypen 1x erzeugen VehicleType thisType = carrierVehicleTypes.getVehicleTypes() @@ -897,82 +842,6 @@ private void createNewCarrierAndAddVehicleTypes(Scenario scenario, String carrie } } - /** - * Gives a duration for the created tour under the given probability. - */ - private int getVehicleTourDuration(TourStartAndDuration t) { - if (t.minDuration == 0.) - return (int) t.maxDuration * 60; - else - return (int) rnd.nextDouble(t.minDuration * 60, t.maxDuration * 60); - } - - /** - * Gives a tour start time for the created tour under the given probability. - */ - private int getVehicleStartTime(TourStartAndDuration t) { - return rnd.nextInt(t.hourLower * 3600, t.hourUpper * 3600); - } - - /** - * Give a service duration based on the purpose and the trafficType under a given probability - * - * @param carrier The carrier for which we generate the serviceTime - * @param carrierAttributes attributes of the carrier to generate the service time for. - * selectedStartCategory: the category of the employee - * @param additionalTravelBufferPerIterationInMinutes additional buffer for the travel time - * @return the service duration - */ - private Integer getServiceTimePerStop(Carrier carrier, CarrierAttributes carrierAttributes, int additionalTravelBufferPerIterationInMinutes) { - - ServiceDurationPerCategoryKey key = null; - if (carrierAttributes.smallScaleCommercialTrafficType.equals( - GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.commercialPersonTraffic.toString())) - key = GenerateSmallScaleCommercialTrafficDemand.makeServiceDurationPerCategoryKey(carrierAttributes.selectedStartCategory, null, carrierAttributes.smallScaleCommercialTrafficType); - else if (carrierAttributes.smallScaleCommercialTrafficType.equals( - GenerateSmallScaleCommercialTrafficDemand.SmallScaleCommercialTrafficType.goodsTraffic.toString())) { - key = GenerateSmallScaleCommercialTrafficDemand.makeServiceDurationPerCategoryKey(carrierAttributes.selectedStartCategory, carrierAttributes.modeORvehType, carrierAttributes.smallScaleCommercialTrafficType); - } - - //possible new Version by Ricardo - double maxVehicleAvailability = carrier.getCarrierCapabilities().getCarrierVehicles().values().stream().mapToDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime()).max().orElse(0); - int usedTravelTimeBuffer = additionalTravelBufferPerIterationInMinutes * 60; // buffer for the driving time; for unsolved carriers the buffer will be increased over time - for (int j = 0; j < 200; j++) { - GenerateSmallScaleCommercialTrafficDemand.DurationsBounds serviceDurationBounds = serviceDurationTimeSelector.get(key).sample(); - - for (int i = 0; i < 10; i++) { - int serviceDurationLowerBound = serviceDurationBounds.minDuration(); - int serviceDurationUpperBound = serviceDurationBounds.maxDuration(); - int possibleValue = rnd.nextInt(serviceDurationLowerBound * 60, serviceDurationUpperBound * 60); - // checks if the service duration will not exceed the vehicle availability including the buffer - if (possibleValue + usedTravelTimeBuffer <= maxVehicleAvailability) - return possibleValue; - } - if (j > 100){ - CarrierVehicle carrierVehicleToChange = carrier.getCarrierCapabilities().getCarrierVehicles().values().stream().sorted(Comparator.comparingDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime())).toList().getFirst(); - log.info("Changing vehicle availability for carrier {}. Old maxVehicleAvailability: {}", carrier.getId(), maxVehicleAvailability); - int tourDuration = 0; - int vehicleStartTime = 0; - int vehicleEndTime = 0; - while (tourDuration < maxVehicleAvailability) { - GenerateSmallScaleCommercialTrafficDemand.TourStartAndDuration t = tourDistribution.get(carrierAttributes.smallScaleCommercialTrafficType).sample(); - vehicleStartTime = getVehicleStartTime(t); - tourDuration = getVehicleTourDuration(t); - vehicleEndTime = vehicleStartTime + tourDuration; - } - CarrierVehicle newCarrierVehicle = CarrierVehicle.Builder.newInstance(carrierVehicleToChange.getId(), carrierVehicleToChange.getLinkId(), - carrierVehicleToChange.getType()).setEarliestStart(vehicleStartTime).setLatestEnd(vehicleEndTime).build(); - carrier.getCarrierCapabilities().getCarrierVehicles().remove(carrierVehicleToChange.getId()); - carrier.getCarrierCapabilities().getCarrierVehicles().put(newCarrierVehicle.getId(), newCarrierVehicle); - maxVehicleAvailability = carrier.getCarrierCapabilities().getCarrierVehicles().values().stream().mapToDouble(vehicle -> vehicle.getLatestEndTime() - vehicle.getEarliestStartTime()).max().orElse(0); - log.info("New maxVehicleAvailability: {}", maxVehicleAvailability); - } - } - - throw new RuntimeException("No possible service duration found for employee category '" + carrierAttributes.selectedStartCategory + "' and mode '" - + carrierAttributes.modeORvehType + "' in traffic type '" + carrierAttributes.smallScaleCommercialTrafficType + "'"); - } - /** * Finds a possible link for a service or the vehicle location. */ @@ -1091,6 +960,14 @@ private TripDistributionMatrix createTripDistribution( return odMatrix; } + public Map> getTourDistribution() { + return tourDistribution; + } + + public Map> getServiceDurationTimeSelector() { + return serviceDurationTimeSelector; + } + private static class MyCarrierScoringFunctionFactory implements CarrierScoringFunctionFactory { @Inject @@ -1333,7 +1210,24 @@ public static ServiceDurationPerCategoryKey makeServiceDurationPerCategoryKey(St return new ServiceDurationPerCategoryKey(employeeCategory, vehicleType, smallScaleCommercialTrafficType); } - public record TourStartAndDuration(int hourLower, int hourUpper, double minDuration, double maxDuration) {} + public record TourStartAndDuration(int hourLower, int hourUpper, double minDuration, double maxDuration) { + /** + * Gives a duration for the created tour under the given probability. + */ + public int getVehicleTourDuration() { + if (minDuration == 0.) + return (int) maxDuration() * 60; + else + return (int) rnd.nextDouble(minDuration * 60, maxDuration * 60); + } + + /** + * Gives a tour start time for the created tour under the given probability. + */ + public int getVehicleStartTime() { + return rnd.nextInt(hourLower * 3600, hourUpper * 3600); + } + } public record DurationsBounds(int minDuration, int maxDuration) {} @@ -1347,7 +1241,7 @@ public record DurationsBounds(int minDuration, int maxDuration) {} * (NOTE: This value only differs between carriers if {@link SmallScaleCommercialTrafficType#completeSmallScaleCommercialTraffic is selected) * @param vehicleDepots Containing the depots of this carrier with linkIds as strings */ - private record CarrierAttributes(int purpose, String startZone, String selectedStartCategory, String modeORvehType, + public record CarrierAttributes(int purpose, String startZone, String selectedStartCategory, String modeORvehType, String smallScaleCommercialTrafficType, ArrayList vehicleDepots, VehicleSelection.OdMatrixEntryInformation odMatrixEntry) {} } diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/UnhandledServicesSolution.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/UnhandledServicesSolution.java new file mode 100644 index 00000000000..9ec350d23bf --- /dev/null +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/UnhandledServicesSolution.java @@ -0,0 +1,41 @@ +package org.matsim.smallScaleCommercialTrafficGeneration; + +import org.matsim.api.core.v01.Id; +import org.matsim.api.core.v01.Scenario; +import org.matsim.freight.carriers.Carrier; + +import java.util.List; +import java.util.Map; + +/** + * When generating service-durations for {@link Carrier}s it may happen service durations of their plans + * are too long to be fully handled. This implementation solves this problem. + */ +public interface UnhandledServicesSolution { + + /** + * @param scenario Scenario to search for carriers with unhandled jobs + * @return List with the found carriers + */ + List createListOfCarrierWithUnhandledJobs(Scenario scenario); + + /** + * Give a service duration based on the purpose and the trafficType under a given probability + * + * @param carrier The carrier for which we generate the serviceTime + * @param carrierAttributes attributes of the carrier to generate the service time for. + * selectedStartCategory: the category of the employee + * @param additionalTravelBufferPerIterationInMinutes additional buffer for the travel time + * @return the service duration + */ + int getServiceTimePerStop(Carrier carrier, GenerateSmallScaleCommercialTrafficDemand.CarrierAttributes carrierAttributes, int additionalTravelBufferPerIterationInMinutes); + + /** + * + * Checks and recalculates plans of carriers, which did not serve all services. + * This step may take a few minutes. + * @param scenario Scenario to handle the carriers for. Needed to execute {@link org.matsim.freight.carriers.CarriersUtils#runJsprit(Scenario)} and {@link UnhandledServicesSolution#createListOfCarrierWithUnhandledJobs(Scenario)} + * @param nonCompleteSolvedCarriers List of carriers, that are not solved. Can be obtained by {@link UnhandledServicesSolution#createListOfCarrierWithUnhandledJobs(Scenario)} + */ + void tryToSolveAllCarriersCompletely(Scenario scenario, List nonCompleteSolvedCarriers, Map, GenerateSmallScaleCommercialTrafficDemand.CarrierAttributes> carrierId2carrierAttributes); +} From 1d53511edc960f7953d833ed200d81ab55f39955 Mon Sep 17 00:00:00 2001 From: aleks Date: Tue, 8 Oct 2024 13:52:01 +0200 Subject: [PATCH 54/60] minor fixes --- .../DefaultUnhandledServicesSolution.java | 18 ++++++------------ ...erateSmallScaleCommercialTrafficDemand.java | 18 +++++++++++++++--- .../UnhandledServicesSolution.java | 4 +--- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultUnhandledServicesSolution.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultUnhandledServicesSolution.java index 9740114dea8..4928ce2a401 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultUnhandledServicesSolution.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/DefaultUnhandledServicesSolution.java @@ -2,7 +2,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.core.gbl.MatsimRandom; import org.matsim.freight.carriers.Carrier; @@ -15,18 +14,13 @@ public class DefaultUnhandledServicesSolution implements UnhandledServicesSolution { private static final Logger log = LogManager.getLogger(DefaultUnhandledServicesSolution.class); - // Replanning configuration - private final int maxReplanningIterations; - private final int additionalTravelBufferPerIterationInMinutes; // Generation data Random rnd; private final GenerateSmallScaleCommercialTrafficDemand generator; - DefaultUnhandledServicesSolution(GenerateSmallScaleCommercialTrafficDemand generator, int maxReplanningIterations, int additionalTravelBufferPerIterationInMinutes){ + DefaultUnhandledServicesSolution(GenerateSmallScaleCommercialTrafficDemand generator){ rnd = MatsimRandom.getRandom(); - this.maxReplanningIterations = maxReplanningIterations; - this.additionalTravelBufferPerIterationInMinutes = additionalTravelBufferPerIterationInMinutes; this.generator = generator; } @@ -102,20 +96,20 @@ private void redrawAllServiceDurations(Carrier carrier, GenerateSmallScaleCommer } @Override - public void tryToSolveAllCarriersCompletely(Scenario scenario, List nonCompleteSolvedCarriers, Map, GenerateSmallScaleCommercialTrafficDemand.CarrierAttributes> carrierId2carrierAttributes) { + public void tryToSolveAllCarriersCompletely(Scenario scenario, List nonCompleteSolvedCarriers) { int startNumberOfCarriersWithUnhandledJobs = nonCompleteSolvedCarriers.size(); log.info("Starting with carrier-replanning loop."); - for (int i = 0; i < maxReplanningIterations; i++) { + for (int i = 0; i < generator.getMaxReplanningIterations(); i++) { log.info("carrier-replanning loop iteration: {}", i); int numberOfCarriersWithUnhandledJobs = nonCompleteSolvedCarriers.size(); for (Carrier nonCompleteSolvedCarrier : nonCompleteSolvedCarriers) { //Delete old plan of carrier nonCompleteSolvedCarrier.clearPlans(); nonCompleteSolvedCarrier.setSelectedPlan(null); - GenerateSmallScaleCommercialTrafficDemand.CarrierAttributes carrierAttributes = carrierId2carrierAttributes.get(nonCompleteSolvedCarrier.getId()); + GenerateSmallScaleCommercialTrafficDemand.CarrierAttributes carrierAttributes = generator.getCarrierId2carrierAttributes().get(nonCompleteSolvedCarrier.getId()); // Generate new services. The new service batch should have a smaller sum of serviceDurations than before (or otherwise it will not change anything) - redrawAllServiceDurations(nonCompleteSolvedCarrier, carrierAttributes, (i + 1) * additionalTravelBufferPerIterationInMinutes); + redrawAllServiceDurations(nonCompleteSolvedCarrier, carrierAttributes, (i + 1) * generator.getAdditionalTravelBufferPerIterationInMinutes()); log.info("Carrier should be changed..."); } try { @@ -129,7 +123,7 @@ public void tryToSolveAllCarriersCompletely(Scenario scenario, List non log.info( "End of carrier-replanning loop iteration: {}. From the {} carriers with unhandled jobs ({} already solved), {} were solved in this iteration with an additionalBuffer of {} minutes.", i, startNumberOfCarriersWithUnhandledJobs, startNumberOfCarriersWithUnhandledJobs - numberOfCarriersWithUnhandledJobs, - numberOfCarriersWithUnhandledJobs - nonCompleteSolvedCarriers.size(), (i + 1) * additionalTravelBufferPerIterationInMinutes); + numberOfCarriersWithUnhandledJobs - nonCompleteSolvedCarriers.size(), (i + 1) * generator.getAdditionalTravelBufferPerIterationInMinutes()); if (nonCompleteSolvedCarriers.isEmpty()) break; } diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index 834b57b48be..ac7dcdd7656 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -198,7 +198,7 @@ public GenerateSmallScaleCommercialTrafficDemand() { log.info("Using default {} for tour specifications!", DefaultTourSpecificationsByUsingKID2002.class.getSimpleName()); this.vehicleSelection = new DefaultVehicleSelection(); log.info("Using default {} for tour vehicle-selection!", DefaultVehicleSelection.class.getSimpleName()); - this.unhandledServicesSolution = new DefaultUnhandledServicesSolution(this, maxReplanningIterations, additionalTravelBufferPerIterationInMinutes); + this.unhandledServicesSolution = new DefaultUnhandledServicesSolution(this); log.info("Using default {} for tour unhandled-services-solution!", DefaultUnhandledServicesSolution.class.getSimpleName()); } @@ -225,7 +225,7 @@ public GenerateSmallScaleCommercialTrafficDemand(IntegrateExistingTrafficToSmall log.info("Using {} for tour vehicle-selection!", vehicleSelection.getClass().getSimpleName()); } if (unhandledServicesSolution == null){ - this.unhandledServicesSolution = new DefaultUnhandledServicesSolution(this, maxReplanningIterations, additionalTravelBufferPerIterationInMinutes); + this.unhandledServicesSolution = new DefaultUnhandledServicesSolution(this); log.info("Using default {} for unhandled-services-solution", DefaultUnhandledServicesSolution.class.getSimpleName()); } else { this.unhandledServicesSolution = unhandledServicesSolution; @@ -490,7 +490,7 @@ private void solveSeparatedVRPs(Scenario originalScenario) throws Exception { CarriersUtils.runJsprit(originalScenario); List nonCompleteSolvedCarriers = unhandledServicesSolution.createListOfCarrierWithUnhandledJobs(originalScenario); if (!nonCompleteSolvedCarriers.isEmpty()) - unhandledServicesSolution.tryToSolveAllCarriersCompletely(originalScenario, nonCompleteSolvedCarriers, carrierId2carrierAttributes); + unhandledServicesSolution.tryToSolveAllCarriersCompletely(originalScenario, nonCompleteSolvedCarriers); solvedCarriers.putAll(CarriersUtils.getCarriers(originalScenario).getCarriers()); CarriersUtils.getCarriers(originalScenario).getCarriers().clear(); if (!splitVRPs) @@ -968,6 +968,18 @@ public Map, CarrierAttributes> getCarrierId2carrierAttributes() { + return carrierId2carrierAttributes; + } + + public int getMaxReplanningIterations(){ + return maxReplanningIterations; + } + + public int getAdditionalTravelBufferPerIterationInMinutes(){ + return additionalTravelBufferPerIterationInMinutes; + } + private static class MyCarrierScoringFunctionFactory implements CarrierScoringFunctionFactory { @Inject diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/UnhandledServicesSolution.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/UnhandledServicesSolution.java index 9ec350d23bf..e5db51e8557 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/UnhandledServicesSolution.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/UnhandledServicesSolution.java @@ -1,11 +1,9 @@ package org.matsim.smallScaleCommercialTrafficGeneration; -import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.freight.carriers.Carrier; import java.util.List; -import java.util.Map; /** * When generating service-durations for {@link Carrier}s it may happen service durations of their plans @@ -37,5 +35,5 @@ public interface UnhandledServicesSolution { * @param scenario Scenario to handle the carriers for. Needed to execute {@link org.matsim.freight.carriers.CarriersUtils#runJsprit(Scenario)} and {@link UnhandledServicesSolution#createListOfCarrierWithUnhandledJobs(Scenario)} * @param nonCompleteSolvedCarriers List of carriers, that are not solved. Can be obtained by {@link UnhandledServicesSolution#createListOfCarrierWithUnhandledJobs(Scenario)} */ - void tryToSolveAllCarriersCompletely(Scenario scenario, List nonCompleteSolvedCarriers, Map, GenerateSmallScaleCommercialTrafficDemand.CarrierAttributes> carrierId2carrierAttributes); + void tryToSolveAllCarriersCompletely(Scenario scenario, List nonCompleteSolvedCarriers); } From 742543abe44c74445fdf16030338a73619a3b608 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 17 Oct 2024 10:08:00 +0200 Subject: [PATCH 55/60] updates tests for freight analysis to use more example inputs --- .../FreightAnalysisEventBasedTest.java | 24 +- .../TimeDistance_perVehicle.tsv | 3 +- .../TimeDistance_perVehicleType.tsv | 3 +- .../in/carrierVehicles.xml | 26 -- .../in/carrierWithServices.xml | 64 --- .../runServiceEventTest/in/grid9x9.xml | 301 -------------- .../in/output_allVehicles.xml | 24 ++ .../in/serviceBasedEvents.xml | 378 ++++++++--------- .../runShipmentEventTest/Carrier_stats.tsv | 2 + .../runShipmentEventTest/Load_perVehicle.tsv | 2 +- .../TimeDistance_perVehicle.tsv | 2 +- .../TimeDistance_perVehicleType.tsv | 3 +- .../in/carrierVehicles.xml | 15 +- .../in/carrierWithShipments.xml | 26 -- .../runShipmentEventTest/in/grid9x9.xml | 301 -------------- .../in/shipmentBasedEvents.xml | 380 +++++++++--------- .../singleCarrierFiveActivities_Shipments.xml | 76 ++++ 17 files changed, 489 insertions(+), 1141 deletions(-) delete mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierVehicles.xml delete mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierWithServices.xml delete mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/grid9x9.xml create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/output_allVehicles.xml create mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Carrier_stats.tsv delete mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierWithShipments.xml delete mode 100644 contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/grid9x9.xml create mode 100644 examples/scenarios/freight-chessboard-9x9/singleCarrierFiveActivities_Shipments.xml diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java index 2c37f03415b..96aab9dfd82 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java @@ -23,27 +23,32 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +import org.matsim.core.utils.io.IOUtils; +import org.matsim.examples.ExamplesUtils; import org.matsim.testcases.MatsimTestUtils; import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; import java.nio.file.Path; public class FreightAnalysisEventBasedTest { @RegisterExtension private MatsimTestUtils testUtils = new MatsimTestUtils(); + final static URL SCENARIO_URL = ExamplesUtils.getTestScenarioURL("freight-chessboard-9x9"); @Test - void runServiceEventTest() throws IOException { + void runServiceEventTest() throws IOException, URISyntaxException { // Note: I had to manually change the files for this test to run, as I did not have access to the original input file of the events-file // This results in the carrier-plans not being related to the actual events. This is however no problem for testing the core functionality, // as those are two disjunct analysis outputs, which do not depend on each other. (aleks Sep'24) RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased( - Path.of(testUtils.getInputDirectory() + "in/grid9x9.xml"), - Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), - Path.of(testUtils.getInputDirectory() + "in/carrierWithServices.xml"), - Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), + Path.of(IOUtils.extendUrl(SCENARIO_URL, "grid9x9.xml" ).toURI()), + Path.of(testUtils.getInputDirectory() + "in/output_allVehicles.xml"), + Path.of(IOUtils.extendUrl(SCENARIO_URL, "singleCarrierFiveActivities.xml" ).toURI()), + Path.of(IOUtils.extendUrl(SCENARIO_URL, "vehicleTypes.xml" ).toURI()), Path.of(testUtils.getInputDirectory() + "in/serviceBasedEvents.xml"), Path.of(testUtils.getOutputDirectory()), null); @@ -56,17 +61,18 @@ void runServiceEventTest() throws IOException { } @Test - void runShipmentEventTest() throws IOException { + void runShipmentEventTest() throws IOException, URISyntaxException { RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased( - Path.of(testUtils.getInputDirectory() + "in/grid9x9.xml"), - Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), - Path.of(testUtils.getInputDirectory() + "in/carrierWithShipments.xml"), + Path.of(IOUtils.extendUrl(SCENARIO_URL, "grid9x9.xml" ).toURI()), Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), + Path.of(IOUtils.extendUrl(SCENARIO_URL, "singleCarrierFiveActivities_Shipments.xml" ).toURI()), + Path.of(IOUtils.extendUrl(SCENARIO_URL, "vehicleTypes.xml" ).toURI()), Path.of(testUtils.getInputDirectory() + "in/shipmentBasedEvents.xml"), Path.of(testUtils.getOutputDirectory()), null); analysisEventBased.runCompleteAnalysis(); + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Carrier_stats.tsv", testUtils.getOutputDirectory() + "Carrier_stats.tsv"); MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Load_perVehicle.tsv", testUtils.getOutputDirectory() + "Load_perVehicle.tsv"); MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicle.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicle.tsv"); MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicleType.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicleType.tsv"); diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicle.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicle.tsv index 745925b9ec9..9ed73be9e24 100644 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicle.tsv +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicle.tsv @@ -1,3 +1,2 @@ vehicleId carrierId vehicleTypeId tourId tourDuration[s] tourDuration[h] travelDistance[m] travelDistance[km] travelTime[s] travelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR] varCostsTime[EUR] varCostsDist[EUR] totalCosts[EUR] -freight_carrier1_veh_carrier_19_lightVehicle_1 carrier1 light 1 6689.0 1.8580555555555556 36000.0 36.0 4824.0 1.34 0.008 4.7E-4 84.0 53.512 16.919999999999998 154.432 -freight_carrier1_veh_carrier_19_lightVehicle_2 carrier1 light 2 3818.0 1.0605555555555555 24000.0 24.0 3216.0 0.8933333333333333 0.008 4.7E-4 84.0 30.544 11.28 125.824 +freight_carrier1_veh_carrier_19_heavyVehicle_1 carrier1 heavy unknown 8003.0 2.2230555555555553 44000.0 44.0 5896.0 1.6377777777777778 0.008 7.7E-4 130.0 64.024 33.879999999999995 227.904 diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicleType.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicleType.tsv index 59136c389ff..962761fc7b1 100644 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicleType.tsv +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/TimeDistance_perVehicleType.tsv @@ -1,2 +1,3 @@ vehicleTypeId nuOfVehicles SumOfTourDuration[s] SumOfTourDuration[h] SumOfTravelDistances[m] SumOfTravelDistances[km] SumOfTravelTime[s] SumOfTravelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR/veh] varCostsTime[EUR] varCostsDist[EUR] fixedCosts[EUR] totalCosts[EUR] -light 2 10507.0 2.9186111111111113 60000.0 60.0 8040.0 2.2333333333333334 0.008 4.7E-4 84.0 84.056 28.2 168.0 280.256 +heavy 1 8003.0 2.2230555555555553 44000.0 44.0 5896.0 1.6377777777777778 0.008 7.7E-4 130.0 64.024 33.879999999999995 130.0 227.904 +light 0 0.0 0.0 0.0 0.0 0.0 0.0 0.008 4.7E-4 84.0 0.0 0.0 0.0 0.0 diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierVehicles.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierVehicles.xml deleted file mode 100644 index 904e5f9b006..00000000000 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierVehicles.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - 0.008 - 0.008 - - - - - - - - - - - diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierWithServices.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierWithServices.xml deleted file mode 100644 index 80210d8f5a6..00000000000 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/carrierWithServices.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - 50 - - - - - - - - - - - - - - - - - - - - - - - i(1,0) j(1,1) j(1,2) i(2,2) i(3,2) i(4,2) - - - - i(4,1)R j(3,2) i(4,2) i(5,2) i(6,2) j(6,2)R - - - - i(7,0) i(8,0) i(9,0) j(9,1) - - - - j(9,3) j(9,4) j(9,5) j(9,6) - - - - i(9,7)R i(8,7)R - - - - i(6,7)R i(5,7)R j(4,7)R - - - - j(5,7) i(5,7)R i(4,7)R - - - - i(2,7)R i(1,7)R j(0,7)R j(0,6)R j(0,5)R j(0,4)R j(0,3)R j(0,2)R - - - - - - - - diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/grid9x9.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/grid9x9.xml deleted file mode 100644 index c5009bdd7f2..00000000000 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/grid9x9.xml +++ /dev/null @@ -1,301 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/output_allVehicles.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/output_allVehicles.xml new file mode 100644 index 00000000000..ee644f0e30f --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/output_allVehicles.xml @@ -0,0 +1,24 @@ + + + + + + + A heavy truck + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/serviceBasedEvents.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/serviceBasedEvents.xml index b4121096264..8da18029836 100644 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/serviceBasedEvents.xml +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runServiceEventTest/in/serviceBasedEvents.xml @@ -1,213 +1,171 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Carrier_stats.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Carrier_stats.tsv new file mode 100644 index 00000000000..f08676856fb --- /dev/null +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Carrier_stats.tsv @@ -0,0 +1,2 @@ +carrierId MATSimScoreSelectedPlan jSpritScoreSelectedPlan nuOfTours nuOfShipments(input) nuOfShipments(handled) nuOfServices(input) nuOfServices(handled) noOfNotHandledJobs nuOfPlanedDemandSize nuOfHandledDemandSize jspritComputationTime[HH:mm:ss] +carrier1 -Infinity -215.4666666666667 1 5 5 0 0 0 26 26 00:00:00 diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Load_perVehicle.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Load_perVehicle.tsv index d1e9be97b45..cf7f4992d37 100644 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Load_perVehicle.tsv +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/Load_perVehicle.tsv @@ -1,2 +1,2 @@ vehicleId capacity maxLoad load state during tour -freight_carrier1_veh_heavyVehicle_1 Infinity 26 [3, 8, 18, 25, 26, 23, 13, 12, 7, 0] +freight_carrier1_veh_freight_carrier1_veh_heavyVehicle_1_1 50.0 26 [3, 8, 18, 25, 26, 23, 13, 12, 7, 0] diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicle.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicle.tsv index ba995b84f2f..24a90a81255 100644 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicle.tsv +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicle.tsv @@ -1,2 +1,2 @@ vehicleId carrierId vehicleTypeId tourId tourDuration[s] tourDuration[h] travelDistance[m] travelDistance[km] travelTime[s] travelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR] varCostsTime[EUR] varCostsDist[EUR] totalCosts[EUR] -freight_carrier1_veh_heavyVehicle_1 carrier1 heavy 1 6870.0 1.9083333333333334 40000.0 40.0 5360.0 1.488888888888889 0.016 5.7E-4 200.0 109.92 22.8 332.72 +freight_carrier1_veh_freight_carrier1_veh_heavyVehicle_1_1 carrier1 heavy 1 6870.0 1.9083333333333334 40000.0 40.0 5360.0 1.488888888888889 0.008 7.7E-4 130.0 54.96 30.799999999999997 215.76 diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicleType.tsv b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicleType.tsv index e7d74050a7a..f2090c11206 100644 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicleType.tsv +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/TimeDistance_perVehicleType.tsv @@ -1,2 +1,3 @@ vehicleTypeId nuOfVehicles SumOfTourDuration[s] SumOfTourDuration[h] SumOfTravelDistances[m] SumOfTravelDistances[km] SumOfTravelTime[s] SumOfTravelTime[h] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR/veh] varCostsTime[EUR] varCostsDist[EUR] fixedCosts[EUR] totalCosts[EUR] -heavy 1 6870.0 1.9083333333333334 40000.0 40.0 5360.0 1.488888888888889 0.016 5.7E-4 200.0 109.92 22.8 200.0 332.72 +heavy 1 6870.0 1.9083333333333334 40000.0 40.0 5360.0 1.488888888888889 0.008 7.7E-4 130.0 54.96 30.799999999999997 130.0 215.76 +light 0 0.0 0.0 0.0 0.0 0.0 0.0 0.008 4.7E-4 84.0 0.0 0.0 0.0 0.0 diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierVehicles.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierVehicles.xml index 44f7bb7b1e0..dbb3af477a7 100644 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierVehicles.xml +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierVehicles.xml @@ -4,22 +4,21 @@ - + A heavy truck + - - - 0.016 - 0.016 - + + - + + - + \ No newline at end of file diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierWithShipments.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierWithShipments.xml deleted file mode 100644 index b5e8cbe0bd5..00000000000 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/carrierWithShipments.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - 50 - - - - - - - - - - - - - - - - - - - - - diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/grid9x9.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/grid9x9.xml deleted file mode 100644 index c5009bdd7f2..00000000000 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/grid9x9.xml +++ /dev/null @@ -1,301 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/shipmentBasedEvents.xml b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/shipmentBasedEvents.xml index ca675a9bcbf..5dd11c5616b 100644 --- a/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/shipmentBasedEvents.xml +++ b/contribs/freight/test/input/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest/runShipmentEventTest/in/shipmentBasedEvents.xml @@ -1,193 +1,193 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/scenarios/freight-chessboard-9x9/singleCarrierFiveActivities_Shipments.xml b/examples/scenarios/freight-chessboard-9x9/singleCarrierFiveActivities_Shipments.xml new file mode 100644 index 00000000000..1e6b969acaf --- /dev/null +++ b/examples/scenarios/freight-chessboard-9x9/singleCarrierFiveActivities_Shipments.xml @@ -0,0 +1,76 @@ + + + + + + 0.12 + 50 + + + + + + + + + + + + + + + + + -215.4666666666667 + + + + + + + + + + + + + + + + + + + + + + + + + i(1,0) i(2,0) i(3,0) j(3,1) j(3,2) i(4,2) i(5,2) i(6,2) j(6,2)R + + + + i(7,0) i(8,0) i(9,0) j(9,1) + + + + j(9,3) j(9,4) j(9,5) j(9,6) + + + + i(9,7)R i(8,7)R i(7,7)R i(6,7)R i(5,7)R j(4,7)R + + + + i(6,6) j(6,6)R i(6,5)R i(5,5)R j(4,5)R j(4,4)R j(4,3)R + + + + i(4,1)R i(3,1)R i(2,1)R i(1,1)R + + + + + + + \ No newline at end of file From 73f37a9092537e29003dd7ef84a2ada9ad083aea Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 17 Oct 2024 10:08:18 +0200 Subject: [PATCH 56/60] formatting --- .../FreightTimeAndDistanceAnalysisEventsHandler.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java index a1682e6d8a3..8b7adbf9a0d 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java @@ -55,13 +55,7 @@ /** * @author Kai Martins-Turner (kturner) */ -public class FreightTimeAndDistanceAnalysisEventsHandler implements - CarrierTourStartEventHandler, - CarrierTourEndEventHandler, - LinkEnterEventHandler, - LinkLeaveEventHandler, - VehicleEntersTrafficEventHandler, - VehicleLeavesTrafficEventHandler { +public class FreightTimeAndDistanceAnalysisEventsHandler implements CarrierTourStartEventHandler, CarrierTourEndEventHandler, LinkEnterEventHandler, LinkLeaveEventHandler, VehicleEntersTrafficEventHandler, VehicleLeavesTrafficEventHandler { private final static Logger log = LogManager.getLogger(FreightTimeAndDistanceAnalysisEventsHandler.class); private final String delimiter; From f26a08beb73ce953187b8598b0c2fde27a9a68ec Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 17 Oct 2024 10:31:47 +0200 Subject: [PATCH 57/60] reduce iterations for test --- .../usecases/chessboard/RunPassengerAlongWithCarriers.java | 1 + 1 file changed, 1 insertion(+) diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java index 9d54c7299e1..40a49ecf40c 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java @@ -100,6 +100,7 @@ public void run() { public Config prepareConfig() { Config config = ConfigUtils.loadConfig(IOUtils.extendUrl(url, "config.xml")); config.controller().setOverwriteFileSetting( OutputDirectoryHierarchy.OverwriteFileSetting.overwriteExistingFiles ); + config.controller().setLastIteration(5); config.global().setRandomSeed(4177); config.controller().setOutputDirectory("./output/"); return config; From abff7453115c8e381869c893f034ad2cf0e17297 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 17 Oct 2024 10:45:35 +0200 Subject: [PATCH 58/60] try to fix test --- .../carriers/analysis/FreightAnalysisEventBasedTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java index 96aab9dfd82..40a043e59f4 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java @@ -45,7 +45,7 @@ void runServiceEventTest() throws IOException, URISyntaxException { // as those are two disjunct analysis outputs, which do not depend on each other. (aleks Sep'24) RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased( - Path.of(IOUtils.extendUrl(SCENARIO_URL, "grid9x9.xml" ).toURI()), + Path.of(IOUtils.extendUrl(SCENARIO_URL, "grid9x9.xml" ).toURI()).toAbsolutePath(), Path.of(testUtils.getInputDirectory() + "in/output_allVehicles.xml"), Path.of(IOUtils.extendUrl(SCENARIO_URL, "singleCarrierFiveActivities.xml" ).toURI()), Path.of(IOUtils.extendUrl(SCENARIO_URL, "vehicleTypes.xml" ).toURI()), From 7881ec10847cf233a44aded97d7a63da66c68ef1 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 17 Oct 2024 12:24:35 +0200 Subject: [PATCH 59/60] remove usage of path to fix tests --- .../analysis/CarrierLoadAnalysis.java | 4 +- .../analysis/CarrierPlanAnalysis.java | 4 +- ...tTimeAndDistanceAnalysisEventsHandler.java | 8 ++-- .../RunFreightAnalysisEventBased.java | 37 +++++++++---------- .../FreightAnalysisEventBasedTest.java | 31 +++++++--------- 5 files changed, 40 insertions(+), 44 deletions(-) diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java index 8e2951d043e..7de5125e51e 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierLoadAnalysis.java @@ -87,10 +87,10 @@ public void handleEvent(CarrierShipmentDeliveryStartEvent event) { vehicle2Load.put(vehicleId, list); } - void writeLoadPerVehicle(Path analysisOutputDirectory, Scenario scenario) throws IOException { + void writeLoadPerVehicle(String analysisOutputDirectory, Scenario scenario) throws IOException { log.info("Writing out vehicle load analysis ..."); //Load per vehicle - String fileName = analysisOutputDirectory.resolve("Load_perVehicle.tsv").toString(); + String fileName = Path.of(analysisOutputDirectory).resolve("Load_perVehicle.tsv").toString(); BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java index 08b7c054790..aeec93fd605 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/CarrierPlanAnalysis.java @@ -62,10 +62,10 @@ public CarrierPlanAnalysis(String delimiter, Carriers carriers) { this.carriers = carriers; } - public void runAnalysisAndWriteStats(Path analysisOutputDirectory) throws IOException { + public void runAnalysisAndWriteStats(String analysisOutputDirectory) throws IOException { log.info("Writing out carrier analysis ..."); //Load per vehicle - String fileName = analysisOutputDirectory.resolve("Carrier_stats.tsv").toString(); + String fileName = Path.of(analysisOutputDirectory).resolve("Carrier_stats.tsv").toString(); try (BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName))) { diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java index 8b7adbf9a0d..c62863465d5 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/FreightTimeAndDistanceAnalysisEventsHandler.java @@ -153,10 +153,10 @@ public void handleEvent(VehicleLeavesTrafficEvent event){ } } - void writeTravelTimeAndDistancePerVehicle(Path analysisOutputDirectory, Scenario scenario) throws IOException { + void writeTravelTimeAndDistancePerVehicle(String analysisOutputDirectory, Scenario scenario) throws IOException { log.info("Writing out Time & Distance & Costs ... perVehicle"); //Travel time and distance per vehicle - String fileName = analysisOutputDirectory.resolve("TimeDistance_perVehicle.tsv").toString(); + String fileName = Path.of(analysisOutputDirectory).resolve("TimeDistance_perVehicle.tsv").toString(); BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); @@ -224,7 +224,7 @@ void writeTravelTimeAndDistancePerVehicle(Path analysisOutputDirectory, Scenario log.info("Output written to {}", fileName); } - void writeTravelTimeAndDistancePerVehicleType(Path analysisOutputDirectory, Scenario scenario) throws IOException { + void writeTravelTimeAndDistancePerVehicleType(String analysisOutputDirectory, Scenario scenario) throws IOException { log.info("Writing out Time & Distance & Costs ... perVehicleType"); //----- All VehicleTypes in CarriervehicleTypes container. Used so that even unused vehTypes appear in the output @@ -234,7 +234,7 @@ void writeTravelTimeAndDistancePerVehicleType(Path analysisOutputDirectory, Scen vehicleTypesMap.putIfAbsent(vehicleType.getId(), vehicleType); } - String fileName = analysisOutputDirectory.resolve("TimeDistance_perVehicleType.tsv").toString(); + String fileName = Path.of(analysisOutputDirectory).resolve("TimeDistance_perVehicleType.tsv").toString(); BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); //Write headline: diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java index 3848b8a1ef6..751e96a2f45 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/analysis/RunFreightAnalysisEventBased.java @@ -38,7 +38,6 @@ import java.io.File; import java.io.IOException; -import java.nio.file.Path; //import static org.matsim.application.ApplicationUtils.globFile; @@ -58,8 +57,8 @@ public class RunFreightAnalysisEventBased { private static final Logger log = LogManager.getLogger(RunFreightAnalysisEventBased.class); //Where is your simulation output, that should be analysed? - private Path EVENTS_PATH = null; - private final Path ANALYSIS_OUTPUT_PATH; + private String EVENTS_PATH = null; + private final String ANALYSIS_OUTPUT_PATH; private Scenario scenario = null; private Carriers carriers = null; private final String delimiter = "\t"; @@ -72,7 +71,7 @@ public class RunFreightAnalysisEventBased { * @param analysisOutputPath The directory where the result of the analysis should go to * @param globalCrs The CRS of the simulation */ - public RunFreightAnalysisEventBased(Path simOutputPath, Path analysisOutputPath, String globalCrs) { + public RunFreightAnalysisEventBased(String simOutputPath, String analysisOutputPath, String globalCrs) { this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; // this.EVENTS_PATH = globFile(simOutputPath, "*output_events.*"); @@ -81,13 +80,13 @@ public RunFreightAnalysisEventBased(Path simOutputPath, Path analysisOutputPath, // Path carriersPath = globFile(simOutputPath, "*output_carriers.*"); // Path carriersVehicleTypesPath = globFile(simOutputPath, "*output_carriersVehicleTypes.*"); - this.EVENTS_PATH = simOutputPath.resolve("*output_events.xml.gz"); - Path vehiclesPath = simOutputPath.resolve("*output_allVehicles.xml.gz"); - Path networkPath = simOutputPath.resolve("*output_network.xml.gz"); - Path carriersPath = simOutputPath.resolve("*output_carriers.xml.gz"); - Path carriersVehicleTypesPath = simOutputPath.resolve("*output_carriersVehicleTypes.xml.gz"); - - createScenarioForFreightAnalysis(vehiclesPath, networkPath, carriersPath, carriersVehicleTypesPath, globalCrs); +// this.EVENTS_PATH = simOutputPath.resolve("*output_events.xml.gz"); +// Path vehiclesPath = simOutputPath.resolve("*output_allVehicles.xml.gz"); +// Path networkPath = simOutputPath.resolve("*output_network.xml.gz"); +// Path carriersPath = simOutputPath.resolve("*output_carriers.xml.gz"); +// Path carriersVehicleTypesPath = simOutputPath.resolve("*output_carriersVehicleTypes.xml.gz"); +// +// createScenarioForFreightAnalysis(vehiclesPath, networkPath, carriersPath, carriersVehicleTypesPath, globalCrs); } /** @@ -101,8 +100,8 @@ public RunFreightAnalysisEventBased(Path simOutputPath, Path analysisOutputPath, * @param analysisOutputPath Path to the output directory * @param globalCrs The CRS of the simulation */ - public RunFreightAnalysisEventBased(Path networkPath, Path vehiclesPath, Path carriersPath, Path carriersVehicleTypesPath, Path eventsPath, - Path analysisOutputPath, String globalCrs) { + public RunFreightAnalysisEventBased(String networkPath, String vehiclesPath, String carriersPath, String carriersVehicleTypesPath, String eventsPath, + String analysisOutputPath, String globalCrs) { this.EVENTS_PATH = eventsPath; this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; @@ -115,16 +114,16 @@ public RunFreightAnalysisEventBased(Path networkPath, Path vehiclesPath, Path ca * @param carriers The carriers to be analysed * @param analysisOutputPath The directory where the result of the analysis should go to */ - public RunFreightAnalysisEventBased(Carriers carriers, Path analysisOutputPath) { + public RunFreightAnalysisEventBased(Carriers carriers, String analysisOutputPath) { this.carriers = carriers; this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; } - private void createScenarioForFreightAnalysis(Path vehiclesPath, Path networkPath, Path carriersPath, Path carriersVehicleTypesPath, + private void createScenarioForFreightAnalysis(String vehiclesPath, String networkPath, String carriersPath, String carriersVehicleTypesPath, String globalCrs) { Config config = ConfigUtils.createConfig(); - config.vehicles().setVehiclesFile(vehiclesPath.toString()); - config.network().setInputFile(networkPath.toString()); + config.vehicles().setVehiclesFile(vehiclesPath); + config.network().setInputFile(networkPath); config.plans().setInputFile(null); config.eventsManager().setNumberOfThreads(null); config.eventsManager().setEstimatedNumberOfEvents(null); @@ -133,7 +132,7 @@ private void createScenarioForFreightAnalysis(Path vehiclesPath, Path networkPat //freight settings FreightCarriersConfigGroup freightCarriersConfigGroup = ConfigUtils.addOrGetModule(config, FreightCarriersConfigGroup.class); - freightCarriersConfigGroup.setCarriersFile(carriersPath.toString()); + freightCarriersConfigGroup.setCarriersFile(carriersPath); freightCarriersConfigGroup.setCarriersVehicleTypesFile(carriersVehicleTypesPath.toString()); scenario = ScenarioUtils.loadScenario(config); @@ -171,7 +170,7 @@ public void runCompleteAnalysis() throws IOException { eventsManager.initProcessing(); MatsimEventsReader matsimEventsReader = CarrierEventsReaders.createEventsReader(eventsManager); - matsimEventsReader.readFile(EVENTS_PATH.toString()); + matsimEventsReader.readFile(EVENTS_PATH); eventsManager.finishProcessing(); log.info("Analysis completed."); diff --git a/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java b/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java index 40a043e59f4..c7fc851bf24 100644 --- a/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java +++ b/contribs/freight/src/test/java/org/matsim/freight/carriers/analysis/FreightAnalysisEventBasedTest.java @@ -28,9 +28,7 @@ import org.matsim.testcases.MatsimTestUtils; import java.io.IOException; -import java.net.URISyntaxException; import java.net.URL; -import java.nio.file.Path; public class FreightAnalysisEventBasedTest { @@ -39,18 +37,17 @@ public class FreightAnalysisEventBasedTest { final static URL SCENARIO_URL = ExamplesUtils.getTestScenarioURL("freight-chessboard-9x9"); @Test - void runServiceEventTest() throws IOException, URISyntaxException { + void runServiceEventTest() throws IOException { // Note: I had to manually change the files for this test to run, as I did not have access to the original input file of the events-file // This results in the carrier-plans not being related to the actual events. This is however no problem for testing the core functionality, // as those are two disjunct analysis outputs, which do not depend on each other. (aleks Sep'24) - RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased( - Path.of(IOUtils.extendUrl(SCENARIO_URL, "grid9x9.xml" ).toURI()).toAbsolutePath(), - Path.of(testUtils.getInputDirectory() + "in/output_allVehicles.xml"), - Path.of(IOUtils.extendUrl(SCENARIO_URL, "singleCarrierFiveActivities.xml" ).toURI()), - Path.of(IOUtils.extendUrl(SCENARIO_URL, "vehicleTypes.xml" ).toURI()), - Path.of(testUtils.getInputDirectory() + "in/serviceBasedEvents.xml"), - Path.of(testUtils.getOutputDirectory()), + IOUtils.extendUrl(SCENARIO_URL, "grid9x9.xml" ).toString(), + testUtils.getInputDirectory() + "in/output_allVehicles.xml", + IOUtils.extendUrl(SCENARIO_URL, "singleCarrierFiveActivities.xml" ).toString(), + IOUtils.extendUrl(SCENARIO_URL, "vehicleTypes.xml" ).toString(), + testUtils.getInputDirectory() + "in/serviceBasedEvents.xml", + testUtils.getOutputDirectory(), null); analysisEventBased.runCompleteAnalysis(); @@ -61,14 +58,14 @@ void runServiceEventTest() throws IOException, URISyntaxException { } @Test - void runShipmentEventTest() throws IOException, URISyntaxException { + void runShipmentEventTest() throws IOException { RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased( - Path.of(IOUtils.extendUrl(SCENARIO_URL, "grid9x9.xml" ).toURI()), - Path.of(testUtils.getInputDirectory() + "in/carrierVehicles.xml"), - Path.of(IOUtils.extendUrl(SCENARIO_URL, "singleCarrierFiveActivities_Shipments.xml" ).toURI()), - Path.of(IOUtils.extendUrl(SCENARIO_URL, "vehicleTypes.xml" ).toURI()), - Path.of(testUtils.getInputDirectory() + "in/shipmentBasedEvents.xml"), - Path.of(testUtils.getOutputDirectory()), + IOUtils.extendUrl(SCENARIO_URL, "grid9x9.xml" ).toString(), + testUtils.getInputDirectory() + "in/carrierVehicles.xml", + IOUtils.extendUrl(SCENARIO_URL, "singleCarrierFiveActivities_Shipments.xml" ).toString(), + IOUtils.extendUrl(SCENARIO_URL, "vehicleTypes.xml" ).toString(), + testUtils.getInputDirectory() + "in/shipmentBasedEvents.xml", + testUtils.getOutputDirectory(), null); analysisEventBased.runCompleteAnalysis(); From 6b1bc7225c2f870384b884402054102af7d194c4 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 17 Oct 2024 12:25:09 +0200 Subject: [PATCH 60/60] use new analysis version --- .../GenerateSmallScaleCommercialTrafficDemand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java index ac7dcdd7656..553b9abc689 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/GenerateSmallScaleCommercialTrafficDemand.java @@ -336,7 +336,7 @@ public Integer call() throws Exception { //Analysis System.out.println("Starting Analysis for Carriers of small scale commercial traffic."); //TODO perhaps change to complete carrier analysis - RunFreightAnalysisEventBased freightAnalysis = new RunFreightAnalysisEventBased(CarriersUtils.addOrGetCarriers(scenario), output.resolve("CarrierAnalysis")); + RunFreightAnalysisEventBased freightAnalysis = new RunFreightAnalysisEventBased(CarriersUtils.addOrGetCarriers(scenario), output.resolve("CarrierAnalysis").toString()); freightAnalysis.runCarriersAnalysis(); System.out.println("Finishing Analysis of Carrier.");