matsim-org / matsim-code-examples

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

Strange long walking behaviour in multimodal scenario! #1076

Open ArezHK opened 7 months ago

ArezHK commented 7 months ago

Hello, I tried running a multimodal scenario by using Subtour mode choice strategy between car and pt as allowed modes and after simulation I see some agents walk the whole distance to destination and then I tried adjusting scoring parameters to make walking unattractive but it did not help! Could you please help me with this issue? (I should also add that I have used pt2matsim to convert osm to matsim network and links have all alowed modes as reality e.g. bus uses network links and not teleported but train has its artificial link and I used subtour mode choice strategy as innovation strategy) Thank you in advance! 1

mrieser commented 7 months ago

using Subtour mode choice strategy between car and pt as allowed modes

In that case, it seems as if the long walk legs are routed as pt, but no bus/train/... was found, and thus they used the fallback mode of walking. You could check this in the population.xml file. Each leg should have an attribute "routingMode", which I assume is "pt" for those walk legs.

Are the public transport services correct and running at the expected times? How are the scoring parameters for walk and pt? Can you share your scenario data? (e.g. config.xml, population.xml, transitSchedule.xml) Without having a closer look at the data it's hard to say what the issue is.

ArezHK commented 7 months ago

Dear Dr. @mrieser. Indeed I tried running my simulation again with more simulations,200, and although some agents changed to car or bus but still some of them still walked althogh walk was not even in allowed modes to choose. Also I tried making car mode unattractive but at the end high share of agents still chose car and not pt. I tried using config file from siouxfalls-2014 and adjusting some parameters and using my input data and I attach my data as zip files so that you can have a look (also I attach some output charts of my simulation to show modal share and scoring results). config.zip network.zip population.zip transitSchedule.zip transitVehicles.zip pkm_modestats scorestats

Briefly explaing my scenario: I added a new bus line to my desired city and it has two lines one from north to south and another vice versa and they there would be departures from 8 to 8:15 and 16 to 16:15 every 5 mins. At first I defined plan file with car mode for all agents and then used subtour mode choice strategy to let agents choose between just car and pt (and not walk). Unfortunately as I don't have real Original-Destination with mode choice information I just built up very few agents to just test MATsim's capability of multimodal simulation and check how can I implement a new mode and then making a mode more attractive or vice versa. (Also I would appreciate it if you can give some hints regarding finding OD infomation either free or paid and also instruction regarding finding suitable scoring paramters and methods of comparing real data and calibrating different parameters in config file).

Thank you in advance!

ArezHK commented 7 months ago

I also add output events and trips file here. output_events.xml.gz output_trips.csv.gz

mrieser commented 7 months ago

Thanks for the data. It's great to see that you start with a very small scenario where you can try to understand what's going on!

Some observations:

Thus, to "fix" it:

ArezHK commented 7 months ago

Dear Dr. @mrieser , Thank you for your comments and attention. As you suggested, I extended my bus line and added one more stop (near agents' activities). I also added more departures. This has helped a lot, and I am now seeing better results. However, I still have a problem with one of my agents, Agent 10. Intentionally, I set its destination in the opposite direction of the bus line to kind of force him to use private car. However, it appears that the agent walks to the destination and then returns again on foot (I tried increasing negative score for walk mode but did not help). What's even stranger is that I utilized the Subtour mode choice strategy and only allowed car and pt as modes of transport. I don't understand why this agent is choosing to walk.

Below, you can see the mentioned agent. image

I also don't understand why there is a lot of fluctuation between car and public transportation modes in the Modestats diagram (and also there is fluctuation in avg worst score in score statistics) . Additionally, it's confusing that the agent who chose to walk mode is not included in this diagram. modestats scorestats

Additionally, I attached my new scenario files. I would appreciate it if you could take a look and provide your comments. output_data.zip

Thank you in advance!

ArezHK commented 7 months ago

I also have some doubts regarding some parameters in the configuration file which are not entirely clear to me. I would appreciate it if you could provide some hints or clarification on the following:

  1. accessEgressType

  2. A bit of confusion between these three modules and also a brief explanation about their parameters: image

  3. Difference of these two teleported modes: "walk" and "non_network_walk"

  4. There are also two other default teleported modes "ride" and "pt" in extended config file and I am a bit confused as I defined pt as network mode but in the config file it is shown as teleported mode. Also what "ride" stands for?

  5. In transit module and in general do I need to define bus as a new transit mode or not? image

I apologize for the high number of questions, and I am sincerely grateful for your consideration.

mrieser commented 7 months ago

Fluctuations in modes

You only have 15 agents. If a single agent changes the mode, it has a big influence

Your replanning settings are ReRoute (weight 0.1) and SubtourModeChoice (weight 0.5), total weight is 0.6. So 5 out of 6 agents will try to change mode in each iteration. This is a very high percentage, and likely leads to the fluctuations. It's always good to have a strategy "ChangeExpBeta" with a high weight (at least 50% of the total weight, better around 70%) to reduce fluctuations.

Agent 10

Distance seems to be 1.4km (beeline), and takes about 37 minutes according to the screenshot.

The agent tries to find a route with PT, but does not find one, so it falls back to walk for the planned pt trip.

Based on the scoring parameters for walk (-6.0 marginal utility per hour), the walk trip costs the agents around 4.0 in score utilities. Both legs (morning and evening) together cost around 8.0 in score utilities.

Car also has a marginal utility of -6.0 per hour. But it also has a dailyMonetaryConstant of -15.0. The marginalUtilityOfMoney is 1.0, thus the dailyMonetaryConstant is converted into -15.0 score utilities. So no matter how fast the car is, once the agent would use the car, it would cost him/her at least -15.0 score utilities -- compared to the -8 of walking, walking is better.

Score stats

Agent 10 is included in the chart. The chart shows the average of the worst scores. So other agents will have a score higher than 120, while that agent will likely have a score much lower. But it averages out to around 120.

AccessEgressType

Traditionally in MATSim, agents using a car just ended their activity, and in the next second could start driving their car. Even if there activity location is far away from the next street (=link), where their car is parked. When using public transport, agents have to walk to the next stop. So it takes time (and uses score utilities) to access public transport. This results in an imbalance between car and pt, as the access to pt was modeled, but access to car not. The parameter would allow to change this behavior for car and probably other modes, such that accessing the mode is more comparable to pt. (You could use accessEgressModeToLink if you want)

config parameters

There are a number of different mode choice algorithms in MATSim, each has its own config module. If you use SubtourModeChoice, you can ignore the changeMode one.

modes

non_network_walk is used as a fallback mode by some routing modes.

ride is usually used in MATSim when you are driving by someone else ("share a ride", "ride along"). If you don't model this, ignore it.

As long as you use the default public transport router in MATSim, it's enough to specify pt for transitModes. This is for more advanced configuration.

ArezHK commented 7 months ago

Dear Dr. @mrieser , Thank you so much for your clarification. I tried making the car less costly, and it works properly now.

I also have another issue. As you mentioned, the number of people in my population is very low. In the next step, I want to build up a larger population dataset based on real data (for Germany). I have tried to find some information about that and found the Pendleratlas for Germany, but it is not complete and does not mention modal share and more detailed information.

May I ask you please to offer some guidance (either directly or by suggesting relevant articles) on how to find open-source data and the methodology for converting it into origin-destination data? I would like to mention that I opened an issue regarding this topic some time ago, but I have not yet received a response, and your assistance would be highly appreciated.("https://github.com/matsim-org/matsim-code-examples/issues/1072").

Thank you once again for your assistance.