CS 7TH SEM MODULE 3RD PPT
CS 7TH SEM MODULE 3RD PPT
Genetic Algorithm
• A genetic algorithm is a heuristic search method
used in artificial intelligence and computing.
• It is used for finding optimized solutions to search
problems based on the theory of natural selection
and evolutionary biology.
• Genetic algorithms are excellent for searching
through large and complex data sets. They are
considered capable of finding reasonable solutions
to complex issues as they are highly capable of
solving unconstrained and constrained optimization
issues.
• Genetic Algorithms are being widely used in
different real-world applications, for
example, Designing electronic circuits, code-
breaking, image processing, and artificial
creativity.
• What is a Genetic Algorithm?
• Before understanding the Genetic algorithm, let's first
understand basic terminologies to better understand
this algorithm:
• Population: Population is the subset of all possible or
probable solutions, which can solve the given problem.
• Chromosomes: A chromosome is one of the solutions
in the population for the given problem, and the
collection of gene generate a chromosome.
• Gene: A chromosome is divided into a different gene, or
it is an element of the chromosome.
• Allele: Allele is the value provided to the gene within a
particular chromosome.
• Fitness Function: The fitness function is used
to determine the individual's fitness level in
the population. It means the ability of an
individual to compete with other individuals. In
every iteration, individuals are evaluated based
on their fitness function.
• Genetic Operators: In a genetic algorithm, the
best individual mate to regenerate offspring
better than parents. Here genetic operators
play a role in changing the genetic composition
of the next generation.
• Selection
• How Genetic Algorithm Work?
• 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.
• It basically involves five phases to solve the complex
optimization problems, which are given as below:
• Initialization
• Fitness Assignment
• Selection
• Reproduction
• Termination
• 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.
• 2. Fitness Assignment
• Fitness function is 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.
• 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.
• There are three types of Selection methods
available, which are:
• Roulette wheel selection
• Tournament selection
• Rank-based selection
• 4. Reproduction
• After the selection process, the creation of a child occurs
in the reproduction step. 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:
• Crossover: The crossover plays a most significant role in
the reproduction phase of the genetic algorithm.
• 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.
• The genes of parents are exchanged among
themselves until the crossover point is met.
These newly generated offspring are added to
the population. This process is also called or
crossover.
• 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.
General Workflow of a Simple
Genetic Algorithm