UGH, I find it extremely difficult to figure out what your post is about, but I'll try to clarify. Also, re-read my last post.
sim3 is supposed to simulate some time spent gaining an attribute, then tell you what was the average value for that attribute during that time. This much should be obvious from the trapezoid + rectangle formulas for ret. Anyway, what the sim3 returns, you need to treat as a predicted attribute value a few years ahead.
I don't know what any of this has to do with producing values for bins. I think taking this and accounting for vampires and other attribute-boosting interactions will suffice:
int att_cap = initial + ((initial > median) ? initial : median);
> I understand the concern of these values represent values after embark, but our frequency bin has a range of %s reserved for this area.
You mean the 1% assumed frequency for attributes above the maximum?
> Take strength of 4500 (vanilla) for example. In our frequency distribution, that maps to 85%.
> if we take a sim1 of 4500/5k, then that value comes out to be 90%.
85% ow what? 90% of what. What does any of this have to do with anything?
> Also, the sim approach has an att_cap included now that is inclusive of a dwarf's max possible gain, further allowing integration into our original % distribution scheme.
See above.
> The frequency distribution we have setup already accounts for values that are generated after embark, we just try to fit it into our distribution scheme, whether values less than lowest raw are a certain %, and values above last raw are a new 98/7% range (i.e. a 14% range).
This looks like something from the way you construct bins. It has nothing to do with sim3 as far as I'm concerned.
> by mixing in a sim1/5k, we're basically introducing new values and saying their higher than a normal 4500 (which would be 85% vs 90%).
> So by converting sim1 (actually sim3, modified) back to our frequency distribution, we are converting this new number back into a matching # in our frequency distribution, before averaging them
Ah, I think I understand what you're trying to do now. You want to assume some attribute gain over time and modify the attribute bins accordingly. Well, for current population and a selected attribute you can calculate the average attribute gain so far:
sum = sum by all dwarves { ((att -initial)*CTI_for_his_caste*caste_frequency)/500 }
average = sum / number_of_dwarves.
Heck, you can even feed that to sim3, assuming you get a reasonable value (above 100).
> max for strength in our frequency bin is 4500
OK, but what about a very strong Dwarf becoming a vampire and having 5000 strength? This is not a hypothetical question. The FoE mod I play has "Power Armour Potion" - one use per dwarf, but boosts some attributes by 2000.
> max generated with this sim3 approach I guess is 4500
Unless att >= 4500, the value generated by sim3 will be <= 4500.
> What to base att_sim on, avg, median gain, or max gain?
Keep in mind that really big gains in attributes, exceeding a thousand, are rare. They only really happen for military ponies. Gaining 4000 or 5000 in an attribute never ever happens, so be a realist here. I think this should either be some arbitrary value for each attribute or something based on the "average median" for all castes. (I'm not kidding, take medians for all castes and get their arithmetic average, based on caste frequencies.)
> Merge ret result back into frequency bin?
It might work with caution and knowing exactly what you do, but looking at your mathematical recklessness so far, don't bother or you will get it wrong.
Your program still uses the wrong formula for factoring in CTI, as proven by Splinterz and explained by me. The correct one is this:
att_sim = (att_sim * 500) / CTI;