Fundamental of GA

download Fundamental of GA

of 27

Transcript of Fundamental of GA

  • 8/12/2019 Fundamental of GA

    1/27

    Fundamentals of GAAndriya Narasimhulu

    Assistant Professor

    Division of MPAE

    NSIT, Dwarka

    NEW Delhi-11078

  • 8/12/2019 Fundamental of GA

    2/27

    Introduction Encoding

    Operators of GA

    Basic GA

    References

  • 8/12/2019 Fundamental of GA

    3/27

    Introduction

    Why genetic algorithms

    Optimization

    Search Optimization algorithm

    Evolutionary Algorithms (EAs)

    Genetic Algorithms (GAs)

    Biological background

    Search space

    Working principles

    Basic genetic algorithm

    Flow chart for genetic programming

  • 8/12/2019 Fundamental of GA

    4/27

    What are GAs

    Genetic Algorithms (GAs) areadaptive heur istic searchbased on the evolutionary ideas of natural selection and gene

    Genetic algorithms (GAs) are a part ofEvolutionary comrapidly growing area of artificial intelligence. GAs are inDarwin's theory about evolution -" survival of the f i ttest" .

    GAs represent an intelligent exploitation of a random searsolve optimization problems.

    GAs, although randomized, exploit historical information tosearch into the region of better performance within the searc

    In nature, competition among individuals for scanty resourin thefittest individuals dominating over the weaker ones.

  • 8/12/2019 Fundamental of GA

    5/27

    Introduction to GASolving problems mean looking for solutions, which is best

    others.Finding the solution to a problem is often thought :

    In computer science and AI, as a process of search through the spsolutions. The set of possible solutions defines the search space (alspace) for a given problem. Solutions or partial solutions are viewethe search space.

    In engineering and mathematics, as a process of optimization. Thfirst formulated as mathematical models expressed in terms of funcfind a solution, discover the parameters that optimize the model or components that provide optimal system performance.

  • 8/12/2019 Fundamental of GA

    6/27

    Why Genetic Algorithms

    It is better than conventional AI ; It is more robust.

    Unlike older AI systems, the GA's do not break easily einputs changed slightly, or in the presence of reasonable nois

    While performing search in large state-space, or multi-mspace, or n-dimensional surface, a genetic algorithms offer

    benefits over many other typical search optimization technilinear programming, heuristic, depth-first, breath-first.

    "Genetic Algorithms are good at taking large, potentially huspaces and navigating them, looking for optimal combinationsthe solutions one might not otherwise find in a lifetime.

    (Salvatore Mangano Computer Design, May 1995)

  • 8/12/2019 Fundamental of GA

    7/27

    OptimOptimization is a process that finds a best, or optimal, solution for a problem.

    The Optimization problems are centered around three factors :

    1.An objective functionwhich is to be minimized or maximized;

    ExamplesIn manufacturing, we want to maximize the profit or minimize thIn designing an automobile panel, we want to maximize the strength.

    2.A set of unknowns or variablesthat affect the objective function,

    ExamplesIn manufacturing, the variables are amount of resources used or t

    In panel design problem, the variables are shape and dimensions of the pane

    3.A set of constraintsthat allow the unknowns to take on certain values but

    ExamplesIn manufacturing, one constrain is, that all "time" variables to be

    In the panel design, we want to limit the weight and put constrain on its sha

    An optimization problem is defined as : Finding values of the variablesmaximize the objective function while satisfying the constraints.

  • 8/12/2019 Fundamental of GA

    8/27

    Search OptimizationWe are interested in

    algorithms.

    Our main concern is

    evolutionary algorith

    - how to describe the- how to impleme

    search,

    - what are the elemen

    out search, and

    - the different searc

    The Evolutionary Al- Genetic Algorithms

    - Genetic Programmi

  • 8/12/2019 Fundamental of GA

    9/27

    Evolutionary Algorithm (EAs) Evolutionary Algorithm (EA) is a subset of Evolutionary Com

    (EC) which is a subfield of Artificial Intelligence (AI).

    Evolutionary Computation (EC) is a general term for severalcomputational techniques. Evolutionary Computation reprepowerful search and optimization paradigm influenced by bmechanisms of evolution : that of natural selection and gen

    Evolutionary Algorithms (EAs) refers to Evolutionary Compu

    models using randomness and genetic inspired operations. involve selection, recombination, random variation and comof the individuals in a population of adequately representedsolutions.

    The candidate solutions are referred as chromosomes or ind

  • 8/12/2019 Fundamental of GA

    10/27

    Genetic Algorithms (GAs) represent the main parEvolutionary Computation.

    - GAs simulate natural evolution, mimicking processes the na

    Selection, Crosses over, Mutation and Accepting.- GAs simulate the survival of the fittest among individconsecutive generation for solving a problem.

  • 8/12/2019 Fundamental of GA

    11/27

    GAs Basic Concepts

    Genetic algorithms (GAs) are the main paradigm of evcomputing. GAs are inspired by Darwin's theory about evolu" sur vival of the f ittest" .In nature, competition among indiscanty resources results in the fittest individuals dominatinweaker ones.

  • 8/12/2019 Fundamental of GA

    12/27

    GAs are the ways of solving problems by mimickingnature uses; ie.,Selection, Crosses over, M utation and Acevolve a solution to a problem.

    GAs areadaptive heur istic searchbased on the evolutionanatural selection and genetics.

    GAs are intelligent exploitation of random searchoptimization problems.

    GAs, although randomized,exploi t historical informationthe search into the region of better performance within space.

    The biological background (basic genetics), the scheme of evprocesses, the working principles and the steps involved inillustrated in next few slides.

    Biological Background Basic Genetics

  • 8/12/2019 Fundamental of GA

    13/27

    Biological Background

    Basic Genetics Everyorganismhas a set of rules, describing how that organism is built. All living organism

    In each cell there is same set ofchromosomes.Chromosomes are strings of DNA and sewhole organism.

    A chromosome consists ofgenes, blocks of DNA.

    Each gene encodes a particular protein that represents atrait(feature), e.g., color of eyes.

    Possible settings for a trait (e.g. blue, brown) are calledalleles.

    Each gene has its own position in the chromosome called itslocus.

    Complete set of genetic material (all chromosomes) is called agenome.

    Particular set of genes in a genome is calledgenotype.

    The physical expression of the genotype (the organism itself after birth) is called thephenmental characteristics, such as eye color, intelligence etc.

    When two organisms mate they share their genes; the resultant offspring may end up havione parent and half from the other. This process is calledrecombination(cross over) .

    The new created offspring can then be mutated. Mutationmeans, that the elements of DThis changes are mainly caused by errors in copying genes from parents.

    Thefitnessof an organism is measured by success of the organism in its life (survival).22

  • 8/12/2019 Fundamental of GA

    14/27

    Below shown, the general scheme of evolutprocess in genetic along with pseudo-code.

  • 8/12/2019 Fundamental of GA

    15/27

    Pseudo-Code

    BEGIN

    INITIALISE population with random candidate solution.

    EVALUATE each candidate;

    REPEAT UNTIL (termination condition ) is satisfied DO

    1. SELECT parents;

    2. RECOMBINE pairs of parents;3. MUTATE the resulting offspring;

    4. SELECT individuals or the next generation;

    END.

  • 8/12/2019 Fundamental of GA

    16/27

    Search SpaceIn solving problems, some solution will be the best among others.

    The space of all feasible solutions (among which the desired solutiis called search space (also called state space).

    Each point in the search space represents one possible solution.

    Each possible solution can be "marked" by its value (or fitness) fproblem.

    The GA looks for the best solution among a number of possible

    represented by one point in the search space. Looking for a solution is then equal to looking for some extreme(minimum or maximum) in the search space.

    At times the search space may be well defined, but usually only apoints in the search space are known.

    In using GA, the process of finding solutions generates other pointsolutions) as evolution proceeds.

  • 8/12/2019 Fundamental of GA

    17/27

    Working Principle

    Chromosome: a set of genes; a chromosome contains the solution in

    Gene: a part of chromosome; a gene contains a part of solution. Isolution. e.g. 16743 is a chromosome and 1, 6, 7, 4 and 3 are its genes

    Individual: same as chromosome.

    Population: number of individuals present with same length of chrom

    Fitness: the value assigned to an individual based on how far or closfrom the solution; greater the fitness value better the solution it contai

    F itness function : a function that assigns fitness value to the problem specific.

    Breeding: taking two fit individuals and then intermingling there create new two individuals.

    Mutation: changing a random gene in an individual.

    Selection: selecting individuals for creating the next generation.

  • 8/12/2019 Fundamental of GA

    18/27

    Genetic algorithm begins with a set of solutions (reprechromosomes) called thepopulation.

    Solutions from one population are taken and used to fo

    population. This is motivated by the possibility that the new will be better than the old one.

    Solutions are selected according to their fitness to form new(offspring); more suitable they are, more chances theyreproduce.

    This is repeated until some condition (e.g. number of popuimprovement of the best solution) is satisfied.

  • 8/12/2019 Fundamental of GA

    19/27

    1. [Start] Generate random population ofnchromosomes (i.e. suitable solutions f

    2. [Fitness] Evaluate the fitnessf(x)of each chromosomexin the population.

    3. [New population] Create a new population by repeating following steps

    population is complete.(a) [Selection] Select two parent chromosomes from a population according to thethe fitness, bigger the chance to be selected)

    (b) [Crossover] With a crossover probability, cross over the parents to form(children). If no crossover was performed, offspring is the exact copy of parents.

    (c) [Mutation] With a mutation probability, mutate new offspring at each lochromosome).

    (d) [Accepting] Place new offspring in the new population4. [Replace] Use new generated population for a further run of the algorithm

    5. [Test] If the end condition is satisfied, stop, and return the best solution in curre

    6. [Loop] Go to step 2

    Note : The genetic algorithm's performance is largely influenced by two crossover and mutation. These two operators are the most important parts of GA.

    Outline basic GA

  • 8/12/2019 Fundamental of GA

    20/27

  • 8/12/2019 Fundamental of GA

    21/27

    Encoding

    Before a genetic algorithm can be put to work on any problemethod is needed to encode potential solutions to that probleform so that a computer can process.

    One common approach is to encode solutions as binary strings: sequand 0's, where the digit at each position represents the value of somethe solution.

    Example :

  • 8/12/2019 Fundamental of GA

    22/27

    Example :

    A Gene represents some data (eye color, hair color, sight, etc.).

    A chromosome is an array of genes. In binary form

    a Gene looks like : (11100010)

    a Chromosome looks like: Gene1 Gene2 Gene3 Gene4

    (11000010, 00001110, 001111010, 10100011)

    A chromosome should in some way contain information about sol

    which it represents; it thus requires encoding. The most popular w

    encoding is a binary string like :

    Chromosome 1 : 1101100100110110

    Chromosome 2 : 1101111000011110Each bit in the string represent some characteristics of the solutio

    There are many other ways of encoding, e.g., encoding values asreal numbers or some permutations and so on.

    The virtue of these encoding method depends on the problem to

  • 8/12/2019 Fundamental of GA

    23/27

  • 8/12/2019 Fundamental of GA

    24/27

    Example 1

    One variable function, say 0 to 15 numbers, numeric values,represented by 4 bit binary string.

    Example 2

  • 8/12/2019 Fundamental of GA

    25/27

    Example 2

    Example : Decoding Value

  • 8/12/2019 Fundamental of GA

    26/27

    Example : Decoding Value

  • 8/12/2019 Fundamental of GA

    27/27

    Value EncodingThe Value encoding can be used in problems where values sunumbers are used. Use of binary encoding for this type of probbe difficult.

    1. In value encoding, every chromosome is a sequence of some va

    2. The Values can be anything connected to the problem, sucnumbers, characters or objects.

    Examples :

    Chromosome A 1.2324 5.3243 0.4556 2.3293 2.4545

    Chromosome B ABDJEIFJDHDIERJFDLDFLFEGT

    Chromosome C (back), (back), (right), (forward), (left)

    3. Value encoding is often necessary to develop some newcrossovers and mutations specific for the problem.