Has anyone wrote any code to find the optimal balance(given a set of constraints) for stam, def, avoidance, etc...?

What I'm suggesting is for someone to write an algorithm that tries various combination of gems, enchants, and possibly other things(gear, buffs, etc...) to maximize survivability or other such things.

The idea is that given a set of parameters such as hps, boss_dps, spike damage, etc... one can somewhat easily find a maximium set of parameters that will maximize survivability.

For example, assuming gems only with no socket bonus for plate tanks(stam + def), one has

loss_hpps = hps - boss_dps.

boss_dps is modified by avoidance and block. We can see here that stam gems are useless for this if boss_dps is average. Hence stam gems only provide a buffer for healers to heal you or for spike damage.

e.g., Suppose you have 30k hp and your fighting a boss that every once in a while does 29k unmitigated damage to you, the tank, and does 90% damage to each person in the raid. In a situation like this it would be wise to have more hp to allow the healers to heal the raid. If you had 60k hp then it might not be an issue for the spike damage since the healers can easily heal up the raid without worrying about the tank.

OTOH, if you can survive all spike damage well then the extra def will increase survivability mitigating most damage. In the example above, if you have 30k hp but the 29k is mitigated to 10k because of the high def then you effectively have about 90k health. (just an example, obvious stam stacking will have some mitigation too)

So the idea is to find the effective health one has. Stam stacking is easy as that just adds to the base hp. Def stacking is more complex because of diminishing returns(hence there is a point when adding def is worthless and the idea is to find that point(which depends on how much stam you can add)).

It's obvious that not all scenarios are identical and in some cases one would want stam stacking while others one wants def. In the above example if the damage is unmitigated and it is now 35k then 30k hp is not enough no matter how much def you have and you must increase your hp by at least 5k for any chance of survivability.

So a basic algorithm for finding the best gems given a set of conditions(such as boss damage, spike damage, hps, etc..) would be quite easy to implement. I'm not quite sure how effectively it would be without decent approximations to different scenarios. One, of course, could mine the data needed by monitoring boss encounters.

In any case if anyone is interested in discussing and potentially developing a useful addon/algorithm feel free to comment. Maybe eventually I'll have the time to explore this more. Obviously it is a very complex issue because of all the variables involved but it should not be difficult to get some approximation to maximizing survivability for most encounters.

(and a similar procedure could be used for healing and dps)