Genetic Algorithms
Li M. Fu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Introduction
-
The algorithms are based on simulated evolution.
-
Basic elements include populations, generations,
genetic operations, stochastic selection, fitness functions.
-
Applications include learning, optimization, and
genetic programming.
Genetic algorithms are algorithms for optimization and learning based on the
mechanism of genetic evolution.
The field of genetic algorithms was founded by John
Holland (1975).
Such algorithms
have been applied to problems that are difficult
and important, and
are being applied to artificial intelligence systems.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Topics
-
Genetic algorithms
-
Genetic programming
-
Models of evolution
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
A genetic algorithm consists of five components:
-
A chromosomal representation of solutions
(Chromosomes carry genetic material inside a cell nucleus.)
-
A way to initialize the population of chromosomes
-
An evaluation function to rate solutions
-
Genetic operators to alter the composition of chromosomes during
reproduction, e.g., crossover
-
Parameter settings for the algorithm, e.g.,
population size and probabilities of
applying genetic operators
Over time, the population evolves to contain better individuals and finally
converges to globally optimal (or near optimal) results.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
An Analysis
Let m(H, t) denote the number of chromosomes of a particular configuration H
at time t. Suppose during reproduction, a chromosome is copied according to its
fitness,
and the old population is replaced by the new population. Then, we may
estimate the number at time t + 1 by (Goldberg 1989)
f(H)
m(H, t+1) = m(H, t)-----
E[f]
where f(H) is the fitness of H and E[f]
is the average fitness of the entire population.
Starting at t = 0 and assuming stationary fitness values, we obtain the equation
f(H)
m(H, t+1) = m(H, 0)(-----)t
E[f]
Thus, it is clear that the numbers of favorable (unfavorable) configurations will
increase (decrease) exponentially.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Schema Theory
- A schema is any string composed of 0s, 1s, and *'s.
- Better fit schemas are selected as evolution goes on.
-
f(s) d(s)
E[m(s, t+1)]=-----m(s, t)(1 - pc----)(1 - pm)o(s)
E[f] l-1
pc: probability of crossover (single-point)
pm: probability of mutation (single-point)
l: length of a chromosome
d(s): distance between the leftmost and rightmost defined bits in s
o(s): number of defined bits
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
A Simple Genetic Algorithm
-
Initialize the population of chromosomes.
-
If the termination criterion is met, exit; else repeat the following steps:
-
Select one or more parents (chromosomes) to reproduce children
(chromosomes). Selection is stochastic, but parents with higher
evaluations are
favored. Children are produced by applying the genetic operators to the
parents.
-
Children are evaluated, and promising ones are inserted into the
population. The entire or a subset of population may be replaced.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Example
A chromosome is represented as
a fixed-length string of 0 and 1.
Two strings undergo crossover at a random position so that
all bits are swapped from that position through the end.
Suppose the initial population consists of four strings:
No. String Fitness
1 111000 90
2 010101 240
3 001011 150
4 101110 320
Now, suppose chromosomes 2 and 3 are selected for reproduction
and crossover occurs at position 3 to yield two new strings:
No. String Fitness
5 011011 470
6 000101 80
Assume that the population size is fixed.
At this point, chromosome 5 can replace
chromosome 1 to give rise to a new population.
Iterations like this continue until
no further improvement for the population is seen.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Example
- The problem domain: Use GA to learn a rule set or disjunctive
concepts.
-
Representation:
IF a1 = T and a2 = F Then c = T
IF a2 = T THEN c = F
-
Genetic Operation:
Parents:
a1 a2 c a1 a2 c
h1: 1[0 01 1 11 1]0 0
h2 0[1 1]1 0 10 01 0
Children:
a1 a2 c
h3: 11 10 0
a1 a2 c a1 a2 c a1 a2 c
h4 00 01 1 11 11 0 10 01 0
-
Fitness Function:
Fitness (h) = (correct(h))2
-
Extensions:
a1 a2 c a1 a2 c Spe Gen
10 01 1 11 10 0 1 0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Example
- The problem domain: Use GP to write a computer program for
stacking blocks.
concepts.
-
Define Objects:
CS (current stack)
TB (top current block)
NN (not necessary)
-
Define Operators (Functions):
(MS x) (move to stack)
(MT x) (move to table)
(EQ x y) (equal)
(NOT x)
(DU x y) (do x until y returns T)
-
GP Parameters:
Population size: 300
Fitness: based on 166 training examples
-
Results: 10 generations
(EQ (DU (MT CS) (NOT CS)) (DU (MS NN) (NOT NN)))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Evolution: Genetics and Learning
- Lamarckian hypothesis
- Baldwin effect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Comments on Genetic Algorithms
A list of features has been identified which make a domain suitable for the
application of genetic algorithms (Davis 1987): Domains should be multimodal;
domains should not exhibit
a high degree of epistasis (epistasis is the inhibition of one
part of a solution by the action of another); domains should exhibit detectable and
encodable regularities. The building block hypothesis has been suggested. Simple
genetic algorithms depend on the recombination of building blocks to seek the best
solutions. If the building blocks are misleading,
the algorithms may still be clever
enough to figure out (near) optimal solutions (by mutation, for example)
but may take a longer time.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Summary
-
What are the genetic algorithms?
-
Are they similar to neural networks? In what sense?
-
Why are they interesting?
-
What are their weaknesses?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Web Material
Genetic Algorithms
Genetic Programming