Professional Documents
Culture Documents
Introduction To GA and SGA
Introduction To GA and SGA
Introduction To GA and SGA
Components of EC:
Genetic Algorithms
Genetic Programming
Particle Swarm Optimization (PSO)
Ant Colony Algorithms
11/25/17 GA 2
Genetic Algorithms (GAs)
• Definition:
Randomized Search and Optimization
technique guided by the Principles of Natural
Genetics.
• Natural selection : Survival of the fittest
• Natural reproduction
11/25/17 GA 3
Randomized Search
11/25/17 GA 4
Classes of Search Techniques
Search techniques
Direct methods Indirect methods Evolutionary algorithms Simulated annealing Dynamic programming
Parallel Sequential
11/25/17 GA 6
Search Techniques (contd.)
Enumerative Techniques:
look at objective function values at every point in
the search space
– dynamic programming – n points
11/25/17 GA 7
GAs: A quick Overview
11/25/17 GA 8
Why GAs
• Most of the real life problems are very complex and can not be
solved in polynomial time using a deterministic algorithm.
11/25/17 GA 9
TSP example
Problem:
Given n cities
Find a complete tour with
minimal length/cost
Computation Time ??
NP-Hard Problem
11/25/17 GA 10
Why GAs (contd.)
• Not limited by restrictive assumptions about the
search space
– Continuity
– Existence of derivative
– Uni-modality and local minima
• Robust search in complex space
– Balance between efficiency and efficacy (flexibility of
biological system necessary for survival in many different
situations)
11/25/17 GA 11
Why GAs (contd.)
• Efficiently exploit historical information to speculate on new search
points with expected improved performance : nature is full of
precedents
11/25/17 GA 12
GAs
11/25/17 GA 13
Why GAs (contd.)
• Always an answer/solution; answer gets better with time
empirically proved to be convergent
• Inherently parallel; easily distributed
• Supports multi-objective optimization
• Modular
• Finally, the power of GAs comes from simple concepts;
easy to understand
11/25/17 GA 14
Features of GAs
• Optimization Technique
11/25/17 GA 15
GAs vs. Nature
11/25/17 GA 16
Simple Genetic Algorithm (SGA)
11/25/17 GA 17
I–nitialize Population
GA Flowchart
– Evaluate Fitness
Yes
– Terminate? –
Output
solution
No
Perform selection,
–
crossover and mutation
– Evaluate Fitness
11/25/17 GA 18
Encoding and Population
• Encoding: A chromosome encodes a solution in the search space
– Usually binary string of 0’s and 1’s
– Each bit in the string can represent some characteristics of the
solution
– Chromosome size depends on parameter set to be encoded
• Population:
– A set of chromosomes in a population
– Population size is usually constant
– Common practice is to choose the initial population randomly.
11/25/17 GA 19
Chromosome Size
Chromosome: A set of alleles/genes
A chromosome is an encoded form of all parameters describing the
given problem
An encoded parameter – A subset of alleles
Chromosome size = ??
An allele parameter n
A Chromosome
11/25/17 GA 20
Population
string 1
string 2
A population –
string m
11/25/17 GA 21
Fitness Evaluation
• Fitness (objective function) associated with each
chromosome
• Indicates the degree of goodness of the encoded solution
(chromosome)
• only problem specific information (also known as the
payoff information) that GAs use
• for minimization problem
fitness ∝ 1/objective
11/25/17 GA 22
Selection (Reproduction)
• A process in which individual strings are copied according
to their objective function or fitness values : Darwin’s
survival of fittest
• Better individuals get higher chance
– more copies to good strings
– fewer copies to bad strings
• Mimics the natural selection procedure to some extent
• Implementation:
• Proportional selection :
• Roulette wheel selection
• Tournament selection etc.
11/25/17 GA 23
Roulette Wheel Selection
1/6 = 17%
fitness(A) = 3
A B fitness(B) = 1
– C fitness(C) = 2
3/6 = 50% 2/6 = 33%
11/25/17 GA 24
Elitist Model of GAs
11/25/17 GA 25
Crossover
• Partial exchange of information between two
randomly selected parent chromosome
• Single point crossover : most commonly
used
• Probabilistic operation, µc
11/25/17 GA 26
Single point Crossover (example)
Crossover point
11/25/17 GA 27
n-point crossover
11/25/17 GA 28
Mutation
• Random alteration in the genetic structure
• Mutating a binary gene : simple negation of the
bit
• Probabilistic operation : alter each gene
independently with a probability pm
• Exploring the search area : new search points
• Introduce genetic diversity into the population
11/25/17 GA 29
Mutation (example)
Before mutation
After mutation
11/25/17 GA 30
Exploitation vs. Exploration
• Exploration: Discovering promising areas in the search space, i.e.
gaining information on the problem – new search points
• Exploitation: Optimizing within a promising area, i.e. using
information - Exploit historical information: survival of the fittest
co-operation AND competition between them
• Crossover is explorative, it makes a big jump to an area somewhere “in
between” two (parent) areas
• Mutation is exploitative as well as explorative, it creates random small
diversions, thereby staying near (in the area of ) the parent
• Selection is totally exploitive
11/25/17 GA 31
An example of SGA (Goldberg)
11/25/17 GA 32
x2 example (contd.) : Selection
11/25/17 GA 33
x2 example (contd.) :Crossover
11/25/17 GA 34
x2 example (contd.) :Mutation
11/25/17 GA 35
Shortcomings of SGA
11/25/17 GA 36
Parameters
• Population size : usually fixed
• String/chromosome length : usually fixed
• Crossover probability : (µc)
• Mutation probability : (µm)
µc >> µm
• Termination criteria :
– desired fitness, if possible (known)
– generally a maximum number of iterations
11/25/17 GA 37
Termination Criterion
The cycle of GA-operators (selection, crossover and
mutation) is repeated a number of times till :
– A desired objective function value is attained in any string/
chromosome of the population
or
– The average fitness value of a population becomes more or less
constant over a specified number of generations
or
– The number of generations/iterations is greater than some
pre-specified value.
11/25/17 GA 38
TSP representation
CityList1 (3 5 7 2 1 6 4 8)
CityList2 (2 5 7 6 8 1 3 4)
11/25/17 GA 39
Crossover
Crossover combines inversion and
recombination:
* *
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)
11/25/17 GA 40
Mutation
* *
Before: (5 8 7 2 1 6 3 4)
– –
After: (5 8 6 2 1 7 3 4)
11/25/17 GA 41
TSP30 - Overview of Performance
1800
1600
1400
1200
Distance
1000
800
600
400
200
0 Best
11
13
15
17
19
21
23
25
27
29
31
1
3
5
7
Worst
Generations (1000)
Average
11/25/17 GA 42
??
• Why not a bad chromosome is totally
eliminated ?
• Mutation is mandatory?
• Population size : Population size is a critical factor
to determine.
– Large : time vs. diversity
– Too small : converge to local optima
11/25/17 GA 43
??
• Total execution time T(approx) ?
I + n ??
given : n = no. of iterations (no. of generations)
p = population size (no. of chromosome)
d = decoding time of the parameters (from chromosome
representation to actual problem/function domain)
E = time to execute the function (problem to be optimized)
to calculate its output/result from the decoded parameters
F = time to calculate the fitness of the function/output/result
I = time to generate initial population
11/25/17 GA 44
Some GA Application Types
11/25/17 GA 45
Conclusion
11/25/17 GA 46
Discussion
??
11/25/17 GA 47
Thanks !
11/25/17 GA 48