You are on page 1of 48

Genetics and

Evolution
Historical perspective
• 1948, Turing:
proposes “genetical or evolutionary search”
• 1962, Bremermann:
optimization through evolution and recombination
• 1964, Rechenberg:
introduces evolution strategies
• 1965, L. Fogel, Owens and Walsh:
introduce evolutionary programming
• 1975, Holland:
introduces genetic algorithms
• 1992, Koza:
introduces genetic programming
Evolution: Survival of the fittest

• All environments have finite resources


(i.e., can only support a limited number of individuals)
• Life forms have basic instinct/ lifecycles geared towards
reproduction
• Therefore some kind of selection is inevitable
• Those individuals that compete for the resources most
effectively have increased chance of reproduction
Evolution: Diversity drives change

• Phenotypic traits:
– Behaviour / physical differences that affect response to
environment
– Partly determined by inheritance, partly by factors during
development
– Unique to each individual, partly as a result of random changes
• If phenotypic traits:
– Lead to higher chances of reproduction
– Can be inherited
then they will tend to increase in subsequent generations,
leading to new combinations of traits …
Evolution: Summary
• Population consists of diverse set of individuals
• Combinations of traits that are better adapted tend to
increase representation in population
Individuals are “units of selection”
• Variations occur through random changes yielding
constant source of diversity, coupled with selection
means that:
Population is the “unit of evolution”
Genetics: Natural
• The information required to build a living organism is
coded in the DNA of that organism
• Genotype (DNA inside) determines phenotype
• Genes  phenotypic traits is a complex mapping
– One gene may affect many traits (pleiotropy)
– Many genes may affect one trait (polygeny)
• Small changes in the genotype lead to small changes in
the organism (e.g., height, hair colour)
Genetics: Genes and the Genome
• Genes are encoded in strands of DNA called
chromosomes
• In most cells, there are two copies of each chromosome
(diploidy)
• The complete genetic material in an individual’s
genotype is called the Genome
• Within a species, most of the genetic material is the
same
Structure of DNA (Deoxyribonucleic Acids)
W C

ƒ DNA has double-helical structure


ƒ The linkages between two strands are
purine-pyrimidine bridges
ƒ Helix makes 360° turn every 10 steps

Purine-pyrimidine bridge
Genetics:Genetic code
• All proteins in life on earth are composed of sequences
built from 20 different amino acids
• DNA is built from four nucleotides in a double helix spiral:
A,G,T,C
• Triplets of these from codons, each of which codes for a
specific amino acid
• Much redundancy:
• 43=64 codons code for 20 amino acids
• genetic code = the mapping from codons to amino acids
The Purine-Pyrimadine Bridge
„ Types of Purines
Adenine (A) (paired with T)
Guanine (G) (paired with C)
„ Types of Pyrimidine
Thymine (T) (paired with A)
Cytosine (C) (paired with G)
The Purine-Pyrimidine Bridge
„ Result – 4 Letter Alphabet
AT A T
TA
GC G C
3.4Å
CG C G
Note: AT isn’t TA
A T
„ Sequence carries information
1000 steps can carry 41000 different T A
messages
Hydrogen bonds
DNA Replication

T A A G A C T A
C A T T C T G A T
A G A
T C T
G T A A G A C T A
A T T C T G A T
Incomplete Dominance
„ Consider color pattern in cattle
„ One pair of alleles determines color (complete
dominance)
BB: black
Bb: black
bb: red
„ Another pair determines extent of color (incomplete
dominance)
RR: solid color
Rr: speckled with white
rr: no color
Mechanism for Dominance
„ Genes result in production of enzymes
„ For complete dominance, one allele produces
enough to achieve a desired effect
„ Often, there will be subtle differences between
homozygous and heterozygous phenotypes (a
few white hairs on a black mouse)
Linkage and Chromosome Mapping

„ During meiosis the chromosomes can line up


side by side and the following can happen:
Linkages and Chromosome Mapping

„ Importance of crossover
Crossover prevents a beneficial gene from being
inseparably linked to deleterious one
Crossover provides means for two good genes to
get together
Extends benefits of sexual reproduction
Inheritance of Quantitative Traits

„ Example: height in humans


„ Genes that control this are
essentially identical to other genes, but not
phenotypically identifiable
cumulative in effect
often influenced by the environment
„ This class of traits is said to be polygenic
Inheritance of Quantitative Traits

„Example: Seed color is some species


Genotype Phenotype
A’A’B’B’ very dark red
A’A’B’B,A’AB’B’ dark red
AA’BB’,A’A’BB,AAB’B’ medium red
A’ABB,AAB’B light red
AABB white
What Are Genetic Algorithms?
„ Genetic algorithms are optimization algorithm
inspired from natural selection and genetics
„ A candidate solution is referred to as an individual
„ Process
Parent individuals generate offspring individuals
The resultant offspring are evaluated for their
fitness
The fittest offspring individuals survive and
become parents
The process is repeated
The Canonical GA
Simple Genetic Algorithms (SGA)
Overview

Initial
population Fitness
Evaluation
19
76
44
f (x) 27
8
53
31
76

Selection

Mutation Crossover Mating pool


Canonical GA
„ The canonical genetic algorithm refers to the GA
proposed by John Holland in 1965
START

Initialization

Fitness evaluation

Selection
Crossover

Mutation

STOP?

END
Gene Representation
„ Parameter values are encoded into binary strings of
fixed and finite length
Gene: each bit of the binary string
Chromosome: a binary string
Individual: a set of one or multiple chromosomes, a
prospective solution to the given problem
Population: a group of individuals
„ Longer string lengths
Improve resolution
Requires more computation time
Binary Representation
„ Suppose we wish to maximize f (x)

„ Where [
x ∈ Ω; Ω = xmin, xmax ]
„ Binary representation xbinary ∈ [bl bl −1 L b2 b1 ]

„ [
We map xmin, xmax ] to [2 −1]
l

x max − x min l
i −1
„ Thus x = x min + ∑ i
b 2
2l − 1 i =1
Example
„ Let l = 5, Ω = [-5, 20]
„ Then

xmin =[0 0 0 0 0 ] ⇒ x = −5
xmax = [ 1 1 1 1 1 ] ⇒ x = 20

x = [1 0 0 1 1 ] ⇒

20 − (−5)
x = −5 + ( 2 + 2 + 2 )
4 1 0
= 10.3226
2 −1
5
Crossover

„ Two parent individuals are selected from mating pool


„ Crossover operation is executed with the probability pc
„ Crossover point is randomly chosen and the strings are
swapped with respect the crossover point between the
two parents
One-Point Crossover
In one-point crossover, a random crossover
point is selected and the tails of its two parents
are swapped to get new off-springs.
N-Point Crossover
Multi point crossover is a generalization of the
one-point crossover wherein alternating
segments are swapped to get new off-springs.

Example: N=2
Uniform Crossover
In a uniform crossover, we don’t divide the chromosome
into segments, rather we treat each gene separately.

• 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
Mutation

„ Mutation operator is applied gene-wise, that is, each


gene undergoes mutation with the probability pm
„ When the mutation operation occurs to a gene, its
gene value is flipped

1 0
0 1
Mutation points

1 1 0 0 1 0 1 1 1 0 0 0 1 1 1 1
Bitwise Mutation
flips bits: 0→1 and 1→0
In this bit flip mutation, we select one or more
random bits and flip them.
This is used for binary encoded GAs.
Swap Mutation
In swap mutation, we select two positions on
the chromosome at random, and interchange
the values. This is common in permutation
based encodings.
Scramble Mutation
Scramble mutation is also popular with permutation
representations.
In this, from the entire chromosome, a subset of
genes is chosen and their values are scrambled or
shuffled randomly.
Inversion Mutation
In inversion mutation, we select a subset of
genes like in scramble mutation, but instead of
shuffling the subset, we merely invert the
entire string in the subset.
Selection

„ Chooses individuals from the current population to


constitute a mating pool for reproduction
„ Fitness proportional selection methods
Each individual x is selected and copied in the
mating pool with the probability proportional to
fitness (f(x) / Σf(x))
Roulette-Wheel Selection
• A fixed point is chosen on the wheel circumference as
shown and the wheel is rotated.
• The region of the wheel which comes in front of the fixed
point is chosen as the parent.

• For the second parent, the same process is repeated.


Stochastic Universal Sampling
• Quite similar to Roulette wheel selection, however instead of having just
one fixed point, we have multiple fixed points as shown in the following
image.
• Therefore, all the parents are chosen in just one spin of the wheel.
• Also, such a setup encourages the highly fit individuals to be chosen at
least once.
Tournament Selection
We select K individuals from the population at random and
select the best out of these to become a parent.

The same process is repeated for selecting the next parent.


Example
Problem Description
„ Consider the following maximization problem
max f(x) = x2
where x is an integer between 0 and 31
1000

900

800

700

600
f(x)

500

400

300

200

100

0
0 5 10 15 20 25 30
x

f(x) = x2 has its maximum value 961 at x = 31


Gene Representation
„ Before applying GA, a representation method must be
defined
„ Use unsigned binary integer of length 5

10110 1⋅24 + 0⋅23 + 1⋅22 + 1⋅21 + 0⋅20 = 22

„ A five-bit unsigned binary integer can have values


between 0(0000) and 31(11111)
Initialization
„ Initial populations are randomly generated
„ Suppose that the population size is 4
„ An example initial population

Individual Initial x value


No. population
1 01101 13
2 11000 24
3 01000 8
4 10011 19
Fitness Evaluation
„ Decoding

01000 Decode x=8 Evaluation f(8) = 82 = 64

„ Results
Individual No. Initial population x value f(x) fi / Σf

1 01101 13 169 0.14


2 11000 24 576 0.49
3 01000 8 64 0.06
4 10011 19 361 0.31
Selection
„ Select individuals to the mating pool
„ uses roulette wheel selection
– fitness proportionate
• expected no. of representatives of each individual
is proportional to its fitness

fitness i
prob i = , j = 1...pop. size
∑ fitness j
j
Selection
1

„ Roulette wheel 2
3
4

„ Outcome of Roulette wheel is 1, 2, 2, and 4


„ Resulting mating pool

No. Mating pool


1 01101
2 11000
3 11000
4 10011
Crossover
„ Two individuals are randomly chosen from mating pool
„ Crossover occurs with the probability of pc = 1
„ Crossover point is chosen randomly

Mating pool Crossover New x f(x)


point population
0110 1 01100 12 144
4
1100 0 11001 25 625
11 000 11011 27 729
2
10 011 10000 16 256
Mutation
„ Applied on a bit-by-bit basis
„ Each gene mutated with probability of pm = 0.001

Before After x f(x)


Mutation Mutation
01100 01100 12 144
11001 11001 25 625
11011 11011 27 729
10000 10010 18 324
Fitness Evaluation
„ Fitness values of the new population are calculated
Old x f(x) New x f(x)
population population
01101 13 169 01100 12 144
11000 24 576 11001 25 625
01000 8 64 11011 27 729
10011 19 361 10010 18 324
sum 1170 sum 1756
avg 293 avg 439
max 576 max 729

You might also like