matsim-org / matsim-code-examples

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

Is it possible to combine carsharing & public transport? #75

Closed ait-energy closed 5 years ago

ait-energy commented 5 years ago

I am currently experimenting with public transport and the carsharing module (from contrib) and was wondering if it is possible to combine carsharing & public transport in one route between two activities, i.e. so that MATSim calculates an intermodal route that first takes a car-sharing car and then switches to public transport if that's faster than using only public transport or car-sharing.

A real-life example would be: use the city-wide car-sharing system to go to the train station, then take the train to the destination (which is not covered by the car-sharing system) - or the other way round.

I imagine the resulting plan to look something like this:

<plan>
    <activity type="home" />
    <leg mode="access_walk" />
    <activity type="car interaction" />
    <leg mode="oneway" />
    <activity type="car interaction" />
    <leg mode="transit_walk" />
    <activity type="pt interaction" />
    <leg mode="pt" />
    <activity type="pt interaction" />
    <leg mode="transit_walk" />
    <activity type="work" />
</plan>
alexdawn commented 5 years ago

That's a valid plan but I believe the core matsim only calculates routes on a per leg basis and does not add in or remove activities, there might be an extension which can do it?

Hopefully you will get an answer I as I am also looking to see if Park and Ride systems can be modelled.

tduberne commented 5 years ago

was wondering if it is possible to combine carsharing & public transport in one route between two activities, i.e. so that MATSim calculates an intermodal route that first takes a car-sharing car and then switches to public transport if that's faster than using only public transport or car-sharing.

This is unfortunately a difficult problem, for which there is no standard solutions yet. We recently had someone who wrote his Master Thesis on this topic:

http://www.ivt.ethz.ch/publikationen/studenten/615.html

The problem is that in order to be efficient, you need to either rely on arbitrary heuristics to reduce the search space, or design a routing algorithm that integrates all modes in the routing network. Such algorithms exist, but making them generic enough that new modes could be added is not trivial.

That's a valid plan but I believe the core matsim only calculates routes on a per leg basis and does not add in or remove activities, there might be an extension which can do it?

Not exactly. MATSim computes routes at the trip level, which is a movement between two "meaningful" activities. A trip is a sequence of legs and "stage activities", usually named "something interaction". Those stage activities are mostly a technicality that is needed to identify the location of a change in mode. So creating a Routing Module that generates such routes is perfectly possible, the only problem is to do it efficiently enough.

I am also looking to see if Park and Ride systems can be modelled.

For Park and Ride, there is an additional difficulty: the agent needs to pick back the car at the end of the day. This means that the optimal decision (for instance, what station to park the car at) depends on the whole day, and cannot be done considering the trip in isolation. Here again, all attempts I am aware of were based on one heuristic or another. I did a very basic implementation years ago, but unfortunately the only existing report is in German. I think people in Berlin also played with the idea, but as far as I know, this never made it to a nicely packaged plugin.

The idea of my approach was basically to have a mutation replanning strategy that would add a "drop car" and a corresponding "pick up car" activity at some reasonable location in the plan, adapt the modes and route the plan, or move those activities if they exist, or delete them with some probability. As said, that was years ago, when the concept of "trips" and "stage activities" did not yet exist, so it is probably not worth trying to reuse my implementation, but the idea is relatively easy to implement.

whizkid-25 commented 4 years ago

@tduberne Hi! I am also looking to implement the combination of car sharing and public transit in one route. Is there any plugin available to implement this two modes together to asses the mode choice of agents?

Also, is there a plugin available for park and ride? I would highly appreciate if you can direct me towards the solution,