Sakarah / GeneTipe

OCaml Genetic Algorithm student project for French TIPE
GNU General Public License v3.0
5 stars 2 forks source link

0% fitness while exact match because of float approximation #5

Closed Sakarah closed 8 years ago

Sakarah commented 8 years ago

When we tested the algorithm on the 10^x function with points from 0 to 10 we got the perfect match after simplification of the population while the fitness was still near 0%. This is caused by float approximation with huge values. Could we find ideas to fix that ?

nchataing commented 8 years ago

As I suggested, we can change the fitness function to determine the dy/y error.

Fitness = sqrt [ sum {for x in points} abs((y-f(x))/y)^2 ]

nchataing commented 8 years ago

After changing that, we can see that the problem isn't due to float approximation yet to bad constant management.