Você está na página 1de 4

Basic Genetic Algorithm cycle

The Genetic Algorithm cycle has the following steps.


It begins with a randomly generated population of chromosome encoded Solutions to a
given problem.
Calculate the fitness of each chromosome, where fitness is a measure of how well a
member of the population performs at solving the problem.
Retain only the fittest members and discard the least fit members. This process is called
selection of fittest strings from existing population.
Generate a new population of chromosome from the remaining member of the old
population by applying the operation reproduction, cross over and mutation.
Calculate the fitness of these new members of the population, retain the fittest, discard the
least fit and re-iterate the process.
Genetic operators
GA is composed of three basic operators
Reproduction
Cross over
Mutation

3.4.1 Encoding of chromosome


Before applying GA operation the encoding has to be done to form the chromosome in
such a way that it contain information about the solution, which it represents. The popular and
effective way of encoding is a binary string. The chromosome will look like this.

Chromosome 1 0 1 1 0 1 0 0 1

Chromosome 2 1 0 1 0 0 1 1 1

Each bit /group of bits in the binary can represent some characteristic of the solution.
3.4.2 Reproduction
Reproduction is a first operator applied on a population. Reproduction selects good
strings according to their objective value in a population and forms a mating pool. For this cause
reproduction operator is known a selection operator. Reproduction makes a set of identical copies
of a given chromosome, where the number of copies depends on the chromosomes fitness. GA
uses the Roulette-wheel techniques to select chromosomes for reproduction. The way to
implement the selection scheme is to imagine a roulette wheel with its circumference marked for
each string proportionate to the string fitness. The roulette wheel is spun n times, each time
selecting an instance of the string chosen by the roulette-wheel pointer. Copying strings
according to their fitness values means that strings with a higher value have a higher probability
of contributing one or more offspring in the next generation. Roulette wheel selection will chose
third string more than any other string.

String Fitness
1 25.0
2 5.0
3 40.0
4 10.0
5 20.0
Reproduction :

0 0 1 0 1 1 1 0 0 0 1 0 1 1 1 0

Fig 3.1 Roulette Wheel

5; 20% 1; 25%

4; 10% 2; 5%

3; 40%

3.4.3 Cross over


The crossover operator exchanges sub parts of the two chromosomes, where the position
of the crossover is randomly selected and is thus crude facsimile of bio-logical sexual
recombination between two single-chromosome organisms. Each pair of strings undergoes
crossing over as follows:

0 1 1 0 1 0 0 1 0 1 1 0 1 1 1 1

1 0 1 0 0 1 1 1 1 0 1 0 0 0 0 1
An integer position k along the string length is selected uniformly at random between 1 and the
string length less one [1, L-1]. Two new strings are created by swapping all characters between
position (k+1) and L inclusively.
3.4.4 Mutation
While reproduction generally rewards high fitness and cross over generates new
chromosomes whose parts, at least, conform chromosome to relatively high fitness, mutation
seems necessary to prevent the loss of diversity at a given bit position. For example, were it not
for mutation, a population might evolve to a state where the first bit-position of each
chromosome contain the value 1 as above in cross-over, with there being no change of
reproduction or crossover ever replacing it with a 0. Mutation in the occasional and (with small
probability) random alteration of the value of a string position. In the binary coding, this simply
means choosing a 1 to 0 and vice-versa.

0 0 1 0 1 1 1 0 0 0 1 0 1 0 1 0
3.5 GA parameters
There are two basic GA parameters.

Cross over probability


Mutation probability

3.5.1 Crossover probability


It specifies how often crossover will be performed. If those are no crossover, offspring
would be exact copy of parents. If there is cross over, offspring is made from some parts of
parent chromosome. If cross over probability is 100%, then all offspring are made by cross over.
If it is 0% whole new generation is made from exert coping of chromosome from old population.
Cross over made generally with a probability of (0.5 to 0.8) 50 to 80% in hope that new
chromosome will have good parts of old chromosome and may be the new chromosome will be
better.

3.5.2 Mutation probability


It indicates how often the bits of chromosome will be mutated. If there is no mutation,
offspring is taken after crossover without any change. If mutation is performed few bits are
changed. Mutation is made to prevent falling GA into local extreme, but it should not occur very
often. The range is normally 0.0001 to 0.1.
3.5.3 Population size
Population size specifies how many chromosomes are in a generation. If there are too few
chromosome, GA has a few possibilities to perform cross over only a small part of search space
is explored. In the other hand if population size is more, GA slowdown. Research results indicate
that after some limit it is not useful to increase the population size, because it does not make the
solution of the problem faster.

Você também pode gostar