Skip to content

Commit

Permalink
include experimental imc
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Apr 9, 2024
1 parent 81c9d1c commit 1619ac6
Show file tree
Hide file tree
Showing 4 changed files with 246 additions and 5 deletions.
5 changes: 3 additions & 2 deletions input/v6.2/berlin-v6.2.config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,13 @@
<param name="probaForRandomSingleTripMode" value="0.5"/>
<param name="coordDistance" value="100"/>
</module>
<!--

<module name="informedModeChoice">
<param name="modes" value="car,pt,bike,walk"/>
<param name="topK" value="5"/>
<param name="constraintCheck" value="warn"/>
</module>
-->


<module name="simwrapper" >
<parameterset type="params" >
Expand Down
221 changes: 221 additions & 0 deletions input/v6.2/berlin-v6.2.schedule-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE config SYSTEM "http://www.matsim.org/files/dtd/config_v2.dtd">
<config>
<module name="timeAllocationMutator">
<param name="mutationRange" value="1800.0"/>
<param name="mutateAroundInitialEndTimeOnly" value="true"/>
</module>
<module name="controller">
<param name="lastIteration" value="500"/>
<param name="overwriteFiles" value="failIfDirectoryExists"/>
<param name="runId" value="berlin-v6.2"/>
<param name="outputDirectory" value="./output/berlin-v6.2-10pct"/>
<param name="writeEventsInterval" value="100"/>
<param name="writePlansInterval" value="100"/>
<param name="routingAlgorithmType" value="SpeedyALT"/>
</module>
<module name="global">
<param name="coordinateSystem" value="EPSG:25832"/>
<param name="insistingOnDeprecatedConfigVersion" value="false"/>
<param name="numberOfThreads" value="16"/>
</module>
<module name="network">
<param name="inputNetworkFile" value="./berlin-v6.2-network-with-pt.xml.gz"/>
</module>
<module name="plans">
<param name="inputPlansFile" value="./berlin-v6.2-25pct.plans-initial.xml.gz"/>
<param name="removingUnnecessaryPlanAttributes" value="true"/>
</module>
<module name="vehicles">
<param name="vehiclesFile"
value="./berlin-v6.2-vehicleTypes.xml"/>
</module>
<module name="transit">
<param name="transitScheduleFile" value="./berlin-v6.2-transitSchedule.xml.gz"/>
<param name="useTransit" value="true"/>
<param name="vehiclesFile" value="./berlin-v6.2-transitVehicles.xml.gz"/>
</module>
<module name="facilities">
<param name="facilitiesSource" value="fromFile"/>
<param name="inputFacilitiesFile" value="./berlin-v6.2-facilities.xml.gz"/>
</module>
<module name="routing">
<param name="networkModes" value="car,truck,freight,ride"/>
<param name="accessEgressType" value="accessEgressModeToLink"/>
<parameterset type="teleportedModeParameters">
<param name="beelineDistanceFactor" value="1.3"/>
<param name="mode" value="bike"/>
<param name="teleportedModeSpeed" value="3.1388889"/>
</parameterset>
<parameterset type="teleportedModeParameters">
<param name="beelineDistanceFactor" value="1.3"/>
<param name="mode" value="walk"/>
<param name="teleportedModeSpeed" value="1.0555556"/>
</parameterset>
</module>
<module name="qsim">
<param name="mainMode" value="car,truck,freight"/>
<param name="flowCapacityFactor" value="0.1"/>
<param name="storageCapacityFactor" value="0.1"/>
<param name="numberOfThreads" value="12"/>
<param name="startTime" value="00:00:00"/>
<param name="endTime" value="36:00:00"/>
<param name="stuckTime" value="30.0"/>
<param name="trafficDynamics" value="kinematicWaves"/>
<param name="vehiclesSource" value="modeVehicleTypesFromVehiclesData"/>
<param name="insertingWaitingVehiclesBeforeDrivingVehicles" value="true"/>
<param name="usePersonIdForMissingVehicleId" value="false"/>
</module>

<module name="subtourModeChoice">
<param name="modes" value="car,pt,bike,walk,ride"/>
<param name="chainBasedModes" value="car,bike"/>
<param name="considerCarAvailability" value="true"/>
<param name="behavior" value="betweenAllAndFewerConstraints"/>
<param name="probaForRandomSingleTripMode" value="0.5"/>
<param name="coordDistance" value="100"/>
</module>

<module name="informedModeChoice">
<param name="modes" value="car,pt,bike,walk,ride"/>
<param name="topK" value="14"/>
<param name="constraintCheck" value="repair"/>
</module>

<module name="scheduledModeChoice">
<param name="scheduleIterations" value="24"/>
<param name="adjustTargetIterations" value="true" />
<param name="subpopulations" value="person" />
<parameterset type="modeTargetParameters" >
<param name="subpopulation" value="person" />
<param name="shares" value="car=0.2" />
</parameterset>
</module>

<module name="simwrapper" >
<parameterset type="params" >
<param name="context" value="" />
<param name="mapCenter" value="13.39,52.51" />
<param name="mapZoomLevel" value="9.1" />
<param name="sampleSize" value="0.1" />
<param name="shp" value="./area/area.shp" />
</parameterset>
</module>

<module name="transitRouter">
<param name="directWalkFactor" value="1.0"/>
<param name="maxBeelineWalkConnectionDistance" value="300.0"/>
</module>
<module name="travelTimeCalculator">
<param name="analyzedModes" value="car,truck"/>
<param name="separateModes" value="true"/>
</module>
<module name="vspExperimental">
<param name="vspDefaultsCheckingLevel" value="abort"/>
</module>

<module name="scoring">
<param name="fractionOfIterationsToStartScoreMSA" value="0.8"/>
<parameterset type="scoringParameters">
<param name="marginalUtilityOfMoney" value="1.0"/>
<!-- car prices 2012->2022: inflation (110.2-91.7)/91.7 = 0.2017448
Euro/m: 0.000124*(1+0.2017448) = 0.00014901635 -->
<!-- 6.0 -> inflation adjusted (2017->2022) -->
<param name="performing" value="6.88"/>

<parameterset type="modeParams">
<param name="constant" value="-0.6269580844054548" />
<!-- result of the calibration, lower than full vehicle ownership cost which gave too unattractive car mode in calibration -->
<param name="dailyMonetaryConstant" value="-3.0" />
<param name="dailyUtilityConstant" value="0" />
<param name="marginalUtilityOfDistance_util_m" value="0.0" />
<param name="marginalUtilityOfTraveling_util_hr" value="0.0" />
<!-- only petrol price 2022, other cost components were excluded -->
<param name="monetaryDistanceRate" value="-1.49E-4" />
<param name="mode" value="car" />
</parameterset>
<parameterset type="modeParams">
<param name="constant" value="-1.3788242711735" />
<param name="dailyMonetaryConstant" value="0.0" />
<param name="dailyUtilityConstant" value="0.0" />
<param name="marginalUtilityOfDistance_util_m" value="0.0" />
<!-- alpha=1, gamma=0 -->
<!-- (alpha+gamma)*beta_performing+(alpha+1)*car_marginalUtilityOfDistance_util_m -->
<param name="marginalUtilityOfTraveling_util_hr" value="-6.88" />
<!-- alpha*car_monetaryDistanceRate -->
<param name="monetaryDistanceRate" value="-1.49E-4" />
<param name="mode" value="ride" />
</parameterset>
<parameterset type="modeParams">
<param name="constant" value="-0.24909103628514367" />
<!-- 2022: 4-trips AB 10Euro -> 2.5 Eu/trip. yearly 761 Eu / 250 days = 3.04 Eu/day -->
<param name="dailyMonetaryConstant" value="-3.0" />
<param name="dailyUtilityConstant" value="0.0" />
<param name="marginalUtilityOfDistance_util_m" value="0.0" />
<param name="marginalUtilityOfTraveling_util_hr" value="0.0" />
<param name="monetaryDistanceRate" value="0.0" />
<param name="mode" value="pt" />
</parameterset>
<parameterset type="modeParams">
<param name="constant" value="-2.2321797854695955" />
<param name="dailyMonetaryConstant" value="0.0" />
<param name="dailyUtilityConstant" value="0.0" />
<param name="marginalUtilityOfDistance_util_m" value="0.0" />
<param name="marginalUtilityOfTraveling_util_hr" value="0.0" />
<param name="monetaryDistanceRate" value="0.0" />
<param name="mode" value="bike" />
</parameterset>
<parameterset type="modeParams">
<param name="constant" value="0.0" />
<param name="dailyMonetaryConstant" value="0.0" />
<param name="dailyUtilityConstant" value="0.0" />
<param name="marginalUtilityOfDistance_util_m" value="0.0" />
<param name="marginalUtilityOfTraveling_util_hr" value="0.0" />
<param name="monetaryDistanceRate" value="0.0" />
<param name="mode" value="walk" />
</parameterset>
<parameterset type="modeParams" >
<param name="constant" value="0.0" />
<param name="dailyMonetaryConstant" value="0.0" />
<param name="dailyUtilityConstant" value="0.0" />
<param name="marginalUtilityOfDistance_util_m" value="0.0" />
<param name="marginalUtilityOfTraveling_util_hr" value="0.0" />
<param name="monetaryDistanceRate" value="-4.0E-4" />
<param name="mode" value="freight" />
</parameterset>
<parameterset type="modeParams" >
<param name="constant" value="0.0" />
<param name="dailyMonetaryConstant" value="0.0" />
<param name="dailyUtilityConstant" value="0.0" />
<param name="marginalUtilityOfDistance_util_m" value="0.0" />
<param name="marginalUtilityOfTraveling_util_hr" value="0.0" />
<param name="monetaryDistanceRate" value="-4.0E-4" />
<param name="mode" value="truck" />
</parameterset>
</parameterset>
</module>

<module name="counts">
<param name="inputCountsFile" value="./berlin-v6.2-counts-vmz.xml.gz"/>
<param name="countsScaleFactor" value="0.1"/>
</module>

<module name="ReplanningAnnealer">
<param name="activateAnnealingModule" value="false"/>
<!-- <parameterset type="AnnealingVariable" >
<param name="annealParameter" value="globalInnovationRate" />
<param name="annealType" value="sigmoid" />
<param name="subpopulation" value="person" />
<param name="halfLife" value="0.5" />
<param name="shapeFactor" value="0.01" />
<param name="startValue" value="0.6" />
<param name="endValue" value="0.01" />
</parameterset> -->
</module>

<module name="replanning">
<param name="fractionOfIterationsToDisableInnovation" value="0.8"/>
<!-- Strategies are added in code -->
</module>

</config>
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<artifactId>matsim-all</artifactId>

<!-- PR-labelled release -->
<version>16.0-PR3193</version>
<!-- <version>16.0-PR3193</version>-->

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

<modelVersion>4.0.0</modelVersion>
Expand Down
21 changes: 20 additions & 1 deletion src/main/java/org/matsim/run/OpenBerlinScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
import org.matsim.core.replanning.strategies.DefaultPlanStrategiesModule;
import org.matsim.core.router.costcalculators.TravelDisutilityFactory;
import org.matsim.core.router.util.TravelTime;
import org.matsim.modechoice.InformedModeChoiceModule;
import org.matsim.modechoice.ModeOptions;
import org.matsim.modechoice.ScheduledModeChoiceModule;
import org.matsim.modechoice.constraints.RelaxedMassConservationConstraint;
import org.matsim.modechoice.estimators.DefaultActivityEstimator;
import org.matsim.modechoice.estimators.DefaultLegScoreEstimator;
import org.matsim.modechoice.estimators.FixedCostsEstimator;
import org.matsim.prepare.RunOpenBerlinCalibration;
import org.matsim.prepare.population.AssignIncome;
import org.matsim.run.scoring.AdvancedScoringConfigGroup;
import org.matsim.run.scoring.AdvancedScoringModule;
import org.matsim.simwrapper.SimWrapperConfigGroup;
Expand Down Expand Up @@ -122,6 +128,19 @@ protected void prepareControler(Controler controler) {
public static final class TravelTimeBinding extends AbstractModule {
@Override
public void install() {

install(InformedModeChoiceModule.newBuilder()
.withFixedCosts(FixedCostsEstimator.DailyConstant.class, TransportMode.car, TransportMode.pt)
.withLegEstimator(DefaultLegScoreEstimator.class, ModeOptions.ConsiderIfCarAvailable.class, TransportMode.car)
.withLegEstimator(DefaultLegScoreEstimator.class, ModeOptions.AlwaysAvailable.class,
TransportMode.walk, TransportMode.ride, TransportMode.pt, TransportMode.bike)
.withConstraint(RelaxedMassConservationConstraint.class)
.withActivityEstimator(DefaultActivityEstimator.class)
.build());

install(ScheduledModeChoiceModule.newBuilder()
.build());

addTravelTimeBinding(TransportMode.ride).to(networkTravelTime());
addTravelDisutilityFactoryBinding(TransportMode.ride).to(carTravelDisutilityFactoryKey());

Expand Down

0 comments on commit 1619ac6

Please sign in to comment.