The genetic algorithm is a mataheuristic method that uses the metaphor of the evolutionary process of living things, especially Darwin's theory of evolution. This persentation will discuss about the fundamental of Genetic Algorithm. Download this PPT and put in "Slide Persentation (F5)" to play the animation in it.
2. Anggi Andriyadi (安吉)
Senior Lecturer Institut Informatics and
Business Darmajaya (IIB Darmajaya) –
System Information Program.
3. Disclaimer
This presentation prepared for Joint Lecture between Informatics and
Business Institute Darmajaya (IIB Darmajaya), Indonesia and Nantong
Vocational University, People's Republic of China.
6. Evolution
In the process of evolution,
individuals are constantly
changing their genes to
adapt to their environment.
"Only strong individuals can
survive".
7. Evolution in Genetic Algorithm
This natural selection process is involves in gene changes that occur in
individuals through the process of reproduction. In genetic algorithm, that
process of reproduction is the basic process that will the foundation , with
the premise of thinking: "How to get better generation".
9. Gene
Genotype (Gen), is a value that states the basic unit that forms a
certain meaning in a single gene unit, which called a chromosome.
In genetic algorithms, these genes can be binary, float, integer or
character values, or combinatorial.
10. Chromosome
Chromosomes is the combination of genes that form a certain
value. In the Genetic Algorithm, it is a value that contained in an
individual person.
Individual, might contain a solution from the problem that we
analyses with Genetic Algorithm.
13. Chromosome in Genetic Algorithm
Chromosome in Genetic Algorithm is called individual. Each Individual will
have each their gene. This gene will consist of solution.
This individual will be processed or selected with natural selection. The
process of natural selection starts with the selection of fittest individuals from
a population.
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.
15. 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.
Introduced by John Holland (1975) and developed by David. E
Goldberg (1989)
Genetic algorithms have good performance for various types of
optimization problems.
16. Genetic Algorithm
In other explanation, genetic algorithm is a search-based algorithm
used for solving optimization problems in machine learning. This
algorithm is important because it solves difficult problems that would
take a long time to solve. It has been used in various real-life
applications such as data centers, electronic circuit design, code-
breaking, image processing, and artificial creativity.
17. How Genetic Algorithm Works?
Output
Population
initialization
Selection Reproduction
Elistism
New Population
18. 1. Initialization of Population
The genetic algorithm procedure begins with initializing the
population. This is a subset of all the probable solutions that can
solve the given problem. Individuals that have been raised are
then, evaluated to determine their fitness value.
The fitness value is a value that states the quality of the individual
19. 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.
20. 2.1 Roullete Wheel Selection
1
2
3
4
5
6
r
In roullete wheel selection, you will select
two chromosome / population randomly.
The two chosen, will become new parents
and reproducing new child / population.
Furthermore, we will also generate
random numbers from every population
selected. This random number will be use
for probability crossover formula.
21. 2.2 Tournament Selection
2
5
6
Population
1
4
3
6
5
2
Contestant (k = 3)
Random
6
Best Individu
Best Fitness
In tournament selection, you choose two individuals in population to
be contestants. Individual with best fitness will be the one who win and
become new parent.
22. 2.3 Ranked Base Selection
1
25%
2
10%
3
20%
4
15%
5
15%
6
15%
3
20%
1
25%
Rank 1: (1)
Rank 2: (2)
Best Rank
In ranked base selection, we will choose two best individual with finest
fitness to become new parent.
23. 3. Crossover
Crossover is the process of crossing two chromosomes to a new
chromosome that is expected to be better than the parent.
Crossover is the most significant phase in a genetic algorithm. For each
pair of parents to be mated, a crossover point is chosen at random
from within the genes.
24. 3.1.1 Crossover Probability (Pxo)
Crossover probability is the number of times a crossover occurs for chromosomes
in one generation, i.e., the chance that two chromosomes exchange some of their
parts),
[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.
25. 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.
26. 3.1.2 Crossover Probability (Pxo=1)
0 0 0 0 0 0
1 1 1 1 1 1
A1
A2
Pxo=1 means that we crossover / swap all gene.
1 1 1 1 1 1
0 0 0 0 0 0
A1
A2
27. 3.1.3 Crossover Probability (Pxo=0)
0 0 0 0 0 0
1 1 1 1 1 1
A1
A2
Pxo= 0 means that we do not crossover / swap all gene.
0 0 0 0 0 0
1 1 1 1 1 1
A1
A2
28. 3.1.4 Crossover Probability (Pxo=0.5)
0 0 0 0 0 0
1 1 1 1 1 1
A1
A2
1 1 1 0 0 0
0 0 0 1 1 1
A1
A2
Pxo= 0.5 means that we half crossover / swap the genes.
Half Crossover
29. 3.2 One Point Crossover
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 < Pco then do crossover
0 0 0 0 0 0
1 1 1 1 1 1
A1
A2
One Point Crossover
Example:
Pxo = 0,50
r = 0,20
30. 3.2.1 Offspring
After we set the point, we swap the gen by crossover it.
0 0 0 0 0 0
1 1 1 1 1 1
A1
A2
1
0
1
0
1
0
1 1 1 0 0 0
0 0 0 1 1 1
A1
A2
The new offspring are added to the
population.
31. 3.3 N Point Crossover
Chromosomes Parent will be divided into N + 1 segments, and then we
swapping it to produce new offspring.
0 0 0 0 0 0
1 1 1 1 1 1
A1
A2
N = 2 Points Crossover
32. 3.3.1 Offspring
After we set the point, we swap the gen by crossover it.
0 0 0 0 0 0
1 1 1 1 1 1
A1
A2
1 1 0 0 1 1
0 0 1 1 0 0
A1
A2
The offspring are added to the
population.
1
0
1
0
1
0
1
0
33. 4. Mutation
Mutations are used to increase the variation of population. It occurs to
maintain diversity within the population and prevent premature
convergence.
Mutation is an individual operation because it only takes one
individual to perform this operation. In other words, he evolute by
itself.
34. 4.1 Mutation Probability (Pm)
Mutation Probability is to determine how many chromosomes should
be mutated in one generation; mutation rate is in the range of [0,001-
0,01]
35. 4.1.1 Mutation Probability (Pm=0)
1 0 1 0 1 0
A1
Pm=1 means that we do not mutated all gene.
1 0 1 0 1 0
A1
39. Why Crossover Mutation (Pm)?
As well as Pxo – if parameter of Pm is large, there will be a larger
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.
40. 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.
41. 4.2.1 Flip Bit Example
After the crossover, we mutate the gene randomly, is as shown below.
But before that, To run Mutation we will raise the random value ( r ).
With condition:
if r < Pm then do mutation
A2
1 1 1 0 0 0
0 0 0 1 1 1
A1
A2
1 1 0 1 0 0
0 0 1 0 1 1
A1
Example:
Pm = 0,01
r = 0,001
0 1
1 0
The new variant offspring are
added to the population.
42. 5. Elitism
Elitism is process to replacing the worst fitness chromosome, with
new offspring that resulted from two mated chromosome before.
44. 6. New Population
We have new population which their chromosome fitness is better
than previous population.
0 0 0 0 0 0
1 1 1 1 1 1
A1
A2
1 1 0 1 0 0
0 0 1 0 1 1
A3
A4
f(x) = 21
f(x) = 22
f(x) = 18
f(x) = 19
45. 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.
0 0 0 0 0 0
1 1 1 1 1 1
A1
A2
1 1 0 1 0 0
0 0 1 0 1 1
A3
A4
f(x) = 21
f(x) = 22
f(x) = 18
f(x) = 19
t(n) .. next iteration
46. 7.1 How to Determine Iteration?
There are many ideal method to determine the iteration, such as:
1. We set maximum iteration
2. We set minimal error of solution
3. Stagnant! When you do many times iteration, but the results not
good. Then iteration is stop.
4. And so on..
47. Bibiloggraphy
Admi Syarif. (2014). Algoritma Genetika - Teori dan Aplikasi Edisi 2 (2nd ed., Vol. 2). Graha Ilmu.
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
48. 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