Introduction to Genetic
Algorithms
Dr R Ramya, AP(Sl G)
Department of CSE
SRM Institute of Science and Technology
Ramapuram Campus, Chennai
Genetic Algorithms
• Genetic algorithms are a part
of evolutionary computing, which is
a rapidly growing area of artificial
intelligence.
• It is a search-based optimization
technique based on the principles
of Genetics and Natural Selection
(Survival of the Fittest).
• It is frequently used to find optimal
or near-optimal solutions to difficult
problems which otherwise would
take a lifetime to solve.
Ant Colony Optimization
• Real ants follow a path between
nest and food source.
• An obstacle appears on the path:
• Ants choose whether to turn left or
right with equal probability.
• Pheromone is deposited more
quickly on the shorter path.
• All ants have chosen the shorter
path.
Genetic Algorithms-A Biological
Background
• All living organisms consist of
cells.
• In each cell there is the same
set of chromosomes.
• Chromosomes are strings
of DNA and serves as a model
for the whole organism.
• DNA carrying genetic
instructions for the
development, functioning,
growth and reproduction of
all known organisms.
Framework of GP
5
Outline of the Basic Genetic
Programming
• Step 1 Generate random population of n chromosomes (suitable solutions for the
problem)
• Step 2 Evaluate the fitness f(x) of each chromosome x in the population
• Step 3 Create a new population by repeating following steps until the new
population is complete
– Select two parent chromosomes from a population according to their fitness
(the better fitness, the bigger chance to be selected)
– With a crossover probability cross over the parents to form a new offspring
(children). If no crossover was performed, offspring is an exact copy of
parents.
– With a mutation probability mutate new offspring at each locus (position in
chromosome).
– Place new offspring in a new population
• Step 4 Use new generated population for a further run of algorithm
• Step 5 If the end condition is satisfied, stop, and return the best solution in current
population
• Step 6 Go to step 2
Representation
• Expressed as Syntax trees rather than lines of
code.
• Variables and constants are the leaves of the
trees, which are called Terminals, while the
arithmetic operations are called Functions.
• The Root node acts as a glue
Example
i =1;
while (i < 20)
{
i = i +1
}
Genetic Operators
Reproduction in GP
• Crossover
• Mutation
Crossover Operations
• Single Point Crossover
• Two-point Crossover
• Uniform Crossover
• Multi-point Crossover
Single Point Crossover
Two-point Crossover
Multi-point Crossover
Uniform Crossover
Selection
Selection Operators
Merits of Genetic Programming
• After the termination criteria is satisfied the
single best program in population produced is
the solution.
• It saves time by freeing the human from
having to design complex algorithms.
• Not only designing the algorithms but
creating ones that give optimal solutions.
Introduction to Genetic Algorithm
Introduction to Genetic Algorithm

Introduction to Genetic Algorithm

  • 1.
    Introduction to Genetic Algorithms DrR Ramya, AP(Sl G) Department of CSE SRM Institute of Science and Technology Ramapuram Campus, Chennai
  • 2.
    Genetic Algorithms • Geneticalgorithms are a part of evolutionary computing, which is a rapidly growing area of artificial intelligence. • It is a search-based optimization technique based on the principles of Genetics and Natural Selection (Survival of the Fittest). • It is frequently used to find optimal or near-optimal solutions to difficult problems which otherwise would take a lifetime to solve.
  • 3.
    Ant Colony Optimization •Real ants follow a path between nest and food source. • An obstacle appears on the path: • Ants choose whether to turn left or right with equal probability. • Pheromone is deposited more quickly on the shorter path. • All ants have chosen the shorter path.
  • 4.
    Genetic Algorithms-A Biological Background •All living organisms consist of cells. • In each cell there is the same set of chromosomes. • Chromosomes are strings of DNA and serves as a model for the whole organism. • DNA carrying genetic instructions for the development, functioning, growth and reproduction of all known organisms.
  • 5.
  • 6.
    Outline of theBasic Genetic Programming • Step 1 Generate random population of n chromosomes (suitable solutions for the problem) • Step 2 Evaluate the fitness f(x) of each chromosome x in the population • Step 3 Create a new population by repeating following steps until the new population is complete – Select two parent chromosomes from a population according to their fitness (the better fitness, the bigger chance to be selected) – With a crossover probability cross over the parents to form a new offspring (children). If no crossover was performed, offspring is an exact copy of parents. – With a mutation probability mutate new offspring at each locus (position in chromosome). – Place new offspring in a new population • Step 4 Use new generated population for a further run of algorithm • Step 5 If the end condition is satisfied, stop, and return the best solution in current population • Step 6 Go to step 2
  • 7.
    Representation • Expressed asSyntax trees rather than lines of code. • Variables and constants are the leaves of the trees, which are called Terminals, while the arithmetic operations are called Functions. • The Root node acts as a glue
  • 8.
    Example i =1; while (i< 20) { i = i +1 }
  • 9.
  • 10.
    Reproduction in GP •Crossover • Mutation
  • 12.
    Crossover Operations • SinglePoint Crossover • Two-point Crossover • Uniform Crossover • Multi-point Crossover
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
    Merits of GeneticProgramming • After the termination criteria is satisfied the single best program in population produced is the solution. • It saves time by freeing the human from having to design complex algorithms. • Not only designing the algorithms but creating ones that give optimal solutions.