Sie sind auf Seite 1von 3

SHES 2402 ADAPTIVE SYSTEMS

WEEK 7 (PART 2): GENETIC ALGORITHMS

BACKGROUND

If natural selection can lead to the emergence of populations with particular traits,
then perhaps it can be used in the computing environment to search for a solution to
a computing (say optimisation) problem? In 1975, John Holland proposed the genetic
algorithm (GA), which is based on the ideas of evolution, as an optimisation method.
The GA belongs to the class of evolutionary algorithms that use operators such as se-
lection, recombination and mutation to search for an exact or approximate solution to
an optimisation problem. This is a useful alternative in cases where conventional search
methods either fail or are very difficult to implement.

AN OUTLINE OF THE GENETIC ALGORTIHM

A typical GA begins by specifying a population of (usually) random values, called


the chromosomes (members). The goal is to let the population evolve according to the
process of selection, recombination and mutation. The criterion for selection is in the
form of an objective function (phenotype) that we wish to optimise. During the process
of evolution, the average value of the objective function in the population gradually shifts
towards the desired outcome (as large or small as possible). The algorithm terminates
when a certain number of iterations have been performed, or when certain stopping
criteria have been satisfied.
To make things concrete, let us consider the problem of finding the maximum of the
function f = 2x(1 − x) in the unit interval. From calculus, we already know that the
answer is 1/2. If the GA works, then it must give us 1/2 (or something very close) as
the solution.

Population Initiation and Selection Stage: Let us set the population size as 5, and gener-
ate 5 random variables from the uniform distribution with unit interval. We then evaluate
them using the objective function f (Table 1).

x f
0.5074 0.4999
0.3067 0.4253
0.4269 0.4893
0.6931 0.4254
0.0851 0.1558
Table 1. The function f = 2x(1 − x) evaluated at the five chromosome values in the initial population.

1
Let us define fitness of the ith member as fi /f¯, where f¯ = i fi is the average of the
P
values of the objective function in the population. Since the goal is to evolve a population
that contains chromosomes with the largest possible value of f , the number of offsprings
that a particular member should leave is approximately proportional to its fitness. If the
latter is some value like 1.5 for a member, then this member makes one exact copy of
itself, with another 0.5 probability of leaving a second copy. Similarly, those with a value
like 0.6 leaves one exact copy with probability 0.6. This particular rule of determining
the number of copies that a member sends to the next generation is known as remainder
stochastic sampling. Table 2 shows a realisation of this particular reproduction scheme.

i xi fi fi /f¯ copies
1 0.5074 0.4999 1.2524 2
2 0.3067 0.4253 1.0656 1
3 0.4269 0.4893 1.2259 1
4 0.6931 0.4254 1.0658 2
5 0.0851 0.1558 0.3903 0
Table 2. Fitness values for the five chromosomes in the starting population, and the (random) number
of copies that they pass on to the next generation.

Recombination and Mutation Stage: The offsprings now enter what is called an intermedi-
ate generation, where they are subjected to the recombination and mutation operations.
First, we allow the offsprings to randomly recombine with each other. Thus, for example,
0.5074 may recombine with 0.6931 at the position between the first and second decimal
digits,

0.5\/074
0.6/\931

This crossover process generates two new recombinant chromosomes,

0.5931, 0.6074.

By specifying the number of recombination events, we generate a pool of recombinant


offspring chromosomes. Next, we allow each of the latter to experience a mutation event
with small probability, say 5% or less. If a mutation occurs, then one of the decimal
digits is randomly replaced with a digit from 0 to 9. After these two processes, we now
have a new generation. This constitutes one execution of a GA. We repeat the algorithm
until a desired number of generations have been reached (and then look for the member
with highest f ).
So how well does the method work? In my simulation, I chose a starting population of
size 100. After 5 generations, the GA returned 0.499855 as the chromosome with largest
f value; after 10, it was 0.499949. The accuracy is pretty satisfactory!

2
CONCLUDING REMARKS

In some problems where the solution must be an integer, we can use binary strings
as chromosomes of the population. For example, a K-bit string induces a solution space
of size 2K . We can also use a GA to see how long it takes for a population of random
letters to evolve into the famous phrase (in computer science)

H E L L O W O R L D .

In bioinformatics, Notredame and Higgins (1996) proposed a a (modified) GA approach


to sequence alignment, which is an alternative to standard alignment using CLUSTAL.
The idea of natural selection was once ridiculed by critics who likenend it to a monkey
producing the works of Shakespeare by randomly typing on a type writer. This shows a
lack of appreciation of the power of natural selection as a means of changing the average
of a particular trait of a population over time. As demonstrated in the “Hello World”
example, a populational process that combines the selection, recombination and mutation
operators can indeed generate apparent order from random junk!

REFERENCES

1. Notredame, C. and Higgins, D.G. (1996) SAGA: sequence alignment by genetic algorithm. Nucleic
Acids Research, 24(8), 15151524.

KTF 2009/2010(2)
3

Das könnte Ihnen auch gefallen