Unit 4

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 39

Soft Computing

Unit 4
Background of Genetic Algorithm

• First time introduced by Prof. John Holland (of Michigan University,


USA, 1965).
• But, the first article on GA was published in 1975. Principles of GA
based on two fundamental biological processes:
1) Genetics: Gregor Johan Mendel (1865)
2) Evolution: Charles Darwin (1875)
A brief account on genetics

• The basic building blocks in living bodies are cells. Each cell carries the
basic unit of heredity, called gene
• For a particular specie, number of chromosomes is fixed.
• Examples
• Mosquito: 6
• Frogs: 26
• Human: 46
A brief account on genetics

• Evolution : Natural Selection


• Four primary premises:
1) Information propagation: An offspring has many of its characteristics of its
parents (i.e. information passes from parent to its offspring). [Heredity]
2) Population diversity: Variation in characteristics in the next generation.
[Diversity]
3) Survival for existence: Only a small percentage of the offspring produced
survive to adulthood. [Selection]
4) Survival of the best: Offspring survived depends on their inherited
characteristics. [Ranking]
Phenotype and Genotype

• The genotype is a set of genes in the DNA which are responsible for


the unique trait or characteristics.
• Whereas the phenotype is the physical appearance or characteristic of
the organism. 
• One can determine the genotype by the biological tests.
• On the other hand, the phenotype is determined by an individual’s
genotype and can be expressed as genes or by the visible traits.
Difference between Genotype and Phenotype

Genotype Phenotype
The hereditary information of the organism in the form of gene in The characters of an organism which are visible are known as
the DNA and remains the same throughout the life. phenotypes.

Same genotype produces same phenotype. Same phenotype may or may not belong to same genotype.

Present inside the body as genetic material. Expression of genes as the external appearence.

The genotype is inherited from the parent to the offspring. The phenotype is not inherited from the parent.

It can be determined by scientific methods such as the polymerase It can be determined by observing the organism.
chain reaction.

It is affected by genes. It is affected by genotype and environmental conditions.

For eg., Blood group, eye colour, height, genetic diseases. For eg., Weight, physique, beak of birds
Working of Genetic Algorithm

• 1) GA is an iterative process.
• 2) It is a searching technique.
• 3) Working cycle with / without convergence.
• 4) Solution is not necessarily guaranteed. Usually, terminated with a
local optima
Working of Genetic Algorithm

• An individual is characterized by a set of parameters (variables)


known as Genes.
• Genes are joined into a string to form
a Chromosome (solution).
Framework of GA: A detail view
GA Operators

• 1) Encoding: How to represent a solution to fit with GA framework.


• 2) Convergence: How to decide the termination criterion.
• 3) Mating pool: How to generate next solutions.
• 4) Fitness Evaluation: How to evaluate a solution.
• 5) Crossover: How to make the diverse set of next solutions.
• 6) Mutation: To explore other solution(s).
• 7) Inversion: To move from one optima to other.
Different Encoding Schemes

• Often, GAs are specified according to the encoding scheme it follows.


For example:
• Encoding Scheme
• Binary encoding – ൐ Binary Coded GA or simply Binary GA
• Representing a gene in terms of bits (0s and 1s).
• Real value encoding – ൐ Real Coded GA or simply Real GA
• Representing a gene in terms of values or symbols or string.
• Order encoding – ൐ Order GA (also called as Permuted GA
• Representing a sequence of elements.
Binary Encoding
Real value encoding
GA Selection

• After deciding an encoding scheme, the second important thing is


how to perform selection from a set of population, that is, how to
choose the individuals in the population that will create offspring for
the next generation and how many offspring each will create.
• The purpose of selection is, of course, to emphasize fittest individuals
in the population in hopes that their offspring will in turn have even
higher fitness.
Canonical selection (proportionate‐based selection)
Canonical selection
Roulette-Wheel selection:

• In this scheme, the probability for an individual is being selected in the mating pool is considered to be
proportional to its fitness.
Roulette-Wheel selection mechanism:
Roulette-Wheel selection mechanism:
Roulette-Wheel selection mechanism: An Example
Rank-based selection

• The process in rank selection consists of two steps.


1. Individuals are arranged in an ascending order of their fitness
values.
The individual, which has the lowest value of fitness is assigned rank 1, and other
individuals are ranked accordingly.
2. The proportionate based selection scheme is then followed based
on the assigned rank.
Rank-based selection
Rank-based selection: Example
Tournament Selection
Tournament selection
Analysis of different selection strategies
Reproduction in Genetic Algorithm

• Reproduction:
• Crossover
• Mutation
• In crossover, there is an exchange of properties between two parents and as a result of which two offspring
solutions are produced.
• The crossover point(s) (also called k‐point(s)) is(are) decided using a random number generator generating
integer(s) in between 1 and L, where L is the length of the chromosome.
Then we perform exchange of gene values with respect to the k‐point(s)
Crossover operations

• There exists a large number of crossover schemes


• Single point crossover
• Two‐point crossover
• Multi‐point crossover (also called n‐point crossover)
• Uniform crossover (UX)
• Half‐uniform crossover (HUX)
Single and two point crossover
Multi-point crossover

1) In case of multi‐point crossover, a number of crossover points are selected along the length of the string, at
random.
2) The bits lying between alternate pairs of sites are then swapped.
Uniform Crossover

• Uniform crossover is a more general version of the multi‐point crossover.


• In this scheme, at each bit position of the parent string, we toss a coin (with a certain probability 􀝌􀝏) to
determine whether there will be swap of the bits or not.
• The two bits are then swapped or remain unaltered, accordingly.
Mutation Operation

• In genetic algorithm, the mutation is a genetic operator used to


maintain genetic diversity from one generation of a population (of
chromosomes) to the next.
• It is analogues to biological mutation.
• In GA, the concept of biological mutation is modelled artificially to
bring a local change over the current solutions.
Mutation Operation
Mutation by Flipping
Mutation Technique: Interchanging

.
Mutation Technique: Reversing
Termination and/or convergence criteria

• Commonly known convergence test or termination conditions are:


1)A solution is found that satisfies the objective criteria.
2)Fixed number of generation is executed.
3)Allocated budget (such as computation time) reached.
4)The highest ranking solution fitness is reaching or has reached a plateau such that successive
iterations no longer produce better result.
5)Manual inspection.
6)Combination of the above.
Simulated Annealing

• In mechanical term Annealing is a process of hardening a metal or glass to


a high temperature then cooling gradually, so this allows the metal to reach
a low-energy crystalline state.
• The same process is used in simulated annealing in which the algorithm
picks a random move, instead of picking the best move.
• If the random move improves the state, then it follows the same path.
• Otherwise, the algorithm follows the path which has a probability of less
than 1 or it moves downhill and chooses another path.
• The algorithm is basically hill-climbing except instead of picking the best
move, it picks a random move
Reference

• NPTEL course on Soft Computing by Prof. Debasis Samanta

You might also like