Skip to content

Commit

Permalink
runs for Zwischenpräsentation
Browse files Browse the repository at this point in the history
  • Loading branch information
j-bnsch committed Sep 11, 2024
1 parent cef8194 commit 3f73a6e
Show file tree
Hide file tree
Showing 4 changed files with 337 additions and 25 deletions.
75 changes: 75 additions & 0 deletions pois.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
"id","x","y","type"
1,714967.281485386,5420712.93057985,"train_station"
2,714543.57253509,5421025.94096163,"doctor"
3,714734.534359453,5420352.34148783,"doctor"
4,711288.946478196,5421134.70953126,"doctor"
5,711302.553931244,5422622.78360285,"doctor"
6,709857.978587948,5424704.88655482,"doctor"
7,710330.281668287,5422405.57684666,"doctor"
8,710367.568795906,5422288.91681884,"doctor"
9,709926.034665088,5421778.12666431,"doctor"
10,711249.775198582,5422741.28142994,"doctor"
11,711254.76617753,5422741.03188099,"doctor"
12,710528.900449989,5422666.73044137,"doctor"
13,714406.849636441,5420483.27299781,"doctor"
14,714366.363206188,5420067.57955894,"doctor"
15,711915.547572406,5422004.40628926,"doctor"
16,710397.085705698,5421733.148831,"doctor"
17,710645.273792608,5422619.57952712,"doctor"
18,714595.082185372,5420231.54333503,"health"
19,710359.341026622,5422271.04311871,"health"
20,711907.235278546,5422004.03407777,"health"
21,710381.451774484,5421745.19071149,"health"
22,711245.246452335,5422741.44578833,"health"
23,710520.880738166,5422666.21548099,"health"
24,709576.059110711,5424791.9774179,"health"
25,710325.115684664,5422406.36337861,"health"
26,710758.81447828,5421497.94666289,"health"
27,711193.229530542,5422738.65829833,"health"
28,710489.039071423,5422387.61928239,"health"
29,710533.925580563,5422334.27788068,"health"
30,715066.23686477,5426276.39740521,"sport"
31,710463.49462981,5422702.38836946,"sport"
32,709695.517687242,5425522.65839825,"sport"
33,709651.677668261,5425523.62023739,"sport"
34,711729.483022788,5421730.86721956,"sport"
35,710823.140133647,5421896.01909432,"sport"
36,709729.550157764,5421970.64100071,"sport"
37,713544.033843897,5421800.68382361,"sport"
38,710848.687497805,5422168.2477298,"sport"
39,711506.26103801,5421845.50358545,"sport"
40,711573.401632234,5421761.85628344,"sport"
41,711391.018892277,5421813.36593934,"sport"
42,714011.525111698,5420533.71269248,"sport"
43,713907.365058413,5420561.64362026,"sport"
44,713490.343781311,5420268.84689286,"sport"
45,713853.281655378,5420234.07440193,"sport"
46,713016.434703145,5420765.67913373,"sport"
47,713121.322176956,5420676.52478098,"sport"
48,713148.855138831,5420724.37969091,"sport"
49,713152.788419099,5420750.60155936,"sport"
50,713174.749233928,5420795.83428244,"sport"
51,710526.379307126,5422360.94022457,"groceries"
52,715209.508788563,5420635.23329233,"groceries"
53,710407.536149899,5422326.50270257,"groceries"
54,711997.319591053,5421707.36310684,"groceries"
55,711992.158114713,5421721.52490823,"groceries"
56,710437.123288498,5422507.55526707,"groceries"
57,711193.229530542,5422738.65829833,"groceries"
58,712806.935503921,5420816.05576412,"groceries"
59,705743.75415755,5418653.09823229,"groceries"
60,711793.179944042,5422423.8101136,"groceries"
61,710423.057684888,5422152.91060626,"groceries"
62,710421.9269158,5422451.64028808,"groceries"
63,711295.615489462,5422755.36845327,"groceries"
64,711247.302866814,5422770.35183658,"groceries"
65,715846.276876516,5421485.5928731,"groceries"
66,711882.4325366,5422275.26510582,"groceries"
67,711894.299370676,5422270.89748911,"groceries"
68,710462.216716889,5422506.7903912,"groceries"
69,710377.28786802,5422313.22679202,"groceries"
70,710421.1724897926,5422368.267495186,"altstadt"
71,711746.758,5422055.557,"senioren"
72,710135.487,5421891.633,"senioren"


2 changes: 1 addition & 1 deletion src/main/java/org/matsim/run/RunDrtEstimModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class RunDrtEstimModel {

public static void main(String[] args) throws IOException {

Path filePath = Path.of("input/v3.0-release/output-KEXI-adequate-vehicles/seed-1-adequate-vehicles/kexi-seed1-adequate-vehicles.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();
Expand Down
90 changes: 66 additions & 24 deletions src/main/java/org/matsim/run/RunKelheimScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
import org.matsim.facilities.ActivityOption;
import org.matsim.run.prepare.PrepareNetwork;
import org.matsim.run.prepare.PreparePopulation;
import org.matsim.simwrapper.SimWrapperConfigGroup;
import org.matsim.simwrapper.SimWrapperModule;
//import org.matsim.simwrapper.SimWrapperConfigGroup;
//import org.matsim.simwrapper.SimWrapperModule;
import org.matsim.vehicles.VehicleType;
import picocli.CommandLine;
import playground.vsp.pt.fare.DistanceBasedPtFareParams;
Expand Down Expand Up @@ -190,13 +190,13 @@ protected Config prepareConfig(Config config) {

config.global().setRandomSeed(randomSeed);

SimWrapperConfigGroup sw = ConfigUtils.addOrGetModule(config, SimWrapperConfigGroup.class);

// Relative to config
sw.defaultParams().shp = "../shp/dilutionArea.shp";
sw.defaultParams().mapCenter = "11.89,48.91";
sw.defaultParams().mapZoomLevel = 11d;
sw.defaultParams().sampleSize = sample.getSample();
// SimWrapperConfigGroup sw = ConfigUtils.addOrGetModule(config, SimWrapperConfigGroup.class);
//
// // Relative to config
// sw.defaultParams().shp = "../shp/dilutionArea.shp";
// sw.defaultParams().mapCenter = "11.89,48.91";
// sw.defaultParams().mapZoomLevel = 11d;
// sw.defaultParams().sampleSize = sample.getSample();

if (intermodal) {
ConfigUtils.addOrGetModule(config, PtIntermodalRoutingModesConfigGroup.class);
Expand Down Expand Up @@ -246,26 +246,40 @@ protected Config prepareConfig(Config config) {
//yyyyyyyyy this was neccessary for the RandomizingTimeDistanceTravelDisutility. TODO: is this compatible with the kelheim runs?
config.routing().setRoutingRandomness(0);



// settings for kelheim city
double mapCenterX = 712144.17;
double mapCenterY = 5422153.87;

double tileSize = 100;
double num_rows = 50;
double tileSize = 200;
double num_rows = 23;

// settings for east kelheim:
// double mapCenterX = 721455;
// double mapCenterY = 5410601;
//
// double tileSize = 200;
// double num_rows = 50;

// settings for landkreis
// double mapCenterX = 711014;
// double mapCenterY = 5409253;
//
// double tileSize = 500;
// double num_rows = 50;

accConfig.setAreaOfAccessibilityComputation(AccessibilityConfigGroup.AreaOfAccesssibilityComputation.fromBoundingBox);
accConfig.setBoundingBoxLeft(mapCenterX - num_rows*tileSize - tileSize/2);
accConfig.setBoundingBoxRight(mapCenterX + num_rows*tileSize + tileSize/2);
accConfig.setBoundingBoxBottom(mapCenterY - num_rows*tileSize - tileSize/2);
accConfig.setBoundingBoxTop(mapCenterY + num_rows*tileSize + tileSize/2);
accConfig.setTileSize_m((int) tileSize);
accConfig.setTimeOfDay(15.5 * 60 * 60.);
accConfig.setTimeOfDay(12 * 60 * 60.);
accConfig.setComputingAccessibilityForMode(Modes4Accessibility.freespeed, false); // works
accConfig.setComputingAccessibilityForMode(Modes4Accessibility.car, false); // works
accConfig.setComputingAccessibilityForMode(Modes4Accessibility.car, true); // works
// accConfig.setComputingAccessibilityForMode(Modes4Accessibility.bike, false); // ??
accConfig.setComputingAccessibilityForMode(Modes4Accessibility.pt, true); // works
accConfig.setComputingAccessibilityForMode(Modes4Accessibility.estimatedDrt, true); // works
// accConfig.setAccessibilityMeasureType(AccessibilityConfigGroup.AccessibilityMeasureType.gravity);
}

// Config is always needed
Expand Down Expand Up @@ -347,7 +361,7 @@ protected void prepareScenario(Scenario scenario) {


// Use this method if reading facilities from a csv.
Path filePath = Path.of("testOsmFacilitiesList.csv");
Path filePath = Path.of("pois.csv");
try (CSVParser parser = new CSVParser(new BufferedReader(new InputStreamReader(Files.newInputStream(filePath))),
CSVFormat.DEFAULT.withDelimiter(',').withFirstRecordAsHeader())) {

Expand Down Expand Up @@ -393,7 +407,7 @@ public void install() {
install(new KelheimPtFareModule());
install(new SwissRailRaptorModule());
install(new PersonMoneyEventsAnalysisModule());
install(new SimWrapperModule());
//install(new SimWrapperModule());

bind(AnalysisMainModeIdentifier.class).to(KelheimMainModeIdentifier.class);
addControlerListenerBinding().to(ModeChoiceCoverageControlerListener.class);
Expand Down Expand Up @@ -481,13 +495,41 @@ public void handleEvent(PersonDepartureEvent event) {
}

if (acc) {
final AccessibilityModule moduleTrain = new AccessibilityModule();
moduleTrain.setConsideredActivityType("train station");
controler.addOverridingModule(moduleTrain);

final AccessibilityModule moduleHosp = new AccessibilityModule();
moduleHosp.setConsideredActivityType("hospital");
controler.addOverridingModule(moduleHosp);
// final AccessibilityModule moduleTrain = new AccessibilityModule();
// moduleTrain.setConsideredActivityType("train_station");
// controler.addOverridingModule(moduleTrain);

// final AccessibilityModule moduleHealth = new AccessibilityModule();
// moduleHealth.setConsideredActivityType("health");
// controler.addOverridingModule(moduleHealth);
//
// final AccessibilityModule moduleDoctors = new AccessibilityModule();
// moduleDoctors.setConsideredActivityType("doctor");
// controler.addOverridingModule(moduleDoctors);
//
// final AccessibilityModule moduleSport = new AccessibilityModule();
// moduleSport.setConsideredActivityType("sport");
// controler.addOverridingModule(moduleSport);

// final AccessibilityModule moduleGroceries = new AccessibilityModule();
// moduleGroceries.setConsideredActivityType("groceries");
// controler.addOverridingModule(moduleGroceries);

// final AccessibilityModule moduleSupermarkets = new AccessibilityModule();
// moduleSupermarkets.setConsideredActivityType("supermarket");
// controler.addOverridingModule(moduleSupermarkets);

// final AccessibilityModule moduleAltstadt = new AccessibilityModule();
// moduleAltstadt.setConsideredActivityType("altstadt");
// controler.addOverridingModule(moduleAltstadt);

// final AccessibilityModule moduleBuildings = new AccessibilityModule();
// moduleBuildings.setConsideredActivityType("building");
// controler.addOverridingModule(moduleBuildings);

final AccessibilityModule moduleSenioren = new AccessibilityModule();
moduleSenioren.setConsideredActivityType("senioren");
controler.addOverridingModule(moduleSenioren);
}
}
}
Loading

0 comments on commit 3f73a6e

Please sign in to comment.