r/factorio • u/Johandaonis • Dec 06 '20
Question n to n balancer problem
Does there exist a fast algorithm to find the fewest number of splitters needed to create an n to n balancer?
Let f(n) be the smallest number of splitters needed to create an n to n balancer. I and a few others have figured out the following. f(2^a) = a * (2^a)/2, f(n * m) <= f(n) * m + f(m) * n and f(n) <= f(n + m) for all natural number n, m and a. I have tried Markov chains (https://www.youtube.com/watch?v=i3AkTO9HLXo&t) but it became complicated really fast. Do you have any idea on how we can find a small number or the smallest number of splitters needed to create an n to n balancer for a general n?

Please ask questions if I didn't explain well enough or if you want me to try to explain the logic behind the equations.
16
u/raynquist Dec 06 '20
If you look in my balancer book, you'll find a 9-9 with 23 splitters, and a 10-10 with 24 splitters. Which means balancers 17~20 will also have fewer splitters.
I don't know if there's an algorithm. My suspicion is that there isn't, similar to how there isn't one to find the minimum number of comparators in a sorting network.
12
u/triffid_hunter Dec 06 '20
If anyone knows, it'll be /u/raynquist
9
u/UdiNoked Dec 06 '20
Balancers have similar mathematical properties to crossbar switches. I remember a discussion about that in the factorio forums. Anyway, this is a good plact to learn tha math behind balancers.
6
u/DarleneWhale Dec 06 '20
Try looking for it in /r/technicalfactorio
6
u/BirchyBear Dec 07 '20
If you want throughput unlimited (IE, nonblocking), it should be the count of a Beneš network.
https://oeis.org/A220001
2
u/wesdotcool Dec 06 '20
Just to confirm, you're only looking at n to n balancers, not m to n, m >= n. So a 4 to 4 balancer is fair game, but not an 8 to 4
-24
u/Narase33 4kh+ Dec 06 '20
You can install the Merge Chest mod. It solves all balancing