Genetic Algorithms Explained : A Python Implementation

Genetic Algorithms Explained : A Python Implementation

Genetic Algorithms , also referred to as simply “GA”, are algorithms inspired in Charles Darwin’s Natural Selection theory that aims to find optimal solutions for problems we don’t know much about. For example: How to find a given function maximum or minimum, when you cannot derivate it? It is based on three concepts: selection, reproduction, and mutation. We generate a random set of individuals, select the best ones, cross them over and finally, slightly mutate the result - over and over again until we find an acceptable solution. You can check some comparisons on other search methods on Goldberg’s book.

Solid intro to GAs luiz, glad that you’ve also added other possible tweaks to the algorithm from the literature. Also noted that the best fit candidate was chosen only from the final generation and not from the list of all generations. Just wanted to suggest this minor tweak to the post so that others who’re going through it can get better results with just a single line and without any alg changes. Thanks.

Thanks for your suggestion @sivaramakrishnan

Indeed, this approach is known as elitism, where you keep the best individuals of each generation regardless of selection. I’ll add it to the text.

:slight_smile:

1 Like