A Demonstration By:   SAFI UR REHMAN     PhD Scholar at Department of Mining Engineering GENETIC ALGORITHMS - A GENTLE INTRODUCTION
Definition of Genetic Algorithms Basic Idea Algorithms Optimization Background of Genetic Algorithms (GAs) Natural world Theory of Natural Selection Introduction to GAs Steps / Flowchart of GAs Examples Applications of GAs 02/05/10   14:07 Genetic Algorithms – A gentle Introduction Overview
“ Genetic algorithms are stochastic search and optimization algorithms based on the mechanics of natural selection and natural genetics subject to survival of the fittest. The algorithm iteratively transforms a set (population) of mathematical objects (string structures), each with an associated fitness value, into a new population of offspring objects  using crossover and mutation ” Stochastic Search  Algorithm Natural Selection and Genetics Operators Darwin’s  Theory (Survival of the Fittest) Evolutionary process  Population Crossover  Mutation  02/05/10   14:07 Genetic Algorithms – A gentle Introduction Definition of Genetic Algorithms
Suppose you have a problem You don’t know how to solve it What can you do? Can you use a computer to somehow find a solution for you? This would be nice! Can it be done? A “BLIND GENERATE AND TEST” Algorithm: Repeat Generate a random possible solution. Test the solution  and see how good it is Until  solution is good enough 02/05/10   14:07 Genetic Algorithms – A gentle Introduction x  and  y  range from 1 – 10   Basic Idea
Can we used this dumb idea? Sometimes - yes: if there are only a few possible solutions and you have enough time then such a method  could  be used For most problems - no: many possible solutions with no time to try them all so this method  can not  be used 02/05/10   14:07 Genetic Algorithms – A gentle Introduction if x  and  y  range from 1 – 1000   Basic Idea
A “less-dumb” idea (GA) Generate   a  set  of random solutions Repeat Test each solution in the set  (rank them) Remove some bad  solutions from set Duplicate  some good solutions make small  changes to some of them Until  best solution is good enough 02/05/10   14:07 Genetic Algorithms – A gentle Introduction Basic Idea
local global I am not at the top. My high is better! I am at the top My Height is .. I will continue 02/05/10   14:07 Genetic Algorithms – A gentle Introduction Search for Optimization
02/05/10   14:07 Genetic Algorithms – A gentle Introduction Optimization
“ Genetic algorithms are  stochastic search and optimization algorithms  based on the mechanics of natural selection and natural genetics subject to survival of the fittest.  The algorithm  iteratively transforms a set (population) of  mathematical objects  (string structures), each with an  associated fitness value,  into a new population of offspring objects  using crossover and mutation ” 02/05/10   14:07 Genetic Algorithms – A gentle Introduction Definition of Genetic Algorithms
Genetic Algorithms Developed by John Holland in 1975 Developed the theoretical basis of GAs  through  Schema theorem John Koza, David Goldberg, De Jong Natural World Vs Function Optimization Natural World Diversity   Complexity  Useful features Why it is so ? How they come into being? Can we imagine natural world as a result of many iterations in a grand optimization algorithm ? 02/05/10   14:07 Genetic Algorithms – A gentle Introduction Background of GAs
02/05/10   14:07 Genetic Algorithms – A gentle Introduction Genes  are the basic “instructions” for building an organism A  chromosome  is a sequence of genes Biologists distinguish between an organism’s   genotype  (the genes and chromosomes) and its   phenotype  (what the organism actually is like) Similarly, “genes” may  describe  a possible solution to a problem, without actually  being  the solution Natural World
02/05/10   14:07 Genetic Algorithms – A gentle Introduction Human body is made up of trillions of cells. Each cell has a core structure (nucleus) that contains chromosomes.  Each chromosome is made up of tightly coiled strands of deoxyribonucleic acid (DNA). Genes are segments of DNA that determine specific traits, such as eye or hair color. A human have more than 20,000 genes.  Natural World
In his book  The Origin of Species   Charles Darwin outlined the principle of natural selection. IF there are organisms that reproduce, and  IF off springs inherit traits from their progenitors, and  IF there is variability of traits, and  IF the environment cannot support all members of a growing population,  THEN those members of the population with less-adaptive traits (determined by the environment) will die out, and  THEN those members with more-adaptive traits (determined by the environment) will thrive  The result is the evolution of  species .   02/05/10   14:07 Genetic Algorithms – A gentle Introduction “ Select The Best, Discard The Rest” - Survival of the Fittest Theory of Natural Selection
02/05/10   14:07 Genetic Algorithms – A gentle Introduction Inspired by  natural evolution Population  of individuals Individual is feasible solution to problem Each individual is characterized by a  Fitness function Higher fitness is better solution Based on their fitness, parents are selected to reproduce  offspring  for a new  generation Fitter individuals have more chance to reproduce New generation has same size as old generation; old generation dies Offspring has  combination  of properties of two parents If well designed, population will  converge  to optimal solution   Introduction to Genetic Algorithms
“ Genetic algorithms are stochastic search and optimization algorithms based on the mechanics of natural selection and natural genetics subject to survival of the fittest. The algorithm iteratively transforms a set (population) of mathematical objects  (string structures),  each with an associated fitness value,  into a new population of offspring objects  using crossover and mutation ” 02/05/10   14:07 Genetic Algorithms – A gentle Introduction Definition of Genetic Algorithms
Randomly generate a population of potential solutions Evaluate fitness of population members Select two parents from population based on fitness Produce two children Evaluate children Crossover and mutation Is solution "Good“? Output best solution found Multiple Repeats in one iteration No Yes Genetic Algorithms Flowchart
02/05/10   14:07 Genetic Algorithms – A gentle Introduction Phenotype  x Genotype  g Gen. Phen. Mapping Population Objective Function  f i Population  Pop Cross over Mutation Genotype  g Initial Population Create an initial population of random individuals
02/05/10   14:07 Genetic Algorithms – A gentle Introduction Simple problem: max x 2  over {0,1,…,31} GA approach: Representation: binary code, e.g. 01101    13 Population size: 4 1-point Crossover, bitwise mutation  Roulette wheel selection Random initialization One generational cycle will be shown  A Simple Example of Genetic Algorithms 16 8 4 2 1 13 0 1 1 0 1 24 1 1 0 0 0 8 0 1 0 0 0
02/05/10   14:07 Genetic Algorithms – A gentle Introduction A Simple Example of Genetic Algorithms
02/05/10   14:07 Genetic Algorithms – A gentle Introduction 2 1 n 3 Area is Proportional  to fitness value 4 Roulette Wheel Selection Individual  i  will have a  probability to be chosen
02/05/10   14:07 Genetic Algorithms – A gentle Introduction 10011 101 11101 000 10011 000 Parent  A  Child of A and B  Parent  B  Crossover Operator A Simple Example of Genetic Algorithms
02/05/10   14:07 Genetic Algorithms – A gentle Introduction A Simple Example of Genetic Algorithms
“ Genetic algorithms are stochastic search and optimization algorithms based on the mechanics of natural selection and natural genetics subject to survival of the fittest. The algorithm iteratively transforms a set (population) of mathematical objects (string structures), each with an associated fitness value, into a new population of offspring objects  using crossover and mutation ” 02/05/10   14:07 Genetic Algorithms – A gentle Introduction Definition of Genetic Algorithms
Function Optimization Multi-Objective Optimization Combinatorial Optimization Economics and Finance  Resource Minimization Scheduling  Robotics Image Processing Chemistry, Chemical Engineering  Networking and Communication  Constraint Satisfaction Problems (CSP) Electrical Engineering and Circuit Design Engineering, Structural Optimization, and Design 02/05/10   14:07 Genetic Algorithms – A gentle Introduction Applications of Genetic Algorithms
T H A N K S

Demonstration1 G As

  • 1.
    A Demonstration By: SAFI UR REHMAN PhD Scholar at Department of Mining Engineering GENETIC ALGORITHMS - A GENTLE INTRODUCTION
  • 2.
    Definition of GeneticAlgorithms Basic Idea Algorithms Optimization Background of Genetic Algorithms (GAs) Natural world Theory of Natural Selection Introduction to GAs Steps / Flowchart of GAs Examples Applications of GAs 02/05/10 14:07 Genetic Algorithms – A gentle Introduction Overview
  • 3.
    “ Genetic algorithmsare stochastic search and optimization algorithms based on the mechanics of natural selection and natural genetics subject to survival of the fittest. The algorithm iteratively transforms a set (population) of mathematical objects (string structures), each with an associated fitness value, into a new population of offspring objects using crossover and mutation ” Stochastic Search Algorithm Natural Selection and Genetics Operators Darwin’s Theory (Survival of the Fittest) Evolutionary process Population Crossover Mutation 02/05/10 14:07 Genetic Algorithms – A gentle Introduction Definition of Genetic Algorithms
  • 4.
    Suppose you havea problem You don’t know how to solve it What can you do? Can you use a computer to somehow find a solution for you? This would be nice! Can it be done? A “BLIND GENERATE AND TEST” Algorithm: Repeat Generate a random possible solution. Test the solution and see how good it is Until solution is good enough 02/05/10 14:07 Genetic Algorithms – A gentle Introduction x and y range from 1 – 10 Basic Idea
  • 5.
    Can we usedthis dumb idea? Sometimes - yes: if there are only a few possible solutions and you have enough time then such a method could be used For most problems - no: many possible solutions with no time to try them all so this method can not be used 02/05/10 14:07 Genetic Algorithms – A gentle Introduction if x and y range from 1 – 1000 Basic Idea
  • 6.
    A “less-dumb” idea(GA) Generate a set of random solutions Repeat Test each solution in the set (rank them) Remove some bad solutions from set Duplicate some good solutions make small changes to some of them Until best solution is good enough 02/05/10 14:07 Genetic Algorithms – A gentle Introduction Basic Idea
  • 7.
    local global Iam not at the top. My high is better! I am at the top My Height is .. I will continue 02/05/10 14:07 Genetic Algorithms – A gentle Introduction Search for Optimization
  • 8.
    02/05/10 14:07 Genetic Algorithms – A gentle Introduction Optimization
  • 9.
    “ Genetic algorithmsare stochastic search and optimization algorithms based on the mechanics of natural selection and natural genetics subject to survival of the fittest. The algorithm iteratively transforms a set (population) of mathematical objects (string structures), each with an associated fitness value, into a new population of offspring objects using crossover and mutation ” 02/05/10 14:07 Genetic Algorithms – A gentle Introduction Definition of Genetic Algorithms
  • 10.
    Genetic Algorithms Developedby John Holland in 1975 Developed the theoretical basis of GAs through Schema theorem John Koza, David Goldberg, De Jong Natural World Vs Function Optimization Natural World Diversity Complexity Useful features Why it is so ? How they come into being? Can we imagine natural world as a result of many iterations in a grand optimization algorithm ? 02/05/10 14:07 Genetic Algorithms – A gentle Introduction Background of GAs
  • 11.
    02/05/10 14:07 Genetic Algorithms – A gentle Introduction Genes are the basic “instructions” for building an organism A chromosome is a sequence of genes Biologists distinguish between an organism’s genotype (the genes and chromosomes) and its phenotype (what the organism actually is like) Similarly, “genes” may describe a possible solution to a problem, without actually being the solution Natural World
  • 12.
    02/05/10 14:07 Genetic Algorithms – A gentle Introduction Human body is made up of trillions of cells. Each cell has a core structure (nucleus) that contains chromosomes. Each chromosome is made up of tightly coiled strands of deoxyribonucleic acid (DNA). Genes are segments of DNA that determine specific traits, such as eye or hair color. A human have more than 20,000 genes. Natural World
  • 13.
    In his book The Origin of Species Charles Darwin outlined the principle of natural selection. IF there are organisms that reproduce, and IF off springs inherit traits from their progenitors, and IF there is variability of traits, and IF the environment cannot support all members of a growing population, THEN those members of the population with less-adaptive traits (determined by the environment) will die out, and THEN those members with more-adaptive traits (determined by the environment) will thrive The result is the evolution of species . 02/05/10 14:07 Genetic Algorithms – A gentle Introduction “ Select The Best, Discard The Rest” - Survival of the Fittest Theory of Natural Selection
  • 14.
    02/05/10 14:07 Genetic Algorithms – A gentle Introduction Inspired by natural evolution Population of individuals Individual is feasible solution to problem Each individual is characterized by a Fitness function Higher fitness is better solution Based on their fitness, parents are selected to reproduce offspring for a new generation Fitter individuals have more chance to reproduce New generation has same size as old generation; old generation dies Offspring has combination of properties of two parents If well designed, population will converge to optimal solution Introduction to Genetic Algorithms
  • 15.
    “ Genetic algorithmsare stochastic search and optimization algorithms based on the mechanics of natural selection and natural genetics subject to survival of the fittest. The algorithm iteratively transforms a set (population) of mathematical objects (string structures), each with an associated fitness value, into a new population of offspring objects using crossover and mutation ” 02/05/10 14:07 Genetic Algorithms – A gentle Introduction Definition of Genetic Algorithms
  • 16.
    Randomly generate apopulation of potential solutions Evaluate fitness of population members Select two parents from population based on fitness Produce two children Evaluate children Crossover and mutation Is solution "Good“? Output best solution found Multiple Repeats in one iteration No Yes Genetic Algorithms Flowchart
  • 17.
    02/05/10 14:07 Genetic Algorithms – A gentle Introduction Phenotype x Genotype g Gen. Phen. Mapping Population Objective Function f i Population Pop Cross over Mutation Genotype g Initial Population Create an initial population of random individuals
  • 18.
    02/05/10 14:07 Genetic Algorithms – A gentle Introduction Simple problem: max x 2 over {0,1,…,31} GA approach: Representation: binary code, e.g. 01101  13 Population size: 4 1-point Crossover, bitwise mutation Roulette wheel selection Random initialization One generational cycle will be shown A Simple Example of Genetic Algorithms 16 8 4 2 1 13 0 1 1 0 1 24 1 1 0 0 0 8 0 1 0 0 0
  • 19.
    02/05/10 14:07 Genetic Algorithms – A gentle Introduction A Simple Example of Genetic Algorithms
  • 20.
    02/05/10 14:07 Genetic Algorithms – A gentle Introduction 2 1 n 3 Area is Proportional to fitness value 4 Roulette Wheel Selection Individual i will have a probability to be chosen
  • 21.
    02/05/10 14:07 Genetic Algorithms – A gentle Introduction 10011 101 11101 000 10011 000 Parent A Child of A and B Parent B Crossover Operator A Simple Example of Genetic Algorithms
  • 22.
    02/05/10 14:07 Genetic Algorithms – A gentle Introduction A Simple Example of Genetic Algorithms
  • 23.
    “ Genetic algorithmsare stochastic search and optimization algorithms based on the mechanics of natural selection and natural genetics subject to survival of the fittest. The algorithm iteratively transforms a set (population) of mathematical objects (string structures), each with an associated fitness value, into a new population of offspring objects using crossover and mutation ” 02/05/10 14:07 Genetic Algorithms – A gentle Introduction Definition of Genetic Algorithms
  • 24.
    Function Optimization Multi-ObjectiveOptimization Combinatorial Optimization Economics and Finance Resource Minimization Scheduling Robotics Image Processing Chemistry, Chemical Engineering Networking and Communication Constraint Satisfaction Problems (CSP) Electrical Engineering and Circuit Design Engineering, Structural Optimization, and Design 02/05/10 14:07 Genetic Algorithms – A gentle Introduction Applications of Genetic Algorithms
  • 25.
    T H AN K S