Tutorial:Quality upcycling math: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
How do we get the most amount of [[Quality|legendary]] items out of an upcycling plant?
How do we get the most amount of [[Quality|legendary]] items out of an upcycling plant?


The answer is not quite as straight forward as we'd like it to be, because it depends on a number of factors, luckily there is a finite number of possibilities of what the modules can be, and for the sake of simplicity this tutorial will ignore the productivity gain from [[Technologies#Space_Age|infinite technologies]].
The answer is not quite as straight forward as we'd like it to be, because it depends on a number of factors, luckily there is a finite number of possibilities of what the modules can be, and for the sake of simplicity this tutorial will ignore the productivity gain from [[Technologies#Space_Age|infinite technologies]]. But first, a presentation of the results.
 
== Best ratios ==
The table below shows the best ratio for [[Quality module 3|quality]] to [[Productivity module 3|productivity modules]] in the crafting machines, while the [[Recycler|recyclers]] always take only quality modules. The values are not given in whole numbers because often it is not just a single crafting machine per tier that will be used, then the ratios can change between different crafting machines in the same tier. e.g. "3.67 quality / 1.33 productivity" could have 4 machines where 3 have a ratio 4 to 1, and one a ratio 3 to 2.
 
<tabber>
common modules =
The columns "Modules for X items" denote which modules need to go into the machines that are set to produce items of X quality.
{| class="wikitable"
! Crafting machine || Modules for common items || Modules for uncommon items || Modules for rare items  || Modules for epic || Modules for legendary || Percentage yield || Items recycled*
|-
| Chemical plant || 3 quality <br />0 productivity || 3 quality <br />0 productivity || 3 quality <br />0 productivity || 3 quality <br />0 productivity  || 0 quality <br />3 productivity || 0.034014% || 2940
|-
| Assembling machine 3 || 4 quality <br />0 productivity || 4 quality <br />0 productivity || 4 quality <br />0 productivity || 4 quality <br />0 productivity  || 0 quality <br />4 productivity || 0.046275% || 2161
|-
| Foundry || 4 quality <br />0 productivity || 4 quality <br />0 productivity || 4 quality <br />0 productivity || 4 quality <br />0 productivity  || 0 quality <br />4 productivity || 0.133814% || 747
|-
| Electromagnetic plant || 5 quality <br />0 productivity || 5 quality <br />0 productivity || 5 quality <br />0 productivity || 5 quality <br />0 productivity  || 0 quality <br />5 productivity || 0.176712% || 566
|-
| Cryogenic plant || 6 quality <br />2 productivity || 6 quality <br />2 productivity || 6 quality <br />2 productivity || 6.5 quality <br />1.5 productivity  || 0 quality <br />8 productivity || 0.119134%|| 840
|}
<nowiki>*</nowiki> "items recycled" quantifies how many items need to be crafted and put into the entire upcycler to yield a single legendary item, it doesn't account for those which get recycled multiple times.
\-\
uncommon modules =
The columns "Modules for X items" denote which modules need to go into the machines that are set to produce items of X quality.
{| class="wikitable"
! Crafting machine || Modules for common items || Modules for uncommon items || Modules for rare items  || Modules for epic || Modules for legendary || Percentage yield || Items recycled*
|-
| Chemical plant || 3 quality <br />0 productivity || 3 quality <br />0 productivity || 3 quality <br />0 productivity || 3 quality <br />0 productivity  || 0 quality <br />3 productivity || 0.059498% || 1681
|-
| Assembling machine 3 || 3.75 quality <br />0.25 productivity || 3.75 quality <br />0.25 productivity || 3.8 quality <br />0.2 productivity || 3.9 quality <br />0.1 productivity  || 0 quality <br />4 productivity || 0.082296% || 1216
|-
| Foundry || 4 quality <br />0 productivity || 4 quality <br />0 productivity || 4 quality <br />0 productivity || 4 quality <br />0 productivity  || 0 quality <br />4 productivity || 0.243699% || 410
|-
| Electromagnetic plant || 4.7 quality <br />0.3 productivity || 4.67 quality <br />0.33 productivity || 4.75 quality <br />0.25 productivity || 4.9 quality <br />0.1 productivity  || 0 quality <br />5 productivity || 0.324189% || 309
|-
| Cryogenic plant || 4.6 quality <br />3.4 productivity || 4.6 quality <br />3.4 productivity || 4.67 quality <br />3.33 productivity  || 5 quality <br />3 productivity  || 0 quality <br />8 productivity || 0.257621% || 389
|}
<nowiki>*</nowiki> "items recycled" quantifies how many items need to be crafted and put into the entire upcycler to yield a single legendary item, it doesn't account for those which get recycled multiple times.
\-\
rare modules =
The columns "Modules for X items" denote which modules need to go into the machines that are set to produce items of X quality.
{| class="wikitable"
! Crafting machine || Modules for common items || Modules for uncommon items || Modules for rare items  || Modules for epic || Modules for legendary || Percentage yield || Items recycled*
|-
| Chemical plant || 2.8 quality <br />0.2 productivity || 2.8 quality <br />0.2 productivity || 2.9 quality <br />0.1 productivity || 2.9 quality <br />0.1 productivity  || 0 quality <br />3 productivity || 0.100660% || 994
|-
| Assembling machine 3 || 3 quality <br />1 productivity || 3.1 quality <br />0.9 productivity || 3.2 quality <br />0.8 productivity || 3.33 quality <br />0.67 productivity  || 0 quality <br />4 productivity || 0.145220% || 689
|-
| Foundry || 3.5 quality <br />0.5 productivity || 3.5 quality <br />0.5 productivity || 3.6 quality <br />0.4 productivity || 3.9 quality <br />0.1 productivity  || 0 quality <br />4 productivity || 0.424039% || 236
|-
| Electromagnetic plant || 3.6 quality <br />1.4 productivity || 3.6 quality <br />1.4 productivity || 3.6 quality <br />1.4 productivity || 3.9 quality <br />1.1 productivity  || 0 quality <br />5 productivity || 0.588510% || 170
|-
| Cryogenic plant || 3.6 quality <br />4.4 productivity || 3.6 quality <br />4.4 productivity || 3.6 quality <br />4.4 productivity  || 3.9 quality <br />4.1 productivity  || 0 quality <br />8 productivity || 0.565030% || 177
|}
<nowiki>*</nowiki> "items recycled" quantifies how many items need to be crafted and put into the entire upcycler to yield a single legendary item, it doesn't account for those which get recycled multiple times.
\-\
epic modules =
The columns "Modules for X items" denote which modules need to go into the machines that are set to produce items of X quality.
{| class="wikitable"
! Crafting machine || Modules for common items || Modules for uncommon items || Modules for rare items  || Modules for epic || Modules for legendary || Percentage yield || Items recycled*
|-
| Chemical plant || 2.33 quality <br />0.67 productivity || 2.4 quality <br />0.6 productivity || 2.4 quality <br />0.6 productivity || 2.4 quality <br />0.6 productivity  || 0 quality <br />3 productivity || 0.152486% || 656
|-
| Assembling machine 3 || 2.5 quality <br />1.5 productivity || 2.5 quality <br />1.5 productivity || 2.6 quality <br />1.4 productivity || 2.8 quality <br />1.2 productivity  || 0 quality <br />4 productivity || 0.232966% || 430
|-
| Foundry || 2.7 quality <br />1.3 productivity || 2.7 quality <br />1.3 productivity || 2.75 quality <br />1.25 productivity || 3 quality <br />1 productivity  || 0 quality <br />4 productivity || 0.664130% || 151
|-
| Electromagnetic plant || 2.6 quality <br />2.4 productivity || 2.6 quality <br />2.4 productivity || 2.67 quality <br />2.33 productivity || 2.9 quality <br />2.1 productivity  || 0 quality <br />5 productivity || 0.974700% || 103
|-
| Cryogenic plant || 2.6 quality <br />5.4 productivity || 2.6 quality <br />5.4 productivity || 2.6 quality <br />4.4 productivity  || 2.8 quality <br />4.2 productivity  || 0 quality <br />8 productivity || 1.122444% || 90
|}
<nowiki>*</nowiki> "items recycled" quantifies how many items need to be crafted and put into the entire upcycler to yield a single legendary item, it doesn't account for those which get recycled multiple times.
\-\
legendary modules=
The columns "Modules for X items" denote which modules need to go into the machines that are set to produce items of X quality.
{| class="wikitable"
! Crafting machine || Modules for common items || Modules for uncommon items || Modules for rare items  || Modules for epic || Modules for legendary || Percentage yield || Items recycled*
|-
| Chemical plant || 1.67 quality <br />1.33 productivity || 1.67 quality <br />1.33 productivity || 1.67 quality <br />1.333 productivity || 1.8 quality <br />1.2 productivity  || 0 quality <br />3 productivity || 0.344061% || 291
|-
| Assembling machine 3 || 1.67 quality <br />2.33 productivity || 1.67 quality <br />2.33 productivity || 1.67 quality <br />2.33 productivity || 1.8 quality <br />2.2 productivity  || 0 quality <br />4 productivity || 0.586191% || 171
|-
| Foundry || 1.4 quality <br />2.6 productivity || 1.4 quality <br />2.6 productivity || 1.4 quality <br />2.6 productivity || 1.5 quality <br />2.5 productivity  || 0 quality <br />4 productivity || 1.624266% || 62
|-
| Electromagnetic plant || 1 quality <br />4 productivity || 1 quality <br />4 productivity || 1 quality <br />4 productivity || 1 quality <br />4 productivity  || 0 quality <br />5 productivity || 2.722332% || 37
|-
| Cryogenic plant || 0 quality <br />8 productivity || 0 quality <br />8 productivity || 0 quality <br />8 productivity || 0 quality <br />8 productivity  || 0 quality <br />8 productivity || 4.835199% || 21
|}
<nowiki>*</nowiki> "items recycled" quantifies how many items need to be crafted and put into the entire upcycler to yield a single legendary item, it doesn't account for those which get recycled multiple times.
</tabber>
 
=== Number of crafting machines ===
If we assume a constant input stream of uncommon items, which will always fill back up, we can additionally figure out what ratio of items will be inside the system at once, and with that we can figure out how many crafting machines we need per tier of quality. This is done by setting <math>m_{1,k+1} = 100 \, \% - m_{2,k+1} - m_{3,k+1} - m_{4,k+1}</math> after each iteration and further adjusting for the crafting machines change in speed dependant on the modules (assuming the machines which only house productivity modules are not additionally boosted by [[Speed module 3|speed moduled]] [[beacon]]s). See the calculations further below for a full explanation of the calculations.
 
<tabber>
per recycler=
{| class="wikitable"
! Crafting machine || Recyclers || Machines producing common items || Machines producing uncommon items || Machines producing rare items || Machines producing epic items || Machines producing legendary items
|-
| Chemical plant || 1 || 4.418130519 || 0.037216657 || 1.294369664 || 0.009779 || 0.431955
|-
| Assembling machine 3 || 1 || 4.733868899 || 0.052316655 || 1.527502978 || 0.015336 || 0.52576
|-
| Foundry || 1 || 4.314446 || 0.082198 || 1.683088 || 0.03016 || 0.58448
|-
| Electromagnetic plant || 1 || 4.494435 || 0.116985 || 1.93479 || 0.049665 || 0.60795
|-
| Cryogenic plant || 1 || 5.23556 || 0.21384 || 2.53374 || 0.1034 || 0.594
|}
\-\
per legendary crafter (exact) =
{| class="wikitable"
! Crafting machine || Recyclers || Machines producing common items || Machines producing uncommon items || Machines producing rare items || Machines producing epic items || Machines producing legendary items
|-
| Chemical plant || 90.1223 || 331.8198 || 38.5325 || 11.2893 || 2.9653 || 1
|-
| Assembling machine 3 || 52.8432 || 208.4632 || 30.3992 || 9.8094 || 2.8783 || 1
|-
| Foundry || 24.7668 || 89.0483 || 19.9206 || 7.7712 || 2.8592 || 1
|-
| Electromagnetic plant || 16.5379 || 61.9418 || 17.4010 || 7.4908 || 3.1822 || 1
|-
| Cryogenic plant || 10.8718 || 47.4350 || 18.2124 || 8.8138 || 4.2654 || 1
|}
\-\
per legendary crafter (conservative)=
{| class="wikitable"
! Crafting machine || Recyclers || Machines producing common items || Machines producing uncommon items || Machines producing rare items || Machines producing epic items || Machines producing legendary items
|-
| Chemical plant || 53 || 198 || 23 || 7 || 2 || 1
|-
| Assembling machine 3 || 31 || 123 || 18 || 6 || 2 || 1
|-
| Foundry || 14 || 53 || 12 || 5 || 2 || 1
|-
| Electromagnetic plant || 14 || 56 || 16 || 7 || 3 || 1
|-
| Cryogenic plant || 9 || 41 || 16 || 8 || 4 || 1
|}
</tabber>


== The crafting machines ==
== The crafting machines ==
Line 25: Line 165:
The mathematical model is time discrete. As opposed to dealing with derivatives in respect to time, the next state is a direct function of the previous state.
The mathematical model is time discrete. As opposed to dealing with derivatives in respect to time, the next state is a direct function of the previous state.


* <math>m_{i,k}</math> ... Number of materials of tier <math>i</math> after the <math>k</math>-th iteration before being crafted. (this doesn't mean that an item only needs one type of ingredient, but that "1 materials" can be crafted into 1 item from them)
* <math>m_{i,k}</math> ... Number of materials of tier <math>i</math> (whereas 1 is common, 2 is uncommon, 3 is rare, 4 is epic, and 5 is legendary) after the <math>k</math>-th iteration before being crafted. (this doesn't mean that an item only needs one type of ingredient, but that "1 materials" can be crafted into 1 item from them)
* <math>n_{i,k}</math> ... Number of items of tier <math>i</math> after the <math>k</math>-th iteration, after being crafted together.
* <math>n_{i,k}</math> ... Number of items of tier <math>i</math> after the <math>k</math>-th iteration, after being crafted together.
* <math>p_0</math> ... the crafting machines inherent productivity bonus
* <math>p_0</math> ... the crafting machines inherent productivity bonus
Line 34: Line 174:


=== Recycled materials ===
=== Recycled materials ===
When a quarter of all items being recycled and the quality probability rules we can write the equations for the amount of materials received after recycling. This calculation is rather simple, as we the lowest tier can only come forth from it's own tier failing to raise in quality. The second tier are 90% of tier 1 items that did increase, and all those tier 2 items that didn't. This continues for all tiers as follows, but legendary items <math>n_{5,k}</math> will not be recycled
When a quarter of all items being recycled and the quality probability rules, we can write the equations for the amount of materials received after recycling. This calculation is rather simple, as uncommon items can only come forth from uncommon material failing to raise in quality. The second tier are 90% of tier 1 items that did increase, and all those tier 2 items that didn't. This continues for all tiers as follows, but legendary items <math>n_{5,k}</math> will not be recycled


<math>
<math>
\begin{align}
\begin{align}
m_{1,k+1} &= \frac{n_{1,k}}{4} \cdot (1 - q_r)\\
\text{common material:}\quad m_{1,k+1} &= \frac{n_{1,k}}{4} \cdot (1 - q_r)\\
m_{2,k+1} &= \frac{n_{1,k}}{4} \cdot q_r \cdot 0.9 &+& \frac{n_{2,k}}{4} \cdot (1 - q_r)\\
\text{uncommon material:}\quad m_{2,k+1} &= \frac{n_{1,k}}{4} \cdot q_r \cdot 0.9 &+& \frac{n_{2,k}}{4} \cdot (1 - q_r)\\
m_{3,k+1} &= \frac{n_{1,k}}{4} \cdot q_r \cdot 0.09 &+& \frac{n_{2,k}}{4} \cdot q_r \cdot 0.9 &+& \frac{n_{3,k}}{4} \cdot (1 - q_r)\\
\text{rare material:}\quad m_{3,k+1} &= \frac{n_{1,k}}{4} \cdot q_r \cdot 0.09 &+& \frac{n_{2,k}}{4} \cdot q_r \cdot 0.9 &+& \frac{n_{3,k}}{4} \cdot (1 - q_r)\\
m_{4,k+1} &= \frac{n_{1,k}}{4} \cdot q_r \cdot 0.009 &+& \frac{n_{2,k}}{4} \cdot q_r \cdot 0.09 &+& \frac{n_{3,k}}{4} \cdot q_r \cdot 0.9 &+& \frac{n_{4,k}}{4} \cdot (1 - q_r)\\
\text{epic material:}\quad m_{4,k+1} &= \frac{n_{1,k}}{4} \cdot q_r \cdot 0.009 &+& \frac{n_{2,k}}{4} \cdot q_r \cdot 0.09 &+& \frac{n_{3,k}}{4} \cdot q_r \cdot 0.9 &+& \frac{n_{4,k}}{4} \cdot (1 - q_r)\\
m_{5,k+1} &= \frac{n_{1,k}}{4} \cdot q_r \cdot 0.001 &+& \frac{n_{2,k}}{4} \cdot q_r \cdot 0.01 &+& \frac{n_{3,k}}{4} \cdot q_r \cdot 0.1 &+& \frac{n_{4,k}}{4} \cdot q_r\\
\text{legendary material:}\quad m_{5,k+1} &= \frac{n_{1,k}}{4} \cdot q_r \cdot 0.001 &+& \frac{n_{2,k}}{4} \cdot q_r \cdot 0.01 &+& \frac{n_{3,k}}{4} \cdot q_r \cdot 0.1 &+& \frac{n_{4,k}}{4} \cdot q_r\\
\end{align}
\end{align}
</math>
</math>
Line 77: Line 217:
<math>
<math>
\begin{align}
\begin{align}
n_{1,k+1} &= m_{1,k+1} \cdot ( 1 + p_1 ) \cdot (1 - q_1)\\
\text{common item:}\quad n_{1,k+1} &= m_{1,k+1} \cdot ( 1 + p_1 ) \cdot (1 - q_1)\\
n_{2,k+1} &= m_{1,k+1} \cdot ( 1 + p_1 ) \cdot q_1 \cdot 0.9 &+&  m_{2,k+1} \cdot ( 1 + p_2 ) \cdot (1 - q_2)\\
\text{uncommon items:}\quad n_{2,k+1} &= m_{1,k+1} \cdot ( 1 + p_1 ) \cdot q_1 \cdot 0.9 &+&  m_{2,k+1} \cdot ( 1 + p_2 ) \cdot (1 - q_2)\\
n_{3,k+1} &= m_{1,k+1} \cdot ( 1 + p_1 ) \cdot q_1 \cdot 0.09 &+&  m_{2,k+1} \cdot ( 1 + p_2 ) \cdot q_2 \cdot 0.9 &+& m_{3,k+1} \cdot ( 1 + p_3 ) \cdot (1 - q_3) \\
\text{rare items:}\quad n_{3,k+1} &= m_{1,k+1} \cdot ( 1 + p_1 ) \cdot q_1 \cdot 0.09 &+&  m_{2,k+1} \cdot ( 1 + p_2 ) \cdot q_2 \cdot 0.9 &+& m_{3,k+1} \cdot ( 1 + p_3 ) \cdot (1 - q_3) \\
n_{4,k+1} &= m_{1,k+1} \cdot ( 1 + p_1 ) \cdot q_1 \cdot 0.009 &+&  m_{2,k+1} \cdot ( 1 + p_2 ) \cdot q_2 \cdot 0.09 &+& m_{3,k+1} \cdot ( 1 + p_3 ) \cdot q_3 \cdot 0.9  &+& m_{4,k+1} \cdot ( 1 + p_4) \cdot (1 - q_4) \\
\text{epic items:}\quad n_{4,k+1} &= m_{1,k+1} \cdot ( 1 + p_1 ) \cdot q_1 \cdot 0.009 &+&  m_{2,k+1} \cdot ( 1 + p_2 ) \cdot q_2 \cdot 0.09 &+& m_{3,k+1} \cdot ( 1 + p_3 ) \cdot q_3 \cdot 0.9  &+& m_{4,k+1} \cdot ( 1 + p_4) \cdot (1 - q_4) \\
n_{5,k+1} &= m_{1,k+1} \cdot ( 1 + p_1 ) \cdot q_1 \cdot 0.001 &+&  m_{2,k+1} \cdot ( 1 + p_2 ) \cdot q_2 \cdot 0.01 &+& m_{3,k+1} \cdot ( 1 + p_3 ) \cdot q_3 \cdot 0.1  &+& m_{4,k+1} \cdot ( 1 + p_4) \cdot q_4 &+& m_{5,k+1} \cdot ( 1 + p_5) + n_{5,k}\\
\text{legendary items:}\quad n_{5,k+1} &= m_{1,k+1} \cdot ( 1 + p_1 ) \cdot q_1 \cdot 0.001 &+&  m_{2,k+1} \cdot ( 1 + p_2 ) \cdot q_2 \cdot 0.01 &+& m_{3,k+1} \cdot ( 1 + p_3 ) \cdot q_3 \cdot 0.1  &+& m_{4,k+1} \cdot ( 1 + p_4) \cdot q_4 &+& m_{5,k+1} \cdot ( 1 + p_5) + n_{5,k}\\
\end{align}
\end{align}
</math>
</math>
Line 98: Line 238:
\underbrace{\begin{bmatrix} m_{1,k+1}\\ m_{2,k+1}\\ m_{3,k+1}\\ m_{4,k+1}\\ m_{5,k+1}\\ \end{bmatrix}}_{\textbf{m}_{k+1}}
\underbrace{\begin{bmatrix} m_{1,k+1}\\ m_{2,k+1}\\ m_{3,k+1}\\ m_{4,k+1}\\ m_{5,k+1}\\ \end{bmatrix}}_{\textbf{m}_{k+1}}
+
+
\begin{bmatrix}
\underbrace{\begin{bmatrix}
0&0&0&0\\
0&0&0&0\\
0&0&0&0\\
0&0&0&0\\
Line 104: Line 244:
0&0&0&0\\
0&0&0&0\\
0&0&0&1\\
0&0&0&1\\
\end{bmatrix}
\end{bmatrix}}_{\textbf{C}}
\underbrace{\begin{bmatrix} n_{1,k}\\ n_{2,k}\\ n_{3,k}\\ n_{4,k}\\ n_{5,k}\\ \end{bmatrix}}_{\textbf{n}_k}
\underbrace{\begin{bmatrix} n_{1,k}\\ n_{2,k}\\ n_{3,k}\\ n_{4,k}\\ n_{5,k}\\ \end{bmatrix}}_{\textbf{n}_k}
</math>
</math>
Line 142: Line 282:


The choice of optimization method (simplex, branch and bound, etc.) itself is irrelevant, although most software will want the problem to be stated in a way so it can find a minimum, and may require the proper guard rails as to not pick values below 0 or higher than the maximum number of allowed modules.
The choice of optimization method (simplex, branch and bound, etc.) itself is irrelevant, although most software will want the problem to be stated in a way so it can find a minimum, and may require the proper guard rails as to not pick values below 0 or higher than the maximum number of allowed modules.
== Best ratios ==
This table shows the best ratio for quality to productivity modules in the crafting machines, while the recyclers always take only quality modules. The values are not given in whole numbers because often it is not just a single crafting machine per tier that will be used, then the ratios can change between different crafting machines in the same tier. e.g. "3.67 quality / 1.33 productivity" could have 4 machines where 3 have a ratio 4 to 1, and one a ratio 3 to 2.
<tabber>
common modules =
"Modules in Tier X" means which Modules need to go into the machines that are set to produce the item at tier X.
{| class="wikitable"
! Crafting machine || Modules in Tier 1 || Modules in Tier 2 || Modules in Tier 3 || Modules in Tier 4 || Modules in Tier 5 || percentage yield || items recycled*
|-
| Chemical plant || 3 quality <br />0 productivity || 3 quality <br />0 productivity || 3 quality <br />0 productivity || 3 quality <br />0 productivity  || 0 quality <br />3 productivity || 0.034014% || 2940
|-
| Assembling machine 3 || 4 quality <br />0 productivity || 4 quality <br />0 productivity || 4 quality <br />0 productivity || 4 quality <br />0 productivity  || 0 quality <br />4 productivity || 0.046275% || 2161
|-
| Foundry || 4 quality <br />0 productivity || 4 quality <br />0 productivity || 4 quality <br />0 productivity || 4 quality <br />0 productivity  || 0 quality <br />4 productivity || 0.133814% || 747
|-
| Electromagnetic plant || 5 quality <br />0 productivity || 5 quality <br />0 productivity || 5 quality <br />0 productivity || 5 quality <br />0 productivity  || 0 quality <br />5 productivity || 0.176712% || 566
|-
| Cryogenic plant || 6 quality <br />2 productivity || 6 quality <br />2 productivity || 6 quality <br />2 productivity || 6.5 quality <br />1.5 productivity  || 0 quality <br />8 productivity || 0.119134%|| 840
|}
<nowiki>*</nowiki> "items recycled" quantifies how many items need to be crafted and put into the entire upcycler to yield a single legendary item, it doesn't account for those which get recycled multiple times.
\-\
uncommon modules =
"Modules in Tier X" means which Modules need to go into the machines that are set to produce the item at tier X.
{| class="wikitable"
! Crafting machine || Modules in Tier 1 || Modules in Tier 2 || Modules in Tier 3 || Modules in Tier 4 || Modules in Tier 5 || percentage yield || items recycled*
|-
| Chemical plant || 3 quality <br />0 productivity || 3 quality <br />0 productivity || 3 quality <br />0 productivity || 3 quality <br />0 productivity  || 0 quality <br />3 productivity || 0.059498% || 1681
|-
| Assembling machine 3 || 3.75 quality <br />0.25 productivity || 3.75 quality <br />0.25 productivity || 3.8 quality <br />0.2 productivity || 3.9 quality <br />0.1 productivity  || 0 quality <br />4 productivity || 0.082296% || 1216
|-
| Foundry || 4 quality <br />0 productivity || 4 quality <br />0 productivity || 4 quality <br />0 productivity || 4 quality <br />0 productivity  || 0 quality <br />4 productivity || 0.243699% || 410
|-
| Electromagnetic plant || 4.7 quality <br />0.3 productivity || 4.67 quality <br />0.33 productivity || 4.75 quality <br />0.25 productivity || 4.9 quality <br />0.1 productivity  || 0 quality <br />5 productivity || 0.324189% || 309
|-
| Cryogenic plant || 4.6 quality <br />3.4 productivity || 4.6 quality <br />3.4 productivity || 4.67 quality <br />3.33 productivity  || 5 quality <br />3 productivity  || 0 quality <br />8 productivity || 0.257621% || 389
|}
<nowiki>*</nowiki> "items recycled" quantifies how many items need to be crafted and put into the entire upcycler to yield a single legendary item, it doesn't account for those which get recycled multiple times.
\-\
rare modules =
"Modules in Tier X" means which Modules need to go into the machines that are set to produce the item at tier X.
{| class="wikitable"
! Crafting machine || Modules in Tier 1 || Modules in Tier 2 || Modules in Tier 3 || Modules in Tier 4 || Modules in Tier 5 || percentage yield || items recycled*
|-
| Chemical plant || 2.8 quality <br />0.2 productivity || 2.8 quality <br />0.2 productivity || 2.9 quality <br />0.1 productivity || 2.9 quality <br />0.1 productivity  || 0 quality <br />3 productivity || 0.100660% || 994
|-
| Assembling machine 3 || 3 quality <br />1 productivity || 3.1 quality <br />0.9 productivity || 3.2 quality <br />0.8 productivity || 3.33 quality <br />0.67 productivity  || 0 quality <br />4 productivity || 0.145220% || 689
|-
| Foundry || 3.5 quality <br />0.5 productivity || 3.5 quality <br />0.5 productivity || 3.6 quality <br />0.4 productivity || 3.9 quality <br />0.1 productivity  || 0 quality <br />4 productivity || 0.424039% || 236
|-
| Electromagnetic plant || 3.6 quality <br />1.4 productivity || 3.6 quality <br />1.4 productivity || 3.6 quality <br />1.4 productivity || 3.9 quality <br />1.1 productivity  || 0 quality <br />5 productivity || 0.588510% || 170
|-
| Cryogenic plant || 3.6 quality <br />4.4 productivity || 3.6 quality <br />4.4 productivity || 3.6 quality <br />4.4 productivity  || 3.9 quality <br />4.1 productivity  || 0 quality <br />8 productivity || 0.565030% || 177
|}
<nowiki>*</nowiki> "items recycled" quantifies how many items need to be crafted and put into the entire upcycler to yield a single legendary item, it doesn't account for those which get recycled multiple times.
\-\
epic modules =
"Modules in Tier X" means which Modules need to go into the machines that are set to produce the item at tier X.
{| class="wikitable"
! Crafting machine || Modules in Tier 1 || Modules in Tier 2 || Modules in Tier 3 || Modules in Tier 4 || Modules in Tier 5 || percentage yield || items recycled*
|-
| Chemical plant || 2.33 quality <br />0.67 productivity || 2.4 quality <br />0.6 productivity || 2.4 quality <br />0.6 productivity || 2.4 quality <br />0.6 productivity  || 0 quality <br />3 productivity || 0.152486% || 656
|-
| Assembling machine 3 || 2.5 quality <br />1.5 productivity || 2.5 quality <br />1.5 productivity || 2.6 quality <br />1.4 productivity || 2.8 quality <br />1.2 productivity  || 0 quality <br />4 productivity || 0.232966% || 430
|-
| Foundry || 2.7 quality <br />1.3 productivity || 2.7 quality <br />1.3 productivity || 2.75 quality <br />1.25 productivity || 3 quality <br />1 productivity  || 0 quality <br />4 productivity || 0.664130% || 151
|-
| Electromagnetic plant || 2.6 quality <br />2.4 productivity || 2.6 quality <br />2.4 productivity || 2.67 quality <br />2.33 productivity || 2.9 quality <br />2.1 productivity  || 0 quality <br />5 productivity || 0.974700% || 103
|-
| Cryogenic plant || 2.6 quality <br />5.4 productivity || 2.6 quality <br />5.4 productivity || 2.6 quality <br />4.4 productivity  || 2.8 quality <br />4.2 productivity  || 0 quality <br />8 productivity || 1.122444% || 90
|}
<nowiki>*</nowiki> "items recycled" quantifies how many items need to be crafted and put into the entire upcycler to yield a single legendary item, it doesn't account for those which get recycled multiple times.
\-\
legendary modules=
"Modules in Tier X" means which Modules need to go into the machines that are set to produce the item at tier X.
{| class="wikitable"
! Crafting machine || Modules in Tier 1 || Modules in Tier 2 || Modules in Tier 3 || Modules in Tier 4 || Modules in Tier 5 || percentage yield || items recycled*
|-
| Chemical plant || 1.67 quality <br />1.33 productivity || 1.67 quality <br />1.33 productivity || 1.67 quality <br />1.333 productivity || 1.8 quality <br />1.2 productivity  || 0 quality <br />3 productivity || 0.344061% || 291
|-
| Assembling machine 3 || 1.67 quality <br />2.33 productivity || 1.67 quality <br />2.33 productivity || 1.67 quality <br />2.33 productivity || 1.8 quality <br />2.2 productivity  || 0 quality <br />4 productivity || 0.586191% || 171
|-
| Foundry || 1.4 quality <br />2.6 productivity || 1.4 quality <br />2.6 productivity || 1.4 quality <br />2.6 productivity || 1.5 quality <br />2.5 productivity  || 0 quality <br />4 productivity || 1.624266% || 62
|-
| Electromagnetic plant || 1 quality <br />4 productivity || 1 quality <br />4 productivity || 1 quality <br />4 productivity || 1 quality <br />4 productivity  || 0 quality <br />5 productivity || 2.722332% || 37
|-
| Cryogenic plant || 0 quality <br />8 productivity || 0 quality <br />8 productivity || 0 quality <br />8 productivity || 0 quality <br />8 productivity  || 0 quality <br />8 productivity || 4.835199% || 21
|}
<nowiki>*</nowiki> "items recycled" quantifies how many items need to be crafted and put into the entire upcycler to yield a single legendary item, it doesn't account for those which get recycled multiple times.
</tabber>
=== Number of crafting machines ===
If we assume a constant input stream of tier 1 items which will always fill back up, we can additionally figure out what ratio of items will be inside the system at once, and with that we can figure out how many crafting machines we need per tier. This is done by setting <math>m_{1,k+1} = 100 \, \% - m_{2,k+1} - m_{3,k+1} - m_{4,k+1}</math> after each iteration.
<tabber>
per recycler=
{| class="wikitable"
! Crafting machine || Recyclers || Machines producing Tier 1 items || Machines producing Tier 2 items || Machines producing Tier 3 items || Machines producing Tier 4 items || Machines producing Tier 5 items
|-
| Chemical plant || 1 || 3.4427 || 0.0290 || 1.0086 || 0.0077 || 0.2979
|-
| Assembling machine 3 || 1 || 3.3027 || 0.0365 || 1.0657 || 0.0108 || 0.3286
|-
| Foundry || 1 || 2.9551 || 0.0563 || 1.1528 || 0.0208 || 0.3653
|-
| Electromagnetic plant || 1 || 2.7239 || 0.0709 || 1.1726 || 0.0301 || 0.3474
|-
| Cryogenic plant || 1 || 2.3798 || 0.0972 || 1.1517 || 0.0470 || 0.2700
|}
\-\
per tier 5 crafter (exact) =
{| class="wikitable"
! Crafting machine || Recyclers || Machines producing Tier 1 items || Machines producing Tier 2 items || Machines producing Tier 3 items || Machines producing Tier 4 items || Machines producing Tier 5 items
|-
| Chemical plant || 108.8978 || 374.9134 || 43.5367 || 12.7555 || 3.3856 || 1
|-
| Assembling machine 3 || 70.4576 || 232.7032 || 33.9340 || 10.9500 || 3.2432 || 1
|-
| Foundry || 33.0224 || 97.5872 || 21.8308 || 8.5164 || 3.1550 || 1
|-
| Electromagnetic plant || 24.1178 || 65.6959 || 18.4556 || 7.9448 || 3.3747 || 1
|-
| Cryogenic plant || 19.9316 || 47.4350 || 18.2124 || 8.8138 || 4.2654 || 1
|}
\-\
per tier 5 crafter (conservative)=
{| class="wikitable"
! Crafting machine || Recyclers || Machines producing Tier 1 items || Machines producing Tier 2 items || Machines producing Tier 3 items || Machines producing Tier 4 items || Machines producing Tier 5 items
|-
| Chemical plant || 92 || 318 || 37 || 11 || 3 || 1
|-
| Assembling machine 3 || 62 || 205 || 30 || 10 || 3 || 1
|-
| Foundry || 30 || 89 || 20 || 8 || 3 || 1
|-
| Electromagnetic plant || 20 || 56 || 16 || 7 || 3 || 1
|-
| Cryogenic plant || 17 || 41 || 16 || 8 || 4 || 1
|}
</tabber>

Latest revision as of 11:54, 24 November 2024

How do we get the most amount of legendary items out of an upcycling plant?

The answer is not quite as straight forward as we'd like it to be, because it depends on a number of factors, luckily there is a finite number of possibilities of what the modules can be, and for the sake of simplicity this tutorial will ignore the productivity gain from infinite technologies. But first, a presentation of the results.

Best ratios

The table below shows the best ratio for quality to productivity modules in the crafting machines, while the recyclers always take only quality modules. The values are not given in whole numbers because often it is not just a single crafting machine per tier that will be used, then the ratios can change between different crafting machines in the same tier. e.g. "3.67 quality / 1.33 productivity" could have 4 machines where 3 have a ratio 4 to 1, and one a ratio 3 to 2.

The columns "Modules for X items" denote which modules need to go into the machines that are set to produce items of X quality.

Crafting machine Modules for common items Modules for uncommon items Modules for rare items Modules for epic Modules for legendary Percentage yield Items recycled*
Chemical plant 3 quality
0 productivity
3 quality
0 productivity
3 quality
0 productivity
3 quality
0 productivity
0 quality
3 productivity
0.034014% 2940
Assembling machine 3 4 quality
0 productivity
4 quality
0 productivity
4 quality
0 productivity
4 quality
0 productivity
0 quality
4 productivity
0.046275% 2161
Foundry 4 quality
0 productivity
4 quality
0 productivity
4 quality
0 productivity
4 quality
0 productivity
0 quality
4 productivity
0.133814% 747
Electromagnetic plant 5 quality
0 productivity
5 quality
0 productivity
5 quality
0 productivity
5 quality
0 productivity
0 quality
5 productivity
0.176712% 566
Cryogenic plant 6 quality
2 productivity
6 quality
2 productivity
6 quality
2 productivity
6.5 quality
1.5 productivity
0 quality
8 productivity
0.119134% 840
* "items recycled" quantifies how many items need to be crafted and put into the entire upcycler to yield a single legendary item, it doesn't account for those which get recycled multiple times.

The columns "Modules for X items" denote which modules need to go into the machines that are set to produce items of X quality.

Crafting machine Modules for common items Modules for uncommon items Modules for rare items Modules for epic Modules for legendary Percentage yield Items recycled*
Chemical plant 3 quality
0 productivity
3 quality
0 productivity
3 quality
0 productivity
3 quality
0 productivity
0 quality
3 productivity
0.059498% 1681
Assembling machine 3 3.75 quality
0.25 productivity
3.75 quality
0.25 productivity
3.8 quality
0.2 productivity
3.9 quality
0.1 productivity
0 quality
4 productivity
0.082296% 1216
Foundry 4 quality
0 productivity
4 quality
0 productivity
4 quality
0 productivity
4 quality
0 productivity
0 quality
4 productivity
0.243699% 410
Electromagnetic plant 4.7 quality
0.3 productivity
4.67 quality
0.33 productivity
4.75 quality
0.25 productivity
4.9 quality
0.1 productivity
0 quality
5 productivity
0.324189% 309
Cryogenic plant 4.6 quality
3.4 productivity
4.6 quality
3.4 productivity
4.67 quality
3.33 productivity
5 quality
3 productivity
0 quality
8 productivity
0.257621% 389
* "items recycled" quantifies how many items need to be crafted and put into the entire upcycler to yield a single legendary item, it doesn't account for those which get recycled multiple times.

The columns "Modules for X items" denote which modules need to go into the machines that are set to produce items of X quality.

Crafting machine Modules for common items Modules for uncommon items Modules for rare items Modules for epic Modules for legendary Percentage yield Items recycled*
Chemical plant 2.8 quality
0.2 productivity
2.8 quality
0.2 productivity
2.9 quality
0.1 productivity
2.9 quality
0.1 productivity
0 quality
3 productivity
0.100660% 994
Assembling machine 3 3 quality
1 productivity
3.1 quality
0.9 productivity
3.2 quality
0.8 productivity
3.33 quality
0.67 productivity
0 quality
4 productivity
0.145220% 689
Foundry 3.5 quality
0.5 productivity
3.5 quality
0.5 productivity
3.6 quality
0.4 productivity
3.9 quality
0.1 productivity
0 quality
4 productivity
0.424039% 236
Electromagnetic plant 3.6 quality
1.4 productivity
3.6 quality
1.4 productivity
3.6 quality
1.4 productivity
3.9 quality
1.1 productivity
0 quality
5 productivity
0.588510% 170
Cryogenic plant 3.6 quality
4.4 productivity
3.6 quality
4.4 productivity
3.6 quality
4.4 productivity
3.9 quality
4.1 productivity
0 quality
8 productivity
0.565030% 177
* "items recycled" quantifies how many items need to be crafted and put into the entire upcycler to yield a single legendary item, it doesn't account for those which get recycled multiple times.

The columns "Modules for X items" denote which modules need to go into the machines that are set to produce items of X quality.

Crafting machine Modules for common items Modules for uncommon items Modules for rare items Modules for epic Modules for legendary Percentage yield Items recycled*
Chemical plant 2.33 quality
0.67 productivity
2.4 quality
0.6 productivity
2.4 quality
0.6 productivity
2.4 quality
0.6 productivity
0 quality
3 productivity
0.152486% 656
Assembling machine 3 2.5 quality
1.5 productivity
2.5 quality
1.5 productivity
2.6 quality
1.4 productivity
2.8 quality
1.2 productivity
0 quality
4 productivity
0.232966% 430
Foundry 2.7 quality
1.3 productivity
2.7 quality
1.3 productivity
2.75 quality
1.25 productivity
3 quality
1 productivity
0 quality
4 productivity
0.664130% 151
Electromagnetic plant 2.6 quality
2.4 productivity
2.6 quality
2.4 productivity
2.67 quality
2.33 productivity
2.9 quality
2.1 productivity
0 quality
5 productivity
0.974700% 103
Cryogenic plant 2.6 quality
5.4 productivity
2.6 quality
5.4 productivity
2.6 quality
4.4 productivity
2.8 quality
4.2 productivity
0 quality
8 productivity
1.122444% 90
* "items recycled" quantifies how many items need to be crafted and put into the entire upcycler to yield a single legendary item, it doesn't account for those which get recycled multiple times.

The columns "Modules for X items" denote which modules need to go into the machines that are set to produce items of X quality.

Crafting machine Modules for common items Modules for uncommon items Modules for rare items Modules for epic Modules for legendary Percentage yield Items recycled*
Chemical plant 1.67 quality
1.33 productivity
1.67 quality
1.33 productivity
1.67 quality
1.333 productivity
1.8 quality
1.2 productivity
0 quality
3 productivity
0.344061% 291
Assembling machine 3 1.67 quality
2.33 productivity
1.67 quality
2.33 productivity
1.67 quality
2.33 productivity
1.8 quality
2.2 productivity
0 quality
4 productivity
0.586191% 171
Foundry 1.4 quality
2.6 productivity
1.4 quality
2.6 productivity
1.4 quality
2.6 productivity
1.5 quality
2.5 productivity
0 quality
4 productivity
1.624266% 62
Electromagnetic plant 1 quality
4 productivity
1 quality
4 productivity
1 quality
4 productivity
1 quality
4 productivity
0 quality
5 productivity
2.722332% 37
Cryogenic plant 0 quality
8 productivity
0 quality
8 productivity
0 quality
8 productivity
0 quality
8 productivity
0 quality
8 productivity
4.835199% 21
* "items recycled" quantifies how many items need to be crafted and put into the entire upcycler to yield a single legendary item, it doesn't account for those which get recycled multiple times.

Number of crafting machines

If we assume a constant input stream of uncommon items, which will always fill back up, we can additionally figure out what ratio of items will be inside the system at once, and with that we can figure out how many crafting machines we need per tier of quality. This is done by setting after each iteration and further adjusting for the crafting machines change in speed dependant on the modules (assuming the machines which only house productivity modules are not additionally boosted by speed moduled beacons). See the calculations further below for a full explanation of the calculations.

Crafting machine Recyclers Machines producing common items Machines producing uncommon items Machines producing rare items Machines producing epic items Machines producing legendary items
Chemical plant 1 4.418130519 0.037216657 1.294369664 0.009779 0.431955
Assembling machine 3 1 4.733868899 0.052316655 1.527502978 0.015336 0.52576
Foundry 1 4.314446 0.082198 1.683088 0.03016 0.58448
Electromagnetic plant 1 4.494435 0.116985 1.93479 0.049665 0.60795
Cryogenic plant 1 5.23556 0.21384 2.53374 0.1034 0.594

Crafting machine Recyclers Machines producing common items Machines producing uncommon items Machines producing rare items Machines producing epic items Machines producing legendary items
Chemical plant 90.1223 331.8198 38.5325 11.2893 2.9653 1
Assembling machine 3 52.8432 208.4632 30.3992 9.8094 2.8783 1
Foundry 24.7668 89.0483 19.9206 7.7712 2.8592 1
Electromagnetic plant 16.5379 61.9418 17.4010 7.4908 3.1822 1
Cryogenic plant 10.8718 47.4350 18.2124 8.8138 4.2654 1

Crafting machine Recyclers Machines producing common items Machines producing uncommon items Machines producing rare items Machines producing epic items Machines producing legendary items
Chemical plant 53 198 23 7 2 1
Assembling machine 3 31 123 18 6 2 1
Foundry 14 53 12 5 2 1
Electromagnetic plant 14 56 16 7 3 1
Cryogenic plant 9 41 16 8 4 1

The crafting machines

Crafting machine Module slots Base productivity bonus
Chemical plant 3 +0%
Assembling machine 3 4 +0%
Foundry 4 +50%
Electromagnetic plant 5 +50%
Cryogenic plant 8 +0%


Quality probability

When an item gets produced and the initial roll decides that the quality of the item will increase, there is a 90% chance it will rise one tier, a 9% chance it will rise two, a 0.9% chance it will rise three, and a 0.1% chance it will rise four. This is of course capped if the item already started out at a higher tier.

Mathematical model

The mathematical model is time discrete. As opposed to dealing with derivatives in respect to time, the next state is a direct function of the previous state.

  • ... Number of materials of tier (whereas 1 is common, 2 is uncommon, 3 is rare, 4 is epic, and 5 is legendary) after the -th iteration before being crafted. (this doesn't mean that an item only needs one type of ingredient, but that "1 materials" can be crafted into 1 item from them)
  • ... Number of items of tier after the -th iteration, after being crafted together.
  • ... the crafting machines inherent productivity bonus
  • ... number of modules the crafting machine can hold
  • ... quality probability of the recyclers with 4 quality module 3's (6.2% is the chance of a legendary tier quality module 3)
  • ... productivity due to legendary productivity module 3's in the crafting machine which takes -tier materials (25% is the productivity boost of a legendary tier productivity module 3)
  • ... quality probability due to legendary quality module 3's in the crafting machine which takes -tier materials

Recycled materials

When a quarter of all items being recycled and the quality probability rules, we can write the equations for the amount of materials received after recycling. This calculation is rather simple, as uncommon items can only come forth from uncommon material failing to raise in quality. The second tier are 90% of tier 1 items that did increase, and all those tier 2 items that didn't. This continues for all tiers as follows, but legendary items will not be recycled

which can also be written as a vector-matrix-multiplication

As we assume there is nothing to be done about recyclers to make them more effective but fill them with all quality modules, the value of is a constant, and therefore the matrix is also a constant. For legendary quality module 3's, it looks like:

Recrafted items

Once more we first check how many items are produced, which is, again, the sum of all possible ways to get to a tier, this time adding productivity , and bringing along all those items which are already legendary

This can once more be written as a vector-matrix-multiplication

Combined model

As such we gain an equation for the amount of items for every tier after any amount of iterations

A realistic starting point for is only items in tier 1, and if we do not care for any other tiers, we simply choose sufficiently large , and, through numeric means, try to maximize a single value. , which falls in the fifth row, first column, of the Matrix raised to the 100th power.

The choice of optimization method (simplex, branch and bound, etc.) itself is irrelevant, although most software will want the problem to be stated in a way so it can find a minimum, and may require the proper guard rails as to not pick values below 0 or higher than the maximum number of allowed modules.