colgreen / sharpneat

SharpNEAT - Evolution of Neural Networks. A C# .NET Framework.
https://sharpneat.sourceforge.io/
Other
380 stars 97 forks source link

FeatureRequest: Allow min fitness so that zero is the perfect answer #38

Closed naigonakoii closed 5 years ago

naigonakoii commented 5 years ago

I'm trying to evolve something and my fitness function is based on penalty points, such that a fitness of zero would be no penalty or a perfect score. However, it looks like the newest implementation still only supports fitness max values. There should be a property that can be passed into the neat class that allows the fitness to be a less than compare instead of a greater than. It's a minor feature but very annoying for me to try and translate, as it is really tough to know the actually maximum possible penalty in my case.

colgreen commented 5 years ago

One option to consider is a function such as:

fitness = 1 / (1+ penalty)

or variations on that function.

naigonakoii commented 5 years ago

Um... yes that would work pretty well. I'll close this for now since it's pretty unimportant and there's a workaround.