Train deadlock finder


A tool that find deadlocks in train networks and try to solve them

2 years ago
1.1
2.03K

b Deadlock still stuck

1 year, 7 months ago

I'm using this mod as a replacement for LTN. Don't ask me why.

What I'm doing is having all stations have a train limit that adds up to the exact number of trains going to and from the station. So example, say I have 2 iron ore loading stations, and 3 iron ore unloading stations, with space for two trains at each station. Here I would have 10 trains, and a train limit of two at each station. Usually, this would of course create a deadlock, but this mod lets trains flow smoothly anyway.

And this works great! Most of the time... I have a problem with only one item type, where the mod suddenly starts spamming the chat with found deadlocks, and no trains move. This can only be solved by manually disabling a train shortly, whereafter it works briefly before going back to the same loop.

I assume this is a bug, or am I doing something wrong?

1 year, 7 months ago

Probably a bug, but i try to build a setup as you describe. It runs for 10 minutes without problem. Can you provide me a save of you game ?

1 year, 7 months ago

Yes of course, and thank you for the quick response, here you go: https://1drv.ms/u/s!AhBOC28LNfJfm74_C__urD_mdM3Uxw?e=UQc5Lu

I will say, it is not consistent in any way, as far as I can tell. I have seen it happen with my iron ore and iron plates trains; might be a correlation in the amount of them, as I have quite a lot of trains going those routes.

It also seems to change when I add or remove stations. I add an iron outpost, boom problem. I add a completely unrelated station, suddenly nothing.

From when I made the save file, roughly 5 minutes went past on my machine before the problem occurred. I would think it would be roughly the same for you. And when it did, I just noticed I got a message saying "cannot remove deadlock (change settings?)". It has probably been there all the time, but when the screen fills so quickly, I haven't noticed it before. Logs say the same:

" 374.823 Script @train_deadlock_finder/scripts/analyzer.lua:6: Cannot remove deadlock (change settings ?); {"IronPlateLoading","IronPlateUnloading"}"

I hope this helps!

1 year, 7 months ago
(updated 1 year, 7 months ago)

Thanks a lot.
I have analyze your map. You are in the case when a deadlock can be solved fully automatically because several occur at the same time.
I suggest that you activate the settting "Allow unsafe deadlock removal ...". Sometimes, it can cause jams but your railroad network can support it.

1 year, 7 months ago

I am unsure if it can, but I will try to activate it. I'm pretty sure it will jam indefinitely if a third train tries to enter some of the stations that aren't unloaded as often. Oh well, I'll test it out.

As a coder myself, can I ask why this makes the script fail? I tried to take a look at the code myself, but I haven't yet had time to read it all through.

1 year, 7 months ago

The issue arises because there are 2 deadlocks detected on the same cycle of station. As the mod cannot predict which one will be broken deterministcally, its fails. But in your case, the 2 deadlock belongs to the same cycle of station (loader <=> unloader) , it does not matter which deadlock is broken (i think). So the option is safe.
Let me know if there are still problem, i will find another solution based on a temporary station.

New response