FSU Seal - 1851

COT 5405
Advanced Algorithms
Chris Lacher
Notes 11: Introduction to Genetic Algorithms


begin with random population
repeat 
    selection
    crossover
    mutation
    ==> new population
until fitness of best individual is optimized

Population


begin with random population
repeat 
    selection
    crossover
    mutation
    ==> new population
until fitness of best individual is optimized

Fitness Function

Fitness-Proportionate Selection


begin with random population
repeat 
    selection
    crossover
    mutation
    ==> new population
until fitness of best individual is optimized

Crossover


begin with random population
repeat 
    selection
    crossover
    mutation
    ==> new population
until fitness of best individual is optimized

Mutation

Fitness Optimization Criteria


Algorithm

main
{
  input
  {
    L,   // chromosome length
    N,   // population size // make this an even number for convenience
    P,   // randomly generated set of n chromosomes of length L
    p_c, // crossover probability
    p_m, // mutation probability
    F    // fitness function
  }
  max_fitness = maximum value of F(c) for c in P;
  c_max       = chromosome in P where maximum is achieved;
  while (max_fitness < fitness_goal)
  {
    P1          = generate_new_population(P);
    max_fitness = maximum value of F(c) for c in P1;
    c_max       = chromosome in P1 where maximum is achieved;
    P           = P1;
  }
  output
  {
    P,
    c_max,
    F(c_max)
  }
}

generate_new_population(P)
{
  for (i = 0; i < N/2; ++i)
  {
    choose two elements c1, c2 of P using roulette wheel sampling;
    with probability p_c, crossover(c1,c2);
    mutate (c1); mutate (c2);
    insert c1 and c2 in P1;
  }
  return P1
}

crossover (&c1 &c2) // passed by reference
{
  loc = random [0,L);
  for (i = 0; i < loc; ++i)
    c1[i]=c2[i];
  for (i = loc; i < L; ++i)
    c2[i] = c1[i];
}

mutate (&c) // passed by reference
{
  for (i = 0; i < L; ++i)
    with probability p_m flip c[i];
}

Example

L    = 8
N    = 4
p_c  = 0.6
p_m  = 0.1
P    = { 00000110 , 11101110 , 00100000 , 00110100 }
F(c) = number of '1'

  P[0]   F ROULETTE XC   P[1]   F ROULETTE XC   P[2]   F ROULETTE XC   P[3]   F 
-------- - -------- -- -------- - -------- -- -------- - -------- -- -------- - 
00000110 2 11101110 y3 11110100 5 11101110 y5 11101100 5 11110110 y6 11110110 6
11101110 6 00110100    00101110 4 11110100    11110110 6 11101110    11101110 6 
00100000 1 11101110 n  11101110 6 11101110 y2 11101110 6 00101110 y4 00100110 3
00110100 3 00000110    00000110 2 00101110    00101110 4 11110110    11111110 7

ROULETTE XC   P[5]   F ROULETTE XC   P[6]   F ROULETTE XC   P[7]   F 
-------- -- -------- - -------- -- -------- - -------- -- -------- - 
11111110 y2 11110110 6 11111110 n  11111110 7 11111110 y3 11111110 7
11110110    11111110 7 11111110    11111110 7 11111110    11111110 7
11111110 n  11111110 7 11101110 y7 11111110 7 11111110 y7 11111110 7
11101110    11101110 6 11111110    11101110 6 11101110    11101110 6



Applying GA


Theory

Schema Theorem (Holland, 1975)

m(H, t + 1) >= m(H,t) [f(H)/F(P)] [1 - pc d(H)/(l - 1) - o(H)pm]

Standard Interpretation: The number of representatives of a schema in a population grows in proportion to the fitness of the schema. This interpretation has come into question in recent years. The theory of GA in particular and evolutionary computation in general is an active field of research.


Variations


Representative Application Areas


Evolving Neural Architectures


Grammatical Encoding - Detailed Example

Alphabet = {S,A,B,C,D,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}

Chromosome = SXXXX XXXXX XXXXX XXXXX XXXXX ...
(X = any alphabet character) (spaces for visual convenience only)

Grammar Terminals (fixed):

a -> 0 0    b -> 0 0    c -> 0 0    d -> 0 0    e -> 0 1 
     0 0         0 1         1 0         1 1         0 0   

f -> 0 1    g -> 0 1    h -> 0 1    i -> 1 0    j -> 1 0 
     1 0         0 1         1 1         0 0         0 1

k -> 1 0    l -> 1 0    m -> 1 1    n -> 1 1    o -> 1 1
     1 0         1 1         0 0         0 1         1 0

p -> 1 1
     1 1

Example non-terminals (variable):

S -> A B    A -> c a    B -> a a    C -> f g    D -> c a
     C D         f a         a a         o k         p c

represented by chromosome SABCDAcafaBaaaaCfgokDcapc

Example chromosome SABCD Aaaca Baaaa Cokab Daaoa
decodes as follows:

S -> A B -> a a a a -> 0 0 0 0 0 0 0 0  = adjacency matrix
     C D    c a a a    0 0 0 0 0 0 0 0
            o k a a    0 0 0 0 0 0 0 0  
            a b o a    1 0 0 0 0 0 0 0
                       1 1 1 0 0 0 0 0
                       1 0 1 0 0 0 0 0
                       0 0 0 0 1 1 0 0
                       0 0 0 1 0 1 0 0

Need ad hoc rules such as:


Research Area: Applying GA to Acyclic Architectures


References