Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
rewertvsp committed Aug 10, 2023
1 parent df71b87 commit 0defd92
Showing 1 changed file with 47 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<File> 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<File> 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();
}
}

0 comments on commit 0defd92

Please sign in to comment.