
The Genetic Algorithm Explained - GarethX
http://techeffigytutorials.blogspot.com/2015/02/the-genetic-algorithm-explained.html
======
Coding_Cat
It's nice to see an article about GA, I've been working on them myself
recently, fascinating stuff.

However the definition of Tournament Selection[1] is a little bit off. With
tournament selection you don't take the fittest "k" individuals but you take a
subset of "k" individuals at random and then apply proportionate selection.

[1]
[http://en.wikipedia.org/wiki/Tournament_selection](http://en.wikipedia.org/wiki/Tournament_selection)

~~~
zenogais
An important distinction. A lot of implementation bugs I saw when researching
GA/GP were related to this slight misunderstanding.

~~~
randomsearch
Tournament Selection in Genetic Programming is predominantly:

1\. Choose n individuals at random. 2\. Return the individual with best
fitness in that set.

i.e. no proportional selection within that set.

------
sclangdon
For those interested, here is Jori Liesenborgs' thesis, "Genetic algorithms
for the non-parametric inversion of gravitational lenses".

[http://research.edm.uhasselt.be/jori/phd/phdthesis_jori_web....](http://research.edm.uhasselt.be/jori/phd/phdthesis_jori_web.pdf)

------
MaastrichtTreat
I have always heard that a focused gradient descent outperforms genetic
algorithms in every application domain.

~~~
SeanLuke
That is absurd. Gradient descent assumes you can compute the gradient of your
objective function. For a great many functions you cannot define the gradient:
indeed you can't even define the objective function well.

Genetic algorithms belong to a family of _metaheuristics_ , algorithms
designed to tackle such ill-defined functions where gradient descent is simply
impossible to use.

My concern with this webpage is that it is a _far_ too simplistic treatment of
genetic algorithms, to the point of being misleading, and has quite a number
of outright errors. I wouldn't use it.

~~~
irishtier
Totally obsurd. Gradient descent will 'almost' always get stuck in a local
optima. The point of evolutionary algorithms, or any naturally inspired
algorithm for that matter, is that it does not tend to converge upon local
optima and has the possibility of moving out of this space towards the global
optima. The fact that most problems it is applied to are NP-Complete means
that it is unlikely it will find the optimal solution in polynomial time.

~~~
SeanLuke
> Totally obsurd. Gradient descent will 'almost' always get stuck in a local
> optima

Well... just as evolutionary algorithms are essentially elaborate versions of
hill-climbing which enable global search, likewise there are many well-
established forms of gradient descent which are global searchers as well.

I think the key distinguishing feature is that gradient descent makes strong
assumptions about the nature of the space being searched; and metaheuristics
make much more general assumptions.

~~~
GordyMD
Good point. This is key, as you say.

Meta-heuristics have the flexibility of providing good performance on all
Combinatorial Optimisation Problems.

But meta-heuristics, can also be given domain knowledge. and/or be combined
with a a heuristic. E.g. Ant Colony Optimisation techniques for Travelling
Salesman Problems that combines ACO with Local Search.

------
chinpokomon
A couple more points. Depending on how diverse the population is, a high
mutation rate may not help when selecting the fittest children. There is also
a chance that you will find a local maxima, and not the best solution overall.
Introducing a concept of multiple "species" to the population will sometimes
help finding other solutions outside the local maxima, but then this
complicates the crossover phase. If the "genes" are of equal length and
therefore closely related species, you may be able to generate some offspring
in the crossover phase, but then you are usually introducing another species
at that time. Depending on the solution you are trying to find, this may or
may not be appropriate.

------
crazypyro
I wrote a toy program that takes a source string and uses a genetic algorithm
to transform it into a target string. It only took about an hour and was a fun
process. I ended up adding in different types of crossover and trying to
figure out which would solve it in the fewest generations on average. Fun
stuff. Highly recommend it as a quick project for anyone.

------
guelo
My favorite genetic algorithm implementation,
[http://boxcar2d.com/](http://boxcar2d.com/)

