Maximum multiple calculation
Posted: Sun Oct 31, 2021 2:06 pm
I have a group of signals with their respective values set in a const combinator. These represent the items required to make 1 of item E. Let's call these signals r1, r2, r3, ... rn. I also have a chest with various items and I am reading its contents. Let's call the signals derived from that c1, c2, c3, ... cn. r- and c-signals with the same index are of the same type (eg "inserter" or "accumulator").
Now I would like to know the maximum amount of E (mE) I can make with the contents of the chest.
Derived just from logic: The maximum is the minimum of the "maximums". The "maximums" are the amounts calculated, when looking at each one required item type separately.
Eg
My approach so far:
- Step 1: For each pair (rx,cx) I can set up a circuit that performs a division and returns a quotient qx. qx is the whole multiple of rx in cx. The growth rate of combinators for this step is O(n).
- Step 2: I would need to perform a calculation mE = min(q1, q2, q3, ... qn). And I believe the growth rate of combinators in this step would also be O(n). As I would perform m12 = min(q1,q2), m13= min(m12,q3), ... mE = min(m1n-1, qn)
Can you get to mE with growth rates smaller than O(n)?
Edit 2937: Added an example. Added step numbers for my approach.
Now I would like to know the maximum amount of E (mE) I can make with the contents of the chest.
Derived just from logic: The maximum is the minimum of the "maximums". The "maximums" are the amounts calculated, when looking at each one required item type separately.
Eg
Code: Select all
r1= 2, r2= 3
c1=19, c2=23
q1 = 19/2 = 9
q2 = 23/3 = 7
mE = min(9,7) = 7
- Step 1: For each pair (rx,cx) I can set up a circuit that performs a division and returns a quotient qx. qx is the whole multiple of rx in cx. The growth rate of combinators for this step is O(n).
- Step 2: I would need to perform a calculation mE = min(q1, q2, q3, ... qn). And I believe the growth rate of combinators in this step would also be O(n). As I would perform m12 = min(q1,q2), m13= min(m12,q3), ... mE = min(m1n-1, qn)
Can you get to mE with growth rates smaller than O(n)?
Edit 2937: Added an example. Added step numbers for my approach.