Skip to content

Commit

Permalink
bump to matsim libs PR3302
Browse files Browse the repository at this point in the history
  • Loading branch information
simei94 committed Jun 3, 2024
1 parent dd97bdd commit 99bd8c8
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 17
java-version: 21
architecture: x64
distribution: adopt
cache: maven
Expand All @@ -32,7 +32,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 17
java-version: 21
architecture: x64
distribution: adopt
cache: maven
Expand All @@ -51,7 +51,7 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [17]
java: [21]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 17
java-version: 21
architecture: x64
distribution: adopt
cache: maven
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ For more information about MATSim, see here: https://www.matsim.org/

### Internal Documentation
Internal documentation can be found here:
https://docs.google.com/document/d/1igBcrRTFklb7THSU1bNNIyG-pwiYgXBg6WeI-Pf7zj8/edit
https://docs.google.com/document/d/1igBcrRTFklb7THSU1bNNIyG-pwiYgXBg6WeI-Pf7zj8/edit?usp=sharing
8 changes: 4 additions & 4 deletions input/v1.1/lausitz-v1.1-10pct.config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@
</parameterset>
<parameterset type="modeParams">
<param name="constant" value="-0.5680132362367731"/>
<!-- #(2.0+1.0)*6+(2.0+1)*0.0 -->
<param name="marginalUtilityOfTraveling_util_hr" value="-18.0"/>
<param name="mode" value="ride"/>
<param name="monetaryDistanceRate" value="-0.0005"/>
<param name="dailyMonetaryConstant" value="-0.0"/>
<!-- the following are set in code, see run class -->
<!-- <param name="marginalUtilityOfTraveling_util_hr" value="-18.0"/>-->
<!-- <param name="monetaryDistanceRate" value="-0.0005"/>-->
<!-- <param name="dailyMonetaryConstant" value="-0.0"/>-->
</parameterset>
<parameterset type="modeParams">
<param name="constant" value="-2.156295829747925"/>
Expand Down
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
<!--<version>14.0-PR1452</version>-->

<!-- snapshot == not recommended: rather use PR-labelled release!-->
<version>16.0-PR3172</version>
<version>2025.0-PR3302</version>
</parent>


<modelVersion>4.0.0</modelVersion>
<groupId>com.github.matsim-scenarios</groupId>
<artifactId>matsim-lausitz</artifactId>
Expand All @@ -31,7 +32,7 @@

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.release>21</maven.compiler.release>
</properties>

<distributionManagement>
Expand Down
24 changes: 18 additions & 6 deletions src/main/java/org/matsim/run/LausitzScenario.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.matsim.run;

import com.google.common.collect.Sets;
import org.matsim.analysis.ModeChoiceCoverageControlerListener;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.TransportMode;
import org.matsim.api.core.v01.network.Link;
Expand All @@ -20,6 +19,7 @@
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.config.groups.ScoringConfigGroup;
import org.matsim.core.controler.AbstractModule;
import org.matsim.core.controler.Controler;
import org.matsim.core.scoring.functions.ScoringParametersForPerson;
Expand Down Expand Up @@ -55,6 +55,10 @@ public LausitzScenario(@Nullable Config config) {
super(config);
}

public LausitzScenario(String configPath) {
super(configPath);
}

public LausitzScenario() {
super(String.format("input/v%s/lausitz-v%s-25pct.config.xml", VERSION, VERSION));
}
Expand Down Expand Up @@ -84,7 +88,18 @@ protected Config prepareConfig(Config config) {

simWrapper.sampleSize = sample.getSample();
}
//

// set ride scoring params dependent from car params
ScoringConfigGroup.ModeParams rideParams = config.scoring().getOrCreateModeParams(TransportMode.ride);
ScoringConfigGroup.ModeParams carParams = config.scoring().getModes().get(TransportMode.car);
// 2.0 + 1.0 = alpha + 1
// ride cost = alpha * car cost
// ride marg utility of traveling = (alpha + 1) * marg utility travelling car + alpha * beta perf
double alpha = 2;
rideParams.setMarginalUtilityOfTraveling((alpha + 1) * carParams.getMarginalUtilityOfTraveling() - alpha * config.scoring().getPerforming_utils_hr());
rideParams.setDailyMonetaryConstant(0.);
rideParams.setMonetaryDistanceRate(carParams.getMonetaryDistanceRate() * 2);

config.qsim().setUsingTravelTimeCheckInTeleportation(true);
config.qsim().setUsePersonIdForMissingVehicleId(false);
config.routing().setAccessEgressType(RoutingConfigGroup.AccessEgressType.accessEgressModeToLink);
Expand Down Expand Up @@ -123,12 +138,9 @@ public void install() {

bind(ScoringParametersForPerson.class).to(IncomeDependentUtilityOfMoneyPersonScoringParameters.class).asEagerSingleton();

// this is only a "nice to have" analysis to check whether agents had the chance to try out all the modes.
// the analysis is added to ModeStatsModule in matsim-libs PR3285
addControlerListenerBinding().to(ModeChoiceCoverageControlerListener.class);
addTravelTimeBinding(TransportMode.ride).to(networkTravelTime());
addTravelDisutilityFactoryBinding(TransportMode.ride).to(carTravelDisutilityFactoryKey());

// we do not need to add SwissRailRaptor explicitely! this is done in core
}

});
Expand Down

0 comments on commit 99bd8c8

Please sign in to comment.