blazespinnaker wrote: ↑Thu Dec 31, 2020 10:47 pm
Btw, what does your production curve look like? It would be a reasonable representational summary of your solution.
It looks like an exponential. Solutions of these kinds of equations are linear combination of exponential (or polynomials times exponential in rare cases), and they mostly look like their main -biggest- component.
Patching several such linear phase should look like patched exponentials.
Very useful would be code, but if not, than something a bit more cookbook. A list of inputs, outputs, and straightforward summary of transformations performed. This can be used to quickly check correctness.
I've only scratched the surface, it will take more time to get to that point. Difficulties will arise when there are no obvious strategy. When there is only one way to do each things (eg burner drill is the only drill, stone furnace is the only furnace, assembler1 is the only assembler), it should be relatively easy using only linear algebra, otherwise, we're entering convex optimization I think, and I don't see a way to automate it yet.
Also patching phases (when you start too far from perfect ratio, eg with resources you can't instantly spend) looks hard to automate.
Any references on this I can check out that this is building on, or purely original work? I'll dig in more deeply, but it deserves some careful consideration before responding in full.
All orignal work in the sense I did not look up anything to write it, I just summoned what I learnt in undergrad and digested over the years. But I would be very surprised if it hasn't been done elsewhere already, though not necessarilly for factorio or even video games. I'll look it up and see if I can give pointers cleaner than what I've done in a forum post.
The Prismata community came up with some very similar notion, and I thought they used matrices as well, but they didn't, they use direct calculation, and recursion when things beome intricate. For the most part, it's all about linear systems, so it's not surprising that matrices are not necessary, but become very useful for intricate system (and my 1st example isn't intricate enough to demonstrate their power IMO, but an example accounting for assembler should be).
The game is free to play on steam if you want to understand it more before diving into the math. The mathematically interesting bits can be found here:
https://www.reddit.com/r/Prismata/wiki/ ... /inflation
https://yujiri.xyz/prismata/math
It should also hint at ways to optimize growth in factorio. What they call inflation of a unit is really it's interest rate.
However, the interest rate of the best units in a set do correspond to a global inflation, hence the name. This concept is especially useful to assess the strength of units whose power comes delayed. Transpose to factorio, an inflation (corresponding to the current growth rate) could be useful to account for latency; for example, if inflation is 10% per minutes, an outpost with 2 minutes latency is virtually 10% more expensive than the same outpost with 1 minute latency.
Gather rate of workers are known and put to good use in any RTS game, but they're usually too fast pace, too interactive and the map is too finite for math to be useful for economy beyond gather rate and consumption rate of production buildings (such maths could be used to find new build orders, but the search space is usually tight enough that you'd be likely to find something that isn't new, isn't good or isn't too different from something which already exists).
In general, I will say that algorithmic simulation using various gradient heuristic and searching strategies is the only way to solve this problem with any degree of accuracy and completeness. This is simply due to the nature of the beast and behavior of the many conditional particulars of problem.
I'm pretty sure there are ways to prove that Dave's or my solution are perfect with regard to some simplified versions of the problem (mine for example optimizes for assymptotic growth of everything instead of 10 minutes number of miners).
The more things you account for, the harder it is to get an exact solutions though, and the place of solution of simplified problems is, I guess, to provide guidlines to players, and a starting point (and maybe heuristics) to a more complete simulation.
The one conditional particular that overwhelms everything is reach + walking distance. The ultimate rate limiter in pre-bot factorio.
[...]
Sadly, however, it didn't use bots, which I think would have been approaching the perfect solution. Writing a TAS script would be challenging enough, no doubt.
That all said, perhaps this all really should just be a bot discussion and should be framed as such. It would help remove the walking distance problem.
I think it's good to have a discussion about growth, and this is how I understood this thread. Bots could use their own discussion, but relative to growth they're only one piece of the puzzle (the last one).
I'm not convinced bots are necessary for TAS any%. The same way automation is not necessary until after your resource gathering rate exceeds your initial crafting rate, Bots aren't necessary until after your mall outpaces your building rate, and while it's common wisdom humans should get bots early, I have zero clue as to where the exact point lies for them, even less for tool assisted runs.
The building rate of a TA runner being much higher than those of a regular human, I would expect bot to be only be useful much later for him (in progression, not necessarilly in time). So late that they might have already launched a rocket.
Now it's a really complex problem, which also depend on whether you're still handfeeding (handfeeding might be so good as a TA it might or might not be worth doing it the whole game even if it competes with building). Also, bear in minds that a TA runner can increase its speed with stone paths, belts, and vehicles (and place stone walls to insta break when needed), probably multiplying its effective speed by 2 or so, and multiplying its building speed as well.
It's not the first time I ponder these kind of questions, and I want to tackle them cleanly and comprehensively at some point, so I totally get why you're interested in cookbook and graphs and I intend to give some eventually, but it's gonna take time.