Add penalty to train route for each train waiting on station

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
jamesp
Manual Inserter
Manual Inserter
Posts: 1
Joined: Mon Jun 22, 2020 10:31 am
Contact:

Add penalty to train route for each train waiting on station

Post by jamesp »

The suggestion:
My understanding of the current train pathfinding algorithm is that there is a penalty added for a station being occupied, and for passing through an occupied block, but the penalty does not increase for each train that is waiting on a station. This can cause some issues with widely-separated stations that have the same name (issue described below), so I propose that to fix this issue, the station-occupied penalty should be multiplied by the number of trains currently heading to that station. This is ideally much simpler than reservation or maximum-train-count-for-station suggestions that have come up before to fix a similar issue.

The issue:
Imagine the following setup:
You have an 'Iron Smelting' station and two 'Iron Ore' stations. There is sufficient throughput as long as both Iron Ore stations are being visited. One of the Iron Ore stations is significantly further away from the Iron Smelting station than the other one.

All the stations have a stacker in front of them that supports a large number of trains. It's one of these types of stacker, where each train waiting has its own block, guarded by a chain signal.

There are a large number of trains running the iron ore-iron smelter route.

Say the close iron ore station is full and the far iron ore station is empty. A train pathfinding to an iron ore station from the smelter will see the far station as being [large distance] away, and the close station as being [small distance + 500 penalty units + some other penalty units] away. The penalties applied are "train stopped in station" and a single occupied block. It's pretty easy for this to result in the train going to the close station, which is probably fine, except then the next train will go there, and the next train, and the next train, etc. and the far station is never visited.

If the penalty increased for each train waiting, eventually trains will spill over to far station.

Workaround:
One workaround is to put a number of signals = the number of stacker bays spaced very closely between the stacker and the station, and use the circuit network to rig them so that each signal is turned red when there's a train in the corresponding stacker bay, but only when there's a train in the station. This approximates the suggested solution by adding a 1000-unit circuit-controlled-signal penalty for each train in the stacker, but requires some combinators and wiring and rail space at each station.

I believe ensuring your stacker has an 'abandon ship' route where it can go back to the main railway line without going through the station is also a workaround, as eventually the waiting trains should give up and reroute to the other iron ore station. Unfortunately this workaround does not help the case where the two stations are for unloading as much.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2250
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Add penalty to train route for each train waiting on station

Post by boskid »

jamesp wrote:
Mon Jun 22, 2020 10:47 am
The suggestion:
My understanding of the current train pathfinding algorithm is that there is a penalty added for a station being occupied, and for passing through an occupied block, but the penalty does not increase for each train that is waiting on a station. This can cause some issues with widely-separated stations that have the same name (issue described below), so I propose that to fix this issue, the station-occupied penalty should be multiplied by the number of trains currently heading to that station. This is ideally much simpler than reservation or maximum-train-count-for-station suggestions that have come up before to fix a similar issue.
Core issue with this idea is that there is no value that tracks how many trains are heading for a given train stop. This also means, train stop penalty does not depend on amount of trains heading to it. If there would be a value that tracks amount of incoming trains, related idea to limit trains per train stop would have been already implemented.

Post Reply

Return to “Ideas and Suggestions”