old LTN discussion thread

Adds new train stops forming a highly configurable logistic network.

Moderator: Optera

yrome
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Nov 25, 2016 1:37 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.4.6

Post by yrome »

Hey,

Just wanted to say, that this is a great mod, I have been thoroughly enjoying it, and it's definitively something I've been waiting a long time for.

That said, there are still a few minor issues with it. Specifically, I'm talking about least effort, which is something others have touched on. I appreciate the idea behind best effort, but, as others have mentioned, what ends up happening is you get consecutive orders for deliveries of minute quantities of items. Every train that doesn't have something better to do gets roped in, and even some trains that do have better things to do. On top of that, they end up clogging your rail infrastructure, because you've now got 10 trains which are waiting to each pick up 50 iron plates. One train would've sufficed, but instead there are 10, plus the other 10 that came before, and those that will come after. To an extent it is possible to get around this, by using a decider combinator that only outputs once there is a certain amount of items stored in the output station chests, but even this isn't perfect. In the time it takes a train to get there and take the items, the system will have time to call other trains to pick up marginal amounts of items.

You are doubtlessly aware of all this, so I'm not going to post all this without offering a solution. Perhaps you can think of a better solution, perhaps there's some reason why my solution won't work, but since I haven't seen it mentioned, here it is.

When using least effort, have a minimum time between deliveries for each item/resource. This could be a config-able option, with a default of say, 5 minutes. Essentially once the system sends out a delivery using least effort, it will create a 'timer' for that resource, and won't create a delivery for that resource based on least effort until the timer has expired (5 minutes in my example). This will give time for the output station(s) to buffer up a sizeable amount of items - possibly enough for least effort to not have to be used, and should overall be more efficient in train usage. Better to have one half full train than 50 1/100th full trains.

Like I said, perhaps this isn't feasible or you have another solution in mind. You would be right to say that I could turn least effort off. But, I like the idea behind least effort, and would like to see it improved. You might also say that if your inputs match your outputs, none of this should be a problem. I would counter that, this is an unsound argument. To expect to always have inputs matching your outputs is a flawed expectation in a game like factorio where you are constantly trying to expand, and where trying to increase your red circuit output (for example - this happened to me) might mean having to increase several different production chains, which can take a lot of time. Time during which your trains are now running amock, delivering 20 red circuits at a time.

Still, love the mod, great work, I appreciate what you've done. :)
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.4.6

Post by Optera »

least effort, i use that mode in daily life :lol:

Jokes aside, I know best effort is far from where it should be. A few posts ago round robin came up as possible solution. I'm still working it.
The_Sane
Inserter
Inserter
Posts: 29
Joined: Tue Jun 09, 2015 7:38 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.4.6

Post by The_Sane »

I really like the idea of this mod but on a tiny test setup I've come across a few issues.

The more serious issue I found is that it doesn't appear the provider stations care about a 'Maximum Train Length' signal, which can easily break a system unless all of your trains are the same length. Especially for double headed trains with dead end stations. If a provider station only has the capacity to load one carriage but 2 arrive then its probably blocking another rail line and / or hasn't come far enough into the station to have a path out again and gets stuck. The other issue is solvable with a decider combinator but just like train length it would be nice if the provider stations used the 'Minimum Delivery Size' variable so trains don't get assigned a pickup job of 50 items in an attempt to fill a 5k request.

I haven't used it yet but judging by the name I'm guessing 'Provider Priority' only applies to providers... Have you thought about implementing requester priority?

Other than that I love it. I'll just have to build a system around these limitations for now, but once you have things ironed out a little in the future I'd quite like to see a train being able to plan a route involving multiple pickups in order to fill a request.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.4.6

Post by Optera »

The_Sane wrote:I really like the idea of this mod but on a tiny test setup I've come across a few issues.

The more serious issue I found is that it doesn't appear the provider stations care about a 'Maximum Train Length' signal, which can easily break a system unless all of your trains are the same length. Especially for double headed trains with dead end stations. If a provider station only has the capacity to load one carriage but 2 arrive then its probably blocking another rail line and / or hasn't come far enough into the station to have a path out again and gets stuck.
max Train Length works on Provider and Requester in any combination for me.
The other issue is solvable with a decider combinator but just like train length it would be nice if the provider stations used the 'Minimum Delivery Size' variable so trains don't get assigned a pickup job of 50 items in an attempt to fill a 5k request.
Set Use_Best_effort to false in config.
I haven't used it yet but judging by the name I'm guessing 'Provider Priority' only applies to providers... Have you thought about implementing requester priority?
Yes, Provider Priority mimics active provider chest in Logistic Network with much more granularity.
LTN's goal is to evenly distribute provided items. Requester Priority would break the current and planned logic for round robin.
Other than that I love it. I'll just have to build a system around these limitations for now, but once you have things ironed out a little in the future I'd quite like to see a train being able to plan a route involving multiple pickups in order to fill a request.
Multi stop routes are not planned. They offer little value for exponential increase in complexity.
The_Sane
Inserter
Inserter
Posts: 29
Joined: Tue Jun 09, 2015 7:38 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.4.6

Post by The_Sane »

Optera wrote:max Train Length works on Provider and Requester in any combination for me.
It works now... Earlier I tried several times in case I was doing something wrong, deleting the station and starting again in case I messed up the wiring, and I could get it to work on the requester fine. Combinator hooked up to the lamp with max length defined. Requester has a max length of 4, and provider a max length of 3 but if I put a 4 length train down it still sent it. I have no idea what changed since then, but I'm happy.
Optera wrote:Set Use_Best_effort to false in config.
Oh, I missed that. Thanks.
Optera wrote:Multi stop routes are not planned. They offer little value for exponential increase in complexity.
Fair enough.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.5.0

Post by Optera »

Hi, I finally finished combining the last 2 pages of feedback into version 0.5.0
  • provided items are split evenly among requesters with Best Effort enabled
  • added round robin handling, sending a train moves the request to the bottom of order list
Hopefully this will make Best Effort more useful and get rid of congestions.
nosferato
Inserter
Inserter
Posts: 27
Joined: Sat Aug 02, 2014 11:11 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.5.0

Post by nosferato »

Optera wrote:Hi, I finally finished combining the last 2 pages of feedback into version 0.5.0
  • provided items are split evenly among requesters with Best Effort enabled
  • added round robin handling, sending a train moves the request to the bottom of order list
Hopefully this will make Best Effort more useful and get rid of congestions.
Thank you for your endeavours, adding the "leave on inactivity" has thrown some issues, no longer am i aware of there being a problem, apart from trains arriving in the depot full of ore, and may be sent to a depot they shouldn't be.
this is why i asked if was possible to add a signal instead, then it can highlight the issue by a train being sat in the offending station and the player can figure out a work around, otherwise i am liking your latest update.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.5.0

Post by Optera »

nosferato wrote: Thank you for your endeavours, adding the "leave on inactivity" has thrown some issues, no longer am i aware of there being a problem, apart from trains arriving in the depot full of ore, and may be sent to a depot they shouldn't be.
this is why i asked if was possible to add a signal instead, then it can highlight the issue by a train being sat in the offending station and the player can figure out a work around, otherwise i am liking your latest update.
Unless you use a mod to raise alerts on circuit conditions, having a signal for "stuck" trains seems pointless.
You can see train arrival/departures messages if you set log level to 3. It can be a bit spammy but helps finding problems a lot faster than a signal.

Trains will go to the same depot regardless if they are forced out by inactivity or un-loaded normally. They will always go to the "nearest" (passing the least amount of signals) free stop named "Depot.
nosferato
Inserter
Inserter
Posts: 27
Joined: Sat Aug 02, 2014 11:11 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.5.0

Post by nosferato »

Optera wrote:
nosferato wrote: Thank you for your endeavours, adding the "leave on inactivity" has thrown some issues, no longer am i aware of there being a problem, apart from trains arriving in the depot full of ore, and may be sent to a depot they shouldn't be.
this is why i asked if was possible to add a signal instead, then it can highlight the issue by a train being sat in the offending station and the player can figure out a work around, otherwise i am liking your latest update.
Unless you use a mod to raise alerts on circuit conditions, having a signal for "stuck" trains seems pointless.
You can see train arrival/departures messages if you set log level to 3. It can be a bit spammy but helps finding problems a lot faster than a signal.

Trains will go to the same depot regardless if they are forced out by inactivity or un-loaded normally. They will always go to the "nearest" (passing the least amount of signals) free stop named "Depot.
You have my apologies, I guess it would be better just staying and blocking the station, then it'll highlight a problem, i guess there is no real fix for that problem except better rail design
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.5.0

Post by Optera »

nosferato wrote: You have my apologies, I guess it would be better just staying and blocking the station, then it'll highlight a problem, i guess there is no real fix for that problem except better rail design
Blocking a station until player intervention just to highlight a possible problem feels like a bad design choice.
If players don't fix it in time the delivery will time out, another train is sent to that station, that delivery will also time out, and so on until all trains wait at that bugged station.

Having trains move on if a station is bugged makes detecting bugged stations a bit harder, but in general is more tolerant to player errors.
nosferato
Inserter
Inserter
Posts: 27
Joined: Sat Aug 02, 2014 11:11 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.5.0

Post by nosferato »

Optera wrote: Blocking a station until player intervention just to highlight a possible problem feels like a bad design choice.
If players don't fix it in time the delivery will time out, another train is sent to that station, that delivery will also time out, and so on until all trains wait at that bugged station.

Having trains move on if a station is bugged makes detecting bugged stations a bit harder, but in general is more tolerant to player errors.
It's a hard decision, right now i am not sure, i will play with it more and figure out what i would prefer. more input would be better, as everyone's play style is different
User avatar
JackTheHat
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sat Mar 02, 2013 5:55 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.5.0

Post by JackTheHat »

It seems like there is a need for minimum train size at the stations/depots?

Right now if I set a depot up to fuel and unload excess for a 8 wagon train, which wont work for a 3 wagon train the 3 wagon trains will still use that depot. Also my smaller trains will attempt the to get the big deliveries that I only want to use the bigger trains for.

Does this make sense?
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.5.0

Post by ssilk »

Stupid question:
I know some of the code. And a lot of code is just handling the train sizes, liquid trains etc.
I think, that could be simplified a lot if the whole pseudointelligence is removed from code and instead put into enabling different "train networks".

Let's say we need 3 networks, one for supply, one for liquids and one for really long trains.

So we would need (minimum) 3 train-stops: Depot, Depot #2 and Depot #3.
The same goes with any other logistic train stop: an added "#2" or "#3" means: this belongs to logistic network 2 or 3 and only trains from Depot 2 or 3 will be ordered.

Forget about wrong trains at stops, forget about complicated refueling, forget about setting constants to limit the length of train....

PS: possible improvement is that instead of adding a number you could add also a name after the #. "Depot #Fuel" would then be also a valid name for a logistic network.
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
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.5.0

Post by Optera »

JackTheHat wrote:It seems like there is a need for minimum train size at the stations/depots?

Right now if I set a depot up to fuel and unload excess for a 8 wagon train, which wont work for a 3 wagon train the 3 wagon trains will still use that depot. Also my smaller trains will attempt the to get the big deliveries that I only want to use the bigger trains for.

Does this make sense?
To clarify, you want a way to set up depots for certain train lengths for easier refueling?
Making Depots accept names like "Depot #L-CCC" would be simple enough. What bothers me about this solution is how it's forcing players to use certain names instead of sending a signal to depots. For this same reason setting train length for stations is done with a signal instead of a tag in the station name.

I know the logic needed to calculate where inserters need to work to refuel a random train from the Logistic Train Stop's train composition signals is very complex.
The only alternative way of outputting train composition that comes to my mind would be to use binary encoded signals, but apart from myself and a few developers no one would be able to utilize such an encoding. Also it'd only work up to 31 carriages
L-CCC: Loco = b1 = 1, Wagon = b1110 = 14
2L-6C-2L: Loco = b11 0000 0011 = 771, Wagon = b00 1111 1100 = 252

demo of binary encoding according to this thread viewtopic.php?f=8&t=20118
binary encoding
binary encoding
2016-12-19-18-54-52-8276022.jpg (126.12 KiB) Viewed 8275 times
Please let me know if you have an idea how to output train composition in a way that allows for a simplistic refuel, un-/loading logic.

I'm using my Inventory Sensor in my test scenario with multiple train sizes. The most simplistic version would switch the fuel inserter on when it detects a locomotive. I've added a check so it wont load fuel above 140 coal so the inserter wont hold coal in its hand.


ssilk wrote:Stupid question:
I know some of the code. And a lot of code is just handling the train sizes, liquid trains etc.
I think, that could be simplified a lot if the whole pseudointelligence is removed from code and instead put into enabling different "train networks".

Let's say we need 3 networks, one for supply, one for liquids and one for really long trains.

So we would need (minimum) 3 train-stops: Depot, Depot #2 and Depot #3.
The same goes with any other logistic train stop: an added "#2" or "#3" means: this belongs to logistic network 2 or 3 and only trains from Depot 2 or 3 will be ordered.

Forget about wrong trains at stops, forget about complicated refueling, forget about setting constants to limit the length of train....

PS: possible improvement is that instead of adding a number you could add also a name after the #. "Depot #Fuel" would then be also a valid name for a logistic network.
No idea how you count "a lot".
From the ~1100 lines liquids need maybe 20 lines of code if you don't count type=="fluid" and RailTanker installed checks. Train length has even less lines.

Most of the code is either keeping track of active deliveries and item counts per station or creation of new orders (finding provider stations and suitable trains, sort and merge deliveries,...)

I will not implement multiple networks. Here's why:
  • no time for excessive rewriting of such a big mod
  • in general I see little gain for huge increase in update time and code complexity
  • If I did simple separated networks the next request probably will be to have stations in multiple networks driving complexity through the roof
Last edited by Optera on Mon Dec 19, 2016 7:34 pm, edited 2 times in total.
User avatar
JackTheHat
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sat Mar 02, 2013 5:55 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.5.0

Post by JackTheHat »

Optera wrote:
JackTheHat wrote:snip
To clarify, you want a way to set up depots for certain train lengths for easier refueling?
Making Depots accept names like "Depot #L-CCC" would be simple enough. What bothers me about this solution is how it's forcing players to use certain names instead of sending a signal to depots. For this same reason setting train length for stations is done with a signal instead of a tag in the station name.
Is it possible to have a signal for minimum train length in the same you way have a signal for maximum train length? Forgive my ignorance I don't a much about modding in Factorio just sharing a thought I had.

The mod is working great otherwise. On a side not I did have trouble trying to setup a delivery system for small quantities of logistic items for outposts, repair packs, replacement items etc. Attempting to override the default minimum delivery size to a lower number generated a lot of deliveries I can see why you set it to 1000. I settled for just delivering more than a needed.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.5.0

Post by Optera »

JackTheHat wrote: Is it possible to have a signal for minimum train length in the same you way have a signal for maximum train length? Forgive my ignorance I don't a much about modding in Factorio just sharing a thought I had.

The mod is working great otherwise. On a side not I did have trouble trying to setup a delivery system for small quantities of logistic items for outposts, repair packs, replacement items etc. Attempting to override the default minimum delivery size to a lower number generated a lot of deliveries I can see why you set it to 1000. I settled for just delivering more than a needed.
For normal stations i don't really see a point as it's implicitly done through minimum Delivery Size anyways.
For depots they would need unique names for each train length regardless, as I can't order trains to go to a certain stop id, only to a non unique name. Hance my focus on making train composition signals more useful to enable creation of one station able to service any train.

Sounds like you changed min_delivery_size in the config, that's global. You can override min_delivery_size for a signle station by sending the Minimum Delivery signal.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.5.0

Post by ssilk »

Optera wrote:No idea how you count "a lot".
A lot is more than a bit. :ugeek: ;)
From the ~1100 lines liquids need maybe 20 lines of code if you don't count type=="fluid" and RailTanker installed checks. Train length has even less lines.
Well, I don't count code lines.
With such a change the player is now responsible to make networks of trains, that are equally equipped. And an equal equipped network means, that you don't need to care so much: Next free train gets next order. See logistic robots. I'm not sure, but some code in the order-processor and dispatcher is then not longer needed, cause the optimization is done by the player just by assigning useful number of trains to useful fitting network-tasks.
Most of the code is either keeping track of active deliveries and item counts per station or creation of new orders (finding provider stations and suitable trains, sort and merge deliveries,...)
IMHO the player has then much more possibiliies to optimize stuff. And for the mod itself a careless scheduling; less CPU, you don't need to care about train size, no sorting for the best train, different algorithms... Removes lot's of code, but - of course - introduces also some code, but in most cases only another "level" (sub-table) of networks. :)
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
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.5.0

Post by Optera »

ssilk wrote: With such a change the player is now responsible to make networks of trains, that are equally equipped. And an equal equipped network means, that you don't need to care so much: Next free train gets next order. See logistic robots. I'm not sure, but some code in the order-processor and dispatcher is then not longer needed, cause the optimization is done by the player just by assigning useful number of trains to useful fitting network-tasks.
It locks trains into certain networks, making balancing the number of trains a lot harder.
Most of the code is either keeping track of active deliveries and item counts per station or creation of new orders (finding provider stations and suitable trains, sort and merge deliveries,...)
IMHO the player has then much more possibiliies to optimize stuff. And for the mod itself a careless scheduling; less CPU, you don't need to care about train size, no sorting for the best train, different algorithms... Removes lot's of code, but - of course - introduces also some code, but in most cases only another "level" (sub-table) of networks. :)
I don't see how it'd make any code obsolete.
Handling Orders in round robin has become the solution to a lot of problems with earlier, simpler builds. Removing it would once again make trains rush to a single order until it's fulfilled, clogging stations in the process, before proceeding to the next.
If I remove handling of different train sizes and cargo type, how should it react if players send different trains into one network?
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.5.0

Post by ssilk »

Optera wrote:It locks trains into certain networks, making balancing the number of trains a lot harder.
Depends on standpoint and taste.

Simple example of what I think is more near to reality:
The station "My sister" orders a book.
And the order is sent to the "Amazon Logistic network". And after short while, the "Amazon Central Europe" station will bring the order with a very small, one L-C-L train.
But "Amazon Central Europe" needs to deliver thousands books per day. So, when books go out, it sends a request to the "Book-Factory Network" to send more books.
That are delivered in a much bigger train, LL-CCCC-LL

[With "more near to reality" I mean in that case, that if you introduce logistics, you need also to think about some kind of "storage", which is able to handle large incomming trains and many small (and vice versa...). And such things. I mean: think to an express company, they bring things from a customer to a storage (and another storage) and then to the customer (in most cases) and not directly from a customer to a customer. Which makes much sense with growing distances. Which we have in Factorio.]

It makes no sense to mix both networks, cause it makes balancing of trains easier, cause the number of possibilities you need to care as a player is much, much lower. And that increases the number of possibilities for the player.
If I remove handling of different train sizes and cargo type, how should it react if players send different trains into one network?
Simply: Not. :) It's the players task to make that work. It's not more work for the player, cause the setup is a lot easier.
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
JackTheHat
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sat Mar 02, 2013 5:55 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.5.0

Post by JackTheHat »

Optera wrote:
JackTheHat wrote: snip
For normal stations i don't really see a point as it's implicitly done through minimum Delivery Size anyways.
For depots they would need unique names for each train length regardless, as I can't order trains to go to a certain stop id, only to a non unique name. Hance my focus on making train composition signals more useful to enable creation of one station able to service any train.

Sounds like you changed min_delivery_size in the config, that's global. You can override min_delivery_size for a signle station by sending the Minimum Delivery signal.
Ah, I understand why it is the way it is now. Thanks for explaining. I guess my task is designing a depot that can handle all sizes of train. This mod is literally what I have been wanting for a long time as I always liked the idea of having a pool of trains that go where they needed rather than trains specific to each resource type. :D
Locked

Return to “Logistic Train Network”