0% found this document useful (0 votes)
64 views

Genetic Algorithms: By: Prof. Mahesh Motwani

Genetic algorithms are search techniques used to find approximate solutions to optimization and search problems. They use principles of natural selection and genetics to evolve solutions over generations. A genetic algorithm starts with a random population that evolves over generations using selection, crossover, and mutation operators. The fittest individuals are selected to breed and produce offspring for the next generation. This process is repeated until a termination condition is met. Genetic algorithms have been applied to problems in many domains.
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)
64 views

Genetic Algorithms: By: Prof. Mahesh Motwani

Genetic algorithms are search techniques used to find approximate solutions to optimization and search problems. They use principles of natural selection and genetics to evolve solutions over generations. A genetic algorithm starts with a random population that evolves over generations using selection, crossover, and mutation operators. The fittest individuals are selected to breed and produce offspring for the next generation. This process is repeated until a termination condition is met. Genetic algorithms have been applied to problems in many domains.
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/ 29

Genetic Algorithms

By: Prof. Mahesh Motwani


What is Genetic Algorithm (GA)

• A Genetic algorithm is a search technique


used in computing to find solutions (may
be approximate) to optimization and search
problems. 
• Natural selection, where the population is
composed of candidate solutions.
What is Genetic Algorithm

• Population of abstract representations (called


chromosomes or the genotype or the
genome) of candidate solutions (called
individuals or phenotypes)  

• Solutions are represented in binary as strings


of 0s and 1s. Other encodings are also
possible but they make crossover and
mutation harder.
What is Genetic Algorithm

• Process starts from a population of randomly


generated individuals 
• In each generation, the fitness of every
individual in the population is evaluated( using
fitness function)
• multiple individuals are selected from the
current population (based on their fitness),
and modified to form a new population.
What is Genetic Algorithm

• The new population is then used in the next


iteration of the algorithm. 
• Commonly, the algorithm terminates when
some terminating condition is reached
Terminology
• Individual - Any possible solution
• Population - Group of all individuals
• Search Space - All possible solutions to the problem
• Chromosome - Blueprint for an individual
• Trait - Possible aspect (features) of an individual
• Allele - Possible settings of trait (black, blond, etc.)
• Locus - The position of a gene on the chromosome
• Genome - Collection of all chromosomes for an
individual
Candidate representation
One of the most important decisions to make while
implementing a genetic algorithm is deciding the
representation that must be used to represent the
solutions.

Chromosomes could be represented as different encoding


methods:
– Binary strings                     (0101 ... 1100)
– Real numbers                     (3.2 -3.1 ... 0.0 79.2) 
– Lists of rules                       (R1 R2 R3 ... R15)
– Program elements             (genetic programming)
Basic Genetic Algorithm

• Initial population is created with a group of


individuals created randomly. 
• Two individuals are then selected based on
their fitness (evaluated using
fitness function). The higher the fitness, the
higher the chance of being selected. 
• These individuals then mate to create one or
more offspring
• This continues until a suitable solution has been
found or a terminating condition is reached
Description of Steps of Basic Genetic Algorithm

    1. Initialization
• Initially many individual solutions are
generated to form an initial
population. This population is generated
randomly from the entire search space. 
• The population size depends on the nature of
the problem.
Description of Basic Genetic Algorithm

   2. Selection
• During next generations, a section of the
existing population is selected to reproduce a
new generation. 
• This selection of individual solutions is based
on a method, where fitter solutions (as
measured by a fitness function) are more
likely to be selected. 
Description of Basic Genetic Algorithm

    3. Reproduction
• From those selected in the Selection stage,
Generate a second generation population of
solutions using Genetic operators (crossover
and/or mutation)
• For each new solution to be produced, a pair
of "parent" solutions is selected for mating
• The process continues until a new population
of solutions of appropriate size is generated.
Description of Basic Genetic Algorithm

4. Termination
The Generational process is repeated until  termination
condition has been reached. 
Common GA terminating conditions are:
1. When fixed number of generations are reached
2. When time/cost limits placed on the GA run are reached
3. A optimal solution is obtained that satisfies the
optimization criteria
4. When successive GA iterations no longer produce better
results
Genetic Operators: Crossover
• Given two candidates, produce one that has
elements of each.
• The point at which the chromosome is broken
depends on the randomly selected crossover
point. 
• Choose a random point on the two parents
• Split parents at this crossover point
• Create children by exchanging tail
Single-Point (One-Point) Crossover

A random crossover point is selected and the tails of


its two parents are swapped to get new off-springs.​
Multi-point (N-point) crossover

•Generalization of the one-point crossover where


alternating segments are swapped to get new off-springs.​
•Choose n random crossover points​
•Split along those points​
Uniform Crossover

• The chromosome are not divided into


segments. 
• Each gene is treated separately. 
• A coin is flipped for each chromosome to
decide whether or not it’ll be included in the
off-spring. 
Uniform Crossover
Mutation

• We select one or more random bits and flip them.


• Alter each gene independently with a probability pm   
mutation rate      
•  Value of mutation rate  ( pm  ) is typically between
1/population_size and 1/ chromosome_length
Mutation
Fitness function
• The fitness function estimates how close a
candidate is to being a solution.
• The fitness function measures the quality of
the represented solution. 
• The choice of fitness function is problem
dependent. 

20
Convergence of Genetic algorithms

• GA converge when there is no significant


improvement in the values of fitness of the
population from one generation to the next. 
• Verifying that a GA has converged is usually not
possible, unless there is a test data set for which the
best solution is already known. 
• The best is to try out multiple runs of the GA, with
different values of Mutation, Crossover probabilities,
try out different fitness functions and crossover
operators.
Convergence of Genetic algorithms

Common GA terminating conditions are:

1. When fixed number of generations are reached


2. When time limits/cost placed on the GA run are
reached
3. A optimal solution is obtained that satisfies the
optimization criteria
4. When successive GA iterations no longer produce
better results
5. Any combination of the above
Applications of Genetic Algorithms

The areas in which Genetic Algorithms can be used are 


• Optimization − where we have to maximize or
minimize a given objective function value under a
given set of constraints. 
• Economics − used to characterize various economic
models like the asset pricing, etc.
• Neural Networks − used to train neural networks,
particularly recurrent neural networks.
Applications of Genetic Algorithms

• Parallelization − GAs also have very good


parallel capabilities in efficiently solving certain
problems, and also provide a good area for research.
• Image Processing − GAs are used for various
digital image processing (DIP) tasks like dense
pixel matching.
• Vehicle routing problems
Applications of Genetic Algorithms

• Scheduling applications − GAs are used to solve


various scheduling problems as well, particularly the
time tabling problem.

• Machine Learning − Genetics based machine learning


(GBML) is an important area in machine learning.

• Robot Trajectory Generation − GAs have been used


to plan the path which a robot arm takes by moving
from one point to another.
Applications of Genetic Algorithms

• Parametric Design of Aircraft − GAs have been


used to design aircrafts by varying the parameters
and evolving better solutions.

• DNA Analysis − GAs have been used to determine


the structure of DNA using spectrometric data about
the sample.
Advantages / Pros of GAs
• Is faster (and has lower memory requirements) as
compared to the traditional methods.
• Has very good parallel capabilities.
• Provides a list of “good” solutions and not just a
single solution.
• Easy, in that if the candidate representation and
fitness function are correct, a solution can be found
without any explicit analytical work.
• Useful when the search space is very large and there
are a large number of parameters involved.
Disadvantages / Cons of GA

– If not implemented properly, the GA may not converge to


the optimal solution.
– Fitness value is calculated repeatedly which might be
computationally expensive for some problems.
– Can get stuck on local maxima, though crossover can help
mitigate this.
– Being stochastic, there are no guarantees on the optimality
or the quality of the solution.
– It can be hard to work out how best to represent a
candidate as a bit string 

28
References

• http://www.cas.mcmaster.ca/~cs777/presenta
tions/3_GO_Olesya_Genetic_Algorithms.pdf
• https://www.iitg.ac.in/rkbc/CE602/CE602/Gen
etic%20Algorithms.pdf
• http://www.cs.cmu.edu/~02317/slides/lec_8.
pdf
• https://www.tutorialspoint.com/genetic_algor
ithms/genetic_algorithms_quick_guide.htm
• https://cs.uwlax.edu/~dmathias/cs419/slides/

You might also like