From 0defd9295cb700f92d327bdc7db8dee8eb8eca4f Mon Sep 17 00:00:00 2001 From: Ricardo Ewert Date: Thu, 10 Aug 2023 17:03:15 +0200 Subject: [PATCH] update example --- .../FreightDemandGenerationExample.java | 91 ++++++++++--------- 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/src/main/java/org/matsim/vsp/freightDemandGeneration/FreightDemandGenerationExample.java b/src/main/java/org/matsim/vsp/freightDemandGeneration/FreightDemandGenerationExample.java index e207744..67db4d1 100644 --- a/src/main/java/org/matsim/vsp/freightDemandGeneration/FreightDemandGenerationExample.java +++ b/src/main/java/org/matsim/vsp/freightDemandGeneration/FreightDemandGenerationExample.java @@ -34,49 +34,52 @@ public class FreightDemandGenerationExample { - public static void main(String[] args) throws UncheckedIOException, IOException { - Path output = Path.of("output/demandGeneration/"); - Path vehicleFilePath = Path.of("../public-svn/matsim/scenarios/countries/de/freight-demand-generation/input_example/vehicleTypes_default.xml"); - Path carrierCSVLocation = Path.of("../public-svn/matsim/scenarios/countries/de/freight-demand-generation/input_example/exampleCarrier.csv"); - Path demandCSVLocation = Path.of("../public-svn/matsim/scenarios/countries/de/freight-demand-generation/input_example/exampleDemand.csv"); - String network = "../public-svn/matsim/scenarios/countries/de/berlin/berlin-v5.5-10pct/input/berlin-v5.5-network.xml.gz"; - Path population = Path.of("../public-svn/matsim/scenarios/countries/de/berlin/berlin-v5.5-1pct/input/berlin-v5.5-1pct.plans.xml.gz"); - Path shapeFilePath = Path.of("../public-svn/matsim/scenarios/countries/de/freight-demand-generation/input_example/shp/Berlin_Ortsteile.shp"); - String shapeCategory = "Ortsteil"; - new FreightDemandGeneration().execute( - "--output", output.toString(), - "--carrierOption", "createCarriersFromCSV", - "--demandOption", "createDemandFromCSV", - "--populationOption", "useNoPopulation", - "--populationSamplingOption", "createMoreLocations", - "--VRPSolutionsOption", "runJspritAndMATSim", - "--combineSimilarJobs", "false", - "--carrierFileLocation", "", - "--carrierVehicleFileLocation", vehicleFilePath.toString(), - "--shapeFileLocation", shapeFilePath.toString(), - "--shapeCRS", "EPSG:3857", - "--populationFileLocation", population.toString(), - "--network", network, - "--networkCRS", "EPSG:31468", - "--networkChangeEvents", "", - "--shapeCategory", shapeCategory, - "--inputCarrierCSV", carrierCSVLocation.toString(), - "--inputDemandCSV", demandCSVLocation.toString(), - "--populationSample", "0.5", - "--populationSamplingTo", "1.0", - "--populationCRS", "DHDN_GK4", - "--defaultJspritIterations", "3" - ); + public static void main(String[] args) throws UncheckedIOException, IOException { + Path output = Path.of("output/demandGeneration/"); + Path vehicleFilePath = Path.of( + "../public-svn/matsim/scenarios/countries/de/freight-demand-generation/input_example/vehicleTypes_default.xml"); + Path carrierCSVLocation = Path.of("../public-svn/matsim/scenarios/countries/de/freight-demand-generation/input_example/exampleCarrier.csv"); + Path demandCSVLocation = Path.of("../public-svn/matsim/scenarios/countries/de/freight-demand-generation/input_example/exampleDemand.csv"); + String network = "../public-svn/matsim/scenarios/countries/de/berlin/berlin-v5.5-10pct/input/berlin-v5.5-network.xml.gz"; + Path population = Path.of("../public-svn/matsim/scenarios/countries/de/berlin/berlin-v5.5-1pct/input/berlin-v5.5-1pct.plans.xml.gz"); + Path shapeFilePath = Path.of("../public-svn/matsim/scenarios/countries/de/freight-demand-generation/input_example/shp/Berlin_Ortsteile.shp"); + String shapeCategory = "Ortsteil"; + new FreightDemandGeneration().execute( + "--output", output.toString(), + "--carrierOption", "createCarriersFromCSV", + "--demandOption", "createDemandFromCSV", + "--populationOption", "useNoPopulation", + "--populationSamplingOption", "createMoreLocations", + "--VRPSolutionsOption", "runJspritAndMATSim", + "--combineSimilarJobs", "false", + "--carrierFileLocation", "", + "--carrierVehicleFileLocation", vehicleFilePath.toString(), + "--shapeFileLocation", shapeFilePath.toString(), + "--shapeCRS", "EPSG:3857", + "--populationFileLocation", population.toString(), + "--network", network, + "--networkCRS", "EPSG:31468", + "--networkChangeEvents", "", + "--shapeCategory", shapeCategory, + "--inputCarrierCSV", carrierCSVLocation.toString(), + "--inputDemandCSV", demandCSVLocation.toString(), + "--populationSample", "0.5", + "--populationSamplingTo", "1.0", + "--populationCRS", "DHDN_GK4", + "--defaultJspritIterations", "3" + ); - List fileData = new ArrayList<>(); - for (File file : Objects.requireNonNull(output.toFile().listFiles())) { - fileData.add(file); - } - Collections.sort(fileData); - File lastFile = fileData.get(fileData.size()-1); - String[] argsAnalysis = { lastFile.toString(), "true"}; - FreightAnalyse.main(argsAnalysis); - RunFreightAnalysisEventbased freightAnalysis = new RunFreightAnalysisEventbased(lastFile.toString() +"/", lastFile.toString() +"/Analysis_new/", "EPSG:31468"); - freightAnalysis.runAnalysis(); - }} + List fileData = new ArrayList<>(); + for (File file : Objects.requireNonNull(output.toFile().listFiles())) { + fileData.add(file); + } + Collections.sort(fileData); + File lastFile = fileData.get(fileData.size() - 1); + String[] argsAnalysis = {lastFile.toString(), "true"}; + FreightAnalyse.main(argsAnalysis); + RunFreightAnalysisEventbased freightAnalysis = new RunFreightAnalysisEventbased(lastFile.toString() + "/", + lastFile.toString() + "/Analysis_new/", "EPSG:31468"); + freightAnalysis.runAnalysis(); + } +}