Talk:Evolutionary algorithm: Difference between revisions
→Problem in previous Python implementation: use syntaxhighlight tags instead of lang
(→Problem in previous Python implementation: use syntaxhighlight tags instead of lang) |
|||
Line 78:
== Problem in previous Python implementation ==
In the first Python example:
<
'Less mutation the closer the fit of the parent'
#This formula does not work as intended because it performs int division
return 1-((perfectfitness - fitness(parent)) / perfectfitness * (1 - minmutaterate))
</syntaxhighlight>
For ex- ((20 - 10)/20*(1-0.09)) will evaluate to 0
Thus it gets stuck in an infinite loop waiting for mutation to occur.
|