Belt math, using lower tier belts to effect.

Circuit-free solutions of basic factory-design to achieve optimal item-throughput.
Involving: Belts (balancers, crossings), Inserters, Chests, Furnaces, Assembling Devices ...
Optimized production chains. Compact design.
Please provide blueprints!
Forum rules
Circuit-free solutions of basic factory-design to achieve optimal item-throughput
Trebor
Filter Inserter
Filter Inserter
Posts: 293
Joined: Sun Apr 30, 2017 1:39 pm
Contact:

Re: Belt math, using lower tier belts to effect.

Post by Trebor »

Impatient wrote: Sat Aug 24, 2019 4:20 am I took "pen and paper" (GIMP and a screenshot) and did the math on your last example. If the input belts are full, it does not balance correctly. It backlogs at the splitter marked in red.


balancer.noloop.1.backlogging.jpg


If you were to replace the red belts/splitter on the right side with blue, it still would not balance evenly.
Is just this design flawed or is this a fundamental flaw in the noloop balancing concept?
I've updated some of the prior pics to have a proper 4 belt balancer. That said it doesn't really effect the throughput. With your math your are starting at the source and working out perfect splits, until the input to a splitter is more than the output will allow because the output is limited by the red belts. And you are correct it will backlog at that point. But the backlog then changes the split on the center splitter from 33.75/33.75 to 30/37.5. This causes the next splitter to have inputs of 37.5/37.5 and an output of 30/45.

Here is a corrected balancer using slightly different math. Note that at no point does it go below 9 yellow belts thou occasionally it does go above. Those points where the number of yellow belts is larger than 9 it allows any backlog to slip through. Splitters are labeled by their throughput when less then two blue belts are connected to both input and output.
Screen Shot 2019-08-24 at 1.44.34 AM.png
Screen Shot 2019-08-24 at 1.44.34 AM.png (2.35 MiB) Viewed 5911 times
The broken one posted before has the same math except the first column labeled 12Y (3Y6Y3Y) would be 12Y (3Y3Y3Y3Y).
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 883
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: Belt math, using lower tier belts to effect.

Post by Impatient »

Testing your design with a proper 4-4 still does not make it work. If the input belts are not full, it does not balance. Thus it is not a proper balancer. Thinking about it, my conclusions are these:

(1. The splitting from 2blue to 3red on the left side can be ommited completely. Feeding 3red+1blue or 3blue into a proper 4-4 gives the exact same output from the 4-4.)

2. But in any case, on the output side of a proper 4-4 in the middle of your example, you are facing a 4-3 problem. So you are transforming the 3-3 problem, which has a solution with a loop, into a 4-3 problem, which has a solution, that also has a loop. So you don't get rid of the loop in this example. It just uses more space and more belts, no matter of what color.

Ok, so far for the example you have given.

Now some general thoughts on balancing. A brute force way implementation of 4-4 balancing could be, to split each of the 4 input belts into 4 belts (=16 belts), interweaving them and then joining them again in a manner, so that each output belt gets 1/4th of each input belt. But what a hughe intermingled mess that would be. Luckily for n-n problems where n is a power of 2, very compact solutions do exist. How is this possible? Looking at 4-4, 8-8 and 16-16 balancing solutions, their commonality is noticable. They mix the contents of their belts in steps and in groups. And each group has a size that is a power of 2. 2 belts are mixed, then this group of size 2 is mixed with another group of size 2, then this group of size 4 is mixed with another group of size 4, then this group of size 8 is mixed with ... etc ... . This the basic concept of balancing and there is no other in vanila Factorio that I know of, except for brute forcing. Why? Because the basic element for splitting, which is necessary for mxing the contents of belts, is Factorios 2-2 splitter. It is the only element that can be used for mixing and only has 2 input and 2 output sockets. Thus balancing can only work for numbers of belts which are powers of 2. If Factorios splitter would be 3-3, it would only work for powers of 3.

Questions and answers:

Q: What about all the other n-m balancers, where n, m or both are not a power of 2?
A: If they balance properly, then they were 4-4, 8-8, ... balancers once, got excess outputs looped back to the input, got cut down and got their elements rearranged to make them more compact.

Q: Does brute forcing an n-m problem work?
A: Yes, but only if the number of output belts is a power of 2, as contents of each input belt have to by divided evenly by the number of output belts. With Factorios 2-2 splitter and without loopbacks, that is only possible for powers of 2. But brute forcing is a hughe intermingelation, happily traded for loopbacks.

Q: What about using ratio splitting to tackle the problem?
A: Ratio splitting without loopbacks also only works with powers of 2. 0.5, 0.25, etc. are powers of 2. It is used in n-n (n=po2) balancers all over the place.

Q: What about using different belt colors for ratio splitting? Isn't it possible to split a blue belt into a red and a yellow one and then have 2/3rds and 1/3rd as output?
A: Splitting a blue belt into one red and one yellow is not proper ratio splitting. It only works if the blue belt is full and then it works because the items are backlogging at the exit to the yellow belt and are put on the red belt instead. The blue splitter always tries to put 50% of its inputs on each of its exits. If the input is 10 items/s the red and the yellow belt get 5 items/s equally.


Conclusion:

If my knowledge is correct and I did not make any mistakes in my thought process, my conclusion is: The concept to split to get powers of 2 and use n-n (n=po2) balancers to get rid of loopbacks is fundamentally flawed.

Edit: I don't mean this in any way negative. I want to drill down to the core of the concept presented here. :)
Last edited by Impatient on Sat Aug 24, 2019 7:59 am, edited 6 times in total.
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 883
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: Belt math, using lower tier belts to effect.

Post by Impatient »

Can you post BP-strings? It would be easier to test.
Trebor
Filter Inserter
Filter Inserter
Posts: 293
Joined: Sun Apr 30, 2017 1:39 pm
Contact:

Re: Belt math, using lower tier belts to effect.

Post by Trebor »

Impatient wrote: Sat Aug 24, 2019 7:23 am Can you post BP-strings? It would be easier to test.
3 belt using 4 not looped:
Screen Shot 2019-08-24 at 11.49.14 AM.png
Screen Shot 2019-08-24 at 11.49.14 AM.png (1.58 MiB) Viewed 5883 times


3 belt balancer using a proper 4 belt balancer with a loop with less then full input:
Screen Shot 2019-08-24 at 11.31.27 AM.png
Screen Shot 2019-08-24 at 11.31.27 AM.png (1 MiB) Viewed 5883 times


You also mentioned using a 4 balancer without a loop:
Screen Shot 2019-08-24 at 11.56.41 AM.png
Screen Shot 2019-08-24 at 11.56.41 AM.png (1.2 MiB) Viewed 5883 times
Screen Shot 2019-08-24 at 11.56.18 AM.png
Screen Shot 2019-08-24 at 11.56.18 AM.png (1.42 MiB) Viewed 5883 times
I'm not convinced it's any better then the looped version with full input:
Screen Shot 2019-08-24 at 12.09.12 PM.png
Screen Shot 2019-08-24 at 12.09.12 PM.png (1.4 MiB) Viewed 5883 times
3 belt balancer using 9 yellows:
Screen Shot 2019-08-24 at 11.37.11 AM.png
Screen Shot 2019-08-24 at 11.37.11 AM.png (2.48 MiB) Viewed 5883 times


As a bonus a 6 red belt balancer:
Screen Shot 2019-08-24 at 12.03.56 PM.png
Screen Shot 2019-08-24 at 12.03.56 PM.png (5.47 MiB) Viewed 5883 times


Note even the standard power of 2 balancers with loops don't always balance evenly when less then full input.

Also to note the output of a splitter can have multiple stable ratios:
Screen Shot 2019-08-24 at 12.13.19 PM.png
Screen Shot 2019-08-24 at 12.13.19 PM.png (531.48 KiB) Viewed 5883 times
Screen Shot 2019-08-24 at 12.15.56 PM.png
Screen Shot 2019-08-24 at 12.15.56 PM.png (459.96 KiB) Viewed 5883 times
Screen Shot 2019-08-24 at 12.17.48 PM.png
Screen Shot 2019-08-24 at 12.17.48 PM.png (505.95 KiB) Viewed 5883 times
(That last one was hard to trigger.)
User avatar
Oktokolo
Filter Inserter
Filter Inserter
Posts: 884
Joined: Wed Jul 12, 2017 5:45 pm
Contact:

Re: Belt math, using lower tier belts to effect.

Post by Oktokolo »

After testing some of the designs i am wondering, whether it is possible to make a non-circuit belt balancer that supplies non-blocking output belts evenly even if one or more output belts are backed up.
User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Belt math, using lower tier belts to effect.

Post by disentius »

You mean something like this?
viewtopic.php?f=202&t=74911#p452689
User avatar
Oktokolo
Filter Inserter
Filter Inserter
Posts: 884
Joined: Wed Jul 12, 2017 5:45 pm
Contact:

Re: Belt math, using lower tier belts to effect.

Post by Oktokolo »

disentius wrote: Sun Aug 25, 2019 7:49 am You mean something like this?
viewtopic.php?f=202&t=74911#p452689
That thread is all about lane balancers.
I am searching for a belt balancer wich keeps balancing insufficient input evenly to unblocked output belts while some of the output belts might be backed up.
Assume lanes of the input belts to already be balanced and consumption to be the same for each two lanes of each output belt.
The difference to belt balancers shown here would be that each nonblocked output belt gets the same share of items in case there isn't enough input even if some outputs are blocked (or not connected yet).
User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Belt math, using lower tier belts to effect.

Post by disentius »

Ok (BTW, lane balancer is just a special case of a belt balancer.)
I don't know enough about balancers to answer that:) let's see if a balancerwizard reacts.
mrvn
Smart Inserter
Smart Inserter
Posts: 5878
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Belt math, using lower tier belts to effect.

Post by mrvn »

Trebor wrote: Sat Aug 24, 2019 4:20 pm 3 belt balancer using 9 yellows:
Screen Shot 2019-08-24 at 11.37.11 AM.png
First:
You split each input belt into 3 yellow belts. Then merge all the top yellow belts to the top output belt. All the middle yellow belts to the middle output belt. All the bottom yellow belts to the bottom output belt.

I think you can optimize that a bit if you for example combine the bottom yellow belt of the first input with the top yellow belt of the second input into a red belt. Same for the second+third input. That reduces 4 yellow belts down to 2 red belts right from the start meaning you need less spaghetti I think.

Secondly:
I think splitting a blue belt into a red and yellow belt and splitting the red again into 2 yellow only works if there are no gaps. Otherwise the first yellow belt gets up to 50% of the input. To balance properly with gaps you need to split the blue belt into 2 red and then 4 yellow and loop one yellow belt back.
Trebor
Filter Inserter
Filter Inserter
Posts: 293
Joined: Sun Apr 30, 2017 1:39 pm
Contact:

Re: Belt math, using lower tier belts to effect.

Post by Trebor »

mrvn wrote: Mon Aug 26, 2019 3:14 pm
Trebor wrote: Sat Aug 24, 2019 4:20 pm 3 belt balancer using 9 yellows:
Screen Shot 2019-08-24 at 11.37.11 AM.png
I think splitting a blue belt into a red and yellow belt and splitting the red again into 2 yellow only works if there are no gaps.
There is a pic with gaps earlier in the thread.
Trebor
Filter Inserter
Filter Inserter
Posts: 293
Joined: Sun Apr 30, 2017 1:39 pm
Contact:

Re: Belt math, using lower tier belts to effect.

Post by Trebor »

There are also pics of using 4 pure blue belt balancers with input gaps to balance 3 belts that are not arguably better.
Trebor
Filter Inserter
Filter Inserter
Posts: 293
Joined: Sun Apr 30, 2017 1:39 pm
Contact:

Re: Belt math, using lower tier belts to effect.

Post by Trebor »

Do you know what the implications of this are:
Screen Shot 2019-08-26 at 7.02.11 PM.png
Screen Shot 2019-08-26 at 7.02.11 PM.png (3.61 MiB) Viewed 5771 times
It means it's possible to have a standard 4 blue belt balancer that does this:
Screen Shot 2019-08-26 at 7.02.23 PM.png
Screen Shot 2019-08-26 at 7.02.23 PM.png (1.02 MiB) Viewed 5771 times

Factorio laughing at your math!

(Save include for your viewing pleasure.)
Attachments
Test2.zip
(2.56 MiB) Downloaded 135 times
mrvn
Smart Inserter
Smart Inserter
Posts: 5878
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Belt math, using lower tier belts to effect.

Post by mrvn »

It's a balancer, not a mixer. Using different items per input is just for show.

That said I really would like a consistent belt mixer.
Bauer
Filter Inserter
Filter Inserter
Posts: 349
Joined: Fri May 05, 2017 12:48 pm
Contact:

Re: Belt math, using lower tier belts to effect.

Post by Bauer »

"mixer" implies some degree of randomness. Gonna be difficult with factorio. However, not impossible... pseudo random numbers, seeded with day/night cycle time, splitter with a prefered side that is toggled with the randomness, and so on...
mrvn
Smart Inserter
Smart Inserter
Posts: 5878
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Belt math, using lower tier belts to effect.

Post by mrvn »

Bauer wrote: Thu Aug 29, 2019 11:11 am "mixer" implies some degree of randomness. Gonna be difficult with factorio. However, not impossible... pseudo random numbers, seeded with day/night cycle time, splitter with a prefered side that is toggled with the randomness, and so on...
That's not what I mean.

I want a splitter that takes items from the top input and puts half on the top output and half on the bottom output. Same for the bottom input. Assuming nothing blocks.

Or the old behavior where the splitter would toggle the output for each item type separately. So coal would always alternate between top and bottom regardless of how many iron plates pass by between coals.
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3160
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Belt math, using lower tier belts to effect.

Post by BlueTemplar »

Can still do that, but it requires quite a bit more space for multiple belts :
Attachments
2-belt_mixer.png
2-belt_mixer.png (358.15 KiB) Viewed 5726 times
BobDiggity (mod-scenario-pack)
mrvn
Smart Inserter
Smart Inserter
Posts: 5878
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Belt math, using lower tier belts to effect.

Post by mrvn »

BlueTemplar wrote: Thu Aug 29, 2019 1:44 pm Can still do that, but it requires quite a bit more space for multiple belts :
Just random chance it worked: Scroll up to what trebor posted.


@Trebor: Here is an implication you might not have thought of: The belt challenge scenario could become trivial.
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3160
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Belt math, using lower tier belts to effect.

Post by BlueTemplar »

It's not random chance - Trevor uses one 2 belts in, 2 belts out splitter, I use two 2 belts in 1 belt out.
BobDiggity (mod-scenario-pack)
mrvn
Smart Inserter
Smart Inserter
Posts: 5878
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Belt math, using lower tier belts to effect.

Post by mrvn »

BlueTemplar wrote: Thu Aug 29, 2019 2:02 pm It's not random chance - Trevor uses one 2 belts in, 2 belts out splitter, I use two 2 belts in 1 belt out.
Ups, I see that now. My bad.
User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Belt math, using lower tier belts to effect.

Post by disentius »

And if you make it even bigger, it becomes a lanebalancer-mixer that doesn't care if outputs are backed up/blocked or partially consumed :mrgreen:
lanebalancer-mixer.gif
lanebalancer-mixer.gif (5.08 MiB) Viewed 5700 times
Post Reply

Return to “Mechanical Throughput Magic (circuit-free)”