Genetic Algorithms

Introduction

Evolutionary algorithms are based on Darwinian evolution. Some basic concepts are:

  • Population
  • Fitness
  • Selection
  • Mutation Individuals that adapt well have a high probability of generating offspring.

Definition (Evolution)

Evolution is a process that acts on populations of individuals. Information is stored in the form of chromosomes with each chromosome containing many genes. In an EA

  • A population of candidate solutions is formed (randomly)
  • Each individual is evaluated (decode their information/chromosomes then evaluated) and assigned a fitness score based on performance.
  • New individuals are formed through the process of selection, crossover, and mutation
  • Repeat until a new population is formed.
  • Once new population is formed we check if we’ve met our termination condition, if not start the whole process again.
Pasted image 20231201101057.png

Definition (Chromosome)

In a genetic algorithm, a chromosome encodes the information of an individual in a population. These are typically represented using a string of digits usually binary.

Definition (Phenotype)

In Genetic Algorithms, we use to represent information of an individual. This is mapped into the phenotype space to represent the encoded information of the genotype in its functional or physical form. Can think of phenotype as the decoded representation of genotype of chromosome. We evaluate fitness based on phenotype representation.

Definition (Binary Encoding)

In this encoding scheme we define the alphabet or alleles to be 00 or 11.

Definition (Messy encoding)

In messy encoding we generate a less position-dependent representation by associating each gene with a number (i.e. its position). For a example a Chromosome or Genotype of length mm c=((p1,gp1),(p2,gp2),,(pm,gpm))c=((p_{1},g_{p1}),(p_{2},g_{p2}),\ldots,(p_{m},g_{pm}))with pjp_{j} indicating the position in the chromosome and gpjg_{pj} being the corresponding allele.

Definition (Real number encoding)

In this application a gene gg holds a floating point number in the range [0,1][0,1] from which the corresponding variable is obtained as x[d,d]x\in[-d,d] formed with x=d+2dgx=-d+2dg

Definition (Selection)

Selection is the process that takes in the individuals of a population and based on their fitness selects the individuals to produce offspring.

Definition (Roulette-wheel selection)

Roulette-wheel defines a cumulative relative fitness value, ϕj\phi_{j}, for each individual jj as ϕj=i=1jFii=1NFi, j=1,,N\phi_{j}=\frac{\sum\limits_{i=1}^{j}F_{i}}{\sum\limits_{i=1}^{N}F_{i}}, \ j=1,\ldots,Nwhere each FiF_{i} is the fitness of individual ii. Next a random number rr is drawn and the selected individual is the taken as the one with the smallest jj that satisfies ϕj>r\phi_{j}>r.

Definition (Tournament selection)

This method consists of picking two individuals randomly (i.e. with equal probability for all individuals) from the population, and then selecting the one with higher fitness with probability ptour0,70.8p_{tour}\approx0,7-0.8, which we define as the tournament selection parameter. We draw a random number r[0,1]r\in[0,1] and if r<ptourr<p_{tour} we select the better of the two, otherwise we select the worse of the two.

Definition (Fitness ranking)

Here we give the best individual fitness NN (the population size) and continue in decreasing order to the worse individual with fitness 11. Let R(i)R(i) denote the ranking of individual ii, defined such that the best individual ibesti_{best} has ranking R(ibest)=1R(i_{best})=1, the fitness values are obtained like so: Firank=N+1R(i)F_{i}^{rank}=N+1-R(i)

Definition (Crossover)

This is where two of selected offspring “breed”. There are two types:

In single-point crossover a single crossover point is selected and the two children are formed from the spliced chromosomes of their parents which are both separated and attached at that point In kk point crossover, kk crossover points are selected randomly and the the chromosome parts are chosen from either parent with equal probability.

In averaging crossover, a gene gg in the offspring taking values g1g_{1} and g2g_{2} in two parents takes the values g1αg1+(1α)g2g_{1}\leftarrow\alpha g_{1}+(1-\alpha)g_{2} g2(1α)g1+αg2g_{2}\leftarrow(1-\alpha)g_{1}+\alpha g_{2} α[0,1]\alpha\in[0,1]

Definition (Mutation)

Mutations are carried out on a gene-by-gene basis. Thus, in principle, the number of mutated genes can range from 00 to mm. We define the mutation probability as pmutp_{mut} which is typically set as cm\frac{c}{m} where cc is a constant of order 11 and mm is the length.

Binary Encoding

Here we just flip bits.

Real Encoding

Here we select a random number in the allowed range (i.e. [0,1][0,1]). The mutated value (allele) of a gene is centred on the previous value, and the creep rate determines how far the mutation may take the new value. The value gg of the gene changes according to g=ψ(g)g'=\psi(g)where ψ\psi is a suitable distribution, for instance a uniform distribution. In this case we get ggCr2+Crrg\leftarrow g-\frac{C_{r}}{2}+C_{r}rwhere rr is the uniform random number in [0,1][0,1] and CrC_{r} is the creep rate (i.e. the width of the distribution).

Definition (Boltzmann Selection)

️️️️️️️In this method we define the notion of temperature TT as a tuneable parameter for determining selection pressure. This notion of selection pressure is the extent to which high-fitness individuals are preferred over low-fitness ones.

We can implement it similarly to the two previous ones:

Roulette-Wheel Selection

The probability pip_{i} of selecting individual ii is pi=eFiTj=1NeFiTp_{i}=\frac{e^{\frac{F_{i}}{T}}}{\sum\limits_{j=1}^{N}e^{\frac{F_{i}}{T}}}Individuals are selected with approximately equal probabilities if TT is large and vice versa for small TT (high-fitness preferred).

Tournament Selection

Pick two individuals kk and jj randomly from the population. During selection a random number rr is generated and the selected individual ii is determined according to i={jif b(Fj,Fk)>rkotherwise  b(Fj,Fk)=11+e1T(1Fj1Fk)i=\begin{cases}j&\text{if }b(F_{j},F_{k})>r \\ k&\text{otherwise} \end{cases} \ \ b(F_{j},F_{k})=\frac{1}{1+e^{\frac{1}{T}(\frac{1}{F_{j}}- \frac{1}{F_{k}})}} with FjF_{j} and FkF_{k} as the fitness values of the two individuals. For large TT the probability of either getting chosen is equal, if TT is small, the better of the two is selected more often.

Linked from