Genetic Algorithm (GA) is a search-based optimization technique based on the principles of Genetics and Natural Selection. It is frequently used to find optimal or near-optimal solutions to difficult problems which otherwise would take a lifetime to solve. It is frequently used to solve optimization problems, in research, and in machine learning.
1. Genetic Algorithm (GA)
Presented by :
A. SEKHAR REDDY
M.S. (Pharm.) semester-II
Reg.No:20PIM3277
Department of Pharmacoinformatics
NIPER , S.A.S. nagar (Mohali), Punjab,India
"Survival of the fittest" - Darwin
2. Genetic Algorithm
• In computer science , a genetic algorithm (GA) is a metaheuristic inspired by the
process of natural selection and genetics that belongs to the larger class of
evolutionary algorithms (EA)
• GAs were developed by John Holland
• Genetic algorithms are commonly used to generate high-quality solutions to
optimization and search problems by relying on biologically inspired operators such
as mutation, crossover and selection
• It is frequently used to find optimal or near-optimal solutions to difficult problems
which otherwise would take a lifetime to solve
2
3. Optimization
• Optimization is the process of making something better. In any process, we have a
set of inputs and a set of outputs as shown in the following figure.
• Optimization refers to finding the values of inputs in such a way that we get the
best output values.
• GA is frequently used to solve optimization problems, in research, and in machine
learning
3
4. Basic Terminology
• Population − It is a subset of all the possible (encoded) solutions to the given
problem. The population for a GA is analogous to the population for human beings
except that instead of human beings, we have Candidate Solutions representing
human beings
• Chromosomes − A chromosome is one such solution to the given problem
• Gene − A gene is one element position of a chromosome
• Allele − It is the value of a gene takes for a particular chromosome
4
6. 6
GENETIC ALOGORITHM TRADITIONAL ALOGORITHM
based on genetics and natural
selection to solve optimization
problems
step by step procedure to solve a
given problem
most advanced not as advanced
used in fields like AI , ML used in fields like programming
and mathematics
based on probabilistic rules based on fully deterministic rules
search on population of points search on single point
7. Components of GA
A problem definition as input, and
• Encoding principles (gene, chromosome)
• Initialization procedure (creation)
• Selection of parents (reproduction)
• Genetic operators (mutation, recombination)
• Evaluation function (environment)
• Termination condition
7
9. 9
• GA uses three main types of rules at each step to create the
next generation from the current population
1. Selection
2. Cross Over
3. Mutation
10. Selection
• Selection is the stage of a genetic algorithm in which individual genomes
are chosen from a population for later breeding (using the crossover
operator)
• we always have to select the best two to generate the next best of all
11
11. Methods of Selection
11
1. Roulette Wheel Selection : In the roulette wheel selection, the probability of
choosing an individual for breeding of the next generation is proportional to its fitness,
the better the fitness is, the higher chance for that individual to be chosen
2. Rank Selection : Rank Selection also works with negative fitness values and is
mostly used when the individuals in the population have very close fitness values (this
happens usually at the end of the run)
12. 3. Steady State Selection :
• This is not a particular method of selecting parents. Main idea of this
selection is that big part of chromosomes should survive to next generation.
4. Tournament selection :
• It is a method of selecting an individual from a population of individuals in a
genetic algorithm. Tournament selection involves running several
"tournaments" among a few individuals (or "chromosomes") chosen at
random from the population
12
13. Crossover
• In genetic algorithms and evolutionary computation, crossover, also called
recombination, is a genetic operator used to combine the genetic information of
two parents to generate new offspring
• It is one way to generate new solutions from an existing population
• Newly generated solutions are typically mutated before being added to the
population
13
14. Types of crossover
14
1. One-point crossover : A point on both parents' chromosomes is picked randomly, and
designated a 'crossover point'. Bits to the right of that point are swapped between the two
parent chromosomes. This results in two offspring, each carrying some genetic
information from both parents
2. Two-point crossover : In two-point crossover, two crossover points are picked
randomly from the parent chromosomes. The bits in between the two points are swapped
between the parent organisms.
15. 3. Multi-point crossover : Two-point crossover strategy can be generalized to multi-
point crossover for any positive integer n , picking n crossover points
4. Uniform crossover : In this each bit is chosen from either parent with equal
probability. Other mixing ratios are sometimes used, resulting in offspring which inherit
more genetic information from one parent than the other
15
16. Mutation
• Mutation is a genetic operator used to maintain genetic diversity from one generation
of a population of genetic algorithm chromosomes to the next.
• It is analogous to biological mutation. Mutation alters one or more gene values in a
chromosome from its initial state.
• In mutation, the solution may change entirely from the previous solution.
• Hence GA can come to a better solution by using mutation. Mutation occurs during
evolution according to a user-definable mutation probability. This probability should
be set low. If it is set too high, the search will turn into a primitive random search.
16
17. Types of Mutation
• Bit Flip Mutation : In this bit flip mutation, we select one or more random bits
and flip them. This is used for binary encoded GAs.
• Random Resetting : Random Resetting is an extension of the bit flip for the
integer representation. In this, a random value from the set of permissible values is
assigned to a randomly chosen gene.
17
18. • Scramble Mutation : It is also popular with permutation representations. In this,
from the entire chromosome, a subset of genes is chosen and their values are
scrambled or shuffled randomly
• Swap Mutation : In this we select two positions on the chromosome at random, and
interchange the values. This is common in permutation based encodings
• Inversion Mutation : In this we select a subset of genes like in scramble mutation,
but instead of shuffling the subset, we merely invert the entire string in the subset
18
19. Termination
This generational process is repeated until a termination condition has been reached.
Common terminating conditions are:
• A solution is found that satisfies minimum criteria
• Fixed number of generations reached
• The highest ranking solution's fitness is reaching or has reached a plateau such
that successive iterations no longer produce better results
• Manual inspection
• Combinations of the above
19
20. Advantages of GA
• The concept is easy to understand
• GA search from a population of points , not a single point
• GA supports multi-objective optimization
• GA use probablistic transition rules, not deterministic rules
• GA is easily parallelised
• GA is stochastic
• GA work well on mixed discrete/continuous problem
20
21. Disadvantages of GA
• GA implementation is still an art
• GA requires less information about the problem , but designing an objective
function and getting the representation and operators right can be difficult
• GA is computationally expensive i.e.time-consuming
• GA is slower than some other methods
21
22. Genetic Algorithms - Application
• Neural Networks − GAs are also used to train neural networks, particularly recurrent
neural networks
• Parallelization − GAs also have very good parallel capabilities, and prove to be very
effective means in solving certain problems, and also provide a good area for research
• Machine Learning - genetics based machine learning (GBML) is a niche area in
machine learning.
• Traveling salesman problem − GAs have been used to solve the TSP, which is a well-
known combinatorial problem using novel crossover
22