Genetic Algorithm - Section 1
Genetic Algorithm - Section 1
Individu
Gene in Genetic
Algorithm Gene Chromosome
Gene Chromosome
Chromosome in Genetic Algorithm
Chromosome in Genetic Algorithm is called individual. Each Individual will
have each their gene. This gene will consist of solution.
They produce offspring which inherit the characteristics of the parents and will
be added to the next generation. If parents have better fitness, their offspring
will be better than parents and have a better chance at surviving. This process
keeps on iterating and at the end, a generation with the fittest individuals will
be found.
Genetic Algorithm
Section 3
Genetic Algorithm
The genetic algorithm is a mataheuristic method that uses the
metaphor of the evolutionary process of living things, especially
Darwin's theory of evolution.
The fitness value is a value that states the quality of the individual
2. Selection
The fitness value will be used in selecting individuals who will chosen
as parents in the reproductive process.
Selection methods that are often used are Roulette Wheel Selection,
Tournament Selection, and rank-based selection.
2.1 Roullete Wheel Selection
6
1
10%
In roullete wheel selection, you will select
two chromosome / population randomly.
50%
5
10%
5%
The two chosen, will become new parents
10%
15%
2 and reproducing new child / population.
4
r
2.2 Tournament Selection
In2 tournament
1
selection, you choose two individuals in population to
be contestants. Individual with best fitness will be the one who win and
become new parent.Random
6 2
Best Fitness
5 4
6
6 3
5
Best Rank 3
5
15% 20% Rank 1: (1)
Rank 2: (2)
2 1
10%
25%
4
15%
3
20%
3. Crossover
Crossover is the process of crossing two chromosomes to a new
chromosome that is expected to be better than the parent.
[1.0] crossover means that all offspring are made by crossover. If the probability is
[0.0], then the complete new generation of individuals is to be exactly copied from
the older population, except those resulted from the mutation process.
Empirical studies have shown that better results are achieved by a crossover
probability of between 0.65 and 0.85, which implies that the probability of a
selected chromosome surviving to the next generation unchanged.
Why Crossover Probability (Pxo)?
If the value of the Pxo parameter is large, there will be a larger
opportunity that many genes will be swapped / crossover, thus we will
get lots of optimal variants from offspring.
vice versa, if the value is too small, then the chance of the gene to be
swapped/crossover will be small, thus, we will get a few population
variation from offspring.
3.1.2 Crossover Probability (Pxo=1)
A1 0 0 0 0 0 0 A1 1 1 1 1 1 1
A2 1 1 1 1 1 1 A2 0 0 0 0 0 0
3.1.3 Crossover Probability (Pxo=0)
A1 0 0 0 0 0 0 A1 0 0 0 0 0 0
A2 1 1 1 1 1 1 A2 1 1 1 1 1 1
3.1.4 Crossover Probability (Pxo=0.5)
A1 0 0 0 0 0 0 A1 1 1 1 0 0 0
A2 1 1 1 1 1 1 A2 0 0 0 1 1 1
Half Crossover
Example:
Pxo = 0,50
3.2 One Point Crossover r = 0,20
One point Crossover will divide the chromosome parent into two parts, and the
offspring will be produced by swapping the parent gene.
But before that, To run crossover we will raise the random value ( r ). With
condition: if r < P co then do crossover
A1 0 0 0 0 0 0
A2 1 1 1 1 1 1
A1 0
1 1
0 1
0 0 0 0 A1 1 1 1 0 0 0
A2 1
0 1
0 0
1 1 1 1 A2 0 0 0 1 1 1
A1 0 0 0 0 0 0
A2 1 1 1 1 1 1
N = 2 Points Crossover
3.3.1 Offspring
After we set the point, we swap the gen by crossover it.
A1 0
1 0
1 0 0 0
1 1
0 A1 1 1 0 0 1 1
A2 1
0 0
1 1 1 0
1 1
0 A2 0 0 1 1 0 0
The less of probability mutation rate will cause potentially genes are
not untested. And high probability mutation rate will cause offspring
to lose resemblance to their parents, so it will destroy the solution
area.
4.1.1 Mutation Probability (Pm=0)
A1 1 0 1 0 1 0 A1 1 0 1 0 1 0
4.1.2 Mutation Probability (Pm=0,01)
A1 1 0 1 0 1 0 A1 0 1 0 1 0 1
4.1.3 Mutation Probability (Pm=1)
A1 1 0 1 0 1 0 A1 0 1 0 1 0 1
4.1.3 Mutation Probability (Pm=0.005)
A1 1 0 1 0 1 0 A1 1 0 0 1 1 0
Why Crossover Mutation (Pm)?
As well as Pxo – if parameter of Pm is higher, than there will be a higher
opportunity that many genes will be mutated, thus we will get lots of
optimal variants from offspring.
vice versa, if the value is too small, then the chance of the gene to be
mutated will be small, thus, we will get a few population variation from
offspring.
4.2 Flip Bit
There are several types of mutations that are quite widely used, such
as Gaussian, Uniform, Non Uniform, Flip Bit, and so on. However, Flip
Bit mutation is the popular one.
Example:
1 1 1
0 0
1 0 0 A1 1 1 0 1 0 0
A1
0 0 1
0 0
1 1 1 A2 0 0 1 0 1 1
A2
5. Elitism
Elitism is process to replacing the worst fitness chromosome, with new
offspring that resulted from two mated chromosome before.
5.1 Elitism Example
Assume we have 4 population size, with each their fitness value
A1 0 0 0 0 0 0 f(x) = 21 A1 0 0 0 0 0 0 f(x) = 21
A2 1 1 1 1 1 1 f(x) = 22 A2 1 1 1 1 1 1 f(x) = 22
A3 1 0 1 0 1 0 f(x) = 23 A3 1 1 0 1 0 0 f(x) = 18
A4 0 1 0 1 0 1 f(x) = 24 A4 0 0 1 0 1 1 f(x) = 19
6. New Population
We have new population which their chromosome fitness is better
than previous population.
A1 0 0 0 0 0 0 f(x) = 21
A2 1 1 1 1 1 1 f(x) = 22
A3 1 1 0 1 0 0 f(x) = 18
A4 0 0 1 0 1 1 f(x) = 19
7. Iteration
In order to get finest solution, we do another iteration from step 1 to
6. The maximum of iteration is depending from the solution you would
like to seek.
A1 0 0 0 0 0 0 f(x) = 21
A2 1 1 1 1 1 1 f(x) = 22
t(n) .. next iteration
A3 1 1 0 1 0 0 f(x) = 18
A4 0 0 1 0 1 1 f(x) = 19
7.1 How to Determine Iteration?
There are many ideal method to determine the iteration, such as:
Sri Kusumadewi. (2003). Artificial Intelligence (Teknik dan Aplikasinya) (Graha Ilmu, Ed.; 1st ed.).
Graha Ilmu.
Syarif, A., Ruby, T., & Saputra, A. (2009). Analisis Kinerja Genetic Algorithm Pada Job Shop
Scheduling. Prosiding SN SMAP 09. http://www.unila.ac.id/~mipa/
Syarif, A., Aristoteles, A., Arianti, D., & Riska, M. (2016). Performance Evaluation of Various Genetic
Algorithm Approaches for Knapsack Problem. Journal of Engineering and Applied Sciences (ARPN
JEAS), 11(7), 4713–4719. http://www.arpnjournal.com
Bibiloggraphy
Suprayogi, D. A., & Mahmudy, W. F. (n.d.). Penerapan Algoritma Genetika Traveling Salesman
Problem with Time Window: Studi Kasus Rute Antar Jemput Laundry 121.
Hassanat, A., Almohammadi, K., Alkafaween, E., Abunawas, E., Hammouri, A., & Prasath, V. B. S.
(2019). Choosing mutation and crossover ratios for genetic algorithms-a review with a new dynamic
approach. Information (Switzerland), 10(12). https://doi.org/10.3390/info10120390
Thank You / 谢谢 / Terima Kasih
Any Question?