-
Notifications
You must be signed in to change notification settings - Fork 179
faq 110331769
by Renan Grace on 2017-06-29 04:43:50
Hi all,
We have written park and ride functionality into our model. It based on the 2012 work done by at VSP and uses the tutorial.programming.example11PluggablePlanStrategyInCode/RunPluggablePlanStrategyInCodeExample.java to make it work. It appears to be working fine.
However, I note that this module is single threaded. The other replanning strategies we are using (ReRoute, SubtourModeChoice, TimeAllocationMutator) are multi-threaded.
I was wondering what people's views are on whether it would be worthwhile re-implementing the parkAndRide module to be multi-threaded - i.e. is this likely to reduce the runtime enough to be worth the upfront effort. The module has a weight of 0.1 and our simulation has 4.5 - 5.5 million people in it.
Thanks in advance.
Renan.
by Marcel Rieser on 2017-06-29 07:59:51
The replanning in MATSim scales very well with the number of available CPU cores if the replanning module supports multi-threading. This is due the fact that, currently, replanning looks only at single agents. As there is no dependency between the agents, running two or more threads leads to a nearly linear speed-up: With two threads, it takes half the time, with 3 threads, one third, and so on. This assumes that your replanning threads do not write into a common data structure, e.g. the list of available P&R locations, as writing usually requires some sort of locks or synchronization. Reading only from a common data structure typically does not require locks or synchronization and thus has no influence on the runtime.
In the log file, you should be able to see how much time your Park and Ride replanning consumes (look for log-messages containing Plan-Strategy finished
). Just take that time and divide it by the number of cores you would assign to the replanning to figure out how much time you could save, and if it's worth to adapt your implementation.
MATSim provides you the class AbstractMultithreadedModule
which should make it fairly easy to wrap your replanning code in a way that it can be executed by multiple threads, keeping the required amount of work low.
You are viewing an archive of the previous MATSim Q&A site. The real site is now at https://matsim.org/faq