7.GenAlgo Intro

Embed Size (px)

Citation preview

  • 8/3/2019 7.GenAlgo Intro

    1/16

    Genetic Algorithms

    [email protected]

  • 8/3/2019 7.GenAlgo Intro

    2/16

    Genetic Algorithm Is...

    Computer algorithm

    That resides(based) on principles of genetics and evolution

  • 8/3/2019 7.GenAlgo Intro

    3/16

    Genetic Algorithm (3) Basic algorithm

    Outline of the basic algorithm

    0 START : Create random population of n chromosomes

    1 FITNESS : Evaluate fitness f(x) of each chromosome in

    the population

    2 NEW POPULATION

    0 SELECTION : Based on f(x)

    1 RECOMBINATION: Cross-over chromosomes

    2 MUTATION : Mutatechromosomes

    3 ACCEPTATION : Reject or accept new one

    3 REPLACE : Replace old with new population: the new

    generation

    4 TEST : Test problem criterium

    5 LOOP : Continue step 1 4 until criterium is

    satisfied

  • 8/3/2019 7.GenAlgo Intro

    4/16

    Initialization

    Start with a population ofrandomly generated individuals, or

    use - A previously saved population- A set of solutions provided by

    a human expert

    - A set of solutions provided byanother heuristic algorithm

  • 8/3/2019 7.GenAlgo Intro

    5/16

    Selection

    The selection operation copies a single individual,probabilistically selected based on fitness,into the next generation of the population.

    There are few possible ways to implement selection:

    Only the strongest survive

    Choose the individuals with the highest fitnessfor next generation

    Some weak solutions survive

    Assign a probability that a particular individual

    will be selected for the next generation More diversity

    Some bad solutions might have good parts!

  • 8/3/2019 7.GenAlgo Intro

    6/16

    Fitness Selection

    Each successive generation the selectedpopulation goes for new population generation.

    Selection is based on the fitness function Roulette wheel selection

    Rank based selection

    Tournament selection

    Steady-state selection

    Truncation selection

  • 8/3/2019 7.GenAlgo Intro

    7/16

    Crossover

    Crossover is concept from genetics.

    Crossover is reproduction.

    Crossover combines genetic material from two parents,

    in order to produce superior offspring. Few types of crossover:

    One-point

    Multiple point

    Uniform

  • 8/3/2019 7.GenAlgo Intro

    8/16

    One-point Crossover

    Parent #1 Parent #2

    0

    1

    5

    3

    5

    4

    7

    6

    7

    6

    2

    4

    2

    3

    0

    1

  • 8/3/2019 7.GenAlgo Intro

    9/16

    One-point Crossover

    Parent #1 Parent #2

    0

    1

    5

    3

    5

    4

    7

    6

    7

    6

    2

    4

    2

    3

    0

    1

  • 8/3/2019 7.GenAlgo Intro

    10/16

    One-point crossover 1

    Randomly one position in the chromosomes is chosen

    Child 1 is head of chromosome of parent 1 with tail of chromosome ofparent 2

    Child 2 is head of 2 with tail of 1

    Parents: 1010001110 0011010010

    Offspring: 0101010010 0011001110

    Randomly chosen position

  • 8/3/2019 7.GenAlgo Intro

    11/16

    Two-point crossover

    Parents: 1010001110 0011010010

    Offspring: 0101010010 0011001110

    Randomly chosen positions

    Randomly two positions in the chromosomes are chosen

    Avoids that genes at the head and genes at the tail of achromosome are always split when recombined

  • 8/3/2019 7.GenAlgo Intro

    12/16

    Uniform crossover

    A random mask is generated

    The mask determines which bits are copied from one parent andwhich from the other parent

    Bit density in mask determines how much material is taken fromthe other parent (takeover parameter)

    Mask: 0110011000 (Randomly generated)

    Parents: 1010001110 0011010010

    Offspring: 0011001010 1010010110

  • 8/3/2019 7.GenAlgo Intro

    13/16

    Mutation

    Mutation introduces randomness into the population.

    The idea of mutationis to reintroduce divergenceinto a converging population.

    Mutation is performedon small part of population,

    in order to avoid entering unstable state.

  • 8/3/2019 7.GenAlgo Intro

    14/16

    Mutation

    Purpose: to simulate the effect of errors thathappen with low probability during

    duplication

    Results:

    - Movement in the search space- Restoration of lost information to thepopulation

  • 8/3/2019 7.GenAlgo Intro

    15/16

    Mutation...

    1 1 0 1 0 10 0

    0 1 0 1 0 10 1

    1 0

    0 1

    Parent

    Child

  • 8/3/2019 7.GenAlgo Intro

    16/16

    Advantages of GAs

    Concept is easy to understand.

    Minimum human involvement.

    Computer is not learned how to use existing solution,but to find new solution!

    Modular, separate from application

    Supports multi-objective optimization

    Always an answer; answer gets better with time !!!

    Inherently parallel; easily distributed

    Many ways to speed up and improve a GA-based application asknowledge about problem domain is gained

    Easy to exploit previous or alternate solutions