# Genetic Algorithms

AI and Robotics

Oct 24, 2013 (4 years and 6 months ago)

91 views

Genetic Algorithms

General Introduction to GA’s

Genetic algorithms (GA’s) are a technique to solve

problems which need optimization

GA’s are a subclass of
Evolutionary Computing

GA’s are based on

Darwin’s theory of evolution

History of GA’s

Evolutionary computing evolved in the 1960’s.

GA’s were created by John Holland in the mid
-
70’s.

Classes of Search Techniques

Search Techniques

Calculus Base
Techniques

Guided random search
techniques

Enumerative
Techniques

BFS

DFS

Dynamic
Programming

Tabu Search

Hill
Climbing

Simulated
Anealing

Evolutionary
Algorithms

Genetic
Programming

Genetic
Algorithms

Sort

Fibonacci

Biological Background

The cell

Every animal cell is a complex of many small

“factories”
working together

The center of this all is the
cell nucleus

The nucleus contains the genetic information

Biological Background

Chromosomes

Genetic information is stored in the
chromosomes

Each chromosome is build of
DNA

Chromosomes in humans form pairs

There are
23
pairs

The chromosome is divided in parts:
genes

Genes code for properties

The posibilities of the genes for

one
property is called:
allele

Every gene has an unique position

on the
chromosome:
locus

Biological Background

Genetics

The entire combination of genes is called
genotype

A genotype develops to a
phenotype

Alleles

can be either dominant or recessive

Dominant alleles will always express from the
genotype to the fenotype

Recessive alleles can survive in the population for
many generations, without being expressed.

Biological Background

Reproduction

During reproduction “errors” occur

Due to these “errors” genetic variation exists

Most important “errors” are:

Recombination (cross
-
over)

Mutation

Biological Background

Natural selection

The origin of species: “Preservation of
favourable variations and rejection of
unfavourable variations.”

There are more individuals born than can
survive, so

there is a continuous
struggle
for life
.

Individuals with an advantage have a greater
chance for

survive:
survival of the fittest
.

Biological Background

Natural
selection

Important aspects in natural selection are:

to the environment

isolation

of populations in different groups which cannot
mutually mate

If small changes in the genotypes of individuals are

expressed easily, especially in small populations, we

speak of
genetic drift

Mathematical expresses as
fitness
: success in life

Simple Genetic Algorithm

{

initialize population;

evaluate population;

while TerminationCriteriaNotSatisfied

{

select parents for reproduction;

perform recombination and mutation;

evaluate population;

}

}

The GA Cycle of Reproduction

reproduction

population

evaluation

modification

deleted

members

parents

children

modified

children

evaluated children

Population

Chromosomes could be:

Bit strings (
0101
...
1100
)

Real numbers (
43.2
-
33.1
...
0.0 89.2
)

Permutations of element (E
11
E
3
E
7
... E
1
E
15
)

Lists of rules (R
1
R
2
R
3
... R
22
R
23
)

Program elements (genetic programming)

... any data structure ...

population

Reproduction

Parents are selected at random with
selection chances biased in relation to
chromosome evaluations.

reproduction

population

parents

children

Chromosome Modification

Modifications are stochastically triggered

Operator types are:

Mutation

Crossover (recombination)

modification

children

modified children

Types of cross over

Single

site crossover

Multi
-
point crossover

Uniform

crossover

Single
-
point crossover

Choose a random point on the two parents

Split parents at this crossover point

Create children by exchanging tails

n
-
point crossover

Choose n random crossover points

Split along those points

Glue parts, alternating between parents

Generalization of
1
point (still some positional bias)

Uniform crossover

Assign 'heads' to one parent, 'tails' to the other

Flip a coin for each gene of the first child

Make an inverse copy of the gene for the second child

Inheritance is independent of position

Mutation

Causes movement in the search space

(local or global)

Restores lost information to the population

Evaluation

The evaluator decodes a chromosome and
assigns it a fitness measure

The evaluator is the only link between a classical
GA and the problem it is solving

evaluation

evaluated

children

modified

children

A Simple Example

The Traveling Salesman Problem:

Find a tour of a given set of cities so that

each city is visited only once

the total distance traveled is minimized

Representation

Representation is an ordered list of city

numbers known as an
order
-
based

GA.

1
) London
3
) Dunedin
5
) Beijing
7
) Tokyo

2
) Venice
4
) Singapore
6
) Phoenix
8
) Victoria

CityList
1

(
3 5 7 2 1 6 4 8
)

CityList
2

(
2 5 7 6 8 1 3 4
)

Crossover

Crossover combines inversion and

recombination:

* *

Parent
1

(
3 5 7 2 1 6 4 8
)

Parent
2

(
2 5 7 6 8 1 3 4

Child

(
5 8 7 2 1 6 3 4
)

This operator is called the
Order
1
crossover.

Mutation

Mutation involves reordering of the list:

* *

Before: (
5 8 7 2 1 6 3 4
)

After: (
5 8 6 2 1 7 3 4
)

Global Search Methods

GAs search for the function optimum

starting from a
population of points
of the function domain, not a
single one. This characteristic suggests that GAs are global
search methods. They can, in fact, climb many peaks in parallel,
reducing the probability of finding local minima, which is one of
the drawbacks of traditional optimization methods.