2.1-Genetic Algorithms

Embed Size (px)

Citation preview

  • 8/7/2019 2.1-Genetic Algorithms

    1/97

    Genetic Al orithms

    ENETIC LGORITHMS

  • 8/7/2019 2.1-Genetic Algorithms

    2/97

    Introduction

    Genetic algorithms are inspired by Darwin's theoryof evolution (i.e., survival of the fittest);

    The new breeds of classes of living things come into existence

    through the process of reproduction, crossover, and mutation

    among existing organisms.

    been translated into an algorithm to search for

    solutions to problems in a more natural way.

  • 8/7/2019 2.1-Genetic Algorithms

    3/97

  • 8/7/2019 2.1-Genetic Algorithms

    4/97

    In the process of improving performance as muchas possible via tuning and specializing the geneticalgorithm operators, new and important findingsregarding the generality, robustness, andapplicability of genetic algorithms becameavailable.

    Following the last couple of years of furiousdevelo ment of enetic al orithms in the sciences,

    engineering and the business world, thesealgorithms in various guises have now beensuccessfull a lied to o timization roblemsscheduling, data fitting and clustering, trend

    spotting and path finding.

  • 8/7/2019 2.1-Genetic Algorithms

    5/97

    Biological Background

    Chromosome: are strings of DNA (genes) andserve as a model for the whole organism

    ac gene enco es a par cu ar pro e n. as ca y,

    it can be said that each gene encodes a trait, for

    example color of eyes.

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

    called alleles.

    ac gene as ts own pos t on n t echromosome. This position is called locus.

  • 8/7/2019 2.1-Genetic Algorithms

    6/97

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

    Particular set of genes in genome is called

    The genotype is the after birth base for the

    organism'sphenotype, its physical and mentalcharacteristics, such as eye color, intelligence, etc.

  • 8/7/2019 2.1-Genetic Algorithms

    7/97

    http://gslc.genetics.utah.edu/units/basics/tour/

  • 8/7/2019 2.1-Genetic Algorithms

    8/97

    During reproduction, recombination(orcrossover)first occurs. Genes from parents combine to form a

    The newly created offspring can then be mutated.u a on means a e e emen s o are a

    changed. This changes are mainly caused by errorsin copying genes from parents.

    The fitnessof an organism is measured by successof the or anism in its life survival .

  • 8/7/2019 2.1-Genetic Algorithms

    9/97

    Biological Metaphor

    Algorithm begins with a set of solutions (represented by

    chromosomes) called population.

    goodness (fitness) and used to form a new population,(reproduction). This is motivated by a hope, that the newpopulation will be better than the old one.

    Solutions which are then selected to form new solutions.(Offspring) are selected according to their fitness - the

    reproduce.

    This is repeated until some condition (for examplenum er o popu a ons or mprovemen o e essolution) is satisfied.

  • 8/7/2019 2.1-Genetic Algorithms

    10/97

    Flowchart

    1. Generate random population ofNchromosomes (feasiblesolutions for the problem)

    START

    FITNESS

    2. va ua e e ness x o eacchromosome x in the population

    3. Create a new population by

    GENERATE NEW

    POPULATION

    the new population is completeby means of selection andcrossover or mutation

    REPLACE

    4. Replace unfit individuals in oldpopulation by new off springs

    5. If the end condition is satisfied,END

    CONDITION

    SATISFIED

    NO

    ,in current population

    else Go to step 2STOPYES

  • 8/7/2019 2.1-Genetic Algorithms

    11/97

    An Illustrative Example

    How a line may be fit through a given data set using agenetic algorithm?

    ons er a nown mo e structure, a near t

    y= C1x+ C2

    Encode C and C in 6-bit strin each L = 6

    E.g., 0 0 0 1 1 1 0 1 0 1 0 0 (genotype)

    C1 = 7 C2 = 20

    Initial population = 4

    Assume the minimum ofC1 and C2 are Cmin = -2; and the

    max mum o 1 an 2 are max = .

    Evaluate the performance from the given data set Cut-off value = 0.8 (relative fitness)

  • 8/7/2019 2.1-Genetic Algorithms

    12/97

    Mappingfrom genotype to phenotype Ci= Cmin,i+ b / (2

    L-1) (Cmax,i- Cmin,i)

    corresponding more copies in the new generation (i.e.,

    strings with lower fitness values are eliminated) (i.e.,

    Crossover: strings are able to mix and match theirdesirable qualities in a random fashion (i.e., one-point

    crossover Mutation: helps to increase the searching space,

    allowing a vital bit of information to vary (from 1 o 0 orfrom 0 to 1) (i.e., bit-flip mutation). Mutation takes place

    very rarely (e.g., 0.005/bit/generation)

  • 8/7/2019 2.1-Genetic Algorithms

    13/97

  • 8/7/2019 2.1-Genetic Algorithms

    14/97

    Another Illustrative Example

    Given some functional mapping for a system, some membershipfunctions and their shapes are assumed for the various fuzzy

    variables defined for a problem.

    These membership functions are them coded as bit strings that are

    then concatenated.

    each set of membership functions.

    Single-input (x) single-output (y) system:

    y 1 4 9 16 25

    Functional mapping in fuzzy logic for the system:

    y S (small) VL (very large) [ ]250y

  • 8/7/2019 2.1-Genetic Algorithms

    15/97

    The only parameter needed to described themembership functions (shape and position) is the

    x

    .S L

    6-bit string (binary) to define the base 24-bit string

    Base 1 Base 2 x

    c romosome

    Initial population = 4

  • 8/7/2019 2.1-Genetic Algorithms

    16/97

  • 8/7/2019 2.1-Genetic Algorithms

    17/97

    Design Parameters

    1. Design a representation2. Decide how to initialize a population

    . es gn a mec an sm o map e p eno ype ogenotype and vice versa

    4. Design a way of evaluating an individual5. Design suitable mutation operators

    6. Design suitable crossover operators

    . 8. Decide how to select individuals to be replaced

    9. Decide when to sto the al orithm

    10. Decide how to manage the population

  • 8/7/2019 2.1-Genetic Algorithms

    18/97

    1. Designing a Representation

    We have to come up with a method of representingan individual as a genotype.

    The way we choose to do it must be relevantto the

    .

    When choosing a representation, we have to bear in

    mind how the genotypes will be evaluated and whatthe genetic operators might be.

  • 8/7/2019 2.1-Genetic Algorithms

    19/97

    Forn-city Traveling Salesman Problem,

    how should we desi n a re resentation(phenotype vs. genotype)?

    0.9

    1

    0 4

    0.5

    0.6

    0.7

    0.8

    0 0.1 0.2 0. 3 0.4 0.5 0.6 0.7 0.8 0.9 1

    0.1

    0.2

    0.3

    .

  • 8/7/2019 2.1-Genetic Algorithms

    20/97

    Binary Valued Representation

    A chromosome should in some way containinformation about solution that it represents. Themost used way of encoding is a binary string. Ac romosome en cou oo e s:

    Chromosome 1 1101 1001 0011 0110 Chromosome 2 1101 1110 0001 1110

    string. Each bit in the string can represent somecharacteristics of the solution. Another possibility isthat the whole strin can re resent a number

  • 8/7/2019 2.1-Genetic Algorithms

    21/97

    Examples

    PHENOTYPE

    Integer

    Real Number

    8 bit GENOTYPE

    .

    .

    ny ng

    WHAT CAN IT REPRESENT ???

  • 8/7/2019 2.1-Genetic Algorithms

    22/97

    Phenotype can be an integer number

    =

    0*22+1*21+1*20

    = 128+32+2+1 = 163

  • 8/7/2019 2.1-Genetic Algorithms

    23/97

    Phenotype can be areal number

    e.g. a num er etween

    2.5 and 20.5 using 8

    binar di its

    X= 2.5 + (163/256) (20.5-

    2.5) = 13.9609

  • 8/7/2019 2.1-Genetic Algorithms

    24/97

    Job Timestep

    Phenotype can

    be a schedule

    1 2

    2 1

    e.g. 8 jobs , 2

    time steps4 1

    5 1

    6 1

    7 2

  • 8/7/2019 2.1-Genetic Algorithms

    25/97

    Real Valued Representation

    A very natural encoding if the solution we are lookingfor is a list of real-valued numbers, then encode as a

    -

    0s)

    Lots of applications , e.g. parameter optimization

  • 8/7/2019 2.1-Genetic Algorithms

    26/97

    Individuals are represented as a tuple ofn realvalued numbers:

    The fitness function maps tuples of real numbers to

    f:Rn R

  • 8/7/2019 2.1-Genetic Algorithms

    27/97

    Binary vs. Real Representation

    Original genetic algorithm is based on binary coding, due to

    biological evidence. But it has some drawbacks when applied to

    multidimensional, high-precision numerical problems.

    There are three advantages of real representation:

    First, the real representation proves adequate precision so that good values

    are presentable in the search space. If a parameter is coded in binary form,ere s a ways e anger a one s a owe enoug prec s on o represen

    parameter values that produce the best solution values.

    Second, with the same digits, the real representation has larger range and

    does not have to be a power of two.

    Third, the real-coded genes have the ability to exploit the gradualness ofcontinuous variables (the gradualness means that small changes in the

    variables correspond to small changes in the function).

    disadvantages of binary one, there are still some weak points like

    inherent premature convergence and leak mountain climbing.

  • 8/7/2019 2.1-Genetic Algorithms

    28/97

    Order Based Representation

    Individuals are represented as permutations Used for ordering, sequencing problems

    Famous example: traveling salesman problem where

    every city gets assigned a unique number from 1 to

    . , , , , .

    Famous example: N-queen problem (orN2-queen)

    Needs special operators to make sure the individuals

    stay in validpermutations.

  • 8/7/2019 2.1-Genetic Algorithms

    29/97

    NQueens Problem

    In chess, a queen can move as far

    as she pleases, horizontally,vertically, or diagonally. A chess

    .The standard 8 by 8 Queen'sproblem asks how to place 8

    queens on an ordinary chess board

    other in one move.

    One solution - the prettiest in myopinion - is given in the figure

    .12 essentially distinct solutions.(Two solutions are not essentiallydistinct if you can obtain one fromano er y ro a ng your c essboard, or placing in in front of a

    mirror, or combining these twooperations.)

  • 8/7/2019 2.1-Genetic Algorithms

    30/97

    Constraint SatisfactionProblem

  • 8/7/2019 2.1-Genetic Algorithms

    31/97

    n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

    Unique

    solution

    1 0 0 1 2 1 6 12 46 92 341 1787 9233 45752 285053

    Distinct

    solution

    1 0 0 2 10 4 40 92 352 724 2680 14200 73712 365596 2279184

    * Distinct solutions are derived from unique solutions by rotations,

    reflections and transpositions

  • 8/7/2019 2.1-Genetic Algorithms

    32/97

    Variants: Super Queen orN2 Queens (3-D version) problem

    e requ res p ac ng queens n an

    cube so that no two queens threaten each other. There can

    only be one queen in any row parallel to any axis, or in any

    . , ,

    cube, so that Sijcontains a height, k, then S is clearly a

    Latin square. A solution to 3DTN2QP is also a pandiagonal

    Latin s uare or Knut-Vik desi n.

    Demonstration (N: 4-60)

    http://www.apl.jhu.edu/~hall/NQueens.html

  • 8/7/2019 2.1-Genetic Algorithms

    33/97

    Tree Based Representation

    Individuals in the population are trees Any expression can be drawn as a tree of function

    an erm na s

    Functions : sine, cosine, add, sub, if-then-else

    , , . , , , ,

  • 8/7/2019 2.1-Genetic Algorithms

    34/97

    Tree Based: Closure and Sufficiency

    In the tree based representation we need to specifya function set and a terminal set. It is very desirable

    By closure we mean that each of the functions in theunc on se s a e o accep as s argumen s anyvalue and data type that may possibly be returned bysome other function or terminal.

    By sufficiencywe mean that there should be asolution in the s ace of all ossible ro ramsconstructed from the specified function and terminal

    sets.

  • 8/7/2019 2.1-Genetic Algorithms

    35/97

    2. Initialization of a Population

    Usually, at random

    Uniformly on the search space . ,if possible

    Binary representation: 0 and 1 with probability of 0.5

    -

    (OK for bounded values only)

    Seed the population with previously known values orthose from heuristics. With care:

    Possible loss of enetic diversit

    Possible unrecoverable bias

  • 8/7/2019 2.1-Genetic Algorithms

    36/97

    Forn-city Traveling Salesman Problem,

    an effective strate to initialize thepopulation, given the way how the solution is

    coded?

  • 8/7/2019 2.1-Genetic Algorithms

    37/97

    Randomly initialized path

    er space- ng curve

    Fast closest ath

  • 8/7/2019 2.1-Genetic Algorithms

    38/97

    3. Mapping a Genotype to Phenotype

    Sometimes producingthe phenotype from the Genotype Problem

    Dataprocess.

    Other times the

    of parameters to somealgorithm, which work

    Growt

    Function

    produce the phenotype.

    Phenot e

  • 8/7/2019 2.1-Genetic Algorithms

    39/97

    Forn-city Traveling Salesman Problem,

    it should be strai htforward for the ma infrom genotype to phenotype.

  • 8/7/2019 2.1-Genetic Algorithms

    40/97

    4. Evaluating an Individual

    By far the most costlystep for real applications Do not re-evaluate unmodified individuals

    It mi ht be a subroutine a black-box simulator or anexternal process (e.g., robot experiment).

    The effectiveness of the process depends on the

    choice of the fitness function. Your could use approximate fitness, but not far too long

    (fitness inheritance orfitness approximation).

    Constraint handlin - what if the henot e breaks

    some constraint of the problem: Penalize the fitness

    Specific evolutionary method

    Multiobjective evolutionary optimization gives a set of

    compromise solutions

  • 8/7/2019 2.1-Genetic Algorithms

    41/97

    Forn-city Traveling Salesman Problem,

    what would be the cost function?

  • 8/7/2019 2.1-Genetic Algorithms

    42/97

    5. Mutation Operators

    The mutation operator should allow every part of the

    search space to be reached.

    The size of mutation is important and should be

    .

    Mutation should produce validchromosomes.

  • 8/7/2019 2.1-Genetic Algorithms

    43/97

    Forn-city Traveling Salesman Problem,

    how should we desi n the mutation o erator?

    0.9

    1

    0.4

    0.5

    0.6

    0.7

    .

    0 0. 1 0. 2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

    0.1

    0.2

    0.3

  • 8/7/2019 2.1-Genetic Algorithms

    44/97

    Binary Valued Representation

    1 1 1 1 1 1 1e ore

    Grey Elephant

    mutated gene

    Mutation probabilitypm, for each gene

  • 8/7/2019 2.1-Genetic Algorithms

    45/97

    Real Valued Representation

    Perturb values by adding some random noise

    Often, a Gaussian/normal distribution N(0,) is used,w ere

    is the standard deviation

    and xi = xi + N(0,i) for each parameter

  • 8/7/2019 2.1-Genetic Algorithms

    46/97

    Order Based Representation

    Randomly select two different genes and swap them.

    7 83 41 2 6 5

    7 83 46 2 1 5

    bit swapping bit reversal

    a sequence of bits is reversedsomewhere in the chromosome

  • 8/7/2019 2.1-Genetic Algorithms

    47/97

    Tree Based Representation

    Single point mutation selects one node and replaces

    it with a similar one.

    * *

    2 * *r r r r

  • 8/7/2019 2.1-Genetic Algorithms

    48/97

    Annealing Procedure Conjecture

    Two fundamental parameters to be controlled: mutation rate and

    degrees of variations

    In early stages, allow mutation to occur frequent and

    Toward the later stages (convergence), limit

    occurrence in mutation and with small jumps for

    exp o tat on

  • 8/7/2019 2.1-Genetic Algorithms

    49/97

    6. Recombination/Crossover Operators

    The child should inherit something from both.

    mutation operator.

    The recombination/crossover operator should bedesigned in conjunction with the representation sothat recombination is not always catastrophic.

    Recombination should produce validchromosomes.

  • 8/7/2019 2.1-Genetic Algorithms

    50/97

    Forn-city Traveling Salesman Problem,

    how should we desi n the crossover o erator?

  • 8/7/2019 2.1-Genetic Algorithms

    51/97

    Binary Valued Representation

    . . .Whole Po ulation:

    1 1 1 1 1 1 1 0 0 0 0 0 0 0parents

    offspring1 1 1 0 0 0 0 0 0 0 1 1 1 1

    1-point crossover

  • 8/7/2019 2.1-Genetic Algorithms

    52/97

    Real Valued Representation

    Uniform crossover: given two parents one child iscreated as follows

    a db fc e g hg

    a c eH

  • 8/7/2019 2.1-Genetic Algorithms

    53/97

    Intermediate recombination (arithmetic crossover):given two parents one child is created as follows

    a c e

    FD ECBA

    (a+A)/2 (b+B)/2 (c+C)/2 (e+E)/2(d+D)/2 (f+F)/2

    o1 =p1*bias + p2*(1-bias)

    * *2 1 - 2

    bias toward the centerbetween two parents

  • 8/7/2019 2.1-Genetic Algorithms

    54/97

    Blend (BLX-) Crossover:

    picking a random number between min(p1,p2)- * and

    *1, 2 , 1 2 ,

    positive number (typically 0.5), and is |p1 p2|.

    This formulation allows for the BLX operator to choose a

    two parents. This allows for better placement of children

    than the Arithmetic Crossover; however, the children will still

    be biased to lie on baselines between sets of arents.

    Therefore, children could still lack diversity.

    iiii dxxX = ),min(211

    21xxd =

    iiii dxxX += ),max(212

  • 8/7/2019 2.1-Genetic Algorithms

    55/97

    Unimodal Normally Distributed (UNDX) Crossover: It first selects three parents at random from the population.

    Next it finds the mid oint of the first two arents and calls it xp.Then, it finds the difference vector of the first two parents as d= x1

    x2. The line containing the first two parents is called the primary

    search line, and the value D is computed as the distance from the

    .

    combined to form a child xc:

    =

    ++=1

    1

    n

    i

    ii

    ceDdmx

    i

    space and and are standard deviations determinedempirically.

    This crossover operator has the advantage of preserving the mean

    vector and covariance matrix of the parent population thereby

    maintaining a similar distribution to the parent population in child

    generations.

  • 8/7/2019 2.1-Genetic Algorithms

    56/97

    Order Based Representation

    Choose an arbitrary part from the first parent and

    copy this to the first child.

    Copy the remaining genes that are not in the copied

    part to the first child: starting right from the cut point of the copied part

    using the order of genes from the second parent

    wra in around at the end of the chromosome

    Repeat this process with the parent roles reversed.

  • 8/7/2019 2.1-Genetic Algorithms

    57/97

    7 83 41 2 6 5 78 16 5234

    Parent 1 Parent 2

    7, 3, 4, 6, 5

    81 2 4, 3, 6, 7, 5

    Child 1

    7 85 41 2 3 6

  • 8/7/2019 2.1-Genetic Algorithms

    58/97

    Tree Based Representation

    *

    *

    *

    + 2 * (r * r )

    r / * r + r

    1 r

    wo su - rees are se ec e

    for swapping.

  • 8/7/2019 2.1-Genetic Algorithms

    59/97

    +

    *

    *

    *

    r / r r*

    1 r* 2 +

    2 * r /

    r r 1 r

    expressions

  • 8/7/2019 2.1-Genetic Algorithms

    60/97

    Crossover vs. Mutation

    Crossover modifications depend on the whole population

    decreasing effects with convergence

    exploitation operator

    Mutation mandatory to escape local optima

    exploration operator

    emp as ze crossover; w e anemphasize mutation

  • 8/7/2019 2.1-Genetic Algorithms

    61/97

    Exploration vs. Exploitation

    Exploration = sample unknown regions

    Too much exporation = random search, no

    convergence

    - -individuals

    Too much expoitation = local search only

    convergence to a local optimum

  • 8/7/2019 2.1-Genetic Algorithms

    62/97

    7. Selection Strategy

    We want to have some way to ensure that better

    fitted individuals have a better chance of being

    .

    This will give us selection pressure which will drive

    the o ulation forward. On the other hand, we have to be careful to give less

    good individuals at least some chance of being

    -

    material.

    Risk of loss diversit

  • 8/7/2019 2.1-Genetic Algorithms

    63/97

    Forn-city Traveling Salesman Problem,

    how should we desi n the selection o erator?

  • 8/7/2019 2.1-Genetic Algorithms

    64/97

    Roulette Wheel Selection

    Parents are selected according to their

    fitness. The better the chromosomes are,the more chances they are to be selected.

    The size of the section in the roulette

    wheel is proportional to the value of thefitness function of every chromosome - thebigger the value is, the larger the sectionis.

    Better (fitter) individuals have: more space more chances to be selected

  • 8/7/2019 2.1-Genetic Algorithms

    65/97

    Fitness Proportionate Selection

    Disadvantages:

    Danger of premature convergence becauseoutstanding individuals take over the entire

    o ulation ver uickl .

    Low selection pressure when fitness values are near.

    Behave differentl on trans osed versions of thesame function.

  • 8/7/2019 2.1-Genetic Algorithms

    66/97

    Fitness Scaling

    At the start, a few extraordinary individuals will dominate the

    evolution process premature convergence Later on, the population average fitness may be closed to the

    population best fitness random walk among the mediocre

    a cure for the problem issue

    Start with the raw fitness function

    Standardize to ensure

    Lower fitness is better fitness

    Optimal fitness equals to 0

    Fitness ranges from 0 to 1 Normalize to ensure

    The sum of the fitness values equals to 1

    Linear scaling: f = af+ b

    a and b are chosen such that favg = favg

  • 8/7/2019 2.1-Genetic Algorithms

    67/97

    Tournament Selection

    Select k random individuals, without replacement

    a e t e est

    k is called the size of the tournament

  • 8/7/2019 2.1-Genetic Algorithms

    68/97

  • 8/7/2019 2.1-Genetic Algorithms

    69/97

    Ranked Based Selection

    Individuals are sorted on their fitness value from best

    to worse. e p ace n t s sorte st s ca e ran .

    ,rank is used by a function to select individuals from

    this sorted list. The function is biased towards

    individuals with a high rank (= good fitness).

  • 8/7/2019 2.1-Genetic Algorithms

    70/97

    Fitness: f(A) = 5, f(B) = 2, f(C) = 19

    Rank: r(A) = 2, r(B) = 3, r(C) = 1

    h(x) = min + (max min)* (r(x) 1)/(n 1)

    unc on: = , = , =

    If applied, proportion on the roulette wheel:= = =. , . , .

  • 8/7/2019 2.1-Genetic Algorithms

    71/97

    8. Replacement Strategy

    The selection pressure is also affected by the way in

    which we decide which members of the population to

    individuals.

    e can use e s oc as c se ec on me o s nreverse, or there are some deterministic replacementstrategies.

    We can decide never to replace the best in theo ulation: elitism.

  • 8/7/2019 2.1-Genetic Algorithms

    72/97

    Forn-city Traveling Salesman Problem,

    how should we desi n the re lacementstrategy?

  • 8/7/2019 2.1-Genetic Algorithms

    73/97

    Elitism

    Should fitness constantly improves?

    Re-introduce in the population previous best-so-far (elitism)or

    Keep best-so-far in a safe place (preservation)

    Theory GA: preserve mandatory ES: no elitism sometimes is better

    Application: avoid users frustration

  • 8/7/2019 2.1-Genetic Algorithms

    74/97

    Bottomline is survival of the fittest

    Generational Replacement Genetic Algorithm (GRGA).

    approach of Holland. If the original population size is N, then Noffspring

    are generated, and they are combined with the parents to get 2N

    individuals which are then sorted and the best Nindividuals are accepted

    for the next generation. This approach is rather simple, and places the

    entire burden of selection and extinction upon the reproductive

    operations.

    ea y a e ene c gor m

    uses a fixed population wherein a finite fraction of the population isextinguished at every generation. This approach separates natural

    ,

    replacement strategy. Whereas there is no choice of replacement

    strategy for the GRGA (because everyone is replaced), there are choices

    for replacement strategy in the SSGA.

  • 8/7/2019 2.1-Genetic Algorithms

    75/97

    Replace Worstreplaces the worst existing chromosome in the

    population with probability equal to one by the newly created child

    chromosome in the population by the newly created child to

    preserve diversity

    Replace Random replaces a random existing chromosome in the

    population.

    ,

    of parents at random and replace the worst, or pick two parents atrandom and replace the worst of the two, with or without some

    attached robabilit check. This can also be combined with roulette

    wheel selection where the two candidates are chosen by roulette

    wheel probabilities based upon absolute fitness, and then proceed

    with the tournament. This is known as a Stochastic Tournament.

  • 8/7/2019 2.1-Genetic Algorithms

    76/97

    Population Decimation All chromosomes below the cut-off

    threshold do not survive to the next generation. Their replacementsare formed by mating the remaining individual chromosomes.

    Mass Extinction Extinction allows the repopulation of niches and

    gives room for new adaptations. In mass extinction models, major

    parts of the population are occasionally replaced, as opposed to agradual substitution of single individuals that one might see in a

    classical GA. Most of the time there are no extinctions, sometimes

    a few individuals die, and very rarely a large proportion of the

    population is affected. However, the current best individual (an elite

    class of size one) always survives extinction events, and is oftenused to repopulate the extinguished individuals in the extinction

    zones y mu a e e ana ogy n na ure s e re-co on za on o a

    niche by fit individuals that quickly explore the environment and

    adapt to it.

  • 8/7/2019 2.1-Genetic Algorithms

    77/97

    9. Stopping Criteria

    The optimum is reached !!!!!

    m on resources

    Maximum number of evolution generations

    Maximum number of fitness evaluations

    m t on t e user s pat ence

    After some generations without improvement

  • 8/7/2019 2.1-Genetic Algorithms

    78/97

    Forn-city Traveling Salesman Problem,

    what would be a reasonable sto in criterion?

  • 8/7/2019 2.1-Genetic Algorithms

    79/97

    In general, generation number, evolution time,

    fitness threshold, fitness convergence are indicators.

    Population convergence The population is deemed

    as conver ed when the avera e fitness across thecurrent population is less than a user-specified

    percentage away from the best fitness of the current

    .

    Gene convergence This is a method that stops theevolution when a user-specified percentage of the

    genes are deemed converged.

  • 8/7/2019 2.1-Genetic Algorithms

    80/97

    10. Managing the Population

    In general, fix population is always used for simplicity.

    If the predetermined population size is too small, there will not be-

    solution. If the population size is too large, it may require

    unnecessarily large computational resources and result into an

    extremely long running time. Optimal population size?

    For MOP, a fixed population size will have great difficulty in

    obtainin a Pareto front with a desired resolution because the

    size and shape of the true Pareto front is unknown in apriorifor

    most of the MOPs

    A d namic o ulation size will be more reasonable for MOEA if

    the computational effort can be adaptively adjusted based on the

    complexity of the problem

  • 8/7/2019 2.1-Genetic Algorithms

    81/97

    Performance

    Neverdraw any conclusion from a single run

    Use statistical measure (average, median) (Box plot)

    rom a su c en num er o n epen en runs - m n mum

    From the application point of view

    Design perspective

    Find a very goodsolution at least once

    Production ers ective

    Find a goodsolution at almost every run

    ,

    performance on toy data and expect it to work with real

    data

  • 8/7/2019 2.1-Genetic Algorithms

    82/97

    Box Plot

    In descriptive statistics, a boxplot (alsoknown as a box-and-whisker diagram or

    plot) is a convenient way of graphicallydepicting groups of numerical data through

    e r ve-num er summar es e sma esobservation, lower quartile (Q1), median(Q2), upper quartile (Q3), and largestobservation). A boxplot may also indicate

    , ,considered outliers. The boxplot wasinvented in 1977 by the Americanstatistician John Tukey.

    Box lots can be useful to dis ladifferences between populations without

    making any assumptions of the underlyingstatistical distribution. The spacingsbetween the different parts of the box helpn ca e e egree o spers on spreaand skewness in the data, and identifyoutliers. Boxplots can be drawn either

    horizontally or vertically.

  • 8/7/2019 2.1-Genetic Algorithms

    83/97

    For this data set:

    " "- lower (first) quartile (Q1,x.25) = 7

    median(second quartile) (Med,x.5) = 8.5 u er third uartile 3 x = 9 .

    largest non-outlier observation = 10 (right "whisker")

    the value 3.5 is a "mild" outlier, between

    the value 0.5 is an "extreme" outlier,

    the data are skewed to the left (negatively skewed)

    the mean value of the data can also be labeled with a point.

  • 8/7/2019 2.1-Genetic Algorithms

    84/97

    Flowchart

    1. Generate random population of

    Nchromosomes (feasiblesolutions for the problem)

    START

    FITNESS

    2. va ua e e ness x o eacchromosome x in the population

    3. Create a new population byGENERATE NEW

    POPULATION

    the new population is completeby means of selection andcrossover or mutation

    REPLACE

    4. Replace unfit individuals in old

    population by new off springs5. If the end condition is satisfied,

    END

    CONDITION

    SATISFIED

    NO

    ,in current population

    else Go to step 2STOP

    YES

  • 8/7/2019 2.1-Genetic Algorithms

    85/97

    Genetic Algorithm for TSP

    Chromosome representation: (order-based)

    Population size & initialization: (50, at random)

    Fitness function: (distance traveled)

    Mutation: (5%)

    ecom na on: (order-based)

    Selection: (rank-based)

    Stopping criteria: (number of generations- 200)

  • 8/7/2019 2.1-Genetic Algorithms

    86/97

    Demonstration

    C S d 101 i TSP bl ( il101)

  • 8/7/2019 2.1-Genetic Algorithms

    87/97

    Case Study: 101-city TSP problem (eil101)

    Total Distance:678.854309.

    Population:50

    Generations:200

    C St d 535 i t bl ( li535)

  • 8/7/2019 2.1-Genetic Algorithms

    88/97

    Case Study: 535-airport problem (ali535)

    Total Distance:

    2433.995486

    Population:50

    Generations:

    C St d N Q P bl

  • 8/7/2019 2.1-Genetic Algorithms

    89/97

    Case Study: N Queens Problem

    In chess, a queen can move as faras she pleases, horizontally,vertically, or diagonally. A chess

    .The standard 8 by 8 Queen'sproblem asks how to place 8queens on an ordinary chess board

    other in one move.

    One solution - the prettiest in myopinion - is given in the figure

    .12 essentially distinct solutions.(Two solutions are not essentiallydistinct if you can obtain one fromano er y ro a ng your c essboard, or placing in in front of amirror, or combining these two

    operations.)

  • 8/7/2019 2.1-Genetic Algorithms

    90/97

    Applications in

    Traffic control

    VLSI design

    Deadlock prevention

    Parallel memory storage schemes

    Sensor deployment

    .

    Proble Iss es in GA

  • 8/7/2019 2.1-Genetic Algorithms

    91/97

    Problem Issues in GA

    Population size

    Binary representation vs. real representation Population initialization

    Noisy fitness function Stochastic fitness function (or dynamic environment) Fitness inheritance and fitness approximation

    Selection/rankin strate Crossover/Recombination operator

    Mutation operator

    Replacement strategy

    Elitism strategy Benchmark test functions

    Ex loration vs. ex loitation dilemma

    Constraint handling Diversity promotion

    Population management

    Homework #3 due 11/7/2009

  • 8/7/2019 2.1-Genetic Algorithms

    92/97

    Homework #3- due 11/7/2009

    Problem #1 (Combinatorial Optimization)

    Develop a genericgenetic algorithm to solve the traveling

    within a unit square in a 2-dimensional plane. The coordinates

    of 20 cities are given below in a matrix:

    =95,0.2867.7148,0.239,0.2184,09697,0.597,0.8274,0.740,0.50290.9500,0.6

    67,0.8148.6091,0.877,0.9536,00398,0.136,0.2124,0.695,0.59060.6606,0.9cities

    36,0.8668.1247,0.169,0.9464,07471,0.544,0.3429,0.041,0.02130.3876,0.7

    Show the best route you find and the associated distance with

    46,0.6768.4351,0.862,0.8191,08192,0.939,0.3025,0.296,0.16490.8200,0.3

    attached computer coding (with documentation- show your

    recipe). An example is given below for reference.

  • 8/7/2019 2.1-Genetic Algorithms

    93/97

    0. 9

    1

    0. 7

    0. 8

    0. 4

    0. 5

    .

    0. 1

    0. 2

    0. 3

    0 0. 1 0. 2 0.3 0. 4 0 .5 0. 6 0.7 0. 8 0. 9 1

  • 8/7/2019 2.1-Genetic Algorithms

    94/97

    Problem 2 (Scalability)

    Extend your genetic algorithm to solve the benchmark 101-city

    Eilson).The benchmark problem can be found from TSPLIB

    archive at

    http://www.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95/

    o nee o urn n e co es. n y e es rou e oun .e., s

    configuration and distance in the form of above figure) is to beturned in. This problem is to test if your algorithm can scale up

    .

  • 8/7/2019 2.1-Genetic Algorithms

    95/97

    Problem 3 (Numerical Optimization)

    Apply the genetic algorithm to De Jongs Rosenbrock's Valley

    where global minimum is at the origin. This function is known

    2

    1

    2

    2

    2

    121 )1()(100),( xxxxxF +=

    . .global optimum is at the tip of the sharp ridge, which is

    parabolic shaped flat valley. The difficulty of this problem is to

    conver e to the lobal o timum.

  • 8/7/2019 2.1-Genetic Algorithms

    96/97

    Problem 4 (Multimodel Function)

    Apply the genetic algorithm to De Jongs Shekels Foxholes

    ( ) =

    +=25

    1

    5

    1002.0

    j jfF x ( )

    =

    +=2

    1

    6

    ,

    i

    jiij axjf

    =

    321601632321601632321601632321601632321601632a

    This function, a multimodel function, which has many local

    323232323216161616160000016161616163232323232

    2,1,536.16536.16where = ixi

    optimal (in this case 25). This function is a challenge to many

    standard optimization algorithms because they can get stuck ina local optimal. Note that all 25 peaks have the same base

    , , , , ... , - , -

    32).

  • 8/7/2019 2.1-Genetic Algorithms

    97/97