#Quality calculation question
1 messages · Page 1 of 1 (latest)
The only thing I can say about the code is that I don't understand what's going on due to missing comments. Can you tell me more about what it is that you want to calculate and how you want to calculate it?
I think it requires a combination of matrices and limit theory. By repeatedly applying the transform matrix to the input condition you will eventually settle on a limit which is the fraction of product at each stage of the quality pipeline, which then could be converted into a ratio.
I used octave to perform the required repeated matrix multiplication.
You can "pretend" it's a geometric sum and get the result in the limit in a single step.
Don't think you can skip matrices though.
I don't see any matrices in that code, but it's Python so who knows what data types those variables are.
Sorry for the confusion, usually I dont share code so I dont have a habbit of creating good comments. My idea is that I input the amount of assemblers I have before the recycling cycle (currently 12), and I get the amount of assemblers I need of each rarity to get a good ratio. I added some comments, hope that helps. Btw, matrices can be represented by lists of lists, or with numpy. Right now I am using matrices only for the chance modifiers provided by the quality modules, but I could see how using them could help
comments are for yourself. most of the people who'll ever look at your code is future you. :)
heh, +1 for using zero indexed quality levels
Is that really all your code? I have 130 lines just for matrix multiplications.
200 for the quality functions
and 300 in main
written in C++, obviously more verbose
Well matix multiplication isnt really used (could be why its not really working) since I only multiply vectors with numbers and by adding each result I am multiplying a vector with a matrix I think
No not really, just a small bit that adds lists because I was to lazy to look if there was something for that
I started prototyping in Excel
good to see what's going on
only after I understood what's going on, how to represent everything, did I move to C++
Matrix multiplication is normally 1 line as you use an appropiate maths library (do not reinvent the wheel, you will likely end up making it square).
Do you need a program to solve this? The ratios are pretty well defined by tables, and you can just multiply them by the number of input machines to get the number of machines at each tier.
Well the tables dont take the recycling loop into account I think
I find that crafting machine ratio is more complex than material cost by quite a margin.
Sorry I dont follow, what do you mean?
Number of input machines does not matter since once you have a ratio table, you can sclar multiply that by the number of input machines to know how many machines at each stage. That table should be constant for all the same module configuration.
me?
The way I calculate material cost, I process the input quality level by quality level. With my geometric sum trick, I can eliminate a quality level in a single "step". (i.e. crafting -> recycling).
Let's say I start out with 100% normal quality. Crafting everything into a product and recycling normal quality level back to ingredients will give back 14% of the original input.
Multiply the product amount from the crafting with ~1.16 to correct for omitting the infinite recursion (that's the geometric sum part) and do the same with uncommon quality next, etc.
In the end, only Legendary quality remains. The inverse of the amount is the material cost.
None of that involves any actual item flow, which is what I'd need for calculating the ratio of the crafting machines. So I have to tear it apart into smaller steps that don't play nice.
will go to bed now, feel free to ask more, will answer when I'm back from work
I wonder if a state transition table would work except with an extra state that totals the amount that milled through one of the lower quality states.
Example. This is for processing unit loop with EM plant with +300% productivity and recycler with all legendary quality 3. Qualities common to rare only for simplicity sake (others would require larger matrix).
This says a ratio of 5 to 4 to 1 would be sufficient.
Calculation done with 1,000 cycles.
Did you check the wiki quality page? Maybe you will find answers without doing what's already done ?
https://wiki.factorio.com/Quality
A different way to explain the added complexity for building ratios:
Let's assume we're talking about an item that has infinite productivity research.
As infinite prod increases, there is a point where with all bonuses combined, +300% prod is possible.
To minimise material cost, number of prod mods in a quality cycler goes up before that point and hits full prod at that point.
Material cost for legendary is 1 at that point. A further increase of infinite prod research will not decrease material cost.
But it'll free up module slots that can be used for quality modules, improving conversion rate.
And this conversion rate requires extra logic for calculating machine ratios/flow rates.