0% found this document useful (0 votes)
19 views68 pages

SC Genetric Algorithm PPTs-1

Uploaded by

india.tech2106
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views68 pages

SC Genetric Algorithm PPTs-1

Uploaded by

india.tech2106
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 68

BTech IV Year VII Semester Section: I

BCSE0103: SOFT COMPUTING-Genetic Algorithm(GA)

Dr. Dilip Kumar Sharma


PhD CSE (IIT DHN), SM(IEEE, ACM, CSI), Fellow IETE, Fellow IE(I)
Professor- Dept. of Computer Engineering & Applications
Dean (International Relations & Academic Collaborations)
GLA University, Mathura, INDIA
Email: [email protected]
https://www.gla.ac.in/academics/faculty-detail/7/prof-dilip-kumar-sharma
<BCSE0103> <Soft Computing> 1
BCSE0103: SOFT COMPUTING-
Genetic Algorithm(GA)
• Genetic Algorithm(GA):Introduction to GA, Search
optimization Method, Evolutionary Algorithm Working
Principle, Biological Background of GA, Working Principles of
GA, Encoding(Binary, Value, Permutation, Tree), Operators
of GA(Random Population, Reproduction or Selection),
Crossover and Mutation, Basics of Genetic Algorithm with
Examples, Introduction to Genetic programming
Text Books:
• S. Rajsekaran& G.A. VijayalakshmiPai, “Neural Networks,
Fuzzy Logic and Genetic Algorithm: Synthesis and
Applications”, 4th Edition, Prentice Hall of India,2003.

<BCSE0103> <Soft Computing> 2


BCSE0103: SOFT COMPUTING
Reference Books:
• Timothy J Ross ,"Fuzzy Logic with Engineering Applications", 3 rd Edition, John Wiley and
Sons,2016.
• David E. Goldberg ,"Genetic Algorithm in Search Optimization and Machine Learning
"Adission-Wesley,2009.
• Karray, “Soft Computing and Intelligent Systems Design: Theory, Tools and Applications”, 1 st
Edition, Pearson Education,2009.
Outcome: After completion of course, student will be able to:
• CO1: Understand basics of Soft Computing including Artificial Neural Networks, Fuzzy Logic and Genetic
Algorithms.
• CO2: Demonstrate the ability to develop some familiarity with current research problems and research
methods in Soft Computing by working on a research or design project.
• CO3: Understand about the fundamental theory and concepts of neural networks, neuro modeling, several
neural networks paradigms and its applications.
• CO4: Design and implement the concepts of knowledge using fuzzy inference systems and other machine
intelligence applications.
• CO5: Identify an evolutionary computing paradigm known as genetic algorithms and its applications to
engineering optimization problems.

<BCSE0103> <Soft Computing> 3


Background of Genetic Algorithm

• First time introduced by Professor John Holland at


Michigan University,USA in 1965.But,the first article on
Genetic Algorithm was published in 1975.
• A class of probabilistic optimization algorithms.
• Inspired by the biological evolution process.

Principles of Genetic Algorithm on two fundamental biological


processes:
(i) Genetics :-Gregor Johan Mendel-1865
(ii) Evolution:-Charles Drawin-1875

<BCSE0103> <Soft Computing> 4


A Brief Account on Genetics

<BCSE0103> <Soft Computing> 5


A Brief Account on
Genetics:- Genetic Code
Biometric Trait:-
Face, fingerprint, hand
geometry, palm print,
iris, voice, signature,
gait, and keystroke
dynamics are examples
of biometric traits. In
the context of a given
system and application,
the presentation of a
user's biometric feature
involves both
biological and
behavioural aspects.
<BCSE0103> <Soft Computing> 6
A Brief account on genetics

<BCSE0103> <Soft Computing> 7


A brief account on genetics
Crossing over
Crossing over is a cellular
process that happens during
meiosis when chromosomes of
the same type are lined up.
When two chromosomes —
one from the mother and one
from the father — line up,
parts of the chromosome can
be switched. The two
chromosomes contain the
same genes, but may have
different forms of the genes.

Meiosis is a type of cell division in sexually reproducing organisms that reduces the
number of chromosomes in gametes (cells, or egg ).
<BCSE0103> <Soft Computing> 8
A Brief Account on Evolution
: Natural Selection

RANKING

<BCSE0103> <Soft Computing> 9


A brief account on evolution
Mutation:
A mutation is a change in the DNA sequence of an
organism. Mutations can result from errors in DNA
replication during cell division, exposure to mutagens
or a viral infection.

Mutation, an alteration in the genetic material


(the genome) of a cell of a living organism or of a virus
that is more or less permanent and that can be
transmitted to the cell’s or the virus’s descendants.
<BCSE0103> <Soft Computing> 10
Biological process :
A quick overview

<BCSE0103> <Soft Computing> 11


Definition: Genetic Algorithm

• Genetic algorithm is a population-based probabilistic search and


optimization techniques, which works based on the mechanisms
of natural genetics and natural evaluation.

<BCSE0103> <Soft Computing> 12


Working of Genetic Algorithm

The genetic algorithm works on the evolutionary generational cycle to


generate high-quality solutions. These algorithms use different
operations that either enhance or replace the population to give an
improved fit solution.
There are five phases to solve the complex optimization problems,
which are given as below:
(i) Initialization
(ii) Fitness Assignment
(iii) Selection
(iv) Reproduction
(v) Termination
<BCSE0103> <Soft Computing> 13
Working of Genetic Algorithm
1. Initialization:-

• The process of a genetic algorithm starts by generating the set of


individuals, which is called population.
• Here each individual is the solution for the given problem. An
individual contains or is characterized by a set of parameters called
Genes.
• Genes are combined into a string and generate chromosomes, which
is the solution to the problem.
• One of the most popular techniques for initialization is the use of
random binary strings.

<BCSE0103> <Soft Computing> 14


Working of Genetic Algorithm

2. Fitness Assignment:-
• Used to determine how fit an individual is? It means the ability of an
individual to compete with other individuals.
• In every iteration, individuals are evaluated based on their fitness
function. The fitness function provides a fitness score to each
individual.
• This score further determines the probability of being selected for
reproduction.
• The high the fitness score, the more chances of getting selected for
reproduction.

<BCSE0103> <Soft Computing> 15


Working of Genetic Algorithm
3. Selection:-

• The selection phase involves the selection of individuals for


the reproduction of offspring.
• All the selected individuals are then arranged in a pair of two
to increase reproduction.
• Then these individuals transfer their genes to the next
generation.

<BCSE0103> <Soft Computing> 16


Working of Genetic Algorithm
4. Reproduction:-

In this step, the genetic algorithm uses two variation operators that are
applied to the parent population.

The two operators involved in the reproduction phase are given below:
(i) Crossover:-In this process, a crossover point is selected at random
within the genes. Then the crossover operator swaps genetic
information of two parents from the current generation to produce a
new individual representing the offspring.

<BCSE0103> <Soft Computing> 17


Working of Genetic Algorithm

(ii) Mutation:-The mutation operator inserts random genes in the offspring (new child) to

maintain the diversity in the population. It can be done by flipping some bits in the
chromosomes. Mutation helps in solving the issue of premature convergence and enhances
diversification.

**A diversity in population is a group of people who differ in terms of


one of more characteristics, such as by gender, age, class and ethnicity .

5. Termination:-After the reproduction phase, a stopping criterion is applied as a base for


termination. The algorithm terminates after the threshold fitness solution is reached. It will
identify the final solution as the best solution in the population.

<BCSE0103> <Soft Computing> 18


Framework of Genetic Algorithm

<BCSE0103> <Soft Computing> 19


<BCSE0103> <Soft Computing> 20
Framework of Genetic Algorithm:
A detail view

<BCSE0103> <Soft Computing> 21


Optimization problem solving with
Genetic Algorithm

<BCSE0103> <Soft Computing> 22


Optimization problem solving
with Genetic Algorithm

Objective function: It takes the chromosome as input, then produces a


result that quantifies how good that chromosome is.

Constraints: Computes the values of all the inequality and equality


constraints

PM-Probability of a mutation
Input Parameters: PC-Probability crossover
N- a population size.

Fitness Function: Also known as the Evaluation Function that evaluates how
close a given solution is to the optimum solution of the
desired problem.

<BCSE0103> <Soft Computing> 23


Optimization problem solving with
Genetic Algorithm
Encoding: In genetic algorithm, an encoding function is use to represent mapping
of the object variables to a string code and mapping of string code to its object
variable is achieve through decoding function.

Decoding: It is a process of transforming a solution from the genotype to the


phenotype space.

Genotype: The set of genes representing the chromosome.

Phenotype: The actual physical representation of the chromosome.

<BCSE0103> <Soft Computing> 24


Genetic Algorithm Operators

<BCSE0103> <Soft Computing> 25


Different Genetic Algorithm Strategies

1. Simple Genetic Algorithm.


2. Steady State Genetic Algorithm.
3. Messy State Genetic Algorithm.

<BCSE0103> <Soft Computing> 26


Simple GA

<BCSE0103> <Soft Computing> 27


Applications :Simple Genetic Algorithm

1.Learning robot behavior using Simple Genetic Algorithm.


2.In the finance industry.
3.Neural networks.
4.Soft computing Applications like Fuzzy logic, Neurocomputing.
5. Optimization problems.

<BCSE0103> <Soft Computing> 28


Encoding Schemes in GA

<BCSE0103> <Soft Computing> 29


Encoding Schemes in GA

<BCSE0103> <Soft Computing> 30


Individual Representation :Phenotype
and Genotype

<BCSE0103> <Soft Computing> 31


Individual Representation :Phenotype
and Genotype

<BCSE0103> <Soft Computing> 32


Encoding techniques

<BCSE0103> <Soft Computing> 33


Binary Encoding

<BCSE0103> <Soft Computing> 34


Example: 0-1 Knapsack problem

<BCSE0103> <Soft Computing> 35


Example: 0-1 Knapsack problem

<BCSE0103> <Soft Computing> 36


Example: 0-1 Knapsack problem

<BCSE0103> <Soft Computing> 37


Few more examples
OBJECTIVE FUNCTION

At x=0, f(0)=Infinite
At x=1,f(1)=125.5
At x=2,f(2)=64.5
.
.
At x=5,f(5)=37.5(Minimum)
.
.
.
0101 .
So (5)2 =(0101)

<BCSE0103> <Soft Computing> 38


Few more examples

X = 10
Y = -1
01010 10001

<BCSE0103> <Soft Computing> 39


Pros and cons of Binary encoding
scheme

<BCSE0103> <Soft Computing> 40


Selection Schemes in
Genetic Algorithm
It is the process of creating the population for next generation from the current
generation.

Selection is the stage of a genetic algorithm in which individual genomes or


chromosomes are chosen from a population for later breeding i.e. the fittest individuals
are selected for reproduction in order to produce offspring of the next generation.

“Selects the best, discards the rest”


Mainly we discuss on two things:-

1.How to choose the individual in the population that will create OFFSPRING for the
next generation?

2.How many OFFSPRING each will create?

<BCSE0103> <Soft Computing> 41


Selection Schemes in Genetic Algorithm

To generate new population:-


(i) Create a mating Pool
(ii) Select a pair
(iii)Reproduce

<BCSE0103> <Soft Computing> 42


Selection Schemes in Genetic
Algorithm

o Elitist Selection

<BCSE0103> <Soft Computing> 43


Canonical Selection

=(fi /Σ fi) X N
i=1

<BCSE0103> <Soft Computing> 44


Canonical Selection

<BCSE0103> <Soft Computing> 45


Canonical Selection: Example
n

fitness(i)=(fi /Σ fi) X N i=1

=(8.2+3.2+1.4+1.2+4.2+.3)/6=18.5/6=3.08
Then
fitness(A)=fA / =8.2/3.08=2.66
fitness(B)=fB / =3.2/3.08=1.04
Mating Pool (Pick 50% of N) fitness(C)=f C / =1.4/3.08=.45
Chromosome Current Fitness Value fitness(D)=fD / =1.2/3.08=.38
A 2.66
fitness(E)=fE / =4.2/3.08=1.36
E 1.36 fitness(F)=fF / =.3/3.08=.1

B 1.04

<BCSE0103> <Soft Computing> 46


Roulette-Wheel selection

<BCSE0103> <Soft Computing> 47


Roulette-Wheel selection mechanism

<BCSE0103> <Soft Computing> 48


Roulette-Wheel selection mechanism

<BCSE0103> <Soft Computing> 49


Roulette-Wheel selection mechanism:
An Example

.04

Ʃfi=23.25

<BCSE0103> <Soft Computing> 50


Crossover Technique
 It is also called recombination. It is a genetic operator used to combine the
genetic information of two parents to generate new offspring.

 Crossover is a genetic operator used to vary the programming of a chromosome


or chromosomes from one generation to the next.

 Crossover is sexual reproduction. Two strings are picked from the mating pool at
random to crossover in order to produce superior offspring. The method chosen
depends on the Encoding Method.

<BCSE0103> <Soft Computing> 51


Crossover Techniques in Binary Coded
GA

<BCSE0103> <Soft Computing> 52


Single point crossover

<BCSE0103> <Soft Computing> 53


Single point crossover: Illustration

<BCSE0103> <Soft Computing> 54


Two-point crossover

<BCSE0103> <Soft Computing> 55


Two-point crossover: Illustration

<BCSE0103> <Soft Computing> 56


Multi-point crossover

<BCSE0103> <Soft Computing> 57


Mutation
Mutation Operator is a unary operator and it needs only one parent to work on.
It does so by selecting a few genes from our selected chromosome and apply
the desired algorithm.

In GA ,there are five Mutation Algorithms for string manipulation –


1) Bit Flip Mutation 2) Random Resetting Mutation
3) Swap Mutation 4) Scramble Mutation
5) Inversion Mutation

<BCSE0103> <Soft Computing> 58


Mutation Algorithm:
Bit Flip Mutation
Bit Flip Mutation is mainly used for bit string manipulation while others can be
used for any kind of strings. Here our chromosome will be represented as an array
and each index will represent one gene. Strings can be represented as an array of
characters which in turn is an array of ASCII or numeric values. In bit flip
mutation, we select one or more genes (array indices) and flip their values i.e. we
change 1s to 0s and vice versa. It is better explained using the given diagram.

<BCSE0103> <Soft Computing> 59


Mutation Algorithm:
Random Resetting Mutation

In random resetting mutation, we select one or more genes (array indices) and
replace their values with another random value from their given ranges. Let’s
say a[i] (an array index / gene) ranges from [1, 6] then random resetting
mutation will select one value from [1, 6] and replace a[i]’s value with it.

<BCSE0103> <Soft Computing> 60


Mutation Algorithm:
Swap Mutation

In Swap Mutation we select two genes from our chromosome and interchange
their values.

<BCSE0103> <Soft Computing> 61


Mutation Algorithm:
Scramble Mutation

In Scramble Mutation we select a subset of our genes and scramble their value.
The selected genes may not be contiguous (see the second diagram).

<BCSE0103> <Soft Computing> 62


Genetic Algorithm with example

<BCSE0103> <Soft Computing> 63


Genetic Algorithm with example
Genetic algorithms find use in various real-world applications.

1.Neural networks:-We use it for ‌genetic optimization in neural networks or use


cases like inheriting qualities of neurons, neural network pipeline optimization,
finding the best fit set of parameters for a given neural network, and others.

2. Data mining and clustering:-Data mining and clustering use genetic


algorithms to find out the centre point of the clusters with an optimal error rate
given to its great searching capability for an optimal value. It is renowned as an
unsupervised learning process in machine learning, where we categorize the data
based on the characteristics of the data points.

3. Image processing:-Image processing tasks, such as image segmentation, are


one of the major use cases of genetic optimization.

<BCSE0103> <Soft Computing> 64


Genetic Algorithm with example
4. Wireless sensor network:-WSN utilizes genetic machine learning to stimulate the
sensors. We can optimize and even customize all the operational stages with the help of
the fitness function from genetic algorithms in wireless sensor networks.

5. Traveling salesman problem (TSP):-TSP is one of the real-life combinatorial


optimization problems that were solved using genetic optimization. It helps in finding an
optimal way in a given map with the distance between two points and with the routes to
be covered by the salesman. It finds application in real-time processes like planning,
manufacturing and logistics.

6. Vehicle routing problems:-Genetic algorithms help in finding the optimal weight of


goods to be delivered through the optimal set of delivery routes. Factors such as depot
points, wait, distance are taken into consideration while solving such problems if they
have any kind of restrictions. Moreover, the genetic algorithm approach is competitive in
terms of solution quality and time with simulated annealing algorithms and tabu search.

<BCSE0103> <Soft Computing> 65


Genetic Algorithm with example

7. Mechanical engineering design:-Genetic algorithm example where the aircraft


wing design is a kind of designing problem that takes multiple disciplines into
consideration. It requires improvement in the ratio of left to drag for a complex wing.
The fitness function in genetic optimization is flexible to considerations that come as
a demand for a particular design.

8. Manufacturing system:-The manufacturing arena includes various examples of


the cost function. Based on the same, the need to find an optimal set of parameters
for such functions poses a problem.Genetic optimization performs this task of using
the optimized set of parameters to minimize the cost function. It also finds
application in product manufacturing to achieve optimum production plans by
considering dynamic conditions like capacity, inventories, or material quality.

<BCSE0103> <Soft Computing> 66


Genetic Algorithm with example

9. Financial markets:-A variety of issues can be solved using genetic optimization in the
financial market. It helps in finding an optimal combination of parameters that can affect
the trades or market rules.

10. Medical science:-Medical signs have an array of use cases for genetic optimization.
The areas of predictive analysis include protein prediction, RNA structure prediction,
operon prediction, and others. Other processes such as protein folding, gene expression
profiling analysis, bioinformatics multiple sequence alignment, or some of the process
alignment that uses genetic optimisation.

11. Task scheduling:-Genetic machine learning algorithms are used to derive optimal
schedules that satisfy certain constraints related to a problem. For instance: assume that you
have to prepare the schedule for the semester exams for University. The genetic algorithm
will find the best optimal schedule for the university considering all the constraints like the
number of classrooms, the number of students, the total number of courses and subjects,
and others.

<BCSE0103> <Soft Computing> 67


Genetic Algorithm with example

12. Economics: Economics is the study of resource utilization in the


production, distribution, and complete consumption of goods and services over
a time period. The genetic algorithm creates models of demand and supply that
derive asset pricing, game theory, and others.

13. Robotics: Robotics comprises the construction, design, and working of the
autonomous robot. Genetic algorithms contribute to the robotics field by
providing the necessary insight into the decisions made by the robot. It
generates optimal routes for the robot so that it can use the least amount of
resources to get to the desired position.

<BCSE0103> <Soft Computing> 68

You might also like