SlideShare a Scribd company logo
1 of 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
Gene Chromosome
Individu
Gene Chromosome
Gene Chromosome
Chromosome and
Gene in Genetic
Algorithm
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?
Output
Population
initialization
Selection Reproduction
Elistism
New Population
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
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.
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.
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.
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)
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
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
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
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
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.
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
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
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]
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
4.1.2 Mutation Probability (Pm=0,01)
1 0 1 0 1 0
A1
Pm=1 means that we mutated all gene.
0 1 0 1 0 1
A1
4.1.3 Mutation Probability (Pm=1)
1 0 1 0 1 0
A1
Pm=1 means that we mutated all gene.
0 1 0 1 0 1
A1
4.1.3 Mutation Probability (Pm=0.005)
1 0 1 0 1 0
A1
Pm=1 means that we half mutated.
1 0 0 1 1 0
A1
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.
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.
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.
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
0 0 0 0 0 0
1 1 1 1 1 1
A1
A2
1 0 1 0 1 0
0 1 0 1 0 1
A3
A4
f(x) = 21
f(x) = 22
f(x) = 23
f(x) = 24
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
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
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
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?

More Related Content

What's hot

Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic AlgorithmESUG
 
Introduction to Evolutionary Algorithms
Introduction to Evolutionary AlgorithmsIntroduction to Evolutionary Algorithms
Introduction to Evolutionary Algorithmsherbps10
 
Genetic algorithm (ga) binary and real Vijay Bhaskar Semwal
Genetic algorithm (ga) binary and real  Vijay Bhaskar SemwalGenetic algorithm (ga) binary and real  Vijay Bhaskar Semwal
Genetic algorithm (ga) binary and real Vijay Bhaskar SemwalIIIT Allahabad
 
MACHINE LEARNING - GENETIC ALGORITHM
MACHINE LEARNING - GENETIC ALGORITHMMACHINE LEARNING - GENETIC ALGORITHM
MACHINE LEARNING - GENETIC ALGORITHMPuneet Kulyana
 
GENETIC ALGORITHM
GENETIC ALGORITHM GENETIC ALGORITHM
GENETIC ALGORITHM Abhishek Sur
 
Genetic Algorithms
Genetic AlgorithmsGenetic Algorithms
Genetic Algorithmsanas_elf
 
Thomas Lenormand - Génétique des populations
Thomas Lenormand - Génétique des populationsThomas Lenormand - Génétique des populations
Thomas Lenormand - Génétique des populationsSeminaire MEE
 
Genetic Algorithms - GAs
Genetic Algorithms - GAsGenetic Algorithms - GAs
Genetic Algorithms - GAsMohamed Talaat
 
Info to Genetic Algorithms - DC Ruby Users Group 11.10.2016
Info to Genetic Algorithms - DC Ruby Users Group 11.10.2016Info to Genetic Algorithms - DC Ruby Users Group 11.10.2016
Info to Genetic Algorithms - DC Ruby Users Group 11.10.2016Geoff Harcourt
 
Hernandez smbe17
Hernandez smbe17Hernandez smbe17
Hernandez smbe17rdhernand
 
Hardy weinberg powerpoint
Hardy weinberg powerpointHardy weinberg powerpoint
Hardy weinberg powerpointjhadachek
 
Austin crowder fly lab
Austin crowder fly labAustin crowder fly lab
Austin crowder fly labaustincrowder
 

What's hot (15)

Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
 
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
 
Introduction to Evolutionary Algorithms
Introduction to Evolutionary AlgorithmsIntroduction to Evolutionary Algorithms
Introduction to Evolutionary Algorithms
 
Genetic algorithm (ga) binary and real Vijay Bhaskar Semwal
Genetic algorithm (ga) binary and real  Vijay Bhaskar SemwalGenetic algorithm (ga) binary and real  Vijay Bhaskar Semwal
Genetic algorithm (ga) binary and real Vijay Bhaskar Semwal
 
MACHINE LEARNING - GENETIC ALGORITHM
MACHINE LEARNING - GENETIC ALGORITHMMACHINE LEARNING - GENETIC ALGORITHM
MACHINE LEARNING - GENETIC ALGORITHM
 
GENETIC ALGORITHM
GENETIC ALGORITHM GENETIC ALGORITHM
GENETIC ALGORITHM
 
Genetic Algorithm
Genetic Algorithm Genetic Algorithm
Genetic Algorithm
 
Genetic Algorithms
Genetic AlgorithmsGenetic Algorithms
Genetic Algorithms
 
Thomas Lenormand - Génétique des populations
Thomas Lenormand - Génétique des populationsThomas Lenormand - Génétique des populations
Thomas Lenormand - Génétique des populations
 
Genetic Algorithms - GAs
Genetic Algorithms - GAsGenetic Algorithms - GAs
Genetic Algorithms - GAs
 
Info to Genetic Algorithms - DC Ruby Users Group 11.10.2016
Info to Genetic Algorithms - DC Ruby Users Group 11.10.2016Info to Genetic Algorithms - DC Ruby Users Group 11.10.2016
Info to Genetic Algorithms - DC Ruby Users Group 11.10.2016
 
Chapter18
Chapter18Chapter18
Chapter18
 
Hernandez smbe17
Hernandez smbe17Hernandez smbe17
Hernandez smbe17
 
Hardy weinberg powerpoint
Hardy weinberg powerpointHardy weinberg powerpoint
Hardy weinberg powerpoint
 
Austin crowder fly lab
Austin crowder fly labAustin crowder fly lab
Austin crowder fly lab
 

Similar to Machine Learning - Genetic Algorithm Fundamental

Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithmgarima931
 
Solving non linear programming minimization problem using genetic algorithm
Solving non linear programming minimization problem using genetic algorithmSolving non linear programming minimization problem using genetic algorithm
Solving non linear programming minimization problem using genetic algorithmLahiru Dilshan
 
4.Genetic-Algorithms.ppt
4.Genetic-Algorithms.ppt4.Genetic-Algorithms.ppt
4.Genetic-Algorithms.pptRamjiChaurasiya
 
Genetic Algorithm (1).pdf
Genetic Algorithm (1).pdfGenetic Algorithm (1).pdf
Genetic Algorithm (1).pdfAzmiNizar1
 
Introduction to Genetic algorithm
Introduction to Genetic algorithmIntroduction to Genetic algorithm
Introduction to Genetic algorithmHEENA GUPTA
 
Practical Genetic Algorithms
Practical Genetic AlgorithmsPractical Genetic Algorithms
Practical Genetic AlgorithmsJulian Bunn
 
A Review On Genetic Algorithm And Its Applications
A Review On Genetic Algorithm And Its ApplicationsA Review On Genetic Algorithm And Its Applications
A Review On Genetic Algorithm And Its ApplicationsKaren Gomez
 
Genetic-Algorithms.ppt
Genetic-Algorithms.pptGenetic-Algorithms.ppt
Genetic-Algorithms.pptNipun85
 
AI_PPT_Genetic-Algorithms.ppt
AI_PPT_Genetic-Algorithms.pptAI_PPT_Genetic-Algorithms.ppt
AI_PPT_Genetic-Algorithms.pptHotTea
 
Genetic-Algorithms forv artificial .ppt
Genetic-Algorithms forv artificial  .pptGenetic-Algorithms forv artificial  .ppt
Genetic-Algorithms forv artificial .pptneelamsanjeevkumar
 
Genetic-Algorithms for machine learning and ai.ppt
Genetic-Algorithms for machine learning and ai.pptGenetic-Algorithms for machine learning and ai.ppt
Genetic-Algorithms for machine learning and ai.pptneelamsanjeevkumar
 
Genetic-Algorithms.ppt
Genetic-Algorithms.pptGenetic-Algorithms.ppt
Genetic-Algorithms.pptssuser2e437f
 

Similar to Machine Learning - Genetic Algorithm Fundamental (20)

GA.pptx
GA.pptxGA.pptx
GA.pptx
 
Genetic
GeneticGenetic
Genetic
 
Ga
GaGa
Ga
 
Gadoc
GadocGadoc
Gadoc
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
 
Solving non linear programming minimization problem using genetic algorithm
Solving non linear programming minimization problem using genetic algorithmSolving non linear programming minimization problem using genetic algorithm
Solving non linear programming minimization problem using genetic algorithm
 
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
 
Extensive Survey on Datamining Algoritms for Pattern Extraction
Extensive Survey on Datamining Algoritms for Pattern ExtractionExtensive Survey on Datamining Algoritms for Pattern Extraction
Extensive Survey on Datamining Algoritms for Pattern Extraction
 
4.Genetic-Algorithms.ppt
4.Genetic-Algorithms.ppt4.Genetic-Algorithms.ppt
4.Genetic-Algorithms.ppt
 
RM 701 Genetic Algorithm and Fuzzy Logic lecture
RM 701 Genetic Algorithm and Fuzzy Logic lectureRM 701 Genetic Algorithm and Fuzzy Logic lecture
RM 701 Genetic Algorithm and Fuzzy Logic lecture
 
Genetic Algorithm (1).pdf
Genetic Algorithm (1).pdfGenetic Algorithm (1).pdf
Genetic Algorithm (1).pdf
 
Introduction to Genetic algorithm
Introduction to Genetic algorithmIntroduction to Genetic algorithm
Introduction to Genetic algorithm
 
Practical Genetic Algorithms
Practical Genetic AlgorithmsPractical Genetic Algorithms
Practical Genetic Algorithms
 
A Review On Genetic Algorithm And Its Applications
A Review On Genetic Algorithm And Its ApplicationsA Review On Genetic Algorithm And Its Applications
A Review On Genetic Algorithm And Its Applications
 
Genetic-Algorithms.ppt
Genetic-Algorithms.pptGenetic-Algorithms.ppt
Genetic-Algorithms.ppt
 
AI_PPT_Genetic-Algorithms.ppt
AI_PPT_Genetic-Algorithms.pptAI_PPT_Genetic-Algorithms.ppt
AI_PPT_Genetic-Algorithms.ppt
 
Genetic-Algorithms forv artificial .ppt
Genetic-Algorithms forv artificial  .pptGenetic-Algorithms forv artificial  .ppt
Genetic-Algorithms forv artificial .ppt
 
Genetic-Algorithms for machine learning and ai.ppt
Genetic-Algorithms for machine learning and ai.pptGenetic-Algorithms for machine learning and ai.ppt
Genetic-Algorithms for machine learning and ai.ppt
 
Genetic-Algorithms.ppt
Genetic-Algorithms.pptGenetic-Algorithms.ppt
Genetic-Algorithms.ppt
 

Recently uploaded

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 

Recently uploaded (20)

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 

Machine Learning - Genetic Algorithm Fundamental

  • 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.
  • 4. Outline 01 Evolution 02 Gen and Chromosome 03 Genetic Algorithm
  • 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.
  • 12. Gene Chromosome Individu Gene Chromosome Gene Chromosome Chromosome and Gene in 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
  • 36. 4.1.2 Mutation Probability (Pm=0,01) 1 0 1 0 1 0 A1 Pm=1 means that we mutated all gene. 0 1 0 1 0 1 A1
  • 37. 4.1.3 Mutation Probability (Pm=1) 1 0 1 0 1 0 A1 Pm=1 means that we mutated all gene. 0 1 0 1 0 1 A1
  • 38. 4.1.3 Mutation Probability (Pm=0.005) 1 0 1 0 1 0 A1 Pm=1 means that we half mutated. 1 0 0 1 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.
  • 43. 5.1 Elitism Example Assume we have 4 population size, with each their fitness value 0 0 0 0 0 0 1 1 1 1 1 1 A1 A2 1 0 1 0 1 0 0 1 0 1 0 1 A3 A4 f(x) = 21 f(x) = 22 f(x) = 23 f(x) = 24 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
  • 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
  • 49. Thank You / 谢谢 / Terima Kasih Any Question?