Game version: 0.10.6
Problem:
Overproduction caused by logistics network / logistics / construction robots choosing to pickup from production provider chests, rather than picking up from storage chests.
Scenario:
I've got an assembling machine producing fast inserters, which are dropped in a passive provider chest for my robots to pickup and keep my toolbelt filled to a certain amount as well as for construction.
At times I use an active provider chest to clean up my inventory, by dumping everything in it. Robots pick up the items and drop them in storage chests.
Next time I need my toolbelt restocked, the robots go straight to the passive provider chest by the assembling machine to get more fast inserters, rather than going the shorter distance to the storage chest that already holds some fast inserters.
Parts of this scenario also involved constructing using blueprints and deconstructing things, forcing the Construction Robots to drop everything they deconstructed into storage chests.
Result:
I now have some 1.3k fast inserters sitting in a storage chest.
The analysis:
Or the TL;DR; if you so please - skip further down to solution suggestion, if you don't care about the analysis.
It took a while for me to discover this particular problem, so once I discovered it I decided to do a proper analysis of this. I've been play testing this scenario and possible work-arounds for quite some time now. This is not just another one of those "oh I only got to <this> an hour ago". I've put in days of play testing on this particular setup, just to make sure I've got the problem figured out right.
As described above the robots choose to go to my production line passive provider chests to pick up the fast inserters, which holds true for the most part. At random they do choose to go the shorter distance to fetch the fast inserters from the storage chest, but I beleive that has more to do with lack of power for the bot, than an actual choice of going to the storage chest rather than the provider chest.
I have an area set up for stuff storage, where I also have that active provider chest I can drop my inventory contents into and let my factory and robots do the sorting and storing. At first I only had a bunch of storage chests there, but at some point I discovered that the robots hardly ever went to the storage chest with the fast inserters, but rather choose to fly the long distance to the passive provider chest at the other end of my factory. That told me that the current code design of the logistics network chests has a higher priority on the provider chests than on the storage chests. The work-around I came up with is to have a double line of chests; storage chests on one side of a belt for the robots to drop off into and passive provider chests on the other side of the belt. I've setup smart inserters to filter things dropped in the storage chests so only certain items go into the passive provider chests I've got setup in a circle. "This should solve that problem!" was my initial thought. I soon realized that it didnt solve the problem at all.
Logistics (and Construction) robots go by place-order. Their first priority when picking up items, appears to always be passive provider chests first and which ever passive provider chest was placed first, will be the one chosen. If none of the passive provider chests holds the item needed, they will then search through the storage chest again in place-order. On a few of my production output passive provider chests, I've removed them and replaced them with new ones just to test if this really holds true and it seems that it does. For certain items in my storage circle they now choose the passive provider chest at the circle, rather than the one by the assembling machine. The only real work-around to this particular problem, would be to place storage chests as output chests on the production line, but that would contaminate those output chests when ever Construction Robots are ordered to deconstruct something. Yes, I have test this too, however it does work slightly better.
I'm guessing that the robot choices are done by looping through some sort of array that holds a list of the different logistics network chests and which ever chest comes up first with the items needed, will be the destination of the robot in question. Their behaviour seems to indicate that this is the case. Usually if I deconstruct something (robots drop off in the nearest storage chest or a storage chest that already holds "that" item) and then immediately after order construction of something by placing down a blueprint, the robots will pick up from the same chests they have just dropped stuff into. After a while though this "short term memory" array gets cleared (probably some form of garbage collection?) but on more than one occation they have still chosen to go to my production line (which is far away), rather than picking up from the storage chest only 10 tiles away where they minutes before dropped the same materials off.
Solution suggestion:
Swap the priority of the storage chests with the provider chests, setting the storage chests the first to be searched, then the provider chests. This would effectively force the robots to pick stuff up that they had previously stored in storage chests, rather than forcing production of new items by grabbing them from the production line.
At some point each robot has to calculate it's line of flight to the destination chest. Rather than checking the place-order of chests (provider / requester / storage) it would make more sense to have the robots go to the chest with the shortest distance, once the chest has been chosen (still holding the same chest type priority: storage first, provider second).
For robot pick ups (either to replenish the player's inventory or for construction):
- First priority: Storage Chest
Second priority: Provider Chest
Pick the chest with the shortest distance
Possibly add a filter option (or research upgrade?) to storage chests