HTML5_Genetic_Cars icon indicating copy to clipboard operation
HTML5_Genetic_Cars copied to clipboard

Erroneous formula for calculating mutation size

Open imranimtiaz opened this issue 1 year ago • 0 comments
trafficstars

In the mutateNormal function, the way mutation_range is applied seems problematic. The current formula used is originalValue - 0.5 + random() * mutation_range (excluding clamping for simplicity). This approach causes mutated values to quickly shrink to the range [0, mutation_range] when the mutation_range is small, leading to reduced variation over generations.

A more suitable formula would be originalValue + (random() - 0.5) * mutation_range, which ensures that the distribution of mutated values remains centered around originalValue, even when no clamping is applied.

imranimtiaz avatar Sep 12 '24 05:09 imranimtiaz