Control Train Pathfinder (Passthru stations, Add Penalty, Control Refueling)

This are only lists of links to other suggestions!
Search, if your idea has been already suggested.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 10461
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Control Train Pathfinder (Passthru stations, Add Penalty, Control Refueling)

Post by ssilk » Sun Mar 20, 2016 6:23 pm

This suggestion goes around influencing the train routes, so that - for example - trains will not drive needless through heavy used stations. Or that a heavy used track will be surrounded by the trains.

There are two general directions:

1. Add a pass-thru-station.
A station is added to the train schedule, where the train must pass thru, before it can go to the next station. Also known as "drive over".

2. Add signals (or other entity) that adds a penalty to the train pathfinder, so that the pathfinder avoids to take that path.
ratchetfreak wrote:The goal is to avoid trains from entering stations and passing through when they don't need to. There is currently no way to do sow without designing your network from the ground up to prevent that.
The extra penalty signal should just add a cost to the path that travels through it just like a train on the rails currently does. So if there isn't an alt path the train can pass the signal.
And added since v0.13:
3. Control signals via circuit network. You can set the entry signals to this "forbidden zone" to red and switch green only, if the right train comes.

There are reasons, that speak more to direction #2. For example: With #1 each train must eventually change their schedule, if a new track is added. That is avoided with solution #2, cause you change the track and not the trains. #3 is not so easy and it takes a lot of know how, to find out, how this works. To handle a large number of trains with the pass-thru-stations makes it dependent on another feature "Train Routes". That is never a good idea, cause a route should have nothing to do with the track, that is finally taken! It would mean to loose flexibility of your train network.

For those situations, this won't work (complicated routing, depending on complex situation), there is the idea to have viewtopic.php?f=6&t=13849 Smart rail signals
(which will come with very high probability with v0.13)

Suggestions

viewtopic.php?f=6&t=14030 Rail that pathfinding sees as 100 units long instead of 1
viewtopic.php?f=6&t=18670 How trains choose a station.
viewtopic.php?f=6&t=20037 New option for Rail Stations - No "Through" traffic allowed
viewtopic.php?f=6&t=20233 Add item to define train pathfinding penalty for a railway
viewtopic.php?f=6&t=21831 Train waypoints
viewtopic.php?f=6&t=25944 Train station skipping conditions
viewtopic.php?f=6&t=30033 Train pathing - forbid passing through stops
viewtopic.php?f=6&t=30239 Treat closed signal identically to red signal
viewtopi c.php?f=6&t=32459 Railway Speed Limits
viewtopic.php?f=5&t=37562 Train waypoint/(no)stop feature request
viewtopic.php?f=6&t=40406 Train privilages block
viewtopic.php?f=6&t=42185 Rail checkpoints/Go via
viewtopic.php?f=6&t=43159 Train Station: Option to require stop
viewtopic.php?f=6&t=45971 Train path finding logic (0.15)
viewtopic.php?f=6&t=47695 Train pathfinding on stations with same name

Control Refueling
(Taken from viewtopic.php?p=317175#p317175, thanks to Jap2.0)

viewtopic.php?f=6&t=25944#p224447 Train station skipping conditions
viewtopic.php?f=6&t=49447#p287036 Allow Trains to select their own stop.
viewtopic.php?f=6&t=52484 Detecting Locomotive Fuel Level
viewtopic.php?f=6&t=53454 Train Maintenance Orders
viewtopic.php?f=6&t=53768 Adding a fuel wait condision to trains
viewtopic.php?f=18&t=53927 Advanced train routing
viewtopic.php?f=18&t=54009 A couple of questions about refueling trains


Older suggestions (PRE-0.13!)
You need to know, that the train routing was completely reprogrammed with v0.12, nevertheless some suggestions are useful.

viewtopic.php?f=6&t=1934 [0.8.5] Train Pathfinding Issue
viewtopic.php?f=6&t=7346 Better train logic (smarter alternative route finding)
viewtopic.php?f=6&t=9417 Path Signals
viewtopic.php?f=71&t=13265 Express or Fast train signals
viewtopic.php?f=71&t=13361 Train Routing Logic


Related

viewtopic.php?f=80&t=7717 Can the player be killed by train? (Train kills?!)
viewtopic.php?f=6&t=7787 Train Lines and global filters
viewtopic.php?f=6&t=8707 Better “No Path” feedback for trains
viewtopic.php?f=68&t=10312&start=10 Connect train stops to circuit networks
viewtopic.php?f=6&t=12491 Semi-automatic and extra train options.
viewtopic.php?f=6&t=13849 Smart rail signals
viewtopic.php?f=6&t=15339 Give the first chain signal in a row an outstanding design
viewtopic.php?f=6&t=19764 Setting train orders to create dynamic train routing
viewtopic.php?f=6&t=25683 Visible Rail Blocks
viewtopic.php?f=6&t=50128 New Train-Schedule-Mode / Conditions instead of Train-Stop-Names / Remove Names from Train-Schedule [scheduling based on conditions instead on stop-names]


Image
viewtopic.php?f=80&t=21899 Control Train Pathfinder (Passthru stations, Add Penalty)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Ghoulish
Filter Inserter
Filter Inserter
Posts: 315
Joined: Fri Oct 16, 2015 8:40 am

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by Ghoulish » Mon Mar 21, 2016 8:08 am

Isn't the need for the proposed change negated by just having good rail design / layout / stacking?

Your second point I don't understand, how exactly would it be implemented or work? You'd maybe have a 3rd type of signal that could stop certain trains from using a path? How would that work within the UI? Also, what would happen if there wasn't an alternative path? Lockup? Haven't we just gone full circle and are back to good rail layout or design?

ratchetfreak
Filter Inserter
Filter Inserter
Posts: 934
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by ratchetfreak » Mon Mar 21, 2016 10:46 am

The goal is to avoid trains from entering stations and passing through when they don't need to. There is currently no way to do sow without designing your network from the ground up to prevent that.

the extra penalty signal should just add a cost to the path that travels through it just like a train on the rails currently does. So if there isn't an alt path the train can pass the signal.

Ghoulish
Filter Inserter
Filter Inserter
Posts: 315
Joined: Fri Oct 16, 2015 8:40 am

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by Ghoulish » Mon Mar 21, 2016 11:47 am

Yeah I see it now, so the train would take an alternative route as it doesn't need to use that station, a sort of no go zone for a length of track unless that station was specifically required.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 10461
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by ssilk » Mon Mar 21, 2016 3:42 pm

I've added ratchetfreak's explanation above.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 10461
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by ssilk » Sat Apr 09, 2016 11:55 am

Sorry for doubleposting, but I think it makes sense to point to this post:
viewtopic.php?f=80&t=7717&p=146599#p146599 Can the player be killed by train? (Train kills?!)

I copy the content:
ssilk wrote:Well, I think for such cases you should be able to build "slowdown signals". They could be the same signals in viewtopic.php?f=80&t=21899 - the signals that add points to the pathfinder. Because if you want to slow down a train it makes sense, that the train avoids that area. And vice versa: If you want a train to avoid an area, it makes sense, that he slows down there, because normally there is no train here.

But that must be done of course before you begin to build your stuff near rails. And believe me (or not): After dying the 10th time you really get used, not to walk on the rails in whatever situation. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

phi1010
Inserter
Inserter
Posts: 45
Joined: Sat Aug 20, 2016 3:31 pm
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by phi1010 » Sun Aug 21, 2016 9:38 pm

ssilk wrote:Well, I think for such cases you should be able to build "slowdown signals". They could be the same signals in viewtopic.php?f=80&t=21899 - the signals that add points to the pathfinder.
I don't think using Slowdown as the only penalty measure is the complete solution.

Slowdown -> Penalty might not apply sometimes:
Where I want the trains to drive slow, they will need more time, so it makes sense to increase the pathfinding cost, if I want them to arrive as early as possible.
Depending on how the fuel usage is calculated (time, time*speed=distance, distance*speed) I might want to reduce the fuel cost by slowing trains down (or to avoid pollution, if they actually produce any).

Penalty -> Slowdown will not apply sometimes:
I have some much-used cul-de-sac stations (usually for fluid wagons not working with filter inserters), which should not be used by other trains to turn around, blocking the way for the trains which actually need to use this path, and making things less efficient; when there is a designated turnaround loop at some distance. In this case I don't want the trains using the station to slow down, I want them to turn around and stop as fast as possible. (Using dead ends instead would require a second train and risk the train entering the station backwards, when the pathfinder decided to recalculate the path at some point on a two-way-track, causing wrong items to land on wrong belts.)

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 10461
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by ssilk » Sun Aug 21, 2016 11:34 pm

It was hard to imagine in head, how this is locking.
As I understand it, you use a station to turn a train into the right direction? But that is no drive through: He stops and turns around! :) The point of drive through is, that the train drives through it, without loosing speed. :)

I'm still not so convinced about drive through stations. It works well for example in OpenTTD. But will this fit to Factorios map-dimensons? Remember: This is an additional step in the setup of the train routes of trains. With your growing train network you need to keep always in mind: Uhm, there is this drive through station, I don't need to forget to add it to the schedule.

In contrast to penalty: penalty needs to be configured once and then you can forget about it. ;)

In any way: A penalty is of course no guarantee, that a path is not used in really every case, but it will work in much more than 95% of cases.

And for the remaining 5%: That cases of misrouting wil be rare and will not influence the transport much. But if: Imagine negative penalty for making preferred paths. :) And if still problems/not running perfectly? Therefore we have the circuits-signals. :)

BTW: controlling train routing by circuit network is another option: I added it to the Original Post.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

phi1010
Inserter
Inserter
Posts: 45
Joined: Sat Aug 20, 2016 3:31 pm
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by phi1010 » Mon Aug 22, 2016 2:00 am

ssilk wrote:It was hard to imagine in head, how this is locking.
As I understand it, you use a station to turn a train into the right direction?
I use a single two-way track with a loop at the end (so no stopping while turning around!) with exactly one two-way exit; no signals except two at the exit to the junction. The train drives into the section, turns at the other end, stops at the station, and exits the station again. No train should enter this section without stopping at the station.
2016-08-22 03_51_33-ArtRage - Unbenannt.png
Cul-de-Sac-Station as unwanted turning point
2016-08-22 03_51_33-ArtRage - Unbenannt.png (348.2 KiB) Viewed 5454 times
ssilk wrote:But that is no drive through: He stops and turns around! :) The point of drive through is, that the train drives through it, without loosing speed. :)
No, the train stopping there isn't a drive through. But many trains that want to turn around use it as drive through, while they should use the intended turning point (at the left). I'd like to add a penalty here to prevent drive throughs, but without slowing the stopping trains down, thus i don't think using only "slowdown signals" as signals that can add points to the pathfinder without seperate "penalty signals" (or an "add penalty, no slowdown" functionality in one combined signal) is a complete solution to the problem of finding undesired paths:
ssilk wrote:Well, I think for such cases you should be able to build "slowdown signals". They could be the same signals in viewtopic.php?f=80&t=21899 - the signals that add points to the pathfinder.

fregate84
Fast Inserter
Fast Inserter
Posts: 233
Joined: Sun Jun 22, 2014 10:56 am
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by fregate84 » Fri Dec 23, 2016 11:08 am

I try to "up" that. Especially :

2. Add signals (or other entity) that adds a penalty to the train pathfinder, so that the pathfinder avoids to take that path.

ratchetfreak wrote:
The goal is to avoid trains from entering stations and passing through when they don't need to. There is currently no way to do sow without designing your network from the ground up to prevent that.
The extra penalty signal should just add a cost to the path that travels through it just like a train on the rails currently does. So if there isn't an alt path the train can pass the signal.
A have lots of train who go to station, and get stuck for 2-3 mins at the station, because pathfinder choose that it's better than wait 10 sec ... If we can have a signals who ask that the block is usable only if no other choose is available, it would be good.

mrvn
Smart Inserter
Smart Inserter
Posts: 3261
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by mrvn » Sun Dec 25, 2016 8:17 pm

fregate84 wrote:I try to "up" that. Especially :

2. Add signals (or other entity) that adds a penalty to the train pathfinder, so that the pathfinder avoids to take that path.

ratchetfreak wrote:
The goal is to avoid trains from entering stations and passing through when they don't need to. There is currently no way to do sow without designing your network from the ground up to prevent that.
The extra penalty signal should just add a cost to the path that travels through it just like a train on the rails currently does. So if there isn't an alt path the train can pass the signal.
A have lots of train who go to station, and get stuck for 2-3 mins at the station, because pathfinder choose that it's better than wait 10 sec ... If we can have a signals who ask that the block is usable only if no other choose is available, it would be good.
I have a side station with a single waiting bay for delivering coal for the refinery complex and for some reason the train with the crude oil barrels has chosen to drive through the station. Now the crude oil barrels are stuck in the waiting bay waiting for the coal train to finish unloading and clear the station. But since the refinery is out of crude oil no plastic is made and no coal is used up. So the coal unloading never happens. It's all deadlocked.

Maybe we need a third kind of signal that is only green for trains with the next station(s) after the signal as destination.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2071
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by Optera » Sun Dec 25, 2016 8:35 pm

Having pure OTTD style waypoints might be one way to do it, but i prefer merging points 2 and 3: a signal that adds configurable penalty through circuit network.
It could be as simple as having the current block signal accept a signal as penalty input similar to how you can set a signal for logistic network bot statistics at roboports.
As for pure circuit controlled path blocking. I don't see how you could prevent trains from pathing through a station without signals being able to read train schedules.

User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1331
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by MeduSalem » Sun Dec 25, 2016 8:41 pm

In my opinion the pathfinder itself should be adjusted.

Like so that each block has a cost that rises the more often trains pass through it and the longer they are staying in that block (like a Time-spent/Block-length ratio or something). At some point the train will look for an alternative route to avoid costly blocks and only go through a block if there is no other route that has blocks that are less costly.

Pretty much like a congestion simulation. It would work on a coarse-grained level that distributes the load over the entire network over time. It would try to balance itself out.

The signals would work on-top of that in a just-in-time manner for the situation when two or more trains still decide to take the same path or try to use two crossing paths.



So what would happen is that most drive-through stations would be avoided automatically since trains stop there to load/unload adding up to the time-spent ratio.

Heavy load crossings would also be avoided because more trains using a crossing would also mean that the time-spent ratio goes up.

fregate84
Fast Inserter
Fast Inserter
Posts: 233
Joined: Sun Jun 22, 2014 10:56 am
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by fregate84 » Wed Jan 18, 2017 10:11 pm

I found a way to add a (big) penalty to a path : viewtopic.php?f=194&t=40067

phi1010
Inserter
Inserter
Posts: 45
Joined: Sat Aug 20, 2016 3:31 pm
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by phi1010 » Sun Mar 05, 2017 5:38 pm

fregate84 wrote:I found a way to add a (big) penalty to a path : viewtopic.php?f=194&t=40067
For me, it does not work depending on a the count of green signals on both paths (don't ask me why, I don't understand it. More green signals on both routes seem to make the path recalculation more probable change the path) and fails as soon as one single train is on the correct route, causing a red signal and a "train blocks the path"-penalty to appear there.

Thus, red signals alone don't seem to work reliably enough to trick a train into taking an extra round (a waiting circle before entering a station, just making the path longer than necessary to let other trains pass) -- here a configuratble penalty signal with an infinite penalty (equals "no rail at all") would come really handy to make trains take the "wrong" turn on purpose, if it could enforce a path recalculation (not only when the train stops, since we can't check whether a train has actually stopped at a closed signal).

fregate84
Fast Inserter
Fast Inserter
Posts: 233
Joined: Sun Jun 22, 2014 10:56 am
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by fregate84 » Sun Mar 05, 2017 9:17 pm

Agree. A simple way could be a check box on train stop who only allow train who stop to the signal.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 10461
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by ssilk » Mon Mar 06, 2017 6:20 pm

Now playing again 100+ hours with trains.

What I found is this:
- The current pathfinder tries to keep the train going.
This is useful, cause in many cases, even if one train is going a longer way it is for the network as whole much better to keep the transport fluid. A stopped train takes time to be stopped and accelerate. In that time the running train is half through the longer path.
- Even if we have a paththru station: That would not guarantee, that the train will run before or after that passthru exactly the shortest path. You cannot guarantee that and for a game in that size/dimensions of Factorio it doesn't make sense to force that, cause the pathfinder is in 70-90% much smarter than the player (for the mass of transports): See above!
- The current pathfinder already tries to avoid train stops. But not enough. I think this will be increased a lot in 0.15.


And from that follow these ideas:

- The faster a train is, the more unlikely it should be to take a path, that makes him stop now.

- What's missing here is more transparency, why a train now takes this path instead of that. The player should see (eventually a debug-view) somehow, what are the pathes that has been checked and why this one is currently the best. Could be primitive and complicated feature yet, and then we will see, if this is really useful.

- I thinks to a more clever scheduling when the train can choose between different stops: Trains should have an ETA time (A super simple distance/speed calculation). And train stops should store an average stop-time. With that numbers (and some more already generated) a train can occupy an estimated time-window at a train stop and compare that with other train stops (of the same name). And then choose that one, which occupies the least time (with the biggest open time-window). This would allow really clever train-routing without doing anything.

- It's a good question, if Factorio should make the train logistic too simple for the player (by adding more clever automation). But I think this looks simple when you are playing in a small Factory. But when you try to make the factory bigger it becomes soon quite annoying, cause it is more and more like micromanagement and you wish more and more, that it just works.

- So it is eventually also an idea to be able to force a recalculation by train-signal. For example: an "T" (for Trigger) into a train-signal triggers the next train to recalculate the path and the signal sends as confirmation (when a train has received that) the "K"-signal (for OK). Which doesn't mean that the train changes it's path, but it recalculates it. If some next signals are red then or if there is a train of a train stop, it is perhaps now the better way to go around. And vice versa. But it doesn't force the train to go that way, cause in general the pathfinder is much better than any player, cause he is so much faster. So if a train still insists on going that way, well, then it is so. The main thing is, that the train does it's job.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

fregate84
Fast Inserter
Fast Inserter
Posts: 233
Joined: Sun Jun 22, 2014 10:56 am
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by fregate84 » Tue Mar 07, 2017 9:59 am

agree ssilk, but for me, you forgot the main problem. Train can choose any "shortest path", even a "waiting way" to a station, who will block all other train.
So I think we need something to ask pathfinder not to use this way if any other way is available.

let me illustrate my point of view :
When my iron plate train (green line) stop to unload, the waiting way are block. Because I do not use lot of plate, train can take 10 min to unload.
Sometime, a other train choose the "waiting way" as best path (because of congestion). like the red line. This thing create lot of problem and congestion on my entire base, and finish to block all my train.
ScreenShot001.jpg
ScreenShot001.jpg (251.5 KiB) Viewed 4749 times
ScreenShot002.jpg
ScreenShot002.jpg (72.96 KiB) Viewed 4749 times

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2071
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by Optera » Tue Mar 07, 2017 12:18 pm

The easiest way to allow players flagging certain paths as reserved would be the ability to add a path penalty to signals via circuit network.

mrvn
Smart Inserter
Smart Inserter
Posts: 3261
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Control Train Pathfinder (Passthru stations, Add Penalty)

Post by mrvn » Tue Mar 07, 2017 3:22 pm

fregate84 wrote:
ScreenShot001.jpg
Unless there are more signals off screen your train station has less signals than the pass through. Even with an extra signal off screen they would be equal. The train station itself must cost in the path finder or trains would always go that way.

I imagine what happened was that the red train picked a path at a time when no train was stopped at the train station but a train was on the pass through. Going by the station therefore was the only way without stop. And since the train isn't hitting any red signals before the branch it doesn't recompute.

I think you can do 2 things here to make this happen less often with your current design:
1) less signals on the pass through / more on the stop.
2) turn the last signal before the stop red if all the signals in the waiting bay are green.

There is also a simple thing you can do to prevent excessive waits if it odes happen: Add a condition to the green train to leave the station if there is a train waiting behind it. Maybe combine that with "and 30s passed" or use combinators to send a signal if a train has waited there for 1 minute..

You could also change your design and make the exit of your train stop before the entry. You branch off the main line, make a half turn, have your waiting bay and then your station going backwards and then another half turn to join the main line again. Or branch off with a quarter turn, waiting bay, half turn, station, quarter turn and join. The drawback there is that a half turn takes more space than a simple parallel line. But with the exit of the station before the entry no train will ever pick that route by accident because not picking it will always be cheaper no matter what. I used this "_O_" design in a few places and put the whole factory for that stop into the O with great success.

Post Reply

Return to “Frequently Suggested / Link Collections”

Who is online

Users browsing this forum: No registered users