Many researchs have shown that probably the best way to implement a GA is to use uniform crossove with a mutation rate of 0.05. This should be used with a steady-state GA meaning that the population of the GA should stay constant, while the worst genes are being replaced each time.
Uniform crossover means that given two parents, there is a 50% chance you''ll take a bit from a certain parent to use in a child. So, the code would go something like follow for crossover:
for (i = 0; i < gene_length; i++)
{
if (random() < 0.5)
{
child = parent1<br> }<br> else<br> {<br> child = parent2<br> }<br>}<br><br>This is used to generate one child, yet it is possible to use this to generate two off springs as well.<br><br>As for selection, I usually get the best results when I select the gene with the best fitness as one of the parents all the time. Then randomly select the second parent from the population. </i>
GA doesn't perform well
The above is NOT uniform crossover , at least not as it was originally implemented by Holland in his canonical Genetic Algorithm. Uniform crossover uses a uniform probability distribution to select a crossover site within the chromosome structure. For a chromosome of length L, there are L-1 crossover sites between genes. Therefore, each site will have a probability of 1/(L-1) of being selected. Every bit to the right of the crossover site is swapped between parents to create two children.
As for mutation rates, 5% is a commonly used number. However, having higher or lower mutation is permissable... it simply affects the likelihood that any given string will change schema.
Cheers,
Timkin
As for mutation rates, 5% is a commonly used number. However, having higher or lower mutation is permissable... it simply affects the likelihood that any given string will change schema.
Cheers,
Timkin
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement