HTML5_Genetic_Cars
HTML5_Genetic_Cars copied to clipboard
Erroneous formula for calculating mutation size
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.