matsim-org / matsim-code-examples

A repository containing code examples around MATSim
GNU General Public License v3.0
83 stars 179 forks source link

Can I make a MATSim PT agent change his TransitRoute during day? #234

Open paud0 opened 5 years ago

paud0 commented 5 years ago

Hello there,

we are simulating public transport from GTFS data. Since in the simulated city there are bus lines with multiple different routes per direction. Some of these routes only have a few departures per day.

So when an agent arrives late at a line switch and the line he wanted to switch to has already departed, he will wait for the next bus with the exact same route. For routes with only few departures that is leading to very long wait times or the agent being stuck.

Now my question is how this is to be handled in MATSim. Is there any way to make an agent switch the TransitRoute he wants to take?

Greetings & thanks in advance Paul

vsp-gleich commented 5 years ago

The TransitConfigGroup has a setting called BoardingAcceptance. It can be either checkLineAndStop or checkStopOnly. Default is checkLineAndStop, which means the agent boards a pt vehicle if it is the right TransitLine and serves the destination stop. So as long as all the TransitRoutes which should be used interchangeably belong to the same TransitLine, you are all fine with the default.

If you want to change the BoardingAcceptance add the following line to your run class: config.transit().setBoardingAcceptance( TransitConfigGroup.BoardingAcceptance.checkStopOnly );

However, checkStopOnly will make the agent board any pt vehicle serving the destination stop, no matter how long the travel time in comparison to the planned TransitLine is. (Let's assume an agent planned to take a fast long distance train, but a slow regional train arrives 2 minutes earlier. The agent will then board the regional train, even though it arrives an hour later at the destination than the fast train.)

kainagel commented 5 years ago

In java code it is

config.transit().setBoardingAcceptance( BoardingAcceptance.checkStopOnly ) ;

From xml config only this currently does not exist.

Are you running the gui, or the cloned matsim-example-project?

paud0 commented 5 years ago

Thanks for the fast answers! I will try that and report whether it solved the problem.

neuma commented 5 years ago

@vsp-gleich Since this is somewhat configurable, do you have any plans to incorporate the more complex logic from the minibus contrib? There are some checks regarding boarding a slower transit route and also regarding boarding transit routes that pass the same stop more than once.