Talk:Evolutionary algorithm: Difference between revisions

(→‎Tacit J solution: The more the merrier)
Line 50:
 
: Put them both in, while explaining the ways in which each is better than the other (perhaps with a little more explanatory text than above). It's a shame that there isn't highlighting for [[J]] yet (especially the comments) as that would aid reading. –[[User:Dkf|Donal Fellows]] 08:59, 5 November 2009 (UTC)
 
== Problem in previous Python implementation ==
In the first Python example:
<lang Python>def mutaterate():
'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))</lang>
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.
Edited the program to avoid this by casting perfectfitness as float.
--lookog --14:22, 26 February 2010 (UTC)
Anonymous user