matsim-org / matsim-code-examples

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

stuck during PersonPrepareForSim #982

Closed hsyfyc closed 1 year ago

hsyfyc commented 1 year ago

Hi all! I had some problems with a new scenario. During the running process, it stucked at PersonPrepareForSim just like the photo shows below. 6225c4efa153b7d960297b1224c49ab 07fcddf6a2b0346c1ab257a86fb95a4 Before this time, I have tried to find which person had problem by reduce the scale of population from 16 to 8, but when the population scale is 16, the program stucked at person#8, when the population scale is 8, the program stuck at person #4.

network file and population file are attached below. input.zip

Hope for your answers.

kainagel commented 1 year ago

This is not enough information. Could you please provide the full logfile. Thanks .

hsyfyc commented 1 year ago

The logfile and logfileWarningsErrors are attached below. logfileWarningsErrors.log logfile.log

kainagel commented 1 year ago

Oh, I see, this is something worse. :-(. You probably saw that before me. @mrieser or @michalmac or anybody else, do you maybe have an idea? From my side:

hsyfyc commented 1 year ago

Thanks for your reply. For the first way, after setting number of threads to 1, the program still stucked at the same place. For the second way, I tried to run with one agent a time, when it comes to the fifth agent, the program stucked. Then I checked the plan in Via, found that in Via route can be found between two node close to the coordinate of agent's activity.

Plan 0b674f164b54d2eba334fc7a04b1f16 Home ad2f75eb12b808ea5933bb1528096ae Work 6146cc5c3e1e0a44af44c053c508352 Route 6bd765f8f23909e45c95a6b9345da61

For the problem, I think it may be wrong with the network?

mrieser commented 1 year ago

There seem to be some issues with the network.

When searching for the exact from-node/to-node in Via as the MATSim router does, I get the following result: Screenshot 2023-07-18 at 11 30 38

That's not what one would expect and points in the direction, that the network is not connected in a way as one would expect.

Also, what looks like direction-separated highways are actually bi-directional links: Screenshot 2023-07-18 at 11 31 44

So, they agents can actually "drive backwards" on these highway-like structures. In the screenshot, there are like 4 roads, and on each road agents can travel from left to right AND from right to left, while it probably should be only 2 roads from left to right and 2 other roads from right to left.

How did you create/convert the network? (And what city is it?)

Digging further, the algorithm seems to hang in a place where two nodes are basically on top of each other:

<node id="sz17121" x="1.3425928733942334E7" y="3686702.4930818207" ></node>
<node id="sz17122" x="1.3425928730825387E7" y="3686702.493668799" ></node>

There are links connecting these two nodes:

<link id="-26423" from="sz17121" to="sz17122" length="0.003256847106865249" freespeed="19.444444444444443" capacity="4800.0" permlanes="3.0" oneway="1" modes="pt,car" ></link>
<link id="26423" from="sz17122" to="sz17121" length="0.003256847106865249" freespeed="19.444444444444443" capacity="4800.0" permlanes="3.0" oneway="1" modes="pt,car" ></link>

But these links are very short (0.003m = 0.3mm), so my current guess is that the travel-time and travel-disutility essentially becomes 0.0 on those short links, which then results in an endless loop in the routing process.

Try to fix the network, make sure you don't have such short links, make sure you properly convert unidirectional links like freeways, and make sure intersections are properly connected (which the current detour to get from A to B suggests they are not).

mrieser commented 1 year ago

Maybe we should include an additional warning in the code if links are very short? Currently there is only a warning I think if a link has length 0.0, but probably everything < 1.0 is worth to know about and might pose some problems.

hsyfyc commented 1 year ago

Thanks for your reply. I hadn't converted the network correctly. I will fix it later.