
A Story to Explain Genetic Algorithms - jakeburtn
http://jake.simvla.com/posts/531-mr-mrs-kipling
======
jacques_chester
If you're interested in the world of "computational intelligence" aka "nature-
inspired computation", this book is a good high level survey:
<http://www.cleveralgorithms.com/>

(You can also find stuff under the heading of "metaheuristics" --
<http://cs.gmu.edu/~sean/book/metaheuristics/>).

GAs are one of four (!) different independently developed strands of thought
-- Genetic Algorithms, Genetic Programming, Evolutionary Programming and
Evolutionary Strategies. Look out for that when you hit the Googletrons.

~~~
jdherman
Those are some good links, thanks. Are there clear distinctions between these
four areas? It seems like the separation is a historical artifact, when
they're all basically doing the same thing.

~~~
jacques_chester
I mostly looked at GAs and GPs. Evo strategy has some interesting mathematical
stuff.

Basically GA and GP are the dominant strands. And there's a key difference.

Genetic _Algorithms_ are historically about finding _paramaters into a
function_. You have some function f(X1 ... Xn), and you are trying to find the
best set of parameters X1...Xn. So a common representation is a string of
floats or integers or whatever, and then you do the crossovers and mutations
based on positions in the string.

Genetic _Programming_ is about creating _new functions_. So instead of a
string of parameters, the genome is (usually) a tree of instructions to be
interpreted. You do mutations by swapping node types, crossovers by chopping
subtrees and moving them etc.

One artefact of the historical "parallel evolution" (teehee) of these fields
is that GP practitioners use crossovers much less than GA practitioners.

------
stcredzero
_> Then our Charles simply had to figure out how Mrs Kipling scored the cakes
and he could genetically evolve the best cake!_

"And then a miracle happens." Isn't the fitness function the "key ingredient?"
(It's in the source code, but not in the text for a reason.)

Still a good explanation of the rest.

~~~
GuiA
> "And then a miracle happens."

One of the favorite quotes of my graduate advisor, thanks for the chuckle :)

For those who are unfamiliar with the reference:

<http://star.psy.ohio-state.edu/coglab/Miracle.html> (mirror image:
<http://i.imgur.com/k7gm70t.jpg>)

------
helloiamdave
Once upon there was another local search algorithm. It was called GA. The end.

~~~
randomsearch
Actually, GAs are mostly described as global search algorithms, because they
use populations with recombination and therefore simultaneously consider
potentially disparate areas of the search space.

------
jmduke
Unrelated: this simvla network thing looks like a pale imitation of Svbtle.

~~~
FaisalAbid
@OP- Hey Jake, awesome article, really understand what Genetic Algorithms are
now.

Also wanted to let the people that think Simvla is a ripoff of Svbtle know
that I recently acquired Simvla from its creator and it's my first job to give
Simvla a unique look. I respect Svbtle and I feel it's unfair to Dustin that
Simvla copies the look he created.

------
ipince
I would suggest making the fitness function more complex. I think its a bit
confusing to see the optimal result be equal to the fitness function's
parameters, and it makes it easier to miss the point.

------
perone
I've written something [1] related to this if someone is interested.

[1] <http://pyevolve.sourceforge.net/wordpress/?p=576>

------
jmcdowell
I don't have much of a knowledge of genetic algorithms so it might be good to
explicitly say what part of GA algorithms set them apart from other branches
of algorithms.

Nice story otherwise.

------
gweinberg
It's not at all clear from the story why or if having multiple recipes "mate"
works better than just using one recipe and fiddling with it.

~~~
jules
It doesn't. At least there is zero evidence that it does and there is a lot of
evidence that it does not (i.e. simple hill climbing beats GA in every
practical situation). I've mentioned this before on HN and reddit, but from
time to time these kind of stories come up again. There is a weird fascination
with genetic algorithms. Even though dozens of people have a career based on
it, as far as I can tell the whole field of biologically inspired optimization
algorithms is basically pseudoscience. Note _optimization_ algorithms, so this
does certainly not include e.g. neural networks, which work fantastically
well.

------
datz
This is stupid. The whole is not simply a sum of its parts in cake baking and
biology.

------
zapdrive
"After thinking long and hard about the problem at hand our Charles came to
the conclusion that he knew two things"

Lol... long and hard.

------
youngerdryas
Neat little story, despite the grammar and capitalization. Is it common to use
_ as an index variable?

Edit: for _ in range(4):

~~~
monochromatic
I've seen it before, but it's a little jarring. Not sure what's wrong with
just using i.

~~~
jdiez17
It says explicitly that you don't care about that value. If you used i, for
example, you wouldn't know whether the loop depended on the iteration number.

~~~
monochromatic
Yeah, I get it. And that's a useful thing to do, I guess. It just seems a
little... unpythonic.

