matsim-org / matsim-code-examples

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

Issues with PT schedule for Amsterdam #20

Closed ghost closed 5 years ago

ghost commented 6 years ago

Hello, I am working with a scenario for the network of Amsterdam with 140000 agents and modes: Car, walk, bike, PT, and drt(taxi). The pt mode comprise of train, tram,subway, and ferry. The transit schedule and vehicles file have been obtained from GTFS data. I am looking into the impact of replacing pt lines with drt, for which I removed all the stops, routes, and lines of bus from the schedule file and ran the simulation with the updated schedule file. The initial plan input file has clean pt plans without any routes. But I encounter an error in the first iteration (2018-10-12 14:07:37,060 ERROR AbstractMultithreadedModule$ExceptionHandler:210 Thread ChooseRandomLegMode.3 died with exception. Will stop after all threads finished.) I thought maybe this happened because of the agents who had a bus route initially, are not able to find an alternate pt route. So I changed all the pt legs in the initial plan file to taxi/drt so that the initial plan file doesn't have any pt legs. But I still get this error. Any help with this would be deeply appreciated. The detailed log file of error is attached.

@mrieser logfileWarningsErrors.log

mrieser commented 6 years ago

The log file contains more information about the actual problem:

2018-10-12 14:07:37,060 ERROR AbstractMultithreadedModule$ExceptionHandler:210 Thread ChooseRandomLegMode.3 died with exception. Will stop after all threads finished.
java.lang.ClassCastException: org.matsim.core.population.ActivityImpl cannot be cast to org.matsim.api.core.v01.population.Leg
    at org.matsim.core.population.algorithms.ChooseRandomLegMode.getTransportMode(ChooseRandomLegMode.java:101)
    at org.matsim.core.population.algorithms.ChooseRandomLegMode.changeToRandomLegMode(ChooseRandomLegMode.java:80)
    at org.matsim.core.population.algorithms.ChooseRandomLegMode.run(ChooseRandomLegMode.java:67)
    at org.matsim.core.replanning.modules.AbstractMultithreadedModule$PlanAlgoThread.run(AbstractMultithreadedModule.java:234)
    at java.lang.Thread.run(Thread.java:748)

Based on that, the code tries to detect the currently used leg mode by looking at the second PlanElement in the agent's plan, which should be a leg. But in your case it seems to be an Activity.

So the problem is somewhere in your plans: They should always alternate between activities and legs, and it looks as if in your case you have at least two activities at the beginning of a plan.