From 6c4d48263111ec444258869d92dcc371091301c5 Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 22 Feb 2024 14:29:41 +0100 Subject: [PATCH] cleanup --- .../GenerateSmallScaleCommercialTrafficDemand.java | 14 ++++++-------- .../TripDistributionMatrix.java | 10 ---------- .../ValueSelectorUnderGivenProbability.java | 8 -------- 3 files changed, 6 insertions(+), 26 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 724763e26fc..b15a3d7d99c 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 @@ -228,8 +228,6 @@ public Integer call() throws Exception { } Path inputDataDirectory = Path.of(config.getContext().toURI()).getParent(); - ShpOptions shpZones = new ShpOptions(shapeFileZonePath, shapeCRS, StandardCharsets.UTF_8); - indexZones = SmallScaleCommercialTrafficUtils.getIndexZones(shapeFileZonePath, shapeCRS); indexBuildings = SmallScaleCommercialTrafficUtils.getIndexBuildings(shapeFileBuildingsPath, shapeCRS); indexLanduse = SmallScaleCommercialTrafficUtils.getIndexLanduse(shapeFileLandusePath, shapeCRS); @@ -243,14 +241,14 @@ public Integer call() throws Exception { switch (usedSmallScaleCommercialTrafficType) { case commercialPersonTraffic, goodsTraffic -> - createCarriersAndDemand(output, scenario, shpZones, resultingDataPerZone, regionLinksMap, + createCarriersAndDemand(output, scenario, resultingDataPerZone, regionLinksMap, usedSmallScaleCommercialTrafficType.toString(), includeExistingModels); case completeSmallScaleCommercialTraffic -> { - createCarriersAndDemand(output, scenario, shpZones, resultingDataPerZone, regionLinksMap, "commercialPersonTraffic", + createCarriersAndDemand(output, scenario, resultingDataPerZone, regionLinksMap, "commercialPersonTraffic", includeExistingModels); includeExistingModels = false; // because already included in the step before - createCarriersAndDemand(output, scenario, shpZones, resultingDataPerZone, regionLinksMap, "goodsTraffic", + createCarriersAndDemand(output, scenario, resultingDataPerZone, regionLinksMap, "goodsTraffic", includeExistingModels); } default -> throw new RuntimeException("No traffic type selected."); @@ -424,7 +422,7 @@ private void solveSeparatedVRPs(Scenario originalScenario, Map> resultingDataPerZone, Map, Link>> regionLinksMap, String smallScaleCommercialTrafficType, boolean includeExistingModels) throws Exception { @@ -451,7 +449,7 @@ else if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic")) trafficVolumePerTypeAndZone_start, trafficVolumePerTypeAndZone_stop); } final TripDistributionMatrix odMatrix = createTripDistribution(trafficVolumePerTypeAndZone_start, - trafficVolumePerTypeAndZone_stop, shpZones, smallScaleCommercialTrafficType, scenario, output, regionLinksMap); + trafficVolumePerTypeAndZone_stop, smallScaleCommercialTrafficType, scenario, output, regionLinksMap); createCarriers(scenario, odMatrix, resultingDataPerZone, smallScaleCommercialTrafficType, regionLinksMap); } @@ -947,7 +945,7 @@ private static void findNearestLinkForZonesWithoutLinks(Network networkToChange, */ private TripDistributionMatrix createTripDistribution( Map> trafficVolume_start, - Map> trafficVolume_stop, ShpOptions shpZones, + Map> trafficVolume_stop, String smallScaleCommercialTrafficType, Scenario scenario, Path output, Map, Link>> regionLinksMap) throws Exception { diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TripDistributionMatrix.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TripDistributionMatrix.java index 99def962079..ce06aa2b34c 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TripDistributionMatrix.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/TripDistributionMatrix.java @@ -519,16 +519,6 @@ private GravityConstantKey makeGravityKey(String fromZone, String modeOrVehType, * @return listOfZones */ ArrayList getListOfZones() { -// int count = 0; -// if (listOfZones.isEmpty()) -// for (TripDistributionMatrixKey key : matrixCache.keySet()) { -// count++; -// System.out.println(count); -// if (!listOfZones.contains(key.getFromZone())) -// listOfZones.add(key.getFromZone()); -// if (!listOfZones.contains(key.getToZone())) -// listOfZones.add(key.getToZone()); -// } return listOfZones; } diff --git a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/ValueSelectorUnderGivenProbability.java b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/ValueSelectorUnderGivenProbability.java index 01446db9c0c..8a2d7ef9407 100644 --- a/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/ValueSelectorUnderGivenProbability.java +++ b/contribs/small-scale-traffic-generation/src/main/java/org/matsim/smallScaleCommercialTrafficGeneration/ValueSelectorUnderGivenProbability.java @@ -58,14 +58,6 @@ private void weightedProbability() { .filter(a -> a.getValue().equals(selectedLetter)) .findFirst() .ifPresent(l -> l.setExpectedCount(l.getExpectedCount() + 1)); - - //After 'testCount' loops, print out the number of times each value was selected and the percentage it represents -// for (ProbabilityForValue probabilityForValue : ProbabilityDistribution) { -// System.out.println(probabilityForValue.getValue() -// + " -> expected: " + probabilityForValue.getExpectedCount() -// + "(" + String.format("%.2f", (probabilityForValue.getExpectedCount() * Math.pow(anIntAsSum, -// -1)) * 100) + " %); prob: " + ((double)Math.round(probabilityForValue.getProbability() * 1000)/10) + "%"); -// } } public void writeResults(){ for (ProbabilityForValue probabilityForValue : ProbabilityDistribution) {