Genetic Recombination

cathamAI and Robotics

Oct 23, 2013 (5 years and 5 months ago)


John Hawkins

Genetic Algorithms

First Google Image result for
“Genetic Algorithms”


Charles Darwin

1859: Writes
Origin of Species

rocks the worlds of science and



1954: First emulates evolution on
a computer


1960s: Popularizes genetic
algorithms as a tool for

Evolution as an algorithm

Start with random population of

Evaluate fitness of each organism

Create a new population

Select parents based on fitness

Create new children through
crossovers and mutations of “DNA”

Replace old population


An example: Tiddlywinks

Given a set of tiddlywinks in a box, find the location and size
of the largest possible non
overlapping tiddlywink


We need chromosomes to work with, so we need to encode
our solutions properly.

Most common way is to convert numbers to a binary string,
which acts as the DNA of the organism.

In our case, we have six segments of the DNA: x, y, and r of
the solution, separating the numbers before and after the

Fitness Test

In this case, easy. We wish to maximize:

In general can be anything your given problem requires.

Selection of Parents: Roulette

We do
automatically choose the most fit parents. The
are chosen stochastically to keep the gene pool from getting
trapped easily in a local max of the fitness function.

Any stochastic process favoring fittest will do. Here we use
the roulette wheel algorithm:

Calculate the sum of the fitness of all chromosomes.

Order the chromosomes and weight them by their fitness

Generate a random numbers

in (0,sum)

Select the parents represented by the values in

Next Generation: Crossover

This and mutation are the most
important steps!

Crossover is simple: take one or more
pieces of two chromosomes and
switch them.

Next Generation: Mutation

Mutation is simply a random change in the chromosome.

In our case, as usual with these algorithms, it is simply
changing a 1 to a 0 or vice
versa with some low probability.


Yes, elitism is a technical term in this algorithm. In fact, it’s a
very important part!

As presented so far, every generation the algorithm loses the
best solution with no guarantee of getting something as good

The solution is to just select the best solution in every step
and keep it without crossover or mutation. This “sheltering”
of the best solution from selection, crossover, and mutation is
called “elitism”.

Ending the Algorithm

The algorithm is complete when one of the following occurs:

A specified tolerance threshold is achieved

A specified number of generations has passed

A specified amount of computational time has passed

The solution fitness has

Kinds of Problems using GA [1]

Nonlinear dynamical systems

predicting, data analysis

Designing neural networks, both architecture and weights

Robot trajectory

Evolving LISP programs (genetic programming)

Strategy planning

Finding shape of protein molecules

TSP and sequence scheduling

Functions for creating images

Limitations and Criticism

The convergence mechanism is poorly understood. That is,
GAs work empirically, but lack solid convergence theory.

GAs often get caught in local minima.

GAs are often not the fastest available algorithms.

For some problems each call of the fitness function would take
hours or days

GAs do not scale well to problems of excessive complexity.

Works Consulted

Genetic Algorithms Tutorial

Genetic Algorithms in Plain English.

[3] Russell,
Artificial Intelligence: A Modern Approach.