Skip to content

Commit

Permalink
Merge branch 'drtAccessibility' of https://github.com/matsim-scenario…
Browse files Browse the repository at this point in the history
…s/matsim-kelheim into drtAccessibility

# Conflicts:
#	src/main/java/org/matsim/run/RunDrtEstimModel.java
#	src/main/java/org/matsim/run/RunKelheimScenario.java
  • Loading branch information
j-bnsch committed Sep 11, 2024
2 parents 3f73a6e + fb88486 commit 1a125be
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/main/java/org/matsim/run/RunDrtEstimModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -57,7 +67,5 @@ public static void main(String[] args) throws IOException {
System.out.println("Slope: " + slope);
System.out.println("R2: " + regression.getRSquare());



}
}
3 changes: 3 additions & 0 deletions src/main/java/org/matsim/run/RunKelheimScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1a125be

Please sign in to comment.