Train Multiplexing Math

Post all other topics which do not belong to any other category.
FrodoOf9Fingers
Fast Inserter
Fast Inserter
Posts: 109
Joined: Sat Apr 29, 2017 11:13 pm
Contact:

Train Multiplexing Math

Post by FrodoOf9Fingers »

I'm working on a super-mega base! Though, this may be better suited for the Math Stack Exchange forums. I mainly want people to check my math.

I have a bunch of train lines going between mines and furnaces. However, the line that goes to the iron furnace might not be the line that goes to all of the iron lines. Rather, lines that go to furnaces have only 1 type of cargo, whereas lines that go to the mines have each type of cargo. I don't want to spam line changers everywhere, as that would reduce the efficiency of the pathfinding algorithm methinks. Instead, I figured that a multiplexer would be the best idea. Each line going to a furnace area needs to be fully saturated with trains for my setup to work (furnaces are designed to handle a train per line every few seconds).

Assuming that there are 10 lines to mines and 10 lines to furnaces, what is the average amount of "collisions" that a multiplexer would experience at each level, a level being a point of crossing? The extension of the question also becomes how many extra lines are placed in such that the multiplexor does not become the bottleneck.

A train is equally likely to start on any line and end on any line. Therefore, for each given input, each given output is equally likely. Find the number of crossings to get to each line from a given line, and divide it by 10 (the total number of lines). For instance, line number 2 would have 0 + 1 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 = 37. Divide by the number of lines to get each lines average number of crossings. Then sum those averages, and divide by the number of lines again to get the average number of crossings of all lines. I got 2.0625 as a result.

I personally have 16 input and 16 output lines, the same procedure comes out to 5.29 average crossings (meaning that I will split the lines into 6 lines to handle the slowed down rate, for a total width of 96 lines, one direction).

Does this seem right to everyone?
FrodoOf9Fingers
Fast Inserter
Fast Inserter
Posts: 109
Joined: Sat Apr 29, 2017 11:13 pm
Contact:

Re: Train Multiplexing Math

Post by FrodoOf9Fingers »

I apologize, the first problem of 10 lanes should be equal to 3.3, not ~2.
saturn7
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Wed Apr 27, 2016 6:14 pm
Contact:

Re: Train Multiplexing Math

Post by saturn7 »

I'm not sure your logic is correct. For example, when train 2 would go to destination 2, you compute 0 crossings. However if train 1 would go to destionation 3, train 2 would have a crossing nonetheless.

How I would calculate it: Suppose you have n trains and n destinations. The probability that two fixed trains a < b must cross at some point is 1/2. Why? Because the destinations are uniform, and so with probability 1/2, the destination of a comes before the destination of b (so they don't need to cross), and with probability 1/2, the destination of a comes after the destination of b, and they need to cross.

For each train, there are n-1 other trains, resulting in (n-1)/2 expected crossings, because of linearity of expectation.
Post Reply

Return to “General discussion”