0% found this document useful (0 votes)
9 views49 pages

Genetic Algorithm - Section 1

The document discusses genetic algorithms. It defines genes and chromosomes, explaining that chromosomes contain genes and represent potential solutions to optimization problems. The genetic algorithm process is then summarized as: 1) initializing a random population of chromosomes, 2) selecting chromosomes based on their fitness to undergo crossover and mutation, 3) performing crossover by combining genes from parent chromosomes to create offspring, and 4) introducing random mutations into the population before repeating the process for the next generation.

Uploaded by

Anggi Andriyadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views49 pages

Genetic Algorithm - Section 1

The document discusses genetic algorithms. It defines genes and chromosomes, explaining that chromosomes contain genes and represent potential solutions to optimization problems. The genetic algorithm process is then summarized as: 1) initializing a random population of chromosomes, 2) selecting chromosomes based on their fitness to undergo crossover and mutation, 3) performing crossover by combining genes from parent chromosomes to create offspring, and 4) introducing random mutations into the population before repeating the process for the next generation.

Uploaded by

Anggi Andriyadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 49

Genetic Algorithm

Anggi Andriyadi., M.T.I


Anggi Andriyadi ( 安吉 )
Senior Lecturer Institut Informatics and
Business Darmajaya (IIB Darmajaya) –
System Information Program.
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.
Outline
01 Evolution
02 Gen and Chromosome
03 Genetic Algorithm
Evolution
Section 1
Evolution
In the process of evolution,
individuals are constantly
changing their genes to
adapt to their environment.
"Only strong individuals can
survive".
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".
Gen & Chromosome
Section 2
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.
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.
Chromosome and
Gene in Biology
Chromosome and Gene Chromosome

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.

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.
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.

Introduced by John Holland (1975) and developed by David. E


Goldberg (1989)

Genetic algorithms have good performance for various types of


optimization problems.
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.
How Genetic Algorithm Works?
Population Reproduction
initialization
Selection Output

New Population Elistism


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
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

Population Contestant (k = 3) Best Individu


2.3 Ranked Base Selection
In ranked
6 base selection, we will choose two best individual with finest
fitness to become new parent.
15%
1
25%

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.

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.
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.
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)

Pxo=1 means that we crossover / swap all gene.

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)

Pxo= 0 means that we do not crossover / swap all gene.

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)

Pxo= 0.5 means that we half crossover / swap the genes.

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

One Point Crossover


3.2.1 Offspring
After we set the point, we swap the gen by crossover it.

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

The new offspring are added to the


population.
3.3 N Point Crossover
Chromosomes Parent will be divided into N + 1 segments, and then we
swapping it to produce new offspring.

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 offspring are added to the


population.
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.
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]

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)

Pm=1 means that we do not mutated all gene.

A1 1 0 1 0 1 0 A1 1 0 1 0 1 0
4.1.2 Mutation Probability (Pm=0,01)

Pm=1 means that we mutated all gene.

A1 1 0 1 0 1 0 A1 0 1 0 1 0 1
4.1.3 Mutation Probability (Pm=1)

Pm=1 means that we mutated all gene.

A1 1 0 1 0 1 0 A1 0 1 0 1 0 1
4.1.3 Mutation Probability (Pm=0.005)

Pm=1 means that we half mutated.

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:

4.2.1 Flip Bit Example


Pm = 0,01
r = 0,001

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:
The new variant offspring are
if r < P m then do mutation added to the population.

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:

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..
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
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?

You might also like