SlideShare a Scribd company logo
1
Global Optimization
Genetic Algorithms
Olesya Peshko
2
Outline
z Evolution in biology
z Algorithm
z Pros and cons
z Applications
z Example
z Software
z Matlab toolboxes
3
Evolution in Biology
Image from http://www.geo.au.dk/besoegsservice/foredrag/evolution
4
Evolution in Biology I
z Organisms produce a number of offspring similar to
themselves but can have variations due to:
– Mutations (random changes)
– Sexual reproduction (offspring have combinations of
features inherited from each parent)
Images adapted from http://www.wpclipart.com
5
Evolution in Biology II
z Some offspring survive, and produce next
generations, and some don’t:
– The organisms adapted to the environment better have
higher chance to survive
– Over time, the generations become more and more adapted
because the fittest organisms survive
Images adapted from http://www.wpclipart.com
6
The Genetic Algorithms
Image from http://www.genetic-programming.org
7
The Genetic Algorithms (GA)
z Based on the mechanics of biological evolution
z Initially developed by John Holland, University of
Michigan (1970’s)
– To understand processes in natural systems
– To design artificial systems retaining the robustness
and adaptation properties of natural systems
z Holland’s original GA is known as the simple genetic
algorithm (SGA)
z Provide efficient techniques for optimization and
machine learning applications
z Widely used in business, science and engineering
Image adapted from http://today.mun.ca/news.php?news_id=2376
8
Genetic Algorithms Techniques
z GAs are a particular class of evolutionary algorithms.
The techniques common to all GAs are:
– Inheritance
– Mutation
– Selection
– Crossover (also called recombination)
z GAs are best used when the objective function is:
– Discontinuous
– Highly nonlinear
– Stochastic
– Has unreliable or undefined derivatives
9
Performance
z GAs can provide solutions for highly complex search
spaces
z GAs perform well approximating solutions to all
types of problems because they do not make any
assumption about the underlying fitness landscape
(the shape of the fitness function, or objective
function)
z However, GAs can be outperformed by more field-
specific algorithms
10
Biological Terminology
z Gene – a single encoding of part of the
solution space, i.e. either single bits or short
blocks of adjacent bits that encode an
element of the candidate solution
z Chromosome – a string of genes that
represents a solution
z Population – the number of chromosomes
available to test
1
0 1 0 1 1
0 1 0 1 1
1 1 1 1 1
1 1 0 1 1
1 0 0 1 1
1 1 0 0 1
0 1 0 1 0 1 1 0 1 0
0 1 0 0 0
11
Biology vs. Optimization
z Candidate solutions to the optimization
problem play the role of individuals in a
population (or chromosomes)
z Cost/fitness/objective function determines the
environment within which the solutions “live”
DNA image from http://static.howstuffworks.com/gif/cell-dna.jpg
12
Features of Genetic Algorithms
z Not too fast but cover large search space
– Capable of quickly finding promising regions of the search space
but may take a relatively long time to reach the optimal solution.
Solution: hybrid algorithms
z Good heuristics for combinatorial problems
z Usually emphasize combining information from good parents
(crossover)
z Different GAs use different
– Representations
– Mutations
– Crossovers
– Selection mechanisms
13
Representation
z Chromosomes can be:
– Bit strings (0110, 0011, 1101, …)
– Real numbers (33.2, -12.11, 5.32, …)
– Permutations of element (1234, 3241, 4312, …)
– Lists of rules (R1, R2, R3, … Rn …)
– Program elements (genetic programming)
– Any other data structure
0 1 0 1 1
1 1 0 1 1
1 1 1 1 1
1 0 0 1 1
Encoding
(representation)
Decoding
(inverse representation)
14
Representation Example
z Generation 0: 4 candidate solutions
z Generation N
34.57 ~ “1000010101101”
23.99 ~ “1000001111110”
15
1-Point Crossover
z Choose a random point
z Split parents at this crossover point
z Create children by exchanging tails
z Probability of crossover is typically in range (0.6, 0.9)
1 1 1 1 1 1 1 0 0 0
0 0 0 0 0 0 0 1 1 1
1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0
Parents Children
16
Other Crossover Types
z Two-point crossover
z Uniform crossover: randomly generated mask
0 0 1 1 1 1 1 0 0 0
1 1 0 0 0 0 0 1 1 1
1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0
Parents Children
0 0 1 0 1 1 1 0 0 1
1 1 0 1 0 0 0 1 1 0
1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0
Parents Children
1 1 0 1 0 0 0 1 1 0
Mask:
17
Mutation
z Alter each gene independently
z Mutation probability is typically in range
(1/population_size, 1/chromosome_length)
z Choose mutation with the best fit
1 1 0 1 1 1 1 0 1 0
1 1 1 1 1 1 1 1 1 1
Parent Child
(-4.32 2.12 -41.56 9.99) (-4.32 2.12 -43.15 9.99)
18
2 1 4 5 7
1 2 3 3 4
1 2 3 3 4
6 2 1 3 1
Selection
z Parents with better fitness have better chances to
produce offspring
2 1 4 5 7
1 2 3 3 4
6 2 1 3 1
1 1 2 1 9
2 1 3 3 5
1 2 4 5 7
1 7 3 3 1
6 2 1 1 4
30
27
32
11
2 1 3 3 4
1 2 4 5 7
1 2 3 3 1
6 2 1 3 4
Initial population Selection Crossover Mutation
Fitness function – measure of goodness of the candidate solution
Mutation can be performed in a way that maximizes fitness function
19
Selection: Roulette Wheel
z Better solutions get higher chance to become
parents for next generation solutions
z Roulette wheel technique:
– Assign each individual part of the wheel
– Spin wheel N times to select N individuals
A
B
C
3/6=50%
1/6=17%
2/6=33%
fitness(A) = 3
fitness(B) = 1
fitness(C) = 2
20
The Basic Genetic Algorithm
{ % Generate random population of chromosomes
Initialize population;
% Evaluate the fitness of each chromosome in the population
Evaluate population; [Fitness]
% Create, accept, and test a new population:
while Termination_Criteria_Not_Satisfied
{ % Select according to fitness
Select parents for reproduction; [Selection]
% With a crossover probability perform crossover or copy parents
Perform crossover; [Crossover]
% With a mutation probability mutate offspring at each position in chromosome
Perform mutation; [Mutation]
Accept new generation;
Evaluate population; [Fitness]
}
}
21
Demo Java Applet
z A Java applet demonstrating genetic algorithm in
action can be found at:
http://cs.felk.cvut.cz/~xobitko/ga/
22
Benefits of Genetic Algorithms
z Concept is easy to understand
z Modular – separate from application
(representation); building blocks can be used in
hybrid applications
z Supports multi-objective optimization
z Good for “noisy” environment
z Always results in an answer, which becomes better
and better with time
z Can easily run in parallel
z The fitness function can be changed from iteration to
iteration, which allows incorporating new data in the
model if it becomes available
23
Issues with Genetic Algorithms
z Choosing parameters:
– Population size
– Crossover and mutation probabilities
– Selection, deletion policies
– Crossover, mutation operators, etc.
– Termination criteria
z Performance:
– Can be too slow but covers a large search space
– Is only as good as the fitness function
24
Applications
Image from http://www.uni-duisburg-essen.de/imperia/md/images/tul/lehre_vorschlag_studarbeiten_ctss_karte.gif
25
Applications of Genetic Algorithms
z Optimization – numerical and combinatorial optimization problems,
e.g. traveling salesman, routing, graph colouring and partitioning
z Robotics – trajectory planning
z Machine learning – designing neural networks, classification and
prediction, e.g. prediction of weather or protein structure,
z Signal processing – filter design
z Design – semiconductor layout, aircraft design, communication
networks
z Automatic programming – evolve computer programs for specific
tasks, design cellular automata and sorting networks
z Economics – development of bidding strategies, emergence of
economics markets
z Immune systems – model somatic mutations
z Ecology – model symbiosis, resource flow
z Population genetics – “Under what condition will a gene for
recombination be evolutionarily viable?”
26
A Simple Example
The traveling salesman problem
Find a tour of a given set of cities
so that:
– Each city is visited only once
– The total distance traveled is
minimized
*An example including results is adapted from [1]
Image from http://www.wpclipart.com
27
Representation
z Representation is an ordered list of city
numbers:
1. Kyiv
2. Budapest
3. Teheran
4. Beijing
5. Jerusalem
6. Bucharest
7. Hamilton
8. Toronto
z Possible city lists as candidate solutions:
– CityList1 (3 5 7 2 1 6 4 8)
– CityList2 (2 5 7 6 8 1 3 4)
28
Crossover
Parent1 ( 3 5 7 2 1 6 4 8 )
Parent2 ( 2 5 7 6 8 1 3 4 )
Child ( 5 8 7 2 1 6 3 4 )
29
Mutation
Mutation involves reordering of the list:
* *
Before: (5 8 7 2 1 6 3 4)
After: (5 8 6 2 1 7 3 4)
30
TSP Example: 30 Cities
31
Solution i (Distance = 941)
32
Solution j (Distance = 800)
33
Solution k (Distance = 652)
34
Best Solution (Distance = 420)
35
Genetic Algorithms References
1. W. Williams, Genetic Algorithms: A Tutorial,
http://web.umr.edu/~ercal/387/slides/GATutorial.ppt
2. A. Eiben, J. Smith, Introduction to Evolutionary
Computing, Genetic Algorithms,
http://www.cs.vu.nl/~jabekker/ec0607/slides/Lectur
e03-Chapter3-GeneticAlgorithms.ppt
3. R. Horst and P.M. Pardalos (eds.), Handbook of
Global Optimization, Kluwer, Dordrecht 1995.
4. M. Mitchell, An Introduction To Genetic Algorithms,
Cambridge, MA: MIT Press, 1996.
36
Software
Image from http://www.mathworks.com/company/pressroom/articles/article7017.html
37
Genetic Algorithm Software
z GENOCOP III – Genetic Algorithm for Constrained Problems in C (by
Zbigniew Michalewicz)
z DE – Differential Evolution Genetic Algorithm in C and Matlab (by Rainer
Storn). DE has won the third place at the 1st International Contest on
Evolutionary Computation on a real-valued function testsuite
z PGAPack – Parallel Genetic Algorithm in Fortran and C (from Argonne
National Laboratory)
z PIKAIA – Genetic algorithm in Fortran 77/90 (by Charbonneau, Knapp
and Miller)
z GAGA – Genetic Algorithm for General Application in C (by Ian Poole)
z GAS – Genetic Algorithm in C++ (by Jelasity and Dombi)
z GAlib – C++ Genetic Algorithm Library (by Matthew Wall)
z Genetic Algorithm in Matlab (by Michael B. Gordy)
z GADS – Genetic Algorithm and Direct Search Toolbox in Matlab (from
MathWorks)
z GEATbx – Genetic and Evolutionary Algorithm Toolbox for Matlab (by
Hartmut Pohlheim)
z GAOT – Genetic Algorithms Optimization Toolbox in Matlab (by Jeffrey
Joines)
38
MathWorks GADS Toolbox
z The MathWorks offers Genetic Algorithm and Direct
Search Toolbox 2.0.2
z GUI (gatool) and command line tools for setting up
problems, algorithm options, and monitoring
progress
z GA tools, such as creation of initial population,
fitness scaling, parent selection, crossover and
mutation
z Ability to solve optimization problems with nonlinear,
linear, and bound constraints
z Support for automatic M-code generation
39
Prices
z No prices are quoted on the website for this toolbox,
have to ask for a quote
– Commercial
– Academic
– Student use
z Academic use, individual license: $200 U.S.
z Press release: “The Genetic Algorithm and Direct
Search Toolbox requires MATLAB and the
Optimization Toolbox and is available immediately
for Windows, UNIX/Linux, and Macintosh systems.
Pricing starts at $700 U.S.”
z http://www.mathworks.com/products/gads/index.html
40
Demo 1
z The traveling salesman problem
gadsdemostraveling_salesman_demo1.m:
41
Demo 2: Function
z Rastrigin’s function :
z Global minimum at [0,0]
z rastriginsfcn.m
42
Demo 2: gatool
43
GEATbx: Features
z Broad class of operators for selection, crossover,
mutation operations
z Complete support of multi-objective optimization
z Supplied with population models
z Real, integer, and binary variable representation
z Sophisticated visualization
z Comfortable monitoring and storing of results
z The GEATbx can be completely compiled into C/C++
code using the Matlab Compiler
z Author: Hartmut Pohlheim
z Can be bought at: http://www.geatbx.com/order.html
z Evaluation can be ordered
44
Demo
z demogeatbx.m
45
Prices
46
GAOT – GA Optimization Toolbox
z Can be downloaded for free at:
http://www.ise.ncsu.edu/mirage/GAToolBox/gaot/
z Author: Jaffrey Joines
z Real, binary, and order-based epresentations
z Paper (the same website):
– Description of the toolbox
– Numerical results:
z Float genetic algorithm (FGA) outperformed binary GA (BGA)
and simulated annealing (SA) algorithms in computational
efficiency and solution quality
z Corana testset: family of parameterized functions, very simple
to compute and contain large number of local minima (reminds
n-dimensional parabola)
47
Demo
z gademo1.m
48
GA Software References
1. Arnold Neumaier, Global Optimization Software,
http://www.mat.univie.ac.at/~neum/glopt/software_
g.html#ga_codes
2. GEATbx: Genetic and Evolutionary Algorithm
Toolbox for use with MATLAB,
http://www.geatbx.com/links/ea_matlab.html
3. The MathWorks, Genetic Algorithm and Direct
Search Toolbox,
http://www.mathworks.com/products/gads/
4. GAOT – Genetic Algorithm Optimization Toolbox
http://www.ise.ncsu.edu/mirage/GAToolBox/gaot/

More Related Content

PPTX
GA of a Paper 2012.pptx
PPTX
Genetic Algorithm
PPTX
PDF
Introduction to Genetic Algorithms
PPT
Introduction to Genetic algorithms
PPTX
Genetic Algorithm
PPTX
Genetic algorithm optimization technique.pptx
PPTX
MACHINE LEARNING - GENETIC ALGORITHM
GA of a Paper 2012.pptx
Genetic Algorithm
Introduction to Genetic Algorithms
Introduction to Genetic algorithms
Genetic Algorithm
Genetic algorithm optimization technique.pptx
MACHINE LEARNING - GENETIC ALGORITHM

Similar to 3_GO_Olesya_Genetic_AlgorithmsOPTIMZTION.p.pdf (20)

PPTX
Genetic algorithm (ga) binary and real Vijay Bhaskar Semwal
PDF
PPT
ga-2.ppt
PDF
A Review On Genetic Algorithm And Its Applications
PPTX
2020 6 16_ga_introduction
PPT
Introduction to Genetic Algorithms
PDF
Introduction to Genetic Algorithms 2014
PPTX
Genetic algorithm
PPTX
Genetic Algorithm
PDF
Data Science - Part XIV - Genetic Algorithms
PPTX
Introduction to Genetic Algorithms
PDF
Introduction to Genetic Algorithms and Evolutionary Computation
PPTX
PDF
RM 701 Genetic Algorithm and Fuzzy Logic lecture
PDF
Genetic Algorithm
PPTX
Genetic algorithm
PPT
Genetic algorithms full lecture
PPTX
Genetic Algorithm by Example
PPT
Genetic-Algorithms.ppt
PPT
Genetic-Algorithms.ppt
Genetic algorithm (ga) binary and real Vijay Bhaskar Semwal
ga-2.ppt
A Review On Genetic Algorithm And Its Applications
2020 6 16_ga_introduction
Introduction to Genetic Algorithms
Introduction to Genetic Algorithms 2014
Genetic algorithm
Genetic Algorithm
Data Science - Part XIV - Genetic Algorithms
Introduction to Genetic Algorithms
Introduction to Genetic Algorithms and Evolutionary Computation
RM 701 Genetic Algorithm and Fuzzy Logic lecture
Genetic Algorithm
Genetic algorithm
Genetic algorithms full lecture
Genetic Algorithm by Example
Genetic-Algorithms.ppt
Genetic-Algorithms.ppt
Ad

More from ssuser8d8cfc1 (12)

PPTX
Underwater-Welding manufacture procesess .pp.pptx
PPT
Welding Basics manufacture procesess .ppt
PPTX
plasma-arc-weldingmanufacture procesess .pptx
PPTX
under-water-weldin manfcteuring procsess.pptx
PPTX
under-water-weldin manfcteuring procsess.pptx
PPTX
underwater weldingPresentation water.pptx
PPTX
under-water-welding procseemanufacturing.pptx
PPT
GMAW5 weldind manufacture process matal.ppt
PPT
GAS WELDING2 manufacture proceess metal.ppt
PPT
GMAWmnufacture on welding materiail 5.ppt
PPT
GAS manufacturing on materail WELDING2.ppt
PPT
01 History Of Manufacturing Systems And Lean Thinking.ppt
Underwater-Welding manufacture procesess .pp.pptx
Welding Basics manufacture procesess .ppt
plasma-arc-weldingmanufacture procesess .pptx
under-water-weldin manfcteuring procsess.pptx
under-water-weldin manfcteuring procsess.pptx
underwater weldingPresentation water.pptx
under-water-welding procseemanufacturing.pptx
GMAW5 weldind manufacture process matal.ppt
GAS WELDING2 manufacture proceess metal.ppt
GMAWmnufacture on welding materiail 5.ppt
GAS manufacturing on materail WELDING2.ppt
01 History Of Manufacturing Systems And Lean Thinking.ppt
Ad

Recently uploaded (20)

PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
III.4.1.2_The_Space_Environment.p pdffdf
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PPTX
Fundamentals of Mechanical Engineering.pptx
PPT
Project quality management in manufacturing
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
DOCX
573137875-Attendance-Management-System-original
PPTX
Artificial Intelligence
PPTX
Construction Project Organization Group 2.pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PPTX
additive manufacturing of ss316l using mig welding
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PPT
Mechanical Engineering MATERIALS Selection
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
III.4.1.2_The_Space_Environment.p pdffdf
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Fundamentals of Mechanical Engineering.pptx
Project quality management in manufacturing
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
573137875-Attendance-Management-System-original
Artificial Intelligence
Construction Project Organization Group 2.pptx
R24 SURVEYING LAB MANUAL for civil enggi
Categorization of Factors Affecting Classification Algorithms Selection
additive manufacturing of ss316l using mig welding
Embodied AI: Ushering in the Next Era of Intelligent Systems
CYBER-CRIMES AND SECURITY A guide to understanding
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
Mechanical Engineering MATERIALS Selection
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx

3_GO_Olesya_Genetic_AlgorithmsOPTIMZTION.p.pdf

  • 2. 2 Outline z Evolution in biology z Algorithm z Pros and cons z Applications z Example z Software z Matlab toolboxes
  • 3. 3 Evolution in Biology Image from http://www.geo.au.dk/besoegsservice/foredrag/evolution
  • 4. 4 Evolution in Biology I z Organisms produce a number of offspring similar to themselves but can have variations due to: – Mutations (random changes) – Sexual reproduction (offspring have combinations of features inherited from each parent) Images adapted from http://www.wpclipart.com
  • 5. 5 Evolution in Biology II z Some offspring survive, and produce next generations, and some don’t: – The organisms adapted to the environment better have higher chance to survive – Over time, the generations become more and more adapted because the fittest organisms survive Images adapted from http://www.wpclipart.com
  • 6. 6 The Genetic Algorithms Image from http://www.genetic-programming.org
  • 7. 7 The Genetic Algorithms (GA) z Based on the mechanics of biological evolution z Initially developed by John Holland, University of Michigan (1970’s) – To understand processes in natural systems – To design artificial systems retaining the robustness and adaptation properties of natural systems z Holland’s original GA is known as the simple genetic algorithm (SGA) z Provide efficient techniques for optimization and machine learning applications z Widely used in business, science and engineering Image adapted from http://today.mun.ca/news.php?news_id=2376
  • 8. 8 Genetic Algorithms Techniques z GAs are a particular class of evolutionary algorithms. The techniques common to all GAs are: – Inheritance – Mutation – Selection – Crossover (also called recombination) z GAs are best used when the objective function is: – Discontinuous – Highly nonlinear – Stochastic – Has unreliable or undefined derivatives
  • 9. 9 Performance z GAs can provide solutions for highly complex search spaces z GAs perform well approximating solutions to all types of problems because they do not make any assumption about the underlying fitness landscape (the shape of the fitness function, or objective function) z However, GAs can be outperformed by more field- specific algorithms
  • 10. 10 Biological Terminology z Gene – a single encoding of part of the solution space, i.e. either single bits or short blocks of adjacent bits that encode an element of the candidate solution z Chromosome – a string of genes that represents a solution z Population – the number of chromosomes available to test 1 0 1 0 1 1 0 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0 1 1 1 1 0 0 1 0 1 0 1 0 1 1 0 1 0 0 1 0 0 0
  • 11. 11 Biology vs. Optimization z Candidate solutions to the optimization problem play the role of individuals in a population (or chromosomes) z Cost/fitness/objective function determines the environment within which the solutions “live” DNA image from http://static.howstuffworks.com/gif/cell-dna.jpg
  • 12. 12 Features of Genetic Algorithms z Not too fast but cover large search space – Capable of quickly finding promising regions of the search space but may take a relatively long time to reach the optimal solution. Solution: hybrid algorithms z Good heuristics for combinatorial problems z Usually emphasize combining information from good parents (crossover) z Different GAs use different – Representations – Mutations – Crossovers – Selection mechanisms
  • 13. 13 Representation z Chromosomes can be: – Bit strings (0110, 0011, 1101, …) – Real numbers (33.2, -12.11, 5.32, …) – Permutations of element (1234, 3241, 4312, …) – Lists of rules (R1, R2, R3, … Rn …) – Program elements (genetic programming) – Any other data structure 0 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 0 0 1 1 Encoding (representation) Decoding (inverse representation)
  • 14. 14 Representation Example z Generation 0: 4 candidate solutions z Generation N 34.57 ~ “1000010101101” 23.99 ~ “1000001111110”
  • 15. 15 1-Point Crossover z Choose a random point z Split parents at this crossover point z Create children by exchanging tails z Probability of crossover is typically in range (0.6, 0.9) 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 Parents Children
  • 16. 16 Other Crossover Types z Two-point crossover z Uniform crossover: randomly generated mask 0 0 1 1 1 1 1 0 0 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 Parents Children 0 0 1 0 1 1 1 0 0 1 1 1 0 1 0 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 Parents Children 1 1 0 1 0 0 0 1 1 0 Mask:
  • 17. 17 Mutation z Alter each gene independently z Mutation probability is typically in range (1/population_size, 1/chromosome_length) z Choose mutation with the best fit 1 1 0 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 Parent Child (-4.32 2.12 -41.56 9.99) (-4.32 2.12 -43.15 9.99)
  • 18. 18 2 1 4 5 7 1 2 3 3 4 1 2 3 3 4 6 2 1 3 1 Selection z Parents with better fitness have better chances to produce offspring 2 1 4 5 7 1 2 3 3 4 6 2 1 3 1 1 1 2 1 9 2 1 3 3 5 1 2 4 5 7 1 7 3 3 1 6 2 1 1 4 30 27 32 11 2 1 3 3 4 1 2 4 5 7 1 2 3 3 1 6 2 1 3 4 Initial population Selection Crossover Mutation Fitness function – measure of goodness of the candidate solution Mutation can be performed in a way that maximizes fitness function
  • 19. 19 Selection: Roulette Wheel z Better solutions get higher chance to become parents for next generation solutions z Roulette wheel technique: – Assign each individual part of the wheel – Spin wheel N times to select N individuals A B C 3/6=50% 1/6=17% 2/6=33% fitness(A) = 3 fitness(B) = 1 fitness(C) = 2
  • 20. 20 The Basic Genetic Algorithm { % Generate random population of chromosomes Initialize population; % Evaluate the fitness of each chromosome in the population Evaluate population; [Fitness] % Create, accept, and test a new population: while Termination_Criteria_Not_Satisfied { % Select according to fitness Select parents for reproduction; [Selection] % With a crossover probability perform crossover or copy parents Perform crossover; [Crossover] % With a mutation probability mutate offspring at each position in chromosome Perform mutation; [Mutation] Accept new generation; Evaluate population; [Fitness] } }
  • 21. 21 Demo Java Applet z A Java applet demonstrating genetic algorithm in action can be found at: http://cs.felk.cvut.cz/~xobitko/ga/
  • 22. 22 Benefits of Genetic Algorithms z Concept is easy to understand z Modular – separate from application (representation); building blocks can be used in hybrid applications z Supports multi-objective optimization z Good for “noisy” environment z Always results in an answer, which becomes better and better with time z Can easily run in parallel z The fitness function can be changed from iteration to iteration, which allows incorporating new data in the model if it becomes available
  • 23. 23 Issues with Genetic Algorithms z Choosing parameters: – Population size – Crossover and mutation probabilities – Selection, deletion policies – Crossover, mutation operators, etc. – Termination criteria z Performance: – Can be too slow but covers a large search space – Is only as good as the fitness function
  • 25. 25 Applications of Genetic Algorithms z Optimization – numerical and combinatorial optimization problems, e.g. traveling salesman, routing, graph colouring and partitioning z Robotics – trajectory planning z Machine learning – designing neural networks, classification and prediction, e.g. prediction of weather or protein structure, z Signal processing – filter design z Design – semiconductor layout, aircraft design, communication networks z Automatic programming – evolve computer programs for specific tasks, design cellular automata and sorting networks z Economics – development of bidding strategies, emergence of economics markets z Immune systems – model somatic mutations z Ecology – model symbiosis, resource flow z Population genetics – “Under what condition will a gene for recombination be evolutionarily viable?”
  • 26. 26 A Simple Example The traveling salesman problem Find a tour of a given set of cities so that: – Each city is visited only once – The total distance traveled is minimized *An example including results is adapted from [1] Image from http://www.wpclipart.com
  • 27. 27 Representation z Representation is an ordered list of city numbers: 1. Kyiv 2. Budapest 3. Teheran 4. Beijing 5. Jerusalem 6. Bucharest 7. Hamilton 8. Toronto z Possible city lists as candidate solutions: – CityList1 (3 5 7 2 1 6 4 8) – CityList2 (2 5 7 6 8 1 3 4)
  • 28. 28 Crossover Parent1 ( 3 5 7 2 1 6 4 8 ) Parent2 ( 2 5 7 6 8 1 3 4 ) Child ( 5 8 7 2 1 6 3 4 )
  • 29. 29 Mutation Mutation involves reordering of the list: * * Before: (5 8 7 2 1 6 3 4) After: (5 8 6 2 1 7 3 4)
  • 35. 35 Genetic Algorithms References 1. W. Williams, Genetic Algorithms: A Tutorial, http://web.umr.edu/~ercal/387/slides/GATutorial.ppt 2. A. Eiben, J. Smith, Introduction to Evolutionary Computing, Genetic Algorithms, http://www.cs.vu.nl/~jabekker/ec0607/slides/Lectur e03-Chapter3-GeneticAlgorithms.ppt 3. R. Horst and P.M. Pardalos (eds.), Handbook of Global Optimization, Kluwer, Dordrecht 1995. 4. M. Mitchell, An Introduction To Genetic Algorithms, Cambridge, MA: MIT Press, 1996.
  • 37. 37 Genetic Algorithm Software z GENOCOP III – Genetic Algorithm for Constrained Problems in C (by Zbigniew Michalewicz) z DE – Differential Evolution Genetic Algorithm in C and Matlab (by Rainer Storn). DE has won the third place at the 1st International Contest on Evolutionary Computation on a real-valued function testsuite z PGAPack – Parallel Genetic Algorithm in Fortran and C (from Argonne National Laboratory) z PIKAIA – Genetic algorithm in Fortran 77/90 (by Charbonneau, Knapp and Miller) z GAGA – Genetic Algorithm for General Application in C (by Ian Poole) z GAS – Genetic Algorithm in C++ (by Jelasity and Dombi) z GAlib – C++ Genetic Algorithm Library (by Matthew Wall) z Genetic Algorithm in Matlab (by Michael B. Gordy) z GADS – Genetic Algorithm and Direct Search Toolbox in Matlab (from MathWorks) z GEATbx – Genetic and Evolutionary Algorithm Toolbox for Matlab (by Hartmut Pohlheim) z GAOT – Genetic Algorithms Optimization Toolbox in Matlab (by Jeffrey Joines)
  • 38. 38 MathWorks GADS Toolbox z The MathWorks offers Genetic Algorithm and Direct Search Toolbox 2.0.2 z GUI (gatool) and command line tools for setting up problems, algorithm options, and monitoring progress z GA tools, such as creation of initial population, fitness scaling, parent selection, crossover and mutation z Ability to solve optimization problems with nonlinear, linear, and bound constraints z Support for automatic M-code generation
  • 39. 39 Prices z No prices are quoted on the website for this toolbox, have to ask for a quote – Commercial – Academic – Student use z Academic use, individual license: $200 U.S. z Press release: “The Genetic Algorithm and Direct Search Toolbox requires MATLAB and the Optimization Toolbox and is available immediately for Windows, UNIX/Linux, and Macintosh systems. Pricing starts at $700 U.S.” z http://www.mathworks.com/products/gads/index.html
  • 40. 40 Demo 1 z The traveling salesman problem gadsdemostraveling_salesman_demo1.m:
  • 41. 41 Demo 2: Function z Rastrigin’s function : z Global minimum at [0,0] z rastriginsfcn.m
  • 43. 43 GEATbx: Features z Broad class of operators for selection, crossover, mutation operations z Complete support of multi-objective optimization z Supplied with population models z Real, integer, and binary variable representation z Sophisticated visualization z Comfortable monitoring and storing of results z The GEATbx can be completely compiled into C/C++ code using the Matlab Compiler z Author: Hartmut Pohlheim z Can be bought at: http://www.geatbx.com/order.html z Evaluation can be ordered
  • 46. 46 GAOT – GA Optimization Toolbox z Can be downloaded for free at: http://www.ise.ncsu.edu/mirage/GAToolBox/gaot/ z Author: Jaffrey Joines z Real, binary, and order-based epresentations z Paper (the same website): – Description of the toolbox – Numerical results: z Float genetic algorithm (FGA) outperformed binary GA (BGA) and simulated annealing (SA) algorithms in computational efficiency and solution quality z Corana testset: family of parameterized functions, very simple to compute and contain large number of local minima (reminds n-dimensional parabola)
  • 48. 48 GA Software References 1. Arnold Neumaier, Global Optimization Software, http://www.mat.univie.ac.at/~neum/glopt/software_ g.html#ga_codes 2. GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with MATLAB, http://www.geatbx.com/links/ea_matlab.html 3. The MathWorks, Genetic Algorithm and Direct Search Toolbox, http://www.mathworks.com/products/gads/ 4. GAOT – Genetic Algorithm Optimization Toolbox http://www.ise.ncsu.edu/mirage/GAToolBox/gaot/