Loading...
  OR  Zero-K Name:    Password:   

What's the difference between a +10 mex and 5 +2 mexes?

31 posts, 1927 views
Post comment
Filter:    Player:  
Page of 2 (31 records)
sort
10 years ago
In terms of overdrive, how does 1 +10 mex compare to 5 +2 mexes. Apparently it is different, though it would be cool to know how in a little more detail if any pro wants to explain
+0 / -0

10 years ago
Overdrive pays to multiply mex output. IIRC, its something like 5E to double a single mex. So to double a single 10 mex to 20, you pay 5e. To double 5 2 mexes to 20, you have to pay 5x5, so 25E. Now, the OD system has diminahing returns so it does eventually make sense for the automatic OD balancing system to shunt a little bit into low-value mexes, but in general high-value mexes are such efficient metal-makers that E just floods in and metal floods out.
+0 / -0
Energy multiplies metal income. It works via this equation that I no longer need to look up.

Metal Mult = Sqrt( 1 + energy/4)

The overdrive system works on each mex individually. Every mex is allocated a certain amount of energy which determines its multiplier using the above equation. For example 12 energy into a mex doubles its income and 32 energy triples its income. Now apply this to your example.

  • 32 energy in a +10 mex = 30 metal income.
  • 32 energy in 5 +2 mexes splits to give each mex 6.4 energy. Note that splitting the energy evenly between equal mexes yields the greatest income (due to the square root). 6.4 energy in a +2 mex gives about 3.22 metal. Multiply this by 5 and we have 16.12 metal income.
+0 / -0
Skasi
10 years ago
*cough*
+0 / -0
Skasi, would you mind posting the values the two involved mexes had? I can't seem to make much sense out of your numbers...

2 solars = 1.5 e?
7 solars = 10 e?
10:3 = 3:1?
Edit: That's metal returned in the notes, not base... Well lemme look into this...

For reference, after checking out the map (@B8142), the mex values were 3.67 and 1.43.
+0 / -0
Well, after some maths and discussion with Skasi, I came to the conclusion that the current OD gadget is actually wrong the way it works.

Why?
In the example Skasi showed in the bugtracker, the ideal solution would be to give no energy to the smaller mex!


I recreated a similar situation (most likely not exactly the same energy, but it matters little). First mex has 3.67 metal, smaller mex has 1.43 metal. The amount of energy the OD gadget spends on OD (which depends on the amount of E you have stored) in this particular example is 1.84 energy, both mexes sit on separate grids that have sufficient max energy.

The amount of OD is proportional to (sqrt(1 + e/4) - 1), the -1 is there because I subtract the base amount. Check this:
maximize 3.67 (sqrt(1 + a/4) - 1) + 1.43 (sqrt(1 + b/4) - 1) with a+b = 1.84

If the formula held true for negative energy investment, it would be best to get energy out of the smaller mex and let it produce even less metal! Now, this obviously isn't allowed but with that boundary, the maximum is clearly found for b=0 and a = 1.84...
Only if the energy invested here becomes bigger than somewhere above 23 will it actually be beneficial to invest any energy into overdriving the small mex!

That sounds like a clear contradiction to how the OD gadged works at the moment.
Skasi then pointed out that "if you divide bonus metal from OD by energy invested, it will become infinite for 0 energy invested". That sounds logical, but maths has something to say about this:
plot 10 (sqrt(1 + x / 4) - 1) / x, 10 (sqrt(1 + x/4) - 1), 1 / x


I plotted the "od metal", "per cost" and "od metal per cost" functions here. You can see that, as the energy approaches 0, the amount of metal also approaches zero, and you can't put a value on 0/0, so you have to use limits:
limes x -> 0 (a (sqrt(1 +x/4) - 1) / x)
It turns out that, if you invest close to 0 energy, you get a maximum of 12.5% of the base metal per point of energy invested. But 12.5% of a small base value per point of energy can be (a lot) less than a lower percentage of a big base value, which is why not investing into the smaller mexes at all can make sense.

This is the "OD per point of energy" (as fraction of the base metal income of the mex):


You can see it starts at 12.5% (1/8) and then becomes less and less the more energy you invest.



How big of a problem is this for more realistical/important energy investments?
Well, as you invest more and more energy into your mexes, the algorithm of the OD widget becomes "more right", that is, the energy distribution for (theoretical) maximum OD metal gets closer and closer to the one the game uses. However, let's take the example of 100 energy for the 2 mexes (that's a lot I'd say, if you hold 20 mexes that would be 1000 unused energy income):
Theoretical maximum: 15.37 OD metal.
If I recall the current algorithm correctly, it will distribute energy proportional to the square of the base income. This would result in 15.35 metal. To be honest, that's less difference than I'd have expected...

Another example: 10 energy for the 2 mexes:
Optimum: 3.255 metal from OD
Current: 3.083 metal from OD

1 energy for the 2 mexes (yeah, that's really not a lot):
Optimum: 0.808 m
Current: 0.402 m
Well, that's 1 more bandit of the span of 3.3 minutes. Doesn't sound like much but this can actually make a difference.

Although the effect is kind of marginal overall, i have to say, since it only ever occurs with bigger mexes in the first place (and most maps having only equal mexes).
I'll look into bigger amounts of smaller mexes in a moment. Or tomorrow.

Now the challenging part will be devising an algorithm that can actually work out how to properly distribute the energy to all grids for maximum OD. Well, food for thought, I'll give it a shot. Although it's likely not very high-priority.
+1 / -0
This is game breaking. Makes the game literally unplayable.

I always assumed that the energy was evenly split between all the mexes, but apparently its smarter than that. Ive noticed this game has lots of little things like that everywhere.

Ive also noticed none of them are documented and nabs like me get confused.
+0 / -0
on icy shell v01
+1.75m mex and +5m mex

http://i.imgur.com/znPk2Ir.jpg?1
8e grid on mexs 8e on com 0.3e nano
using 22 to build
full E store

1.91e to +5 mex +1.09m (1.077 theoretical)
.23e to 1.75 mex +0.05m (0.049 theoretical)

1.91+.23=2.14
5-(5*Sqrt(1+2.12/4))=1.194
1.077-1.194=0.117m




http://i.imgur.com/DmK2wfv.jpg?1
8 grid on +1.75mex 18 on +5Mex 8 on com 0.3 nano
using 22 to build
full E store

10.95 to +5 mex 4.67m (4.667 theoretical)
1.35 to 1.75 mex 0.27m (.274 theoretical)

10.95+1.35=12.3
5-(5*Sqrt(1+12.3/4))=5.093m
4.667-5.093=0.426m

http://i.imgur.com/0PsGvYs.jpg?1
with 3 mex 2 +1.75m and 1 +5m
-22E drain
full E store

+5m mex takes full 8e grid
works properly as expected



conclusion : game breaking? no; buggy? a bit
less then 10% lost, only if you have literaly just 2 mex

+0 / -0
Well, don't be fooled by "only if you have 2 mexes".

Look at this example with 1 big mex and 20 smaller ones:
http://pastebin.com/6HWf5VFN
(You can convince yourself that the W|A inputs are correct by writing the equations down for all the mexes individually and then seeing how you can merge the terms).

The optimal solution here would still be to give all e to the big mex, but the current algorithm allocates a significant amount to the small mexes. This results in about 20% less OD.

Now, realistically, you won't have all your small mexes linked to the grid in most cases, but you would actually gain quite a bit more metal from keeping your e linked only to the big mex, not the smaller ones.

The saving grace for the current gadget here is that OD figures will always be pretty small in comparison to the base mex output unless you invest quite a bit of energy, in which case the gadget's error becomes smaller.


To give a more roundabout answer to the OP question: If you have a set of n mexes that, in total, have the same base income as one big mex, then you need n times as much energy to get the same amount of OD metal out of the smaller ones as the big one.

PS: GBrankKyubey, get your minus signs straight:
1.077-1.194=0.117m <- wrong, that's -0.117 (similar for many parts of your calculation). You're getting the correct figure but do some wonky stuff with the signs.
+0 / -0


10 years ago
These numerical solutions are decent examples. Those of a more analytical leaning could have a go at solving the problem in general. If you give an optimization algorithm or function you don't even have to write any code.

We may not use an algorithm which is too difficult to compute because the current one can be done really easily and is pretty good.
+0 / -0
Yeah, I looked into this yesterday night. I noticed that, for maxima with all energy investments being positive, the derivatives of the individual mex od functions are all equal.

That is, say you have 2 mexes with base income m_a and m_b and you invest e_a and e_b into them for OD, then at the maximum OD return you will have

derivative(m_a * (sqrt(1 + e_a/4) - 1)) = derivative(m_b * (sqrt(1 + e_b/4) - 1)),
or with the actual derivatives:
m_a / (4 sqrt(e_a + 4)) = m_b / (4 sqrt(e_b + 4))

(Still held true for 4 different mexes, so I would assume that it applies to any number).

Now, confusingly enough, if any of the energy investments at the global maximum were negative, the above didn't hold. I wasn't awake enough to figure it out any deeper and also don't have enough time on my hands for this at the moment.

I currently can't come up with an algorithm that does not possibly lead to having to redo the calculation each time the optimum would involve a negative energy investment (which you could then safely set to 0 and start over). Since this is likely more "difficult" (as in, computationally expensive) than we want, a different approach would be needed. I'm not sure if iteratively constructing or approaching the optimum would be a good idea.


Studying the locus curve of the optimal investments per mex (depending on the amount of e available for OD) in the case with just two mexes (= two dimensional search space [two e inputs] with one dimensional constraint [sum of investments is fixed], it can even be visualized) might be enlightnening.

Have a look at (for example) this. As expected, the maximum total OD involves a square root of the total energy invested, the optimal energy investments per mex are linear functions (this sort of surprised me).
Finding how those functions depend on the involved mex incomes would be quite helpful, but an analytical derivation would be even better.

W|A breaks down when trying to add more mexes (taking the problem to the next dimension, literally), which sort of limits my investigative power here. I'd mainly be interested if the optimal energy investments still depend linearly on the total energy.
+0 / -0
Skasi
10 years ago
quote:
Now, realistically, you won't have all your small mexes linked to the grid in most cases, but you would actually gain quite a bit more metal from keeping your e linked only to the big mex, not the smaller ones.

Ha, I do that since I reported the bug! All hail Skasipro the bro pro of bro pro pros!
+0 / -0
I think that's not always beneficial. Sometimes the OD gadget gives less than optimal e to the small mexes and too much to the big ones... I don't have the example around anymore though.



About the algorithm:
Assuming my observation about "equal derivatives" holds true, all the requested values could be calculated directly. Let me go through this myself before I post it though, to check if it works out.

Edit: Gah, i should really use an interpreter here... Well, no time to get into that...
My algorithm successfully managed the first example, working on verifying a second one.
+0 / -0
Skasi
10 years ago
Well what I do is I sometimes try to use grids for different mexes. All mexes with base output x are linked together, all mexes with base output y are linked together. Then I try to keep grid colors balanced.
+0 / -0
Well, here it is!

Computationally inexpensive, straightforward and so far passing all examples :D

(I'll spare the derivation of these formulas, I already outlined it above).

Input: n mexes, mex incomes m_i, energy available for OD E
Output: Allocated energies per mex e_i

1. Calculate k = 1/(4 sqrt(E + 4 n)) * sqrt(sum(m_i²))
2. For each mex, set e_i = m_i²/(16 k²) - 4

That's basically it.

Exceptions:
-This formula may result in negative e values, in which case the respective e_i should be set to 0 and the calculation restarted (this time omitting that particular mex that is not worth overdriving).
-If any grid doesn't hold enough e for the requested amounts, solve the problem for the grid locally (with E = the max e available in the grid) and redo the calculation for the remaining stuff (with the remaining energy). (This is basically what the current algorithm already does).

It will make sense to calculate the e_i beginning with the smallest mexes, so that negative values can immediately be ruled out. k will have to be recalculated each time, but that's acceptable (applying that formula even for every mex should really not be a problem if you have all the m_i at hand).

2 examples (2 mexes, 3 mexes) of cases without the exceptions:
http://pastebin.com/b3AjS5HD

No more manual grid color balancing :)

PS: It's sort of odd to notice that the current gadged is actually quite close, seeing as it uses energy proportional to m_i², too. It's just (sort of) missing the constant term there. Well, I really can't get a decent interpretation out of that formula atm (although i notice now that there's some cancellation I missed, the 16 in the second formula is pretty unnecessary if you just cancel it with the first 4 in the first formula. I'd just introduce mistakes if I'd attempt to change it now).
Also note that I have no proof for this formula thus far. The "equal derivatives" was just sort of empirical from 3 examples, please tell me if you manage to find a counter-example! (SCIENCE!)

Well, that felt good. I need to do this stuff more often :P
+1 / -0
Skasi
10 years ago
Woohoo! Mauran for lead dev! (sorry xponen)
+0 / -0


10 years ago
Well done, the amount of restarting is worrying though. There can already be a lot of restarting with the current algorithm due to maxed grids. You have added a lot of square roots which may need to be redone many times if a restart occurs.

Do you think there is a way to exclude all the negative value mexes in one pass without recalculating k? Even that would not be one pass because later discovery of a maxed grid would give you extra energy which could send some mexes positive. At least maxed grids do not need recalculating once they are discovered and done. The extra complexity is still worrying.

The Overdrive gadget is unreasonably slow already although I will probably give this algorithm a go sometime and see how it performs.
+0 / -0

10 years ago
Really? 2 square roots per calculation is a lot? Seems like i need to lower my standards, lol.
+0 / -0
10 years ago
It is if it is calculated every second for every mex.
+0 / -0


10 years ago
Wait, you are squaring it anyway, and there is no addition involved outside of roots, so why bother with the root in the first place?

AFAICT k² = sum(m_i²)/(16 (E + 4n))
thus e_i = (256 * m_i² * (E + 4n)) / (16 * sum(m_i²)) - 4
+0 / -0
Page of 2 (31 records)