Skip to content

Commit 82cad54

Browse files
simei94tschlenther
andauthored
Average dashboard drt (#78)
* average drt dashboard wip * bump to matsim-2025.0.PR3254 * use GridMap instead of XY * bump to java 21 * move to dashboard package + add some dashboards * move to dashboard package + add some dashboards * update config (ReplanningAnnealerConfigGroup) * enable plan inheritance analysis via config * average dashboard + analysis WIP * re-structure tables * customize dashboard + add todo * add average emissions dashboard infrastructure WIP * bump to matsim 2025 PR 3271 * finalize average emissions dashboard * average noise dashboard * use new append option rather than renaming existing dashboards. needs to be tested though * checkstyle * update drt config to fix tests * bump up maven compiler + jacoco * actions v4 * handle drt groups in KelheimDrtFareHandler (by not cleaning map :/ ) --------- Co-authored-by: tschlenther <[email protected]>
1 parent 3d48fa6 commit 82cad54

29 files changed

+1321
-86
lines changed

.github/workflows/build.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111

1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
15-
- uses: actions/setup-java@v3
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-java@v4
1616
with:
17-
java-version: 17
17+
java-version: 21
1818
architecture: x64
1919
distribution: adopt
2020
cache: maven
@@ -32,7 +32,7 @@ jobs:
3232
- uses: actions/checkout@v3
3333
- uses: actions/setup-java@v3
3434
with:
35-
java-version: 17
35+
java-version: 21
3636
architecture: x64
3737
distribution: adopt
3838
cache: maven
@@ -51,7 +51,7 @@ jobs:
5151
strategy:
5252
fail-fast: false
5353
matrix:
54-
java: [17]
54+
java: [21]
5555

5656
steps:
5757
- uses: actions/checkout@v3
@@ -80,7 +80,7 @@ jobs:
8080
- uses: actions/checkout@v3
8181
- uses: actions/setup-java@v3
8282
with:
83-
java-version: 17
83+
java-version: 21
8484
architecture: x64
8585
distribution: adopt
8686
cache: maven

input/test.config.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
<parameterset type="AnnealingVariable" >
7979
<param name="annealParameter" value="globalInnovationRate" />
8080
<param name="annealType" value="sigmoid" />
81-
<param name="defaultSubpopulation" value="person" />
81+
<param name="subpopulation" value="person" />
8282
<!-- this parameter enters the exponential and sigmoid formulas. May be an iteration or a share, i.e. 0.5 for halfLife at 50% of iterations. Exponential: startValue / exp(it/halfLife) -->
8383
<param name="halfLife" value="0.5" />
8484
<!-- sigmoid: 1/(1+e^(shapeFactor*(it - halfLife))); geometric: startValue * shapeFactor^it; msa: startValue / it^shapeFactor -->

input/test.with-drt.config.xml

+15-23
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
<parameterset type="AnnealingVariable" >
7878
<param name="annealParameter" value="globalInnovationRate" />
7979
<param name="annealType" value="sigmoid" />
80-
<param name="defaultSubpopulation" value="person" />
80+
<param name="subpopulation" value="person" />
8181
<!-- this parameter enters the exponential and sigmoid formulas. May be an iteration or a share, i.e. 0.5 for halfLife at 50% of iterations. Exponential: startValue / exp(it/halfLife) -->
8282
<param name="halfLife" value="0.5" />
8383
<!-- sigmoid: 1/(1+e^(shapeFactor*(it - halfLife))); geometric: startValue * shapeFactor^it; msa: startValue / it^shapeFactor -->
@@ -292,15 +292,10 @@
292292
<!-- &lt;!&ndash; Weights to sample an additional drt passenger. E.g. 70 % +0 pax, 30 % +1 pax. Please specify at least two values. &ndash;&gt;-->
293293
<!-- <param name="drtCompanionSamplingWeights" value="16517.0,2084.0,532.0,163.0,20.0,5.0,0.0,0.0" />-->
294294
<!-- </parameterset>-->
295-
<parameterset type="zonalSystem" >
296-
<!-- size of square cells used for demand aggregation. Depends on demand, supply and network. Often used with values in the range of 500 - 2000 m -->
297-
<param name="cellSize" value="null" />
298-
<!-- Defines how the target link of a zone is determined (e.g. for rebalancing). Possible values are [random,mostCentral]. Default behavior is mostCentral, where all vehicles are sent to the same link. -->
299-
<param name="zoneTargetLinkSelection" value="mostCentral" />
300-
<!-- Logic for generation of zones for the DRT zonal system. Value can be: [GridFromNetwork, ShapeFile]. -->
301-
<param name="zonesGeneration" value="ShapeFile" />
302-
<!-- allows to configure zones. Used with zonesGeneration=ShapeFile -->
303-
<param name="zonesShapeFile" value="https://svn.vsp.tu-berlin.de/repos/public-svn/matsim/scenarios/countries/de/kelheim/projects/KelRide/AVServiceAreas/input/shp/kelheim-v2.0-drtZonalAnalysisSystem.shp" />
295+
<parameterset type="zonalSystem">
296+
<parameterset type="SquareGridZoneSystem">
297+
<param name="cellSize" value="500"/>
298+
</parameterset>
304299
</parameterset>
305300
</parameterset>
306301

@@ -329,16 +324,10 @@
329324

330325
<!-- Writes out detailed DRT customer stats in each iteration. True by default. -->
331326
<param name="writeDetailedCustomerStats" value="true"/>
332-
333-
<parameterset type="zonalSystem" >
334-
<!-- size of square cells used for demand aggregation. Depends on demand, supply and network. Often used with values in the range of 500 - 2000 m -->
335-
<param name="cellSize" value="null" />
336-
<!-- Defines how the target link of a zone is determined (e.g. for rebalancing). Possible values are [random,mostCentral]. Default behavior is mostCentral, where all vehicles are sent to the same link. -->
337-
<param name="zoneTargetLinkSelection" value="mostCentral" />
338-
<!-- Logic for generation of zones for the DRT zonal system. Value can be: [GridFromNetwork, ShapeFile]. -->
339-
<param name="zonesGeneration" value="ShapeFile" />
340-
<!-- allows to configure zones. Used with zonesGeneration=ShapeFile -->
341-
<param name="zonesShapeFile" value="https://svn.vsp.tu-berlin.de/repos/public-svn/matsim/scenarios/countries/de/kelheim/projects/KelRide/AVServiceAreas/input/shp/kelheim-v2.0-drtZonalAnalysisSystem.shp" />
327+
<parameterset type="zonalSystem">
328+
<parameterset type="SquareGridZoneSystem">
329+
<param name="cellSize" value="500"/>
330+
</parameterset>
342331
</parameterset>
343332
</parameterset>
344333
</module>
@@ -349,9 +338,12 @@
349338

350339
<!-- Used for estimation of travel times for VrpOptimizer by means of the exponential moving average. The weighting decrease, alpha, must be in (0,1]. We suggest small values of alpha, e.g. 0.05. The averaging starts from the initial travel time estimates. If not provided, the free-speed TTs is used as the initial estimates For more info see comments in: VrpTravelTimeEstimator, VrpTravelTimeModules, DvrpModule. -->
351340
<param name="travelTimeEstimationAlpha" value="0.05" />
352-
<parameterset type="travelTimeMatrix">
353-
<param name="cellSize" value="200"/>
354-
</parameterset>
341+
<parameterset type="travelTimeMatrix">
342+
<parameterset type="SquareGridZoneSystem">
343+
<param name="cellSize" value="200"/>
344+
</parameterset>
345+
<param name="maxNeighborDistance" value="1000"/>
346+
</parameterset>
355347
</module>
356348

357349
</config>

input/v3.1/kelheim-v3.1-25pct.kexi.config.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
<parameterset type="AnnealingVariable" >
7878
<param name="annealParameter" value="globalInnovationRate" />
7979
<param name="annealType" value="sigmoid" />
80-
<param name="defaultSubpopulation" value="person" />
80+
<param name="subpopulation" value="person" />
8181
<!-- this parameter enters the exponential and sigmoid formulas. May be an iteration or a share, i.e. 0.5 for halfLife at 50% of iterations. Exponential: startValue / exp(it/halfLife) -->
8282
<param name="halfLife" value="0.5" />
8383
<!-- sigmoid: 1/(1+e^(shapeFactor*(it - halfLife))); geometric: startValue * shapeFactor^it; msa: startValue / it^shapeFactor -->

input/v3.1/kelheim-v3.1-config.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
<parameterset type="AnnealingVariable" >
7979
<param name="annealParameter" value="globalInnovationRate" />
8080
<param name="annealType" value="sigmoid" />
81-
<param name="defaultSubpopulation" value="person" />
81+
<param name="subpopulation" value="person" />
8282
<!-- this parameter enters the exponential and sigmoid formulas. May be an iteration or a share, i.e. 0.5 for halfLife at 50% of iterations. Exponential: startValue / exp(it/halfLife) -->
8383
<param name="halfLife" value="0.5" />
8484
<!-- sigmoid: 1/(1+e^(shapeFactor*(it - halfLife))); geometric: startValue * shapeFactor^it; msa: startValue / it^shapeFactor -->

pom.xml

+35-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<artifactId>matsim-all</artifactId>
77

88
<!-- PR-labelled release -->
9-
<version>16.0-PR2878</version>
9+
<version>2025.0-PR3271</version>
1010

1111
<!-- snapshot == not recommended: rather use PR-labelled release!-->
1212
<!-- <version>16.0-SNAPSHOT</matsim.version>-->
@@ -27,7 +27,7 @@
2727

2828
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2929
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
30-
<maven.compiler.release>17</maven.compiler.release>
30+
<maven.compiler.release>21</maven.compiler.release>
3131
</properties>
3232

3333
<distributionManagement>
@@ -88,11 +88,30 @@
8888
</exclusions>
8989
</dependency>
9090

91+
<!-- <dependency>-->
92+
<!-- &lt;!&ndash; Include the JUnit testing library. Not transitive. &ndash;&gt;-->
93+
<!-- <groupId>junit</groupId>-->
94+
<!-- <artifactId>junit</artifactId>-->
95+
<!-- <version>4.13.2</version>-->
96+
<!-- <scope>test</scope>-->
97+
<!-- </dependency>-->
98+
99+
<!-- Test dependencies -->
100+
<dependency>
101+
<groupId>org.junit.jupiter</groupId>
102+
<artifactId>junit-jupiter-engine</artifactId>
103+
<scope>test</scope>
104+
</dependency>
105+
<dependency>
106+
<groupId>org.junit.jupiter</groupId>
107+
<artifactId>junit-jupiter</artifactId>
108+
<scope>test</scope>
109+
</dependency>
110+
91111
<dependency>
92-
<!-- Include the JUnit testing library. Not transitive. -->
93-
<groupId>junit</groupId>
94-
<artifactId>junit</artifactId>
95-
<version>4.13.2</version>
112+
<groupId>org.assertj</groupId>
113+
<artifactId>assertj-core</artifactId>
114+
<version>3.24.2</version>
96115
<scope>test</scope>
97116
</dependency>
98117

@@ -187,9 +206,16 @@
187206
<dependency>
188207
<groupId>commons-io</groupId>
189208
<artifactId>commons-io</artifactId>
190-
<version>2.13.0</version>
209+
<version>2.16.1</version>
210+
</dependency>
211+
212+
<dependency>
213+
<groupId>org.apache.avro</groupId>
214+
<artifactId>avro</artifactId>
215+
<version>1.11.3</version>
191216
</dependency>
192217

218+
193219
</dependencies>
194220

195221
<build>
@@ -208,7 +234,7 @@
208234
<forkCount>1</forkCount>
209235
<reuseForks>false</reuseForks>
210236
<!-- avoid out of memory errors: -->
211-
<argLine>@{argLine} -Xmx6500m -Djava.awt.headless=true -Dmatsim.preferLocalDtds=true</argLine>
237+
<argLine>@{argLine} -Djava.awt.headless=true -Dmatsim.preferLocalDtds=true</argLine>
212238
<!--necessary in tu berlin gitlab. BUT not good in other places, so solve by command line switch only where needed. kai, nov'18-->
213239
<!--<useSystemClassLoader>false</useSystemClassLoader>-->
214240
</configuration>
@@ -217,7 +243,7 @@
217243
<plugin>
218244
<groupId>org.jacoco</groupId>
219245
<artifactId>jacoco-maven-plugin</artifactId>
220-
<version>0.8.8</version>
246+
<version>0.8.12</version>
221247
<executions>
222248
<execution>
223249
<goals>

src/main/java/org/matsim/analysis/CreateEmissionDashboard.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public Integer call() throws Exception {
6666
log.info("Running on {}", runDirectory);
6767

6868
//this is to avoid overriding
69-
renameExistingDashboardYAMLs(runDirectory);
69+
// renameExistingDashboardYAMLs(runDirectory);
7070

7171
Path configPath = ApplicationUtils.matchInput("config.xml", runDirectory);
7272
Config config = ConfigUtils.loadConfig(configPath.toString());
@@ -88,7 +88,7 @@ public Integer call() throws Exception {
8888
}
8989

9090
try {
91-
sw.generate(runDirectory);
91+
sw.generate(runDirectory, true);
9292
sw.run(runDirectory);
9393
} catch (IOException e) {
9494
throw new RuntimeException(e);

src/main/java/org/matsim/analysis/PotentialServiceAreaAnalysis.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
import org.matsim.core.utils.geometry.CoordinateTransformation;
5151
import org.matsim.core.utils.geometry.geotools.MGC;
5252
import org.matsim.core.utils.geometry.transformations.TransformationFactory;
53-
import org.matsim.core.utils.gis.ShapeFileReader;
53+
import org.matsim.core.utils.gis.GeoFileReader;
5454
import org.matsim.core.utils.io.IOUtils;
5555
import org.matsim.freight.carriers.*;
5656
import org.matsim.vehicles.Vehicle;
@@ -103,7 +103,7 @@ public static void main(String[] args) {
103103

104104
//read in service area map
105105
PreparedGeometryFactory factory = new PreparedGeometryFactory();
106-
Map<String, PreparedGeometry> serviceAreas = StreamEx.of(ShapeFileReader.getAllFeatures(IOUtils.getFileUrl(INPUT_SERVICE_AREAS_SHAPE)))
106+
Map<String, PreparedGeometry> serviceAreas = StreamEx.of(GeoFileReader.getAllFeatures(IOUtils.getFileUrl(INPUT_SERVICE_AREAS_SHAPE)))
107107
.mapToEntry(sf -> (String) sf.getAttribute("name"), sf -> factory.create((Geometry) sf.getDefaultGeometry()))
108108
.collect(toMap(Map.Entry::getKey, Map.Entry::getValue));
109109

@@ -300,8 +300,6 @@ private static Carrier buildCarrier(String areaName, Collection<Stop> stops, Net
300300
CarrierVehicle.Builder vBuilder = CarrierVehicle.Builder.newInstance(Id.create((areaName + "_shuttle"), Vehicle.class), depotLink, vehicleType);
301301
vBuilder.setEarliestStart(0 * 60 * 60);
302302
vBuilder.setLatestEnd(24 * 60 * 60);
303-
vBuilder.setType(vehicleType);
304-
vBuilder.setTypeId(vehicleType.getId());
305303
CarrierVehicle vehicle = vBuilder.build();
306304
carrier.getCarrierCapabilities().getCarrierVehicles().put(vehicle.getId(), vehicle);
307305

src/main/java/org/matsim/analysis/emissions/KelheimEmissionsDashboard.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
import org.matsim.simwrapper.Dashboard;
2525
import org.matsim.simwrapper.Header;
2626
import org.matsim.simwrapper.Layout;
27+
import org.matsim.simwrapper.viz.GridMap;
2728
import org.matsim.simwrapper.viz.Links;
2829
import org.matsim.simwrapper.viz.Table;
29-
import org.matsim.simwrapper.viz.XYTime;
3030

3131
/**
3232
* this is basically equivalent to the standard emissions dashboard
@@ -88,14 +88,14 @@ public void configure(Header header, Layout layout) {
8888
viz.center = data.context().getCenter();
8989
viz.width = 3.0;
9090
});
91-
layout.row("second").el(XYTime.class, (viz, data) -> {
91+
layout.row("second").el(GridMap.class, (viz, data) -> {
9292
viz.title = "CO₂ Emissions";
9393
viz.description = "per day. Be aware that CO2 values are provided in the simulation sample size!";
9494
viz.height = 12.0;
9595
viz.file = data.compute(KelheimOfflineAirPollutionAnalysisByEngineInformation.class, "emissions_grid_per_day.xyt.csv", new String[0]);
9696
});
9797
layout.row("third")
98-
.el(XYTime.class, (viz, data) -> {
98+
.el(GridMap.class, (viz, data) -> {
9999
viz.title = "CO₂ Emissions";
100100
viz.description = "per hour. Be aware that CO2 values are provided in the simulation sample size!";
101101
viz.height = 12.;

0 commit comments

Comments
 (0)