I'm trying to create an idea fitness function using an inverse parabola but I'm struggling with the math.
Basically what I have is:
score = -1 * (actual-ideal)^2 + weight
Or 0 if the score is negative. This works great except that it's not flat enough, and it gives no score if the actual isn't close enough to the idea (at least not a positive value).
What I would ideally like is some kind of minimum score, so that f(0)=0, f(1)>0, etc. and anything above that in terms of x has some kind of value peaking at the ideal value.
Even better would be if I could have the score slowly decrease when the value goes past the ideal, but I'm ok with say 2*ideal being 0, so it's an inverse parabola. A more complex function would be awesome but right now I'm just looking for something simpler.
How would you adjust the equation above so that the score always starts at 0 and peaks out at the ideal?