Sei sulla pagina 1di 15

GENETIC ALGORITHM

ABSTRACT

Genetic algorithms are a part of evolutionary computing, which is a rapidly growing area
of artificial intelligence. Genetic algorithms are inspired by Darwin's theory of evolution.
Problems are solved by an evolutionary process resulting in a best (fittest) solution (survivor) - in
other words, the solution is evolved.

Genetic Algorithm is followed by the explanation of tools like Mutation, Crossover,


Encoding etc. The wide range of applications of genetic algorithm in different areas is covered.
Pure analytical methods widely proved their efficiency. Combining mathematical analysis and
random search, many methods have appeared. Imagine you scatter small robots in a
Mountainous landscape. Those robots can follow the steepest path they found. When a robot
reaches a peak, it claims that it has found the optimum. This method is very efficient, but there's
no proof that the optimum has been found, each robot can be blocked in a local optimum. This
type of method only works with reduced search spaces

We explore the use of an adaptive search technique (genetic algorithms) to construct a


system GABIL which continually learns and refines concept classification rules from its
interaction with the environment. The performance of the system is measured on a set of concept
learning problems and compared with the performance of two existing systems: ID5R and C4.5.
Preliminary results support that, despite minimal system bias, GABIL is an effective concept
learner and is quite competitive with ID5R and C4.5 as the target concept increases in
complexity
INTRODUCTION:

All living organisms consist of cells. In each cell there is the same set of chromosomes.
Chromosomes are strings of DNA and serve as a model for the whole organism. A chromosome
consists of genes, blocks of DNA. Each gene encodes a particular protein. Basically, it can be
said that each gene encodes a trait, for example color of eyes. Possible settings for a trait (e.g.
blue, brown) are called alleles. Each gene has its own position in the chromosome. This position
is called locus.

Complete set of genetic material (all chromosomes) is called genome. Particular set of
genes in genome is called genotype. The genotype is with later development after birth base for
the organism's phenotype, its physical and mental characteristics, such as eye color, intelligence
etc. During reproduction, recombination (or crossover) first occurs. Genes from parents
combine to form a whole new chromosome. The newly created offspring can then be mutated.
Mutation means that the elements of DNA are a bit changed. This changes are mainly caused by
errors in copying genes from parents.

The fitness of an organism is measured by success of the organism in its life (survival). If
we are solving a problem, we are usually looking for some solution which will be the best among
others. The space of all feasible solutions (the set of solutions among which the desired solution
resides) is called search space (also state space). Each point in the search space represents one
possible solution. Each possible solution can be "marked" by its value (or fitness) for the
problem. With GA we look for the best solution among a number of possible solutions -
represented by one point in the search space.
Evolution and optimization
We are now 45 millions years ago examining a Basilosaurus :

Basilosaurus
The Basilosaurus was quite a prototype of a whale. It was about 15 meters long for 5
tons. It still had a quasi-independent head and posterior paws. He moved using undulatory
movements and hunted small preys. Its anterior members were reduced to small flippers with an
elbow articulation.
Movements in such a viscous element (water) are very hard and require big efforts. The
anterior members of basilosaurus were not really adapted to swimming. To adapt them, a double
phenomenon must occur : the shortening of the "arm" with the locking of the elbow articulation
and the extension of the fingers which will constitute the base structure of the flipper.

Tursiops flipper
The image shows that two fingers of the common dolphin are hypertrophied to the
detriment of the rest of the member.
The basilosaurus was a hunter, he had to be fast and precise. Through time, subjects
appeared with longer fingers and short arms. They could move faster and more precisely than
before, and therefore, live longer and have many descendants.
Darwinian mechanism hence generate an optimization process, Hydrodynamic
optimization for fishes and others marine animals, aerodynamic for pterodactyls, birds or bats.
This observation is the basis of genetic algorithms.
Evolution and Genetic Algorithms
Genetic algorithms are inspired by Darwin's theory of evolution. Solution to a problem
solved by genetic algorithms uses an evolutionary process (it is evolved). Algorithm begins with
a set of solutions (represented by chromosomes) called population. Solutions from one
population are taken and used to form a new population. This is motivated by a hope, that the
new population will be better than the old one. Solutions that are then selected to form new
solutions (offspring) are selected according to their fitness - the more suitable they are the more
chances they have to reproduce. This is repeated until some condition (for example number of
populations or improvement of the best solution) is satisfied.

1. [Start] Generate random population of n chromosomes (suitable solutions for the


problem)

2. [Fitness] Evaluate the fitness f(x) of each chromosome x in the population

3. [New population] Create a new population by repeating following steps until the new
population is complete

1. [Selection] Select two parent chromosomes from a population according to


their fitness (the better fitness, the bigger chance to be selected)

2. [Crossover] With a crossover probability cross over the parents to form new
offspring (children). If no crossover was performed, offspring is the exact
copy of parents.

3. [Mutation] With a mutation probability mutate new offspring at each locus


(position in chromosome).

4. [Accepting] Place new offspring in the new population

4. [Replace] Use new generated population for a further run of the algorithm

5. [Test] If the end condition is satisfied, stop, and return the best solution in current
population

6. [Loop] Go to step 2
The crossover and mutation are the most important parts of the genetic algorithm. Mainly these
two operators influence the performance. Before we can explain more about crossover and
mutation, some information about chromosomes will be given.

ENCODING:

A chromosome should in some way contain information about solution that it represents. The
most used way of encoding is a binary string. A chromosome then could look like this:

Chromosome 1 1101100100110110
Chromosome 2 1101111000011110
A binary string represents each chromosome. Each bit in the string can represent some
characteristics of the solution. Another possibility is that the whole string can represent a number
- this has been used in the basic GA applet.

Of course, there are many other ways of encoding. The encoding depends mainly on the solved
problem. For example, one can encode directly integer or real numbers, sometimes it is useful to
encode some permutations and so on.

CROSSOVER:

After we have decided what encoding we will use, we can proceed to crossover operation.
Crossover operates on selected genes from parent chromosomes and creates new offspring. The
simplest way how to do that is to choose randomly some crossover point and copy everything
before this point from the first parent and then copy everything after the crossover point from the
other parent.

Crossover can be illustrated as follows: (| is the crossover point):

Chromosome 1 11011 | 00100110110


Chromosome 2 11011 | 11000011110
Offspring 1 11011 | 11000011110
Offspring 2 11011 | 00100110110
There are other ways how to make crossover, for example we can choose more crossover points.
Crossover can be quite complicated and depends mainly on the encoding of chromosomes.
Specific crossover made for a specific problem can improve performance of the genetic
algorithm.
MUTATION:

After a crossover is performed, mutation takes place. Mutation is intended to prevent falling of
all solutions in the population into a local optimum of the solved problem. Mutation operation
randomly changes the offspring resulted from crossover. In case of binary encoding we can
switch a few randomly chosen bits from 1 to 0 or from 0 to 1. Mutation can be then illustrated as
follows:

Original offspring 1 1101111000011110


Original offspring 2 1101100100110110
Mutated offspring 1 1100111000011110
Mutated offspring 2 1101101100110110
The technique of mutation (as well as crossover) depends mainly on the encoding of
chromosomes. For example when we are encoding permutations, mutation could be performed as
an exchange of two genes.

Functioning of a Genetic Algorithm


As an example, we're going to enter a world of simplified genetic. The "chromosomes"
encode a group of linked features. "Genes" encode the activation or deactivation of a feature.
Let us examine the global genetic pool of four basilosaurus belonging to this world. We
will consider the "chromosomes" which encode the length of anterior members.
The length of the "paw" and the length of the "fingers" are encoded by four genes : the
first two encode the "paw" and the other two encode the fingers.
In our representation of the genome, the circle on blue background depict the activation
of a feature, the cross on green background depict its deactivation. The ideal genome (short paws
and long fingers) is :

The genetic pool of our population is the following one :


Subject Genome

We can notice that A and B are the closest to their ancestors ; they've got quite long paws
and short fingers. On the contrary, D is close to the optimum, he just needs a small lengthening
of his fingers.
This is such a peculiar world that the ability to move is the main criteria of survival and
reproduction. No female would easily accept to marry basilosaurus whose paws would look like
A's. But they all dream to meet D one day.
The fitness is easy to compute: we just have to give one point to each gene corresponding
to the ideal. The perfect genome will then get four points. The probability of reproduction of a
given subject will directly depend on this value. In our case, we'll get the following results :

Subject Fitness Reproduction Probability


A 1 1/7 = 0.143
B 1 1/7 = 0.143
C 2 2/7 = 0.286
D 3 3/5 = 0.428
Total 7 7/7=1

We'll consider a cycle of reproduction with for descendants, i.e. four mating
concerning height subjects. D will be selected four times and will then get four descendants. C
will be selected twice and will get two descendants. Finally A and B will only be selected once.
The reproduction pattern is the following :

Subject Received Genome Fitness Reproduction


Genes Probability
A’ 2 2/10=0.2
A:
D:
B’ 2 2/10=0.2
B:
D:
C’ 3 3/10=0.3
D:
C:
D’ 3 3/10=0.3
C:
D:

Total - - 10 10/10=1

During reproduction crossovers occur at a random place (center of the genome for A', B'
and C', just after the first gene for D'). The link existing between the degree of adaptation and the
probability of reproduction leads to a trend to the rise of the average fitness of the population. In
our case, it jumps from 7 to 10.
During the following cycle of reproduction, C' and D' will have a common descendant :

D' : + C' : =
The new subject has inherited the intended genome : his paws have become flippers.

We can then see that the principle of genetic algorithms is simple :


1. Encoding of the problem in a binary string.
2. Random generation of a population. This one includes a genetic pool representing a
group of possible solutions.
3. Reckoning of a fitness value for each subject. It will directly depend on the distance to
the optimum.
4. Selection of the subjects that will mate according to their share in the population global
fitness.
5. Genomes crossover and mutations.
6. And then start again from point 3.
The functioning of a genetic algorithm can also be described in reference to
genotype (GTYPE) and phenotype (PTYPE) notions.
1. Select pairs of GTYPE according to their PTYPE fitness.
2. Apply the genetic operators (crossover, mutation...) to create new GTYPE.
3. Develop GTYPE to get the PTYPE of a new generation and start again from 1.

Crossover is the basis of genetic algorithms, there is nevertheless other operators like
mutation. In fact, the desired solution may happen not to be present inside a given genetic pool,
even a large one.
Mutations allow the emergence of new genetic configurations which, by widening the
pool improve the chances to find the optimal solution. Other operators like inversion are also
possible, but we won't deal with them here.

Adaptation and Selection : the scaling problem


We saw before that in a genetic algorithm, the probability of reproduction directly
depends on the fitness of each subject. We simulate that way the adaptive pressure of the
environment.
The use of this method nevertheless set two types of problems:
1. A "super-subject" being too often selected the whole population tends to converge
towards his genome. The diversity of the genetic pool is then too reduced to allow the
genetic algorithm to progress.
2.With the progression of the genetic algorithm, the differences between fitness are reduced.
The best ones then get quite the same selection probability as the others and the genetic
algorithm stops progressing.

In order to palliate these problems, it's possible to transform the fitness values. Here are
the four main methods:
1- Windowing: For each subject, reduce its fitness by the fitness of the worse subject.
2- Exponential: This method, proposed by S.R. Ladd, consists in taking the square roots of the
fitness plus one. This permits to reduce the influence of the strongest subjects.
3- Linear Transformation: Apply a linear transformation to each fitness, i.e. f ' = a.f + b. The
strongest subjects are once again reduced.
4- Linear normalization: Fitness is linearized. For example over a population of 10 subjects,
the first will get 100, the second 90, 80 ... The last will get 10.

To illustrate these methods, let's consider a population of four subjects to check the effect
of scaling. For each subject, we give the fitness and the corresponding selection probability.

Subjects 1 2 3 4
Rough Fitness 50/50% 25/25% 15/15% 10/10%
Windowing 40/66.7% 15/25% 5/8.3% 0/0%
Exponential 7.14/36.5% 5.1/26.1% 4.0/20.5% 3.32/16.9%
Linear 53.3/44.4% 33.3/27.8% 20/16.7 13.3/11.1%
Transfo.
Linear 40/40% 30/30% 20/20% 10/10%
normalization

Windowing eliminates the weakest subject - the probability comes to zero - and
stimulates the strongest ones (the best one jumps from 50 % to 67 %).
Exponential flattens the distribution. It's very useful when a super-subject induces an
excessively fast convergence.
Linear transformation plays slightly the same role than exponential.
At last, linear normalization is neutral towards the distribution of the fitness and only
depends on the ranking. It avoids as well super-subjects as a too homogeneous distribution.
Genetic Programming

One of the central challenges of computer science is to get a computer to do what


needs to be done, without telling it how to do it. Genetic programming addresses this challenge
by providing a method for automatically creating a working computer program from a high-level
problem statement of the problem. Genetic programming achieves this goal of automatic
programming (also sometimes called program synthesis or program induction) by
geneticallybreeding a population of computer programs using the principles of Darwinian natural
selection and biologically inspired operations. The operations include reproduction, crossover
(sexual recombination), mutation, and architecture-altering operations patterned after gene
duplication and gene deletion in nature.
Genetic programming is a domain-independent method that genetically breeds a
population of computer programs to solve a problem. Specifically, genetic programming
iteratively transforms a population of computer programs into a new generation of programs by
applying analogs of naturally occurring genetic operations. The genetic operations include
crossover (sexual recombination), mutation, reproduction, gene duplication, and gene deletion.
Genetic programming (GP) is an automated method for creating a working computer
program from a high-level problem statement of a problem. Genetic programming starts from a
high-level statement of “what needs to be done” and automatically creates a computer program
to solve the problem.
Applications of Genetic Programming
There are numerous applications of genetic programming including

• “black art” problems, such as the automated synthesis of analog electrical circuits,
controllers, antennas, networks of chemical reactions, and other areas of design,

• “programming the unprogrammable” (PTU) involving the automatic creation of


computer programs for unconventional computing devices such as cellular automata,
multi-agent systems, parallel systems, field-programmable gate arrays, field-
programmable analog arrays, ant colonies, swarm intelligence, distributed systems, and
the like,

• “commercially usable new inventions” (CUNI) involving the use of genetic programming
as an automated "invention machine" for creating commercially usable new inventions.

• We are constantly looking for new domain areas in which to apply the techniques of
genetic programming to achieve human-competitive machine intelligence.

• Distributed computer network topologies are designed by a Genetic Algorithm, using


three different objective functions to optimize network reliability parameters, namely
diameter, average distance, and computer network reliability. The Genetic Algorithm has
successfully designed networks with 100 order of nodes.

Genetic Algorithm Viewer


GAV is a demonstration applet of the functioning of a Genetic Algorithm (GA). It aims at
showing the power of GA and of the main mechanisms used while permitting a certain form of
visualization of the general functioning. We have it for demonstration purpose, which will be
shown during the presentation.
CONCLUSION

Genetic algorithms are original systems based on the supposed functioning of the Living.
The method is very different from classical optimization algorithms.
1. Use of the encoding of the parameters, not the parameters themselves.
2. Work on a population of points, not a unique one.
3. Use the only values of the function to optimize, not their derived function or other
auxiliary knowledge.
4. Use probabilistic transition function not determinist ones.
It's important to understand that the functioning of such an algorithm does
not guarantee success. We are in a stochastic system and a genetic pool may be too far from the
solution, or for example, a too fast convergence may halt the process of evolution. These
algorithms are nevertheless extremely efficient, and are used in fields as diverse as stock
exchange, production scheduling or programming of assembly robots in the automotive industry.
REFERENCES:

[1] Introduction to Genetic Algorithms


-Axcelis
(http://www.axcelis.com:80/articles/itga/application.html)

[2] Functioning of a Genetic Algorithm


(http://www.rennard.org/alife/english/gavintrgb.html#gafunct)

[3] Creating New Solutions through Mutation


Selecting Solutions via “Survival of the Fittest”
(http://www.solver.com/gabasics.html#Mutation)
(http://www.solver.com/gabasics.html#Selection)

[4] GA White Paper


(http://www.manmach.com/information/white.html)

[5] Introduction to Bioinformatics,


by S. Sundararajan & R. Balaji

[6] Genetic algorithm Warehouse


(http://www.geneticalgorithms.ai-depot.com)

Potrebbero piacerti anche