diff --git a/src/main/java/org/matsim/run/RunDrtEstimModel.java b/src/main/java/org/matsim/run/RunDrtEstimModel.java index 797777c..2ea87b4 100644 --- a/src/main/java/org/matsim/run/RunDrtEstimModel.java +++ b/src/main/java/org/matsim/run/RunDrtEstimModel.java @@ -6,6 +6,7 @@ import org.apache.commons.csv.CSVParser; import org.apache.commons.csv.CSVRecord; import org.apache.commons.math3.stat.regression.SimpleRegression; +import org.jgrapht.graph.specifics.ArrayUnenforcedSetEdgeSetFactory; import java.io.BufferedReader; import java.io.IOException; @@ -16,28 +17,37 @@ public class RunDrtEstimModel { + private static final int SEEDS = 5; + + + // Paths: + // 1) Conventional DRT: Path.of("input/v3.0-release/output-KEXI/kexi-seed" + seed + ".output_drt_legs_drt.csv"); + // 2) Current AV: Path.of("input/v3.1.1/output-KEXI-2.45-AV--0.0/AV-speed-mps-3.3/SAR2023-AV2/AV2-MPS3.3-SAR2023-seed" + seed + ".output_drt_legs_av.csv"); + // 3) Future AV: Path.of("input/v3.1.1/output-KEXI-2.45-AV--0.0/AV-speed-mps-8.3/ALLCITY-AV100-intermodal-allDay/AV100-MPS8.3-ALLCITY-allDay-seed"+seed+".output_drt_legs_av.csv"); public static void main(String[] args) throws IOException { - Path filePath = Path.of("C:/Users/J/Downloads/kexi-seed1.output_drt_legs_drt.csv"); + //Path filePath = Path.of("C:/Users/J/Downloads/kexi-seed1.output_drt_legs_drt.csv"); DoubleList inVehicleTravelTime = new DoubleArrayList(); DoubleList directTravelDistance_m = new DoubleArrayList(); - - double n = 0.; double waitTimeSum = 0.; - try (CSVParser parser = new CSVParser(new BufferedReader(new InputStreamReader(Files.newInputStream(filePath))), - CSVFormat.DEFAULT.withDelimiter(';').withFirstRecordAsHeader())) { - - for (CSVRecord record : parser) { - n++; - waitTimeSum += Double.parseDouble(record.get("waitTime")); - inVehicleTravelTime.add(Double.parseDouble(record.get("inVehicleTravelTime"))); - directTravelDistance_m.add(Double.parseDouble(record.get("directTravelDistance_m"))); + for (int seed = 1; seed <= SEEDS; seed++) { + Path filePath = Path.of("input/v3.1.1/output-KEXI-2.45-AV--0.0/AV-speed-mps-8.3/ALLCITY-AV100-intermodal-allDay/AV100-MPS8.3-ALLCITY-allDay-seed"+seed+".output_drt_legs_av.csv"); + try (CSVParser parser = new CSVParser(new BufferedReader(new InputStreamReader(Files.newInputStream(filePath))), + CSVFormat.DEFAULT.withDelimiter(';').withFirstRecordAsHeader())) { + + for (CSVRecord record : parser) { + n++; + waitTimeSum += Double.parseDouble(record.get("waitTime")); + inVehicleTravelTime.add(Double.parseDouble(record.get("inVehicleTravelTime"))); + directTravelDistance_m.add(Double.parseDouble(record.get("directTravelDistance_m"))); + } } } + double waitTime_s = waitTimeSum / n; System.out.println("Wait time (seconds):" + waitTime_s); System.out.println("Wait time (minutes):" + waitTime_s/60); @@ -57,7 +67,5 @@ public static void main(String[] args) throws IOException { System.out.println("Slope: " + slope); System.out.println("R2: " + regression.getRSquare()); - - } } diff --git a/src/main/java/org/matsim/run/RunKelheimScenario.java b/src/main/java/org/matsim/run/RunKelheimScenario.java index 101ed17..38b02dc 100644 --- a/src/main/java/org/matsim/run/RunKelheimScenario.java +++ b/src/main/java/org/matsim/run/RunKelheimScenario.java @@ -83,9 +83,12 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.SplittableRandom; +//run --1pct --with-drt --accessibility --config input/v3.1/kelheim-v3.1-25pct.kexi.config.xml + @CommandLine.Command(header = ":: Open Kelheim Scenario ::", version = RunKelheimScenario.VERSION, mixinStandardHelpOptions = true) @MATSimApplication.Prepare({ CreateNetworkFromSumo.class, CreateTransitScheduleFromGtfs.class, TrajectoryToPlans.class, GenerateShortDistanceTrips.class,