0% found this document useful (0 votes)
4 views26 pages

Genetic Algorithm

The document discusses the principles of evolution and its application in artificial intelligence through evolutionary computation, specifically genetic algorithms. It explains key concepts such as genes, chromosomes, fitness, crossover, and mutation, which are fundamental to genetic algorithms. Additionally, it outlines the process of using genetic algorithms to solve optimization problems, including a detailed example scenario.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views26 pages

Genetic Algorithm

The document discusses the principles of evolution and its application in artificial intelligence through evolutionary computation, specifically genetic algorithms. It explains key concepts such as genes, chromosomes, fitness, crossover, and mutation, which are fundamental to genetic algorithms. Additionally, it outlines the process of using genetic algorithms to solve optimization problems, including a detailed example scenario.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Artificial Intelligence

CSE - 351
Genetic
Algorithm
Contents
❖ Evolution
❖ Natural Evolution
❖ Evolutionary Computation
❖ Genetic Algorithms
❖ Evolution Strategy
❖ Genetic Programming
❖ An Example Scenario

3
Evolution?

❖Evolution: A series of genetic changes by which a


living organism acquires characteristics that
distinguish it from other organisms.

❖Human are the products of evolution.

❖So, by modeling the process of evolution, we might


expect to create intelligent behaviour.

4
Natural Evolution
❖On 1st July 1858, Darwin Presented his theory of
evolution
❖Darwin’s classical theory of evolution, together
with Weisman’s theory of natural selection and
Mendel’s concept of genetics now represent the
Neo-Darwinian paradigm.
❖Neo-Darwinism is based on the process of
reproduction, mutation, competition and
selection.

5
Evolutionary Computation

❖Evolutionary computation simulates evolution on a


computer.
❖The evolution approach to machine learning is based
on computational model of natural selection and
genetics. We call them evolutionary computation, an
umbrella term that combines genetic algorithms,
evolution strategies and genetic programming.

6
Genetic Algorithms
❖A type of evolutionary computation inspired by
Darwin’s theory of evolution.
❖A genetic algorithm generates a population of
possible solutions encoded as chromosomes,
evaluates their fitness, and create a new population by
applying genetic operators-crossover and mutation.
❖By repeating this process over many generations, the
genetic algorithm breeds an optimal solution to the
problem.

7
Keywords Related to GA
❖Gene: A basic unit of chromosome that controls the
development of a particular feature of a living organism. In
Holland’s (Founder of GA) Chromosome a gene is represented
by either 0 or 1.
❖Chromosomes: A string of genes that represent an individual.
Each chromosome consists of a number of gene.
❖Fitness: The ability of a living organism to survive and
reproduce in a specific environment.
❖Crossover: A reproduction operator that creates a new
chromosome by exchanging parts of two existing chromosome.
❖Mutation: A genetic operator that randomly change the gene
value in a chromosome.

8
Keywords Related to GA (cont.)
❖Fitness Function: A mathematical function used for calculating
the fitness of a chromosome.
❖Crossover Probability: A number between zero and one that
indicates the probability of two chromosomes crossing over.
❖Mutation Probability: A number between zero and one that
indicates the probability of mutation occurring in a single gene.
❖Offspring: An individual that was produced through
reproduction. It also referred to as child.
❖Population: A group of individuals that breed together.

9
Evolution Strategy
❖Evolution strategy is a numerical optimization procedure.
❖Unlike the genetic algorithms, evolution strategies use only a
mutation operator, and do not require a problem to be represented
in coded form.
❖Evolution strategies are used for solving technical optimization
problems when no analytical objective function is available, and no
conventional optimization method exists.

10
Genetic Programming

❖An application of genetic algorithms to computer


programs.
❖Genetic programming is most easily implemented
where the programming language permits a program
to be manipulated as data and the newly created
data to be executed as a program.

11
Genetic Algorithm Flowchart

Start Select a pair of chromosomes for mating

With the crossover probability pc exchange


part of the two selected chromosomes and
Generate a population of select two offspring
chromosomes of size N:
x1, x2, ……, xN
With the mutation probability pm randomly
change the gene Values in the two offspring
Calculate the fitness of chromosomes
each chromosome:
f(x1), f(x2), ……, f(xN)
Place the resulting chromosomes
in the new population
No
Termination? No
Size of Population
equal to N?
Yes
Yes
Stop
Replace the current chromosome population
with the new population
12
Example Problem & Solution
❖Find the maximum value of the function (15x-x2),
where parameter x varies between 0 and 15.
❖ Chromosome can be built with only four gene (0-15)
Solution:
Suppose,
❖ The size of the chromosome population, N = 6
❖ The crossover probability, pc = 0.7
❖ The mutation probability, pm = 0.001
❖ The fitness function, f(x) = 15x-x2

13
Example Problem & Solution
Step 1: GA creates an initial population of
chromosomes by filling six 4-bit string with
randomly generated ones and zeros

Chromosome Chromosome Decoded Chromosome Fitness


Label String Integer Fitness Ratio
X1 1100 12
X2 0100 4
X3 0001 1
X4 1110 14
X5 0111 7
X6 1001 9

14
Example Problem & Solution

Step 2: Calculate the fitness of each individual


Chromosome
Chromosome Chromosome Decoded Chromosome Fitness
Label String Integer Fitness Ratio
X1 1100 12 36
X2 0100 4 44
X3 0001 1 14
X4 1110 14 14
X5 0111 7 56
X6 1001 9 54

15
Fitness Function and Chromosome
Locations

. .
.
.
. .

16
Example Problem & Solution
Step 3: The fitness ratio determines the chromosome’s chance
of being selected for mating.
❖X5 & X6 have fair chance; X3 & X4 have less chance.

Chromosome Chromosome Decoded Chromosome Fitness


Label String Integer Fitness Ratio
X1 1100 12 36 16.51
X2 0100 4 44 20.18
X3 0001 1 14 6.42
X4 1110 14 14 6.42
X5 0111 7 56 25.68
X6 1001 9 54 24.77

17
Fitness Function in Roulette
Wheel Distribution

1100 (12)=36
0100 (4)=44
0001 (1)=14
1110 (14)=14
0111 (7)=56
1001 (9)=54

18
Example Problem & Solution
(Mating)
Step 4: Select chromosome for mating.
❖First X6 & X2 become parents, 2nd X1 & X5, then X2 &
X5.
Generation i Crossover
Chromoso Chromosome
me Label String
X1i 1100 X6i 10-01 X2i 01-00
X2i 0100
X3i 0001 X1i 11-00 X5i 01-11
X4i 1110
X5i 0111 X2i 01-00 X5i 01-11
X6i 1001

19
Example Problem & Solution
(Crossover)
Step 5: Crossover Operator randomly chooses a crossover point
where two parent chromosomes ‘Break’ and then exchange the
chromosomes after that point.

Generation i Crossover
Chromoso Chromosome
me Label String
X1i 1100 X6i 10-01 X2i 01-00
X2i 0100
X3i 0001 X1i 11-00 X5i 01-11
X4i 1110
X5i 0111 X2i 01-00 X5i 01-11
X6i 1001

20
Example Problem & Solution
(Crossover)
Step 5: If a pair of chromosomes does not cross over then
chromosome cloning take places and the offspring are exact
copies of each parent.

Generation i Crossover
Chromoso Chromoso
me Label me String
X1i 1100 X6i 10-01 X2i 01-00 X6`i 1000
X2i 0100 X2`i 0101
X3i 0001 X1i 11-00 X5i 01-11 X1`i 1111
X4i 1110 X5`i 0100
X5i 0111 X2i 01-00 X5i 01-11 X5`i 0100
X6i 1001 X2`i 0111

21
Example Problem & Solution
(Mutation)
Step 6: The mutation operator flips a randomly selected gene in a
chromosome.

Generation i Crossover Mutation


Chromoso Chromosom
me Label e String
X1i 1100 X6`i 1000
X2i 0100 X6i 10-01 X2i 01-00 X2`i 0101
X3i 0001 X1`i 1111, X1``i 1011
X1i 11-00 X5i 01-11
X4i 1110 X5`i 0100
X5i 0111 X2`i 0100, X2``i 0110
X2i 01-00 X5i 01-11
X6i 1001 X5`i 0111

22
Example Problem & Solution
Step 7: The fitness ratio determines the chromosome’s chance
of being selected for mating.
❖X5 & X6 have fair chance; X3 & X4 have less chance.

Generation i Generation i+1


Chromosome Chromosome Chromosome Chromosome Fitness
Label String Label String 15x-x2

X1i 1100 X1i+1 1000 56


X2i 0100 X2i+1 0101 50
X3i 0001 X3i+1 1011 44
X4i 1110 X4i+1 0100 44
X5i 0111 X5i+1 0110 54
X6i 1001 X6i+1 0111 56

23
Fitness Function and Chromosome
Locations

. .

24
Applications of Genetic Algorithm

• Links:
• https://www.quora.com/What-are-some-real-world-applications-of-
genetic-algorithms
. .
• http://brainz.org/15-real-world-applications-genetic-algorithms/
• https://en.wikipedia.org/wiki/List_of_genetic_algorithm_applications

25
Recommended Textbooks
❖ [Negnevitsky, 2001] M. Negnevitsky “ Artificial Intelligence:
A guide to Intelligent Systems”, Pearson Education Limited,
England, 2002.
❖ [Russell, 2003] S. Russell and P. Norvig Artificial
Intelligence: A Modern Approach Prentice Hall, 2003,
Second Edition
❖ [Patterson, 1990] D. W. Patterson, “Introduction to Artificial
Intelligence and Expert Systems”, Prentice-Hall Inc.,
Englewood Cliffs, N.J, USA, 1990.
❖ [Lindsay, 1997] P. H. Lindsay and D. A. Norman, Human
Information Processing: An Introduction to Psychology,
Academic Press, 1977.

26

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy