Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MATSim CW31 2nd #108

Merged
merged 222 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
222 commits
Select commit Hold shift + click to select a range
1b641f8
Score explanation functionality
rakow Apr 18, 2023
ec75934
rename a method from add... to set... since that is what is does.
kainagel Feb 8, 2024
5a28bad
Merge branch 'master' into drtMaintenance
kainagel Feb 8, 2024
b24d01b
changes
kainagel Feb 12, 2024
fbcce95
Merge branch 'master' into score-exaplaination
rakow Mar 3, 2024
7d54e16
update config group
rakow Mar 3, 2024
2257d30
update tests and added attributes
rakow Mar 3, 2024
e62ffce
fix un initialized attribute
rakow Mar 3, 2024
febd686
small improvement to object creation
rakow Mar 3, 2024
bc0bb82
Merge branch 'master' into score-exaplaination
rakow Mar 18, 2024
e148010
add leg score for individual legs
rakow Mar 18, 2024
41bf9a4
more consistent naming
rakow Mar 18, 2024
67e1429
Merge branch 'master' into score-explanation
rakow Mar 18, 2024
44cf94b
more consistent naming
rakow Mar 18, 2024
c6f70ed
revert unintentional changes
rakow Mar 18, 2024
ccc5522
Merge branch 'master' into score-explanation
rakow Mar 18, 2024
6a4dda5
CreateDrtDashboard
tschlenther Jun 18, 2024
fa69d25
Merge branch 'master' into drtSimwrapperRunner
tschlenther Jun 18, 2024
31b91d0
Bump org.apache.maven.plugins:maven-failsafe-plugin from 3.2.5 to 3.3.0
dependabot[bot] Jun 19, 2024
548a431
Merge branch 'master' into drtSimwrapperRunner
tschlenther Jun 19, 2024
2e9e58b
rename pooling ratio to occupancy rate
tschlenther Jun 19, 2024
e2aa840
Merge branch 'drtSimwrapperRunner' of https://github.com/matsim-org/m…
tschlenther Jun 19, 2024
10c245f
Merge pull request #3323 from matsim-org/drtSimwrapperRunner
tschlenther Jun 19, 2024
3e16d89
account for group bookings in DrtAnalysisPostProcessing (and thus Drt…
tschlenther Jun 19, 2024
6ee1b3b
Merge pull request #3326 from matsim-org/drtDashboard
tschlenther Jun 19, 2024
0a1f2c2
typo in CreateDrtDashboard
tschlenther Jun 20, 2024
cc78ba4
fix wrong sum calculation
rewertvsp Jun 20, 2024
886ea24
debug NoiseAnalysis and proper testing in NoiseDashboardTests
tschlenther Jun 20, 2024
b9ab343
Merge pull request #3328 from matsim-org/noiseDashboard
tschlenther Jun 20, 2024
0474657
fix wrong map selection
rewertvsp Jun 20, 2024
728fc28
add reduction of numberOfJobs
rewertvsp Jun 20, 2024
10b884b
add comments and format log massages
rewertvsp Jun 21, 2024
22ba33e
combine
rewertvsp Jun 21, 2024
d08b85a
rename parameter
rewertvsp Jun 21, 2024
27b6173
reduce code
rewertvsp Jun 21, 2024
fa70df1
format logging
rewertvsp Jun 21, 2024
1856d07
use method for demand calculating
rewertvsp Jun 21, 2024
9cc13cf
use method for shipment creation
rewertvsp Jun 21, 2024
89d24bf
remove todo
rewertvsp Jun 21, 2024
b6efcbe
use method to calculate demand based on link lengths
rewertvsp Jun 21, 2024
4646328
introduce parameter
rewertvsp Jun 21, 2024
ef954c1
simplify
rewertvsp Jun 21, 2024
a127fee
cleanup
rewertvsp Jun 21, 2024
17bf445
Merge branch 'refs/heads/master' into modifyFreightDemandGenerationTool
rewertvsp Jun 21, 2024
5960389
Merge pull request #3329 from matsim-org/modifyFreightDemandGeneratio…
rewertvsp Jun 21, 2024
2c5374a
Support TransitRouteStops where boarding or alighting is not allowed
mrieser Jun 22, 2024
1ac6e04
Merge pull request #3330 from matsim-org/transit-schedule-enhancements
mrieser Jun 22, 2024
ddd6914
make drt shifts multi mode drt comatible
nkuehnel Jun 23, 2024
b739633
adjust shift efficiency tracker as well
nkuehnel Jun 23, 2024
1663f22
Merge pull request #3331 from moia-oss/multimodeDrtShifts
nkuehnel Jun 23, 2024
4fcb5f3
Extended Trip analysis and dashboard (#3332)
rakow Jun 24, 2024
f1f54c3
Merge branch 'master' into dependabot/maven/org.apache.maven.plugins-…
jfbischoff Jun 24, 2024
4ef1c05
Merge pull request #3320 from matsim-org/dependabot/maven/org.apache.…
jfbischoff Jun 24, 2024
69169b5
Bump org.apache.maven.plugins:maven-surefire-plugin from 3.2.5 to 3.3.0
dependabot[bot] Jun 24, 2024
7966b6b
Merge pull request #3321 from matsim-org/dependabot/maven/org.apache.…
jfbischoff Jun 24, 2024
3097f6d
Bump org.apache.maven.plugins:maven-surefire-report-plugin
dependabot[bot] Jun 24, 2024
59b30d0
Bump org.apache.maven.plugins:maven-jar-plugin from 3.4.1 to 3.4.2
dependabot[bot] Jun 24, 2024
f0c58c3
Merge pull request #3322 from matsim-org/dependabot/maven/org.apache.…
jfbischoff Jun 24, 2024
d6e0399
Merge branch 'master' into dependabot/maven/org.apache.maven.plugins-…
jfbischoff Jun 24, 2024
b971cd6
Merge pull request #3327 from matsim-org/dependabot/maven/org.apache.…
jfbischoff Jun 24, 2024
bae8902
Bump com.fasterxml.woodstox:woodstox-core from 6.6.2 to 7.0.0
dependabot[bot] Jun 24, 2024
b3f4252
Bump org.jfree:jfreechart from 1.5.4 to 1.5.5
dependabot[bot] Jun 24, 2024
8396454
Merge pull request #3335 from matsim-org/dependabot/maven/org.jfree-j…
jfbischoff Jun 25, 2024
187541c
Merge branch 'master' into dependabot/maven/com.fasterxml.woodstox-wo…
jfbischoff Jun 25, 2024
05e5285
Merge branch 'master' into score-explanation
jfbischoff Jun 25, 2024
67ee3bc
Merge pull request #3334 from matsim-org/dependabot/maven/com.fasterx…
jfbischoff Jun 25, 2024
c722dcd
Merge branch 'master' into score-explanation
jfbischoff Jun 25, 2024
12335a8
Merge pull request #3175 from matsim-org/score-explanation
jfbischoff Jun 25, 2024
3194e9d
Merge branch 'master' into drtMaintenance
jfbischoff Jun 25, 2024
abbab85
Merge pull request #3099 from matsim-org/drtMaintenance
kainagel Jun 25, 2024
a9949d5
make drt work with only custom constraints sets
nkuehnel Jun 25, 2024
63208e9
add some logging to NetworkChangeEventsWriter
nkuehnel Jun 25, 2024
38d54d6
Merge branch 'master' into custom-constraints-update
nkuehnel Jun 25, 2024
2d72078
Merge branch 'master' into add-logging-to-network-change-events-writer
nkuehnel Jun 25, 2024
7f245e6
correct logging statement
nkuehnel Jun 25, 2024
47ebec6
Merge pull request #3337 from moia-oss/add-logging-to-network-change-…
nkuehnel Jun 25, 2024
5b1aa87
Merge branch 'master' into custom-constraints-update
nkuehnel Jun 25, 2024
0ec23f8
Merge pull request #3336 from moia-oss/custom-constraints-update
nkuehnel Jun 25, 2024
0282b8a
add router binding for complex request unscheduling
nkuehnel Jun 27, 2024
4c57821
use time as disutility
nkuehnel Jun 27, 2024
2054bba
Bump junit.version from 5.10.2 to 5.10.3
dependabot[bot] Jun 27, 2024
de64f77
* repair wrong positioning of vehicles if linkSpeedCalculator returns…
kainagel Jun 27, 2024
d7d1e47
Merge branch 'master' into bicycleContrib
kainagel Jun 27, 2024
ca7746a
Merge branch 'master' into parkingChoiceMaintenance
kainagel Jun 27, 2024
06e654f
Merge pull request #3345 from matsim-org/parkingChoiceMaintenance
kainagel Jun 27, 2024
126ffcd
norm subgroups to 1 (#3346)
rakow Jun 27, 2024
f05ec2d
Merge branch 'master' into dependabot/maven/junit.version-5.10.3
jfbischoff Jun 28, 2024
bd9e865
Merge pull request #3343 from matsim-org/dependabot/maven/junit.versi…
jfbischoff Jun 28, 2024
b49541f
add test integration test case for complex unscheduler
nkuehnel Jun 28, 2024
b4b9429
Merge branch 'master' into addROuterToPrebooking
nkuehnel Jun 28, 2024
e388016
Bump io.grpc:grpc-all from 1.64.0 to 1.65.0
dependabot[bot] Jun 28, 2024
5220b13
Merge pull request #3347 from matsim-org/dependabot/maven/io.grpc-grp…
jfbischoff Jun 28, 2024
3702bb5
Bump com.google.protobuf:protobuf-java from 4.27.1 to 4.27.2
dependabot[bot] Jun 30, 2024
88acd6c
Merge pull request #3338 from matsim-org/dependabot/maven/com.google.…
michalmac Jun 30, 2024
a497cc1
Merge branch 'master' into addROuterToPrebooking
nkuehnel Jun 30, 2024
1dd4d60
Merge pull request #3340 from moia-oss/addROuterToPrebooking
nkuehnel Jul 2, 2024
d6c43d9
Split CalculateSkimMatrices.prepareAndCalculateNetworkMatrices() to a…
marecabo Jul 2, 2024
8dfc8c3
Bump org.checkerframework:checker-qual from 3.44.0 to 3.45.0
dependabot[bot] Jul 2, 2024
8313a4d
Switch to DrtWithExtensionsConfigGroup
steffenaxer Jul 3, 2024
7fc08d6
Merge pull request #3355 from steffenaxer/DrtWithExtensionsConfigGroup
steffenaxer Jul 4, 2024
eba4326
Merge branch 'master' into skim-matrices-with-custom-travel-time-object
steffenaxer Jul 4, 2024
cb853ee
Merge pull request #3351 from matsim-org/skim-matrices-with-custom-tr…
steffenaxer Jul 4, 2024
f79f0bf
Merge branch 'master' into dependabot/maven/org.checkerframework-chec…
jfbischoff Jul 4, 2024
12160b2
Merge pull request #3352 from matsim-org/dependabot/maven/org.checker…
jfbischoff Jul 4, 2024
64c4bd5
Bump org.apache.poi:poi-ooxml from 5.2.5 to 5.3.0
dependabot[bot] Jul 4, 2024
f1b39c5
Merge pull request #3353 from matsim-org/dependabot/maven/org.apache.…
jfbischoff Jul 4, 2024
56f5868
reworked CreatePseudoNetwork with loop-links to avoid duplicating stops
davibicudo Jul 4, 2024
5d278aa
Merge branch 'master' of github.com:matsim-org/matsim-libs into featu…
davibicudo Jul 4, 2024
f8c417a
Merge pull request #3357 from davibicudo/feature/pseudonet-looplinks
jfbischoff Jul 4, 2024
7b0e554
repair test failures
kainagel Jul 4, 2024
8ddacdf
Trip facet dashboard (#3350)
frievoe97 Jul 4, 2024
041381a
adjust rounding
rewertvsp Jul 8, 2024
c52cbed
exclude case
rewertvsp Jul 8, 2024
a745c95
Merge pull request #3361 from matsim-org/fixLinkSelectionForFreightGe…
rewertvsp Jul 8, 2024
cdc625d
Drt dashboard typo fix (#3360)
frievoe97 Jul 8, 2024
e07615e
Bump com.fasterxml.jackson:jackson-bom from 2.17.1 to 2.17.2
dependabot[bot] Jul 8, 2024
c2d4592
Merge pull request #3362 from matsim-org/dependabot/maven/com.fasterx…
jfbischoff Jul 8, 2024
613c039
Bump net.bytebuddy:byte-buddy from 1.14.17 to 1.14.18
dependabot[bot] Jul 9, 2024
a639335
set networkMode based on vehicleTypes
rewertvsp Jul 9, 2024
cd4a870
Bump org.assertj:assertj-core from 3.26.0 to 3.26.3
dependabot[bot] Jul 10, 2024
5359c73
Merge pull request #3363 from matsim-org/dependabot/maven/net.bytebud…
jfbischoff Jul 10, 2024
2c849ea
Merge branch 'master' into dependabot/maven/org.assertj-assertj-core-…
jfbischoff Jul 10, 2024
ae137e3
Merge pull request #3364 from matsim-org/dependabot/maven/org.assertj…
jfbischoff Jul 10, 2024
61b02bc
chore: clean up MinimalTransferTimes (#3365)
sebhoerl Jul 11, 2024
79c9523
chore: cleanup adaptive transfers (#3366)
sebhoerl Jul 11, 2024
d0f310a
Bump org.apache.maven.plugins:maven-failsafe-plugin from 3.3.0 to 3.3.1
dependabot[bot] Jul 11, 2024
678ef0f
Merge pull request #3367 from matsim-org/dependabot/maven/org.apache.…
jfbischoff Jul 11, 2024
bad4be0
add missing case of enum
rewertvsp Jul 12, 2024
9cf945d
add functionality to split jobs
rewertvsp Jul 12, 2024
c157c29
use new methods
rewertvsp Jul 12, 2024
346b6e7
update activity creation
rewertvsp Jul 12, 2024
0137ffc
Merge pull request #3370 from matsim-org/changesForFreightDemandGener…
rewertvsp Jul 12, 2024
5fd7bb2
set activity time correctly
rewertvsp Jul 12, 2024
b98e04a
Merge branch 'refs/heads/master' into adjustModeSelectionForSmallScal…
rewertvsp Jul 12, 2024
d485262
Merge branch 'master' into adjustModeSelectionForSmallScaleCommercial
rewertvsp Jul 12, 2024
683b731
remove unneeded exception
rewertvsp Jul 13, 2024
f8119af
Merge pull request #3371 from matsim-org/adjustModeSelectionForSmallS…
rewertvsp Jul 13, 2024
6f0721e
change to parameterized log message
kt86 Jul 16, 2024
af5098e
delete empty test methods
kt86 Jul 16, 2024
6d14b25
remove unused import
kt86 Jul 16, 2024
edda343
fix unchecked assignment
kt86 Jul 16, 2024
a1c3a77
remove redundant local variables
kt86 Jul 16, 2024
720a2d0
minor code style update
kt86 Jul 16, 2024
7e45620
remove not needed throw information
kt86 Jul 16, 2024
8d310b4
make things final
kt86 Jul 16, 2024
295ef5f
remove redundant final declaration
kt86 Jul 16, 2024
e57b138
remove unnecessary 'throws' declarations
kt86 Jul 16, 2024
72aa7ca
simplify assertions
kt86 Jul 16, 2024
154f91b
cleanup Strings
kt86 Jul 16, 2024
bbb1919
remove redundant casts
kt86 Jul 16, 2024
bc5fda2
code style update
kt86 Jul 16, 2024
2814bc9
cleanup imports
kt86 Jul 16, 2024
00beceb
Java language: Replace explicit type with <>
kt86 Jul 16, 2024
93e6294
Java language: use computeIfAbsent
kt86 Jul 16, 2024
b5d767f
Java language: use Double.hashCode(...)
kt86 Jul 16, 2024
3c964b0
Java language: replace if by switch
kt86 Jul 16, 2024
967e0e8
Java language: avoid raw use
kt86 Jul 16, 2024
87e7f99
Java language: use text block
kt86 Jul 16, 2024
6a1cc65
Java language: use pattern variable
kt86 Jul 16, 2024
128b9aa
Java language: use add/getFirst()
kt86 Jul 16, 2024
ac78f5b
Access to TestUtils.EPSILION
kt86 Jul 16, 2024
f59e4d6
add not null assertion
kt86 Jul 16, 2024
31d2c0d
Merge pull request #3374 from matsim-org/kmt_freightCleanupCode
kt86 Jul 17, 2024
af740e6
remove one layer of "LSPs"
kt86 Jul 17, 2024
0da2db8
Merge pull request #3375 from matsim-org/kmt_updateLspDefinition
kt86 Jul 17, 2024
60368d2
add prebooking support for drt shifts
nkuehnel Jul 19, 2024
4a5ad3f
cancel assigned shifts
nkuehnel Jul 19, 2024
7c2f4d2
add some documentation
nkuehnel Jul 19, 2024
106766a
shift drt maintenance
nkuehnel Jul 19, 2024
c7a9904
some more drt shift maintenance
nkuehnel Jul 19, 2024
6dc0421
consider break corridors for (pre)bookings
nkuehnel Jul 19, 2024
6f8d841
consider break corridors for (pre)bookings
nkuehnel Jul 19, 2024
ef5de17
clean up obsolete method
nkuehnel Jul 19, 2024
2d4f1d7
update FISS test, reduce iterations to reduce runtime
nkuehnel Jul 23, 2024
f55bf93
avoid abandoning prebooked requests twice in the same time step
nkuehnel Jul 23, 2024
9e934d4
Merge pull request #3379 from moia-oss/drtShiftsWithPrebooking
nkuehnel Jul 23, 2024
aea22bd
Merge branch 'master' into fix_prebooking_abandonment
nkuehnel Jul 23, 2024
2a40907
Merge pull request #3380 from moia-oss/fix_prebooking_abandonment
nkuehnel Jul 23, 2024
f684d07
remove redundant suppression
kt86 Jul 25, 2024
95af125
remove unused field
kt86 Jul 25, 2024
f754070
internal renaming
kt86 Jul 25, 2024
50daf7d
remove unnecessary toString() calls
kt86 Jul 25, 2024
db06b2b
remove unnecessary semicolon
kt86 Jul 25, 2024
53a9a1f
inline and remove method
kt86 Jul 25, 2024
f2eee3f
cleanup imports
kt86 Jul 25, 2024
c104df2
simplification
kt86 Jul 25, 2024
fdadeca
make final, internal renaming
kt86 Jul 25, 2024
26cbfd4
replace 'if' by 'switch'
kt86 Jul 25, 2024
41af9a2
simplification
kt86 Jul 25, 2024
a3c5c2b
use enhanced 'switch'
kt86 Jul 25, 2024
71c8509
simplification
kt86 Jul 25, 2024
174009f
use 'getFirst()'
kt86 Jul 25, 2024
ad74210
javadoc: replace blank lines with '<p>'
kt86 Jul 25, 2024
fcd62ef
javadoc: set link as a link
kt86 Jul 25, 2024
8de79dc
logging: use parameterized logging
kt86 Jul 25, 2024
f9ccc49
add casting
kt86 Jul 25, 2024
268f609
simplification
kt86 Jul 25, 2024
44713d9
use 'append()' calls
kt86 Jul 25, 2024
8fd0955
simplification by removing inaccessibly parts of if statements.
kt86 Jul 25, 2024
1a8510d
remove duplicated setting of variable
kt86 Jul 25, 2024
3fa72e9
Simplify assertions
kt86 Jul 25, 2024
04ad679
Simplify stream
kt86 Jul 25, 2024
ebec885
avoid casting
kt86 Jul 25, 2024
0319bab
suppress warning
kt86 Jul 25, 2024
597faae
fix some (language) grammar
kt86 Jul 25, 2024
d08aec1
fix some typos
kt86 Jul 25, 2024
adcb9f8
more simplifications
kt86 Jul 25, 2024
2d5c06f
cleanup: remove commented out code
kt86 Jul 25, 2024
dac7488
small cleanups
kt86 Jul 25, 2024
ed26933
Merge pull request #3383 from matsim-org/kmt_emissions-maintenance
kt86 Jul 25, 2024
213fae0
optimize h3 zone system initialization; move h3 test to common module
nkuehnel Jul 27, 2024
8091cab
Merge branch 'master' into optimizeH3ZoneSystem
nkuehnel Jul 27, 2024
0730d0b
Merge pull request #3384 from moia-oss/optimizeH3ZoneSystem
nkuehnel Jul 28, 2024
8caaa37
shift drt maintenance; fix bug for prebooked e-drt scenarios that nee…
nkuehnel Jul 29, 2024
3af17e5
make FISS integration test less sensible to smaller changes in link e…
nkuehnel Jul 29, 2024
84ee758
Merge pull request #3385 from moia-oss/drtShiftMaintenance
nkuehnel Jul 29, 2024
4fa6530
set level of some logging's back from WARN to DEBUG
kt86 Jul 29, 2024
e1783db
Merge pull request #3386 from matsim-org/kmt_reduceLoggingLevel
kt86 Jul 29, 2024
33d857b
SimWrapper Dashboard features (#3381)
rakow Jul 30, 2024
d5df451
Merge branch 'master' into bicycleContrib
tschlenther Aug 1, 2024
84948be
Merge pull request #3344 from matsim-org/bicycleContrib
kainagel Aug 1, 2024
7a0654c
Merge branch 'moia-deployment' into fixcw31
nkuehnel Aug 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ private void writeOutput(Network network, EmissionsOnLinkEventHandler emissionsE
if (link2pollutants.get(linkId).get(pollutant) != null) {
emissionValue = link2pollutants.get(linkId).get(pollutant);
}
absolute.print(nf.format(emissionValue));
absolute.print(nf.format(emissionValue * sample.getUpscaleFactor()));

Link link = network.getLinks().get(linkId);
double emissionPerM = emissionValue / link.getLength();
perMeter.print(nf.format(emissionPerM));
perMeter.print(nf.format(emissionPerM * sample.getUpscaleFactor()));
}

absolute.println();
Expand Down Expand Up @@ -246,7 +246,7 @@ private void writeTotal(Network network, EmissionsOnLinkEventHandler emissionsEv

total.printRecord("Pollutant", "kg");
for (Pollutant p : Pollutant.values()) {
double val = (sum.getDouble(p) / sample.getSample()) / 1000;
double val = (sum.getDouble(p) * sample.getUpscaleFactor()) / 1000;
total.printRecord(p, val < 100_000 && val > 100 ? simple.format(val) : scientific.format(val));
}

Expand Down Expand Up @@ -286,7 +286,7 @@ private void writeAvroRaster(Network network, Config config, EmissionsOnLinkEven
for (int xi = 0; xi < xLength.get(0); xi++) {
for (int yi = 0; yi < yLength.get(0); yi++) {
Coord coord = raster.getCoordForIndex(xi, yi);
double value = rasterMap.get(Pollutant.CO2_TOTAL).getValueByIndex(xi, yi);
double value = rasterMap.get(Pollutant.CO2_TOTAL).getValueByIndex(xi, yi) * sample.getUpscaleFactor();
if (xi == 0) yCoords.add((float) coord.getY());
if (yi == 0) xCoords.add((float) coord.getX());
valuesList.add((float) value);
Expand Down Expand Up @@ -349,7 +349,7 @@ private void writeRaster(Network network, Config config, EmissionsOnLinkEventHan
for (int yi = 0; yi < yLength.get(0); yi++) {

Coord coord = raster.getCoordForIndex(xi, yi);
double value = rasterMap.get(Pollutant.CO2_TOTAL).getValueByIndex(xi, yi);
double value = rasterMap.get(Pollutant.CO2_TOTAL).getValueByIndex(xi, yi) * sample.getUpscaleFactor();

if (value == 0)
continue;
Expand Down Expand Up @@ -406,7 +406,7 @@ private void writeTimeDependentRaster(Network network, Config config, EmissionsO
for (TimeBinMap.TimeBin<Map<Pollutant, Raster>> timeBin : timeBinMap.getTimeBins()) {

Coord coord = raster.getCoordForIndex(xi, yi);
double value = timeBin.getValue().get(Pollutant.CO2_TOTAL).getValueByIndex(xi, yi);
double value = timeBin.getValue().get(Pollutant.CO2_TOTAL).getValueByIndex(xi, yi) * sample.getUpscaleFactor();

if (value == 0)
continue;
Expand Down Expand Up @@ -467,7 +467,8 @@ private void writeTimeDependentAvroRaster(Network network, Config config, Emissi
if (yi == 0 && isFirst)
xCoords.add((float) coord.getX());

valuesList.add((float) timeBin.getValue().get(Pollutant.CO2_TOTAL).getValueByIndex(xi, yi));
double value = timeBin.getValue().get(Pollutant.CO2_TOTAL).getValueByIndex(xi, yi) * sample.getUpscaleFactor();
valuesList.add((float) value);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter;
import org.apache.commons.math3.analysis.interpolation.LoessInterpolator;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.locationtech.jts.geom.Coordinate;
Expand All @@ -32,6 +33,7 @@
import java.math.RoundingMode;
import java.nio.file.Files;
import java.util.*;
import java.util.stream.IntStream;

import static tech.tablesaw.aggregate.AggregateFunctions.count;

Expand All @@ -41,6 +43,7 @@
produces = {
"mode_share.csv", "mode_share_per_dist.csv", "mode_users.csv", "trip_stats.csv",
"mode_share_per_%s.csv", "population_trip_stats.csv", "trip_purposes_by_hour.csv",
"mode_share_distance_distribution.csv",
"mode_choices.csv", "mode_choice_evaluation.csv", "mode_choice_evaluation_per_mode.csv",
"mode_confusion_matrix.csv", "mode_prediction_error.csv"
}
Expand Down Expand Up @@ -109,6 +112,25 @@ private static int durationToSeconds(String d) {
return (Integer.parseInt(split[0]) * 60 * 60) + (Integer.parseInt(split[1]) * 60) + Integer.parseInt(split[2]);
}

private static double[] calcHistogram(double[] data, double[] bins) {

double[] hist = new double[bins.length - 1];

for (int i = 0; i < bins.length - 1; i++) {

double binStart = bins[i];
double binEnd = bins[i + 1];

// The last right bin edge is inclusive, which is consistent with the numpy implementation
if (i == bins.length - 2)
hist[i] = Arrays.stream(data).filter(d -> d >= binStart && d <= binEnd).count();
else
hist[i] = Arrays.stream(data).filter(d -> d >= binStart && d < binEnd).count();
}

return hist;
}

@Override
public Integer call() throws Exception {

Expand Down Expand Up @@ -247,6 +269,8 @@ public Integer call() throws Exception {

writeTripPurposes(joined);

writeTripDistribution(joined);

return 0;
}

Expand Down Expand Up @@ -293,13 +317,15 @@ private void writeTripStats(Table trips) throws IOException {
Object2IntMap<String> n = new Object2IntLinkedOpenHashMap<>();
Object2LongMap<String> travelTime = new Object2LongOpenHashMap<>();
Object2LongMap<String> travelDistance = new Object2LongOpenHashMap<>();
Object2LongMap<String> beelineDistance = new Object2LongOpenHashMap<>();

for (Row trip : trips) {
String mainMode = trip.getString("main_mode");

n.mergeInt(mainMode, 1, Integer::sum);
travelTime.mergeLong(mainMode, durationToSeconds(trip.getString("trav_time")), Long::sum);
travelDistance.mergeLong(mainMode, trip.getLong("traveled_distance"), Long::sum);
beelineDistance.mergeLong(mainMode, trip.getLong("euclidean_distance"), Long::sum);
}

try (CSVPrinter printer = new CSVPrinter(Files.newBufferedWriter(output.getPath("trip_stats.csv")), CSVFormat.DEFAULT)) {
Expand Down Expand Up @@ -338,6 +364,13 @@ private void writeTripStats(Table trips) throws IOException {
}
printer.println();

printer.print("Avg. beeline speed [km/h]");
for (String m : modeOrder) {
double speed = (beelineDistance.getLong(m) / 1000d) / (travelTime.getLong(m) / (60d * 60d));
printer.print(new BigDecimal(speed).setScale(2, RoundingMode.HALF_UP));
}
printer.println();

printer.print("Avg. distance per trip [km]");
for (String m : modeOrder) {
double avg = (travelDistance.getLong(m) / 1000d) / (n.getInt(m));
Expand Down Expand Up @@ -458,6 +491,55 @@ private void writeTripPurposes(Table trips) {

}

private void writeTripDistribution(Table trips) throws IOException {

Map<String, double[]> dists = new LinkedHashMap<>();

// Note that the results of this interpolator are consistent with the one performed in matsim-python-tools
// This makes the results comparable with reference data, changes here will also require changes in the python package
LoessInterpolator inp = new LoessInterpolator(0.05, 0);

long max = distGroups.get(distGroups.size() - 3) + distGroups.get(distGroups.size() - 2);

double[] bins = IntStream.range(0, (int) (max / 100)).mapToDouble(i -> i * 100).toArray();
double[] x = Arrays.copyOf(bins, bins.length - 1);

for (String mode : modeOrder) {
double[] distances = trips.where(
trips.stringColumn("main_mode").equalsIgnoreCase(mode))
.numberColumn("traveled_distance").asDoubleArray();

double[] hist = calcHistogram(distances, bins);

double[] y = inp.smooth(x, hist);
dists.put(mode, y);
}

try (CSVPrinter printer = new CSVPrinter(Files.newBufferedWriter(output.getPath("mode_share_distance_distribution.csv")), CSVFormat.DEFAULT)) {

printer.print("dist");
for (String s : modeOrder) {
printer.print(s);
}
printer.println();

for (int i = 0; i < x.length; i++) {

double sum = 0;
for (String s : modeOrder) {
sum += Math.max(0, dists.get(s)[i]);
}

printer.print(x[i]);
for (String s : modeOrder) {
double value = Math.max(0, dists.get(s)[i]) / sum;
printer.print(value);
}
printer.println();
}
}
}

/**
* How shape file filtering should be applied.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

/**
* Class to calculate the traffic congestion index based on the paper
* "A Traffic Congestion Assessment Method for Urban Road Networks Based on Speed Performance Index" by Feifei He, Xuedong Yan*, Yang Liu, Lu Ma.
* "A Traffic Congestion Assessment Method for Urban Road Networks Based on Speed Performance Index" by Feifei He, Xuedong Yan, Yang Liu, Lu Ma.
*/
public final class TrafficStatsCalculator {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ public double getSample() {
return sample;
}

/**
* Return factor that is used to upscale the sample size.
*/
public double getUpscaleFactor() {
return 1.0 / sample;
}

private void setSize(double sample) {
this.set = true;
this.sample = sample;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,6 @@ else if (samplingOption.equals("changeDemandOnLocation")) {
.skip(rand.nextInt(usedServiceLocations.size() - 1)).findFirst().get()));
}
int demandForThisLink = calculateDemandForThisLink(demandToDistribute, numberOfJobs, distributedDemand, i);

Carrier thisCarrier = CarriersUtils.getCarriers(scenario).getCarriers()
.get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class));
int numberOfJobsForDemand = calculateNumberOfJobsForDemand(thisCarrier, demandForThisLink);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ public final class BicycleLinkSpeedCalculatorDefaultImpl implements BicycleLinkS
private static final Logger log = LogManager.getLogger(BicycleLinkSpeedCalculatorDefaultImpl.class );
@Inject private BicycleConfigGroup bicycleConfigGroup;
@Inject private QSimConfigGroup qSimConfigGroup;
@Inject private BicycleLinkSpeedCalculatorDefaultImpl() { }
@Inject private Config config;
@Inject private BicycleLinkSpeedCalculatorDefaultImpl() {
}

/**
* for unit testing
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@
import com.google.inject.Singleton;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.units.qual.C;
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.Scenario;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigGroup;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.controler.AbstractModule;
import org.matsim.core.controler.events.StartupEvent;
import org.matsim.core.controler.listener.StartupListener;
Expand All @@ -34,37 +38,51 @@
* @author smetzler, dziemke
*/
public final class BicycleModule extends AbstractModule {

private static final Logger LOG = LogManager.getLogger(BicycleModule.class);

@Inject
private BicycleConfigGroup bicycleConfigGroup;
@Inject private BicycleConfigGroup bicycleConfigGroup;

@Override public void install() {
// BicycleConfigGroup bicycleConfigGroup = ConfigUtils.addOrGetModule( this.getConfig(), BicycleConfigGroup.class );
// this.bind( BicycleConfigGroup.class ).toInstance( bicycleConfigGroup );
// the above feels odd. But it seems to work. I actually have no idea where the config groups are bound, neither for the core config
// groups nor for the added config groups. In general, the original idea was that AbstractModule provides the config from
// getConfig(), not from injection. kai, jun'24

// It actually does not work in general. The ExplodedConfigModule injects all config groups that are materialized by then. Which
// means that it needs to be materialized "quite early", and in particular before this install method is called. For the time being,
// a run script using the contrib thus needs to materialize the config group. kai, jul'24


@Override
public void install() {
// The idea here is the following:
// * scores are just added as score events. no scoring function is replaced.

// * link speeds are computed via a plugin handler to the DefaultLinkSpeedCalculator. If the plugin handler returns a speed, it is
// used, otherwise the default speed is used. This has the advantage that multiple plugins can register such special link speed calculators.

// this gives the typical things to the router:
addTravelTimeBinding(bicycleConfigGroup.getBicycleMode()).to(BicycleTravelTime.class).in(Singleton.class);
addTravelDisutilityFactoryBinding(bicycleConfigGroup.getBicycleMode()).to(BicycleTravelDisutilityFactory.class).in(Singleton.class);
// (the BicycleTravelTime uses the BicycleLinkSpeed Calculator bound below)
// (the BicycleDisutility uses a BicycleTravelDisutility)

// compute and throw the additional score events:
this.addEventHandlerBinding().to( BicycleScoreEventsCreator.class );
// (the motorized interaction is in the BicycleScoreEventsCreator)
// (this uses the AdditionalBicycleLinkScore to compute and throw corresponding scoring events)
// (it also computes and throws the motorized interaction events, if they are switched on)

this.bind( AdditionalBicycleLinkScore.class ).to( AdditionalBicycleLinkScoreDefaultImpl.class );

bind( BicycleLinkSpeedCalculator.class ).to( BicycleLinkSpeedCalculatorDefaultImpl.class ) ;
// this is still needed because the bicycle travel time calculator for routing needs to use the same bicycle speed as the mobsim. kai, jun'23
// (this computes the value of the per-link scoring event. yyyy Very unfortunately, it is a re-implementation of the BicycleTravelDisutility (mentioned above).)

this.installOverridingQSimModule( new AbstractQSimModule(){
@Override protected void configureQSim(){
this.addLinkSpeedCalculator().to( BicycleLinkSpeedCalculator.class );
}
} );

bind( BicycleLinkSpeedCalculator.class ).to( BicycleLinkSpeedCalculatorDefaultImpl.class ) ;
// (both the router and the mobsim need this)

addControlerListenerBinding().to(ConsistencyCheck.class);
}

Expand All @@ -73,7 +91,6 @@ static class ConsistencyCheck implements StartupListener {
@Inject private Scenario scenario;

@Override public void notifyStartup(StartupEvent event) {

Id<VehicleType> bicycleVehTypeId = Id.create(bicycleConfigGroup.getBicycleMode(), VehicleType.class);
if (scenario.getVehicles().getVehicleTypes().get(bicycleVehTypeId) == null) {
LOG.warn("There is no vehicle type '" + bicycleConfigGroup.getBicycleMode() + "' specified in the vehicle types. "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import com.google.inject.Inject;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.ScoringConfigGroup;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.router.costcalculators.TravelDisutilityFactory;
Expand All @@ -35,21 +37,20 @@
*/
public final class BicycleTravelDisutilityFactory implements TravelDisutilityFactory {
// public-final is ok since ctor is package-private: can only be used through injection

private static final Logger LOG = LogManager.getLogger(BicycleTravelDisutilityFactory.class);

@Inject BicycleConfigGroup bicycleConfigGroup;
@Inject
ScoringConfigGroup cnScoringGroup;
@Inject
RoutingConfigGroup routingConfigGroup;

private BicycleConfigGroup bicycleConfigGroup;
@Inject Config config;
@Inject ScoringConfigGroup cnScoringGroup;
@Inject RoutingConfigGroup routingConfigGroup;
private static int normalisationWrnCnt = 0;

/* package-private */ BicycleTravelDisutilityFactory(){}
/* package-private */ BicycleTravelDisutilityFactory(){
}

@Override
public TravelDisutility createTravelDisutility(TravelTime timeCalculator) {
this.bicycleConfigGroup = ConfigUtils.addOrGetModule( config, BicycleConfigGroup.class );

double sigma = routingConfigGroup.getRoutingRandomness();

double normalization = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,11 @@ private static boolean hasNoCycleway( String cyclewayType ) {
}
return userDefinedNetworkAttributeFactor;
}
// ===
public static void setSmoothness( Link link, String smoothness ){
link.getAttributes().putAttribute( SMOOTHNESS, smoothness );
}
public static void setBicycleInfrastructureFactor( Link link, double factor ){
link.getAttributes().putAttribute( BICYCLE_INFRASTRUCTURE_SPEED_FACTOR, factor );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ protected void setOrModifyLinkAttributes(Link l, OsmWay way, boolean forwardDire
// Smoothness
String smoothness = way.tags.get(BicycleUtils.SMOOTHNESS);
if (smoothness != null) {
l.getAttributes().putAttribute(BicycleUtils.SMOOTHNESS, smoothness);
BicycleUtils.setSmoothness( l, smoothness );
this.countSmoothness++;
}

Expand Down
Loading