I have a video game(Factorio, if you have heard of it) that I like to play that involves many different kinds of ratios in order to optimize the production of items that require other items. Normally I can solve for the ratios, but this one is a little more complicated. Here is the problem:
I have 3 different kinds of factories in my setup. For simplicity, we will call them X
, Y
, and Z
. We will also have 3 different products we will be discussing, which we will call H
, L
, and G
.
Factory X
takes no input(it does, but it is a fourth product that can be supplied unlimited from an external source, so shouldn't be needed to solve the problem), and produces all three outputs. It produces 55.575
of H
, 100.035
of L
, and 122.265
of G
.
Factory Y
takes H
as an input, and has L as an output. It consumes 131
of H
and produces 127.725
of L
.
Factory Z
takes L
as an input, and has G
as an output. Is consumes 98.25
of L
and produces 65.5
of G
.
The problem to solve is to find the ratio of X:Y:Z
(where X
, Y
, and Z
are all greater than zero) that will avoid any excess product of H
or L
, leaving only G
as the net output.
I am pretty sure that this problem falls in the realm of Linear Algebra(which I admittingly have only a basic knowledge of), something to do with matrices and/or simultaneous equations. Trying to solve for X
, Y
, and Z
, though, would require 3 equations, and I have sadly only been able to come up with either 2, or a third at the cost of accidentally creating a fourth unknown.
Here is what I have tried thus far, in case I was on the right track:
First attempt:
0 = H = 55.575X - 131Y + 0Z
0 = L = 100.035X + 127.725L - 98.25Z
G = 122.265X + 0Y + 65.5Z
(Doesn't work due to creating fourth unknown, G)
Second attempt:
Y = (55.575X)/131
Z = (100.035X + 127.725Y)/98.25
(Doesn't work due to only having 2 equations)
I would love to see the solution to this problem, and see what exactly I am missing here. Thank you in advance for any help!
EDIT:
From another source, I had a few people solving the problem. I am led to believe that there are too many unknowns to solve for a perfect ratio, and also that perhaps there may not actually be a completely perfect ratio. That said, with a ratio of 1000000000000 : 424236641221 : 1569675572520
, there is only a 0.000000000088752720331681537543048644709316% error
from whatever the perfect ratio would be, which in incredibly close. I will follow up with the person's calculations to obtain said ratio.
EDIT:
Turns out that it is a repeating decimal answer, so the above was not in simplest form. In its simplest form, the answer is 52400:22230:82251
EDIT:
Corrected type on second equation, changing 100.032 to 100.035
Best Answer
Let's go back to your first attempt. We have the system of equations:
\begin{align} 0 &= 55.575X - 131Y + 0Z \\ 0 &= 100.032X + 127.725Y - 98.25Z \\ G &= 122.265X + 0Y + 65.5Z \end{align}
Now we have four unknowns, but remember we're just trying to find a ratio between $X$, $Y$, and $Z$. This means we can fix any of them at $1$ and find the ratio from there. Let $X=1$, and we will find.
\begin{align} 0 &= 55.575 - 131Y\\ 0 &= 100.032 + 127.725Y - 98.25Z \\ G &= 122.265+65.5Z \end{align}
We can solve this system now, I used WolframAlpha to do so and got $$G=\frac{900307}{4000}, X = 1, Y = \frac{2223}{5240}, Z = \frac{411247}{262000}$$
Now we wish to find integer results for $Y$ and $Z$ so we multiply and find $$262000: 111150: 411247$$ as the ratio $X:Y:Z$.
I've now checked my work by plugging it back into the original equations and find an output of $G = 5.89701\cdot 10^7$.
Happy engineering!