SlideShare a Scribd company logo
1 of 38
Download to read offline
Foundations in AI
Introduction to Genetic Algorithms
Dr Vanessa Camilleri 

Department of AI
October 2018
Overview
• Introduction
• GA Algorithm
• Components
• Examples
• Applications
Introduction
• Mimics Theory of Evolution

• GAs as a general purpose learning algorithm

• Solving a complex problem of problems

• Uses Natural Selection or Survival of the Fittest
Introduction
• Natural Selection:
variations in gene that
increases its chances of
survival
Introduction
Introduction
Introduction
Introduction
• NP (nondeterministic polynomial) Hard Problems

• cannot be solved in traditional way

• possible to guess the solution
Basic GA algorithm
1. [Start] Generate random population of n chromosomes (suitable solutions for the problem)

2. [Fitness] Evaluate the fitness f(x) of each chromosome x in the population

3. [New population] Create a new population by repeating following steps until the new population is
complete

1. [Selection] Select two parent chromosomes from a population according to their fitness (the
better fitness, the bigger chance to be selected)

2. [Crossover] With a crossover probability cross over the parents to form a new offspring (children).
If no crossover was performed, offspring is an exact copy of parents.

3. [Mutation] With a mutation probability mutate new offspring at each locus (position in
chromosome).

4. [Accept] Place new offspring in a new population

5. [Replace] Use new generated population for a further run of algorithm

6. [Test] If the end condition is satisfied, stop, and return the best solution in current population

[Loop] Go to step 2
{
initialize	population;
evaluate	population;
while	TerminationCriteriaNotSatisfied
{
select	parents	for	reproduction;
perform	recombination	and	mutation;
evaluate	population;
}
}
GA Cycle of Reproduction
Reproduction Modification
EvaluationPopulation
Discard
Children
Modified	
Children
Evaluated	
Children
Deleted	
Members
Parents
GA Operators
1. Reproduction: aka selection operator, usually the first
operator applied on the population. Chromosomes are
selected from the population to cross over and produce
offspring

2. Crossover: After reproduction population is enriched
with better individuals. 

3. Mutation: Happens after crossover, causing a random
change in the offspring.
Chromosomes	could	be:
– Bit	strings																						 (0101	...	1100)
– Real	numbers																	 (43.2	-33.1	...	0.0	89.2)	
– Permutations	of	element					(E11	E3	E7	...	E1	E15)
– Lists	of	rules																							 (R1	R2	R3	...	R22	R23)
– Program	elements													 (genetic	programming)
– Any	data	structure	...
Crossover
Chromosome 1 11011 | 00100110110
Chromosome 2 11011 | 11000011110
Offspring 1 11011 | 11000011110
Offspring 2 11011 | 00100110110
Chromosome 1 1101100100110110
Chromosome 2 1101111000011110
Mutation
Original offspring 1 1101111000011110
Original offspring 2 1101100100110110
Mutated offspring 1 1100111000011110
Mutated offspring 2 1101101100110110
GA Parameters
• Solving the problem by finding the extreme of a function

• GA Parameters

• Crossover and Mutation Probability

• Population Size
GA: Selection
Roulette Wheel Selection Rank Selection
before
after
Steady State Selection
Elitism
GA: Encoding
• Binary Encoding

• example Knapsack problem

• Permutation Encoding

• example Travelling Salesman problem
Chromosome A 101100101100101011100101
Chromosome B 111111100000110000011111
Chromosome A 1  5  3  2  6  4  7  9  8
Chromosome B 8  5  6  7  2  3  1  4  9
GA: Encoding
• Value Encoding

• example finding weights
for neural network

• Tree Encoding

• example finding a function
from given values
Chromosome A 1.2324  5.3243  0.4556  2.3293  2.4545
Chromosome B ABDJEIFJDHDIERJFDLDFLFEGT
Chromosome C (back), (back), (right), (forward), (left)
Chromosome A Chromosome B
( +  x  ( /  5  y ) ) ( do_until  step  wall )
• Binary Encoding: Crossover 

• Single Point Crossover 

• Two Point Crossover
Crossover & Mutation
11001011+11011111 = 11001111
11001011 + 11011111 = 11011111
Crossover & Mutation
• Uniform Crossover 

• Arithmetic Crossover
11001011 + 11011101 = 11011111
11001011 + 11011111 = 11001001 (AND)
Crossover & Mutation
• Mutation: Bit Inversion
11001001 =>  10001001
• Permutation Encoding 

• Crossover: Single Point Crossover 

• Mutation: Order Changing
Crossover & Mutation
(1 2 3 4 5 6 7 8 9) + (4 5 3 6 8 9 7 2 1) = (1 2 3 4 5 6 8 9 7)
(1 2 3 4 5 6 8 9 7) => (1 8 3 4 5 6 2 9 7)
• Value Encoding 

• Crossover: All crossovers from Binary Encoding can
be used 

• Mutation: Adding
Crossover & Mutation
1.29  5.68  2.86  4.11  5.55) => (1.29  5.68  2.73  4.22  5.55)
• Tree Encoding 

• Crossover: Tree Crossover 

• Mutation: Changing operator, number
Crossover & Mutation
Example
Distribution	of	Individuals	in	Generation	0
Distribution	of	Individuals	in	Generation	N
Example: Travelling
Salesman Problem
Problem Space: 30 cities
Example: Travelling
Salesman Problem
Solutioni [Distance=941]
Example: Travelling
Salesman Problem
Solutionj [Distance=800]
Example: Travelling
Salesman Problem
Solutionk [Distance=652]
Example: Travelling
Salesman Problem
Best Solution [Distance=420]
Applications of GAs
• GAs used to solve NP-hard
problems, but also for art,
evolving pictures and music

• In the first represented image,
a binary tree type of encoding
is used to generate the
images through mathematical
operations:
Source: [http://www.algosome.com/articles/genetic-algorithm-evolution-art.html]
Applications of GAs
• Data analysis

• Designing Neural Networks

• Robot trajectory

• Evolving LISP programs
• Strategy Planning 

• Finding the shape of protein
molecules

• Sequence Scheduling

• Functions for creating images
Issues for GAs
• Choosing basic implementation issues:

• representation

• population size, mutation rate, ...

• selection, deletion policies

• crossover, mutation operators

• Termination Criteria

• Performance, scalability

• Solution is only as good as the evaluation function (often
hardest part)
Strengths of GAs
• Concept is easy to understand

• Modular, separate from application

• Supports multi-objective optimization

• Good for “noisy” environments

• Always an answer; answer gets better with time

• Inherently parallel; easily distributed
Strengths of GAs
• Many ways to speed up and improve a GA-based
application as knowledge about problem domain is
gained

• Easy to exploit previous or alternate solutions

• Flexible building blocks for hybrid applications

• Substantial history and range of use
When to use GAs
• Alternate solutions are too slow or overly complicated

• Need an exploratory tool to examine new approaches

• Problem is similar to one that has already been
successfully solved by using a GA

• Want to hybridize with an existing solution

• Benefits of the GA technology meet key problem
requirements
Time for class exercise …

More Related Content

Similar to Introduction to Genetic Algorithms

GA of a Paper 2012.pptx
GA of a Paper 2012.pptxGA of a Paper 2012.pptx
GA of a Paper 2012.pptxwaqasjavaid26
 
Genetic algorithm raktim
Genetic algorithm raktimGenetic algorithm raktim
Genetic algorithm raktimRaktim Halder
 
Genetic algorithm_raktim_IITKGP
Genetic algorithm_raktim_IITKGP Genetic algorithm_raktim_IITKGP
Genetic algorithm_raktim_IITKGP Raktim Halder
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithmgarima931
 
CSA 3702 machine learning module 4
CSA 3702 machine learning module 4CSA 3702 machine learning module 4
CSA 3702 machine learning module 4Nandhini S
 
evolutionary algo's.ppt
evolutionary algo's.pptevolutionary algo's.ppt
evolutionary algo's.pptSherazAhmed103
 
Geneticalgorithms 100403002207-phpapp02
Geneticalgorithms 100403002207-phpapp02Geneticalgorithms 100403002207-phpapp02
Geneticalgorithms 100403002207-phpapp02Amna Saeed
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithmJari Abbas
 
Chapter09.ppt
Chapter09.pptChapter09.ppt
Chapter09.pptbutest
 
Introduction to Genetic Algorithms 2014
Introduction to Genetic Algorithms 2014Introduction to Genetic Algorithms 2014
Introduction to Genetic Algorithms 2014Aleksander Stensby
 
Final Presentation - Edan&Itzik
Final Presentation - Edan&ItzikFinal Presentation - Edan&Itzik
Final Presentation - Edan&Itzikitzik cohen
 
Introduction to Genetic Algorithms
Introduction to Genetic AlgorithmsIntroduction to Genetic Algorithms
Introduction to Genetic AlgorithmsAhmed Othman
 
ObjRecog2-17 (1).pptx
ObjRecog2-17 (1).pptxObjRecog2-17 (1).pptx
ObjRecog2-17 (1).pptxssuserc074dd
 
Ff meeting 25nov03
Ff meeting 25nov03Ff meeting 25nov03
Ff meeting 25nov03moniajit
 

Similar to Introduction to Genetic Algorithms (20)

Genetic Algorithm
Genetic Algorithm Genetic Algorithm
Genetic Algorithm
 
GA of a Paper 2012.pptx
GA of a Paper 2012.pptxGA of a Paper 2012.pptx
GA of a Paper 2012.pptx
 
Genetic algorithm raktim
Genetic algorithm raktimGenetic algorithm raktim
Genetic algorithm raktim
 
Genetic algorithm_raktim_IITKGP
Genetic algorithm_raktim_IITKGP Genetic algorithm_raktim_IITKGP
Genetic algorithm_raktim_IITKGP
 
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
CSA 3702 machine learning module 4
CSA 3702 machine learning module 4CSA 3702 machine learning module 4
CSA 3702 machine learning module 4
 
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
 
evolutionary algo's.ppt
evolutionary algo's.pptevolutionary algo's.ppt
evolutionary algo's.ppt
 
genetic computing
genetic computinggenetic computing
genetic computing
 
Geneticalgorithms 100403002207-phpapp02
Geneticalgorithms 100403002207-phpapp02Geneticalgorithms 100403002207-phpapp02
Geneticalgorithms 100403002207-phpapp02
 
Introduction to Genetic algorithm and its significance in VLSI design and aut...
Introduction to Genetic algorithm and its significance in VLSI design and aut...Introduction to Genetic algorithm and its significance in VLSI design and aut...
Introduction to Genetic algorithm and its significance in VLSI design and aut...
 
ga-2.ppt
ga-2.pptga-2.ppt
ga-2.ppt
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
Chapter09.ppt
Chapter09.pptChapter09.ppt
Chapter09.ppt
 
Introduction to Genetic Algorithms 2014
Introduction to Genetic Algorithms 2014Introduction to Genetic Algorithms 2014
Introduction to Genetic Algorithms 2014
 
Final Presentation - Edan&Itzik
Final Presentation - Edan&ItzikFinal Presentation - Edan&Itzik
Final Presentation - Edan&Itzik
 
Introduction to Genetic Algorithms
Introduction to Genetic AlgorithmsIntroduction to Genetic Algorithms
Introduction to Genetic Algorithms
 
ObjRecog2-17 (1).pptx
ObjRecog2-17 (1).pptxObjRecog2-17 (1).pptx
ObjRecog2-17 (1).pptx
 
Ff meeting 25nov03
Ff meeting 25nov03Ff meeting 25nov03
Ff meeting 25nov03
 

More from Vanessa Camilleri

ICS 2208 Lecture 8 Slides AI and VR_.pdf
ICS 2208 Lecture 8 Slides AI and VR_.pdfICS 2208 Lecture 8 Slides AI and VR_.pdf
ICS 2208 Lecture 8 Slides AI and VR_.pdfVanessa Camilleri
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
ICS2208 Lecture4 Intelligent Interface Agents.pdf
ICS2208 Lecture4 Intelligent Interface Agents.pdfICS2208 Lecture4 Intelligent Interface Agents.pdf
ICS2208 Lecture4 Intelligent Interface Agents.pdfVanessa Camilleri
 
ICS2208 Lecture3 2023-2024 - Model Based User Interfaces
ICS2208 Lecture3 2023-2024 - Model Based User InterfacesICS2208 Lecture3 2023-2024 - Model Based User Interfaces
ICS2208 Lecture3 2023-2024 - Model Based User InterfacesVanessa Camilleri
 
ICS2208 Lecture 2 Slides Interfaces_.pdf
ICS2208 Lecture 2 Slides Interfaces_.pdfICS2208 Lecture 2 Slides Interfaces_.pdf
ICS2208 Lecture 2 Slides Interfaces_.pdfVanessa Camilleri
 
ICS Lecture 11 - Intelligent Interfaces 2023
ICS Lecture 11 - Intelligent Interfaces 2023ICS Lecture 11 - Intelligent Interfaces 2023
ICS Lecture 11 - Intelligent Interfaces 2023Vanessa Camilleri
 
ICS3211_lecture_week72023.pdf
ICS3211_lecture_week72023.pdfICS3211_lecture_week72023.pdf
ICS3211_lecture_week72023.pdfVanessa Camilleri
 
ICS3211_lecture_week62023.pdf
ICS3211_lecture_week62023.pdfICS3211_lecture_week62023.pdf
ICS3211_lecture_week62023.pdfVanessa Camilleri
 
ICS3211_lecture_week52023.pdf
ICS3211_lecture_week52023.pdfICS3211_lecture_week52023.pdf
ICS3211_lecture_week52023.pdfVanessa Camilleri
 

More from Vanessa Camilleri (20)

ICS 2208 Lecture 8 Slides AI and VR_.pdf
ICS 2208 Lecture 8 Slides AI and VR_.pdfICS 2208 Lecture 8 Slides AI and VR_.pdf
ICS 2208 Lecture 8 Slides AI and VR_.pdf
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
ICS2208 Lecture4 Intelligent Interface Agents.pdf
ICS2208 Lecture4 Intelligent Interface Agents.pdfICS2208 Lecture4 Intelligent Interface Agents.pdf
ICS2208 Lecture4 Intelligent Interface Agents.pdf
 
ICS2208 Lecture3 2023-2024 - Model Based User Interfaces
ICS2208 Lecture3 2023-2024 - Model Based User InterfacesICS2208 Lecture3 2023-2024 - Model Based User Interfaces
ICS2208 Lecture3 2023-2024 - Model Based User Interfaces
 
ICS2208 Lecture 2 Slides Interfaces_.pdf
ICS2208 Lecture 2 Slides Interfaces_.pdfICS2208 Lecture 2 Slides Interfaces_.pdf
ICS2208 Lecture 2 Slides Interfaces_.pdf
 
ICS Lecture 11 - Intelligent Interfaces 2023
ICS Lecture 11 - Intelligent Interfaces 2023ICS Lecture 11 - Intelligent Interfaces 2023
ICS Lecture 11 - Intelligent Interfaces 2023
 
ICS3211_lecture 09_2023.pdf
ICS3211_lecture 09_2023.pdfICS3211_lecture 09_2023.pdf
ICS3211_lecture 09_2023.pdf
 
ICS3211_lecture 08_2023.pdf
ICS3211_lecture 08_2023.pdfICS3211_lecture 08_2023.pdf
ICS3211_lecture 08_2023.pdf
 
ICS3211_lecture_week72023.pdf
ICS3211_lecture_week72023.pdfICS3211_lecture_week72023.pdf
ICS3211_lecture_week72023.pdf
 
ICS3211_lecture_week62023.pdf
ICS3211_lecture_week62023.pdfICS3211_lecture_week62023.pdf
ICS3211_lecture_week62023.pdf
 
ICS3211_lecture_week52023.pdf
ICS3211_lecture_week52023.pdfICS3211_lecture_week52023.pdf
ICS3211_lecture_week52023.pdf
 
ICS3211_lecture 04 2023.pdf
ICS3211_lecture 04 2023.pdfICS3211_lecture 04 2023.pdf
ICS3211_lecture 04 2023.pdf
 
ICS3211_lecture 03 2023.pdf
ICS3211_lecture 03 2023.pdfICS3211_lecture 03 2023.pdf
ICS3211_lecture 03 2023.pdf
 
ICS3211_lecture 11.pdf
ICS3211_lecture 11.pdfICS3211_lecture 11.pdf
ICS3211_lecture 11.pdf
 
FoundationsAIEthics2023.pdf
FoundationsAIEthics2023.pdfFoundationsAIEthics2023.pdf
FoundationsAIEthics2023.pdf
 
ICS3211_lecture 9_2022.pdf
ICS3211_lecture 9_2022.pdfICS3211_lecture 9_2022.pdf
ICS3211_lecture 9_2022.pdf
 
ICS1020CV_2022.pdf
ICS1020CV_2022.pdfICS1020CV_2022.pdf
ICS1020CV_2022.pdf
 
ARI5902_2022.pdf
ARI5902_2022.pdfARI5902_2022.pdf
ARI5902_2022.pdf
 
ICS2208 Lecture10
ICS2208 Lecture10ICS2208 Lecture10
ICS2208 Lecture10
 

Recently uploaded

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
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
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
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
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
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
 
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
 
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
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
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
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
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
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
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
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxAnaBeatriceAblay2
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 

Recently uploaded (20)

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
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
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.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
 
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
 
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
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
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
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
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
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 

Introduction to Genetic Algorithms

  • 1. Foundations in AI Introduction to Genetic Algorithms Dr Vanessa Camilleri Department of AI October 2018
  • 2. Overview • Introduction • GA Algorithm • Components • Examples • Applications
  • 3. Introduction • Mimics Theory of Evolution • GAs as a general purpose learning algorithm • Solving a complex problem of problems • Uses Natural Selection or Survival of the Fittest
  • 4. Introduction • Natural Selection: variations in gene that increases its chances of survival
  • 8. Introduction • NP (nondeterministic polynomial) Hard Problems • cannot be solved in traditional way • possible to guess the solution
  • 9. Basic GA algorithm 1. [Start] Generate random population of n chromosomes (suitable solutions for the problem) 2. [Fitness] Evaluate the fitness f(x) of each chromosome x in the population 3. [New population] Create a new population by repeating following steps until the new population is complete 1. [Selection] Select two parent chromosomes from a population according to their fitness (the better fitness, the bigger chance to be selected) 2. [Crossover] With a crossover probability cross over the parents to form a new offspring (children). If no crossover was performed, offspring is an exact copy of parents. 3. [Mutation] With a mutation probability mutate new offspring at each locus (position in chromosome). 4. [Accept] Place new offspring in a new population 5. [Replace] Use new generated population for a further run of algorithm 6. [Test] If the end condition is satisfied, stop, and return the best solution in current population [Loop] Go to step 2
  • 11. GA Cycle of Reproduction Reproduction Modification EvaluationPopulation Discard Children Modified Children Evaluated Children Deleted Members Parents
  • 12. GA Operators 1. Reproduction: aka selection operator, usually the first operator applied on the population. Chromosomes are selected from the population to cross over and produce offspring 2. Crossover: After reproduction population is enriched with better individuals. 3. Mutation: Happens after crossover, causing a random change in the offspring.
  • 13. Chromosomes could be: – Bit strings (0101 ... 1100) – Real numbers (43.2 -33.1 ... 0.0 89.2) – Permutations of element (E11 E3 E7 ... E1 E15) – Lists of rules (R1 R2 R3 ... R22 R23) – Program elements (genetic programming) – Any data structure ...
  • 14. Crossover Chromosome 1 11011 | 00100110110 Chromosome 2 11011 | 11000011110 Offspring 1 11011 | 11000011110 Offspring 2 11011 | 00100110110 Chromosome 1 1101100100110110 Chromosome 2 1101111000011110
  • 15. Mutation Original offspring 1 1101111000011110 Original offspring 2 1101100100110110 Mutated offspring 1 1100111000011110 Mutated offspring 2 1101101100110110
  • 16. GA Parameters • Solving the problem by finding the extreme of a function • GA Parameters • Crossover and Mutation Probability • Population Size
  • 17. GA: Selection Roulette Wheel Selection Rank Selection before after Steady State Selection Elitism
  • 18. GA: Encoding • Binary Encoding • example Knapsack problem • Permutation Encoding • example Travelling Salesman problem Chromosome A 101100101100101011100101 Chromosome B 111111100000110000011111 Chromosome A 1  5  3  2  6  4  7  9  8 Chromosome B 8  5  6  7  2  3  1  4  9
  • 19. GA: Encoding • Value Encoding • example finding weights for neural network • Tree Encoding • example finding a function from given values Chromosome A 1.2324  5.3243  0.4556  2.3293  2.4545 Chromosome B ABDJEIFJDHDIERJFDLDFLFEGT Chromosome C (back), (back), (right), (forward), (left) Chromosome A Chromosome B ( +  x  ( /  5  y ) ) ( do_until  step  wall )
  • 20. • Binary Encoding: Crossover • Single Point Crossover • Two Point Crossover Crossover & Mutation 11001011+11011111 = 11001111 11001011 + 11011111 = 11011111
  • 21. Crossover & Mutation • Uniform Crossover • Arithmetic Crossover 11001011 + 11011101 = 11011111 11001011 + 11011111 = 11001001 (AND)
  • 22. Crossover & Mutation • Mutation: Bit Inversion 11001001 =>  10001001
  • 23. • Permutation Encoding • Crossover: Single Point Crossover • Mutation: Order Changing Crossover & Mutation (1 2 3 4 5 6 7 8 9) + (4 5 3 6 8 9 7 2 1) = (1 2 3 4 5 6 8 9 7) (1 2 3 4 5 6 8 9 7) => (1 8 3 4 5 6 2 9 7)
  • 24. • Value Encoding • Crossover: All crossovers from Binary Encoding can be used • Mutation: Adding Crossover & Mutation 1.29  5.68  2.86  4.11  5.55) => (1.29  5.68  2.73  4.22  5.55)
  • 25. • Tree Encoding • Crossover: Tree Crossover • Mutation: Changing operator, number Crossover & Mutation
  • 31. Example: Travelling Salesman Problem Best Solution [Distance=420]
  • 32. Applications of GAs • GAs used to solve NP-hard problems, but also for art, evolving pictures and music • In the first represented image, a binary tree type of encoding is used to generate the images through mathematical operations: Source: [http://www.algosome.com/articles/genetic-algorithm-evolution-art.html]
  • 33. Applications of GAs • Data analysis • Designing Neural Networks • Robot trajectory • Evolving LISP programs • Strategy Planning • Finding the shape of protein molecules • Sequence Scheduling • Functions for creating images
  • 34. Issues for GAs • Choosing basic implementation issues: • representation • population size, mutation rate, ... • selection, deletion policies • crossover, mutation operators • Termination Criteria • Performance, scalability • Solution is only as good as the evaluation function (often hardest part)
  • 35. Strengths of GAs • Concept is easy to understand • Modular, separate from application • Supports multi-objective optimization • Good for “noisy” environments • Always an answer; answer gets better with time • Inherently parallel; easily distributed
  • 36. Strengths of GAs • Many ways to speed up and improve a GA-based application as knowledge about problem domain is gained • Easy to exploit previous or alternate solutions • Flexible building blocks for hybrid applications • Substantial history and range of use
  • 37. When to use GAs • Alternate solutions are too slow or overly complicated • Need an exploratory tool to examine new approaches • Problem is similar to one that has already been successfully solved by using a GA • Want to hybridize with an existing solution • Benefits of the GA technology meet key problem requirements
  • 38. Time for class exercise …