mk
im pretty sure your wrong. only for cti 500 is max (current + max)/2
for cti of 1 it does return close to max value
ex.
current 1500 max 3000 cti 1
returns 2994.0299
theres a gap value thats multiplied against and this creates an add value that closes the gap.
so it does pass your second test. i tested all this myself in a similar fashion to ensure it reached near max. ill have to post the google sheet later.
btw. we did a simple fix for values over or at max. we just returm current.
man... all that talk about my method, and a 1500/3000 on sim3 is 2250 (i.e. (current + max)/2)not sure on this one
the problem with all this code, is we need to figure it out, because Splinterz is on the cusp of his next release, and you keep getting my formula wrong... dogging it and all is frustrating when your saying incorrect things about it.
I don't really care what formula we use, but it irks me when you say it's broken, but you point out things that aren't broken.
so it makes it harder for Splinterz to figure out what goes into v20.
I'm working on getting a comparison between your sim3 and mine right now, going to graph it and display it.
update:
now it's my turn.
yours and mine seem to be on par with each other... until you get to 1 CTI, then what happens?
your's goes negative... in all fairness though, it only does it for 1, and not 2...
This all started because I want to feed the values back into the bins (which I now firmly believe can be done safely), so I came up with a formula I understood in order to do so, but now I understand how att_sim works... so I don't think it matters if we feed it in or not, it just scales things back down to the normal bin frequencys (Splinterz concern all along was your formula was producing really large #'s... which to be honest, could have just been re-merged with the original value, which I was doing... so like I said, I don't care what value we use).
here's sim3 vs my code, and to be honest, they produce VERY SIMILAR NUMBERS, yet mine produces numbers that work with any range of CTI 1 to 1000+... to be honest, the code is in your credit, I had no idea how to reduce the scale, but it's more workable, and doesn't need to cap any values to work
#include <iostream>
#include<stdio.h>
#include <math.h>
using namespace std;
const int default_cti = 500; //set as default... values above/below will adjust accordingly.
int sim3 (int att, int cap, int CTI)
{
if (att > cap)
return att;
int sim_value = 2000;
int att_sim = sim_value * default_cti / CTI; //default_cti could be a weighted average of all cti's.
int max_delta = (cap - att) > att_sim? att_sim : (cap - att);
long ret = ((att + att + max_delta) * max_delta) /2 ;
ret += (att_sim - max_delta) * cap;
ret /= att_sim;
return (int)ret;
}
int mySim (int att, int cap, int CTI)
{
//int CTI; //Cost to improve as described via tokens.
//int max; //dwarf's max attribute
//int current; //dwarf's current attribute
float mod_Att_Value;
float add_value;
if(att>=5000)
{
return 5000;
}
float gap = (float(cap) - float(att)) * default_cti / CTI;
float normalized_gap = 0.5 * (1 - gap / (float(cap) - float(att)));
if (normalized_gap >= 0)
normalized_gap += 0.5; // Values <0, 0.5> reserved for those suitable for a task.
else
normalized_gap = -0.5 / (normalized_gap - 1.0);
add_value = normalized_gap * gap;
mod_Att_Value = att + add_value; //can weight mod_Att_Value against current value for weighted average
return int(mod_Att_Value);
}
int main()
{
int ret = 3;
int att;
int cap;
int CTI;
//att_sim is based on median possible gain, not sure if it should be based on average possible gain, or median possible gain, or max possible gain
//formula is ((median*.5) + (((5th bin + 6th bin)/2) *.5)
/*
450:950:1150:1250:1350:1550:2250
(1250*.5)+((1350+1550)/2)*.5
=1350
*/
printf("input:\n current, cap, CTI\n\n");
printf("output:\n current, cap, CTI, sim3, mine\n\n");
while (ret = scanf("%d %d %d", &att, &cap, &CTI) == 3)
{
printf("%d, %d, %d, %d, %d\n", att, cap, CTI, sim3(att, cap, CTI), mySim(att, cap, CTI));
}
return 0;
}
I will post some sheets to show comparisons.
and here's a spreadsheet
https://docs.google.com/spreadsheet/pub?key=0AvBdaXUaNVMndEFqV2pkckJjeFFvRkM4RjBNcjU1WEE&output=htmljust in case this didn't get posted on google docs and linked properly
current cap CTI sim3 mine
375 1000 600 882 678
500 1000 600 924 743
625 1000 600 957 807
750 2000 600 1531 1357
1000 2000 600 1699 1486
1250 2000 600 1831 1614
1125 3000 600 1958 2036
1500 3000 600 2324 2229
1875 3000 600 2620 2421
1500 4000 600 2333 2715
2000 4000 600 2833 2972
2500 4000 600 3324 3229
1875 5000 600 2708 3394
2500 5000 600 3333 3715
3125 5000 600 3958 4036
2250 5000 600 3083 3586
3000 5000 600 3833 3972
3750 5000 600 4531 4357
2625 5000 600 3458 3779
3500 5000 600 4324 4229
4375 5000 600 4882 4678
3000 5000 600 3833 3972
4000 5000 600 4699 4486
5000 5000 600 5000 5000
3750 5000 600 4531 4357
5000 5000 600 5000 5000
375 1000 500 902 687
500 1000 500 937 750
625 1000 500 964 812
750 2000 500 1609 1375
1000 2000 500 1750 1500
1250 2000 500 1859 1625
1125 3000 500 2121 2062
1500 3000 500 2437 2250
1875 3000 500 2683 2437
1500 4000 500 2500 2750
2000 4000 500 3000 3000
2500 4000 500 3437 3250
1875 5000 500 2875 3437
2500 5000 500 3500 3750
3125 5000 500 4121 4062
2250 5000 500 3250 3625
3000 5000 500 4000 4000
3750 5000 500 4609 4375
2625 5000 500 3625 3812
3500 5000 500 4437 4250
4375 5000 500 4902 4687
3000 5000 500 4000 4000
4000 5000 500 4750 4500
5000 5000 500 5000 5000
3750 5000 500 4609 4375
5000 5000 500 5000 5000
375 1000 250 951 791
500 1000 250 968 833
625 1000 250 982 875
750 2000 250 1804 1583
1000 2000 250 1875 1666
1250 2000 250 1929 1750
1125 3000 250 2560 2375
1500 3000 250 2718 2500
1875 3000 250 2841 2625
1500 4000 250 3218 3166
2000 4000 250 3500 3333
2500 4000 250 3718 3500
1875 5000 250 3779 3958
2500 5000 250 4218 4166
3125 5000 250 4560 4375
2250 5000 250 4054 4083
3000 5000 250 4500 4333
3750 5000 250 4804 4583
2625 5000 250 4294 4208
3500 5000 250 4718 4500
4375 5000 250 4951 4791
3000 5000 250 4500 4333
4000 5000 250 4875 4666
5000 5000 250 5000 5000
3750 5000 250 4804 4583
5000 5000 250 5000 5000
375 1000 100 980 895
500 1000 100 987 916
625 1000 100 992 937
750 2000 100 1921 1791
1000 2000 100 1950 1833
1250 2000 100 1971 1875
1125 3000 100 2824 2687
1500 3000 100 2887 2750
1875 3000 100 2936 2812
1500 4000 100 3687 3583
2000 4000 100 3800 3666
2500 4000 100 3887 3750
1875 5000 100 4511 4479
2500 5000 100 4687 4583
3125 5000 100 4824 4687
2250 5000 100 4621 4541
3000 5000 100 4800 4666
3750 5000 100 4921 4791
2625 5000 100 4717 4604
3500 5000 100 4887 4750
4375 5000 100 4980 4895
3000 5000 100 4800 4666
4000 5000 100 4950 4833
5000 5000 100 5000 5000
3750 5000 100 4921 4791
5000 5000 100 5000 5000
375 1000 50 990 943
500 1000 50 993 954
625 1000 50 996 965
750 2000 50 1960 1886
1000 2000 50 1975 1909
1250 2000 50 1985 1931
1125 3000 50 2912 2829
1500 3000 50 2943 2863
1875 3000 50 2968 2897
1500 4000 50 3843 3772
2000 4000 50 3900 3818
2500 4000 50 3943 3863
1875 5000 50 4755 4715
2500 5000 50 4843 4772
3125 5000 50 4912 4829
2250 5000 50 4810 4750
3000 5000 50 4900 4818
3750 5000 50 4960 4886
2625 5000 50 4858 4784
3500 5000 50 4943 4863
4375 5000 50 4990 4943
3000 5000 50 4900 4818
4000 5000 50 4975 4909
5000 5000 50 5000 5000
3750 5000 50 4960 4886
5000 5000 50 5000 5000
we're honestly crying over small differences... I'm just going to chock it up to you not following my formula through all the way. However, you seem to be quite aloof to reading about things you have an understanding of (I'm choosing my words carefully here)...
which means you miss the details (hence the comment on reading/responding to emails).
I'm saying here, that my formula does account for low CTI's, as you can see, as well as high CTI's...
so what's the diff. The only reason I created it was to feed it back into the frequency bins... I know what mine's doing, yours is doing some area measurements under some sort of curve that I don't get, but they do the same thing in the end, graph it any which way you want, and give some honest feedback (please, lets just comment and be honest in the shortcomings).
question?
BTW, in case you didn't notice this yourself, your graphs for sim3 had 2 intervals where they were linear: before the cap and after the cap.
link please?
Hey Maklak...
I don't want you thinking I'm hating on you, I'm just trying to figure this shit out. If we can't implement it without not knowing how it works, it's like magic to us...
I've been rereading, and you posted this
sim3 gives you the predicted average attribute value during some some hypothethical gain. If you don't hit a cap, it returns "att + att_sim/2" (the formulas it uses do exactly this, except are more complex to handle the second part. After you hit the cap, value returned by sim3 is between "(att_cap+att)/2" and "att_cap". It increases with att_sim at the speed of "x/(1+x)" (If you really want me to, I can derive the formula for this).
which looks quite similar to my (current + max)/2 concept...
so I think we're hitting on the same things, maybe you can explain SUPER LAMEN terms how what I conjured compares with yours (I know you don't owe us that, but if you present it, then Splinterz will understand, and be that much better to make his decision on v20!)...
Update:
Here's a pic of it graphed (sorted by current smallest to largest, cap smallest to largest, cti largest to smallest)