Skip to content

faq 309657606

Billy Charlton edited this page Sep 5, 2018 · 2 revisions

differentiated scoring of non "pt" transit modes

by Gunnar Flötteröd on 2018-08-14 10:05:53


I wonder what scoring parameters are applied in the following case.

  • Transit route modes (in transitSchedule.xml) are "bus" and "tram".

  • Scoring parameters (in "planCalcScore" config module) are defined for "bus" and "tram" but not for "pt".

I have come this far: In CharyparNagelLegScoring.calcLegScore(...), I read

ModeUtilityParameters modeParams = this.params.modeParams.get(leg.getMode());
if (modeParams == null) {
  if (leg.getMode().equals(TransportMode.transit_walk)) { 
    modeParams = this.params.modeParams.get(TransportMode.walk);
  } else {
    modeParams = this.params.modeParams.get(TransportMode.other);
  }
}

Given that it appears as if all "transitModes" (as declared in the "transit" config module) are turned into "pt" leg modes, and given that there are no pt scoring parameters in the config, do "bus" and "tram" receive "transit walk" or "other" scoring parameters?

Most importantly, how to I enable transit route mode specific scoring parameters, meaning in my case individual scoring parameters for "bus" and "tram"?

Thanks in advance!

Gunnar


Comments: 1


Re: differentiated scoring of non "pt" transit modes

by Kai Nagel on 2018-08-14 19:54:15

It should abort with an exception. Can you say where the code comes from that you mention? We used to have that fallback to "other", but tried to remove it some time ago. (The mode entry in the transit schedule, if I remember right, should say something about the links that that vehicle can use. Except that this functionality may be buggy. :-( )

What may happen, depending on how it is set up, is that it teleports those legs.

Can you look into your output_plans? Does it really say "tram" or "bus" there?

What you need is not possible in a totally easy way. https://github.com/matsim-org/matsim-code-examples/blob/0.10.x/src/main/java/tutorial/scoring/kindergartenActivityScoring/RunScenarioWithCustomScoring.java tells you how to plug together your own scoring function. You could either replace the leg scoring, or just have a score addition for (say) tram. Note that "tram" as a mode should not exist (should be pt), so you need to get the "tram" from something else. E.g. from the vehicle id into which the agent enters.

Replacing scoring functions is a good thing to learn; definitely not a waste of time in the longer run.

Clone this wiki locally