Professional Documents
Culture Documents
R.K. Bhattacharjya/CE/IITG
References
2
R.K. Bhattacharjya/CE/IITG
D. E. Goldberg, Genetic Algorithm In Search, Optimization And Machine Learning, New York: Addison Wesley (1989) John H. Holland Genetic Algorithms, Scientific American Journal, July 1992. Kalyanmoy Deb, An Introduction To Genetic Algorithms, Sadhana, Vol. 24 Parts 4 And 5.
7 November 2013
Introduction to optimization
3
R.K. Bhattacharjya/CE/IITG
Global optima
Local optima
Local optima
7 November 2013
Introduction to optimization
4
7 November 2013
Genetic Algorithms
5
R.K. Bhattacharjya/CE/IITG
Genetic Algorithms are the heuristic search and optimization techniques that mimic the process of natural evolution.
7 November 2013
R.K. Bhattacharjya/CE/IITG
7 November 2013
An Example.
7
R.K. Bhattacharjya/CE/IITG
An Example.
8
R.K. Bhattacharjya/CE/IITG
This longer necks may have due to the effect of mutation initially. However as it was favorable, this was propagated over the generations.
7 November 2013
Evolution of species
9
R.K. Bhattacharjya/CE/IITG
Millions Of Years
Evolved Species
7 November 2013
10
R.K. Bhattacharjya/CE/IITG
Thus genetic algorithms implement the optimization strategies by simulating evolution of species through natural selection
7 November 2013
R.K. Bhattacharjya/CE/IITG
T=0
Optimum Solution?
NO
Selection Crossover
7 November 2013 Mutation
YES
T=T+1
Stop
R.K. Bhattacharjya/CE/IITG
function sga () {
Initialize population; Calculate fitness function; While(fitness value != termination criteria) { Selection; Crossover; Mutation; Calculate fitness function;
} }
7 November 2013
R.K. Bhattacharjya/CE/IITG
7 November 2013
Selection
14
R.K. Bhattacharjya/CE/IITG
The process that determines which solutions are to be preserved and allowed to reproduce and which ones deserve to die out. The primary objective of the selection operator is to emphasize the good solutions and eliminate the bad solutions in a population while keeping the population size constant. Selects the best, discards the rest
7 November 2013
R.K. Bhattacharjya/CE/IITG
Identify the good solutions in a population Make multiple copies of the good solutions Eliminate bad solutions from the population so that multiple copies of good solutions can be placed in the population Now how to identify the good solutions?
7 November 2013
Fitness function
16
R.K. Bhattacharjya/CE/IITG
7 November 2013
R.K. Bhattacharjya/CE/IITG
Considering c = 0.0654
23
d
7 November 2013
Selection operator
18
R.K. Bhattacharjya/CE/IITG
There are different techniques to implement selection in Genetic Algorithms. They are: Tournament selection Roulette wheel selection Proportionate selection Rank selection Steady state selection, etc
7 November 2013
Tournament selection
19
R.K. Bhattacharjya/CE/IITG
In tournament selection several tournaments are played among a few individuals. The individuals are chosen at random from the population. The winner of each tournament is selected for next generation. Selection pressure can be adjusted by changing the tournament size. Weak individuals have a smaller chance to be selected if tournament size is large.
7 November 2013
Tournament selection
20
R.K. Bhattacharjya/CE/IITG 22 22 13 +30 32 32 40 22 Best solution will have two copies 7 +45 25 25 13 +30 7 +45 13 +30 Worse solution will have no copies Other solutions will have two, one or zero copies
7 November 2013
32 25 25
Selected
22 32 25 22 13 +30
40 22 25
21
AC 2 0 1 1 1 1 6
Roulet wheel
2 3% 5 21%
3 21% 4 18%
7 November 2013
Rank selection
22
Chrom # Fitness 1 37 3 36 5 36 4 30 6 28 2 6
Assign raking
Chrom # Rank 6 1 5 3 4 5 4 3 2 6 1 2 AC 2 1 1 1 1 0
Roulette wheel
In this method, a few good chromosomes are used for creating new offspring in every iteration.
Then some bad chromosomes are removed and the new offspring is placed in their places
R.K. Bhattacharjya/CE/IITG The rest of population migrates to the next generation without going through the selection process.
Good
New offspring
Good
Bad
New offspring
7 November 2013
R.K. Bhattacharjya/CE/IITG The crossover operator is used to create new solutions from the existing solutions available in the mating pool after applying selection operator. This operator exchanges the gene information between the solutions in the mating pool.
Encoding of solution is necessary so that our solutions look like a chromosome Source: http://www.biologycorner.com/bio1/celldivision-chromosomes.html
7 November 2013
Encoding
25
R.K. Bhattacharjya/CE/IITG
The process of representing a solution in the form of a string that conveys the necessary information. Just as in a chromosome, each gene controls a particular characteristic of the individual, similarly, each bit in the string represents a characteristic of the solution.
7 November 2013
Encoding Methods
26
R.K. Bhattacharjya/CE/IITG
Most common method of encoding is binary coded. Chromosomes are strings of 1 and 0 and each position in the chromosome represents a particular characteristic of the problem
Decoded value
52
26
Encoding Methods
27
R.K. Bhattacharjya/CE/IITG
Defining a string
[0100001010] d h
7 November 2013
Crossover operator
28
R.K. Bhattacharjya/CE/IITG The most popular crossover selects any two solutions strings randomly from the mating pool and some portion of the strings is exchanged between the strings. Solution 1 The selection point is selected randomly. A probability of crossover is also introduced in order to give freedom to an individual solution string to determine whether the solution would go for crossover or not.
Binary Crossover
29
R.K. Bhattacharjya/CE/IITG
Mutation operator
30
R.K. Bhattacharjya/CE/IITG
Mutation is the occasional introduction of new features in to the solution strings of the population pool to maintain diversity in the population. Though crossover has the main responsibility to search for the optimal solution, mutation is also used for this purpose.
Before mutation
After mutation
7 November 2013
Binary Mutation
31
R.K. Bhattacharjya/CE/IITG
Mutation operator changes a 1 to 0 or vise versa, with a mutation probability of . The mutation probability is generally kept low for steady convergence. A high value of mutation probability would search here and there like a random search technique.
7 November 2013
Elitism
32
R.K. Bhattacharjya/CE/IITG
Crossover and mutation may destroy the best solution of the population pool Elitism is the preservation of few best solutions of the population pool Elitism is defined in percentage or in number
7 November 2013
R.K. Bhattacharjya/CE/IITG
Nature
Population Individual Fitness Chromosome Gene
Computer
Set of solutions Solution to a problem Quality of a solution Encoding for a solution Part of the encoding solution
7 November 2013
An example problem
34
R.K. Bhattacharjya/CE/IITG
Consider 6 bit string to represent the solution, then 000000 = 0 and 111111 =
7 November 2013
An example problem
35
R.K. Bhattacharjya/CE/IITG Calculate real Calculate objective value function value Calculate relative fitness value Calculate fitness value
Fitness calculation
DV
x value
Actual count 2 1 0 1
37 0.587 0.96 0.96 12 46 0.19 0.56 0.56 0.73 0.75 0.75 Avg 0.563 Max 0.96 58 0.921 0.25 0.25
Matting pool
Crossover: Single point Sol No Matting CS pool 1 2 3 4 100101 001100 100101 101110 3 3 2 2 New Binary String 100100 001101 101110 100101 DV x value 0.57 0.21 0.73 0.59 f F
36 13 46 37
7 November 2013
R.K. Bhattacharjya/CE/IITG
Mutation Sol No Population Population after crossover after mutation 100100 001101 101110 100101 100000 101101 100110 101101 DV x value 0.51 0.71 0.60 0.71 f F
1 2 3 4
32 45 38 45
7 November 2013
R.K. Bhattacharjya/CE/IITG
7 November 2013
R.K. Bhattacharjya/CE/IITG
Choose initial population Assign a fitness function Perform elitism Perform selection Perform crossover Perform mutation
R.K. Bhattacharjya/CE/IITG
C1 C2
8 2
6 9
4 3
8 7
9 6
7 November 2013
R.K. Bhattacharjya/CE/IITG
Linear Crossover Parents: (x1,,xn ) and (y1,,yn ) Select a single gene (k) at random Three children are created as,
R.K. Bhattacharjya/CE/IITG
( x1 , ..., xk , yk + (1 ) xk , ..., xn )
reverse for other child. e.g. with = 0.5
0.5 0.7 0.7 0.5 0.2 0.5 0.3 0.9 0.4 0.1 0.3 0.1 0.3 0.7 0.5 0.5 0.1 0.2
7 November 2013
0.5 0.7 0.7 0.5 0.2 0.8 0.3 0.9 0.4 0.1 0.3 0.1 0.3 0.7 0.2 0.5 0.1 0.2
R.K. Bhattacharjya/CE/IITG
( x , ..., x , y + (1 ) x , ..., y + (1 ) x ) 1 k k +1 k +1 n n
0.5 0.7 0.7 0.5 0.2 0.8 0.3 0.9 0.4 0.1 0.3 0.1 0.3 0.7 0.2 0.5 0.1 0.2
R.K. Bhattacharjya/CE/IITG
x + (1 ) y
reverse for other child. e.g. with = 0.5
0.3 0.5 0.4 0.4 0.4 0.5 0.4 0.5 0.3 0.3 0.5 0.4 0.4 0.4 0.5 0.4 0.5 0.3
7 November 2013
0.5 0.7 0.7 0.5 0.2 0.8 0.3 0.9 0.4 0.1 0.3 0.1 0.3 0.6 0.2 0.5 0.1 0.2
R.K. Bhattacharjya/CE/IITG
Where, a random number is a parameter that controls the crossover process. A high value of the parameter will create near-parent solution
7 November 2013
Random mutation
46
R.K. Bhattacharjya/CE/IITG
Where
R.K. Bhattacharjya/CE/IITG
Where
7 November 2013
Polynomial mutation
48
R.K. Bhattacharjya/CE/IITG
= 1 2 1
If < 0.5
If 0.5
7 November 2013
Multi-modal optimization
49
R.K. Bhattacharjya/CE/IITG
7 November 2013
R.K. Bhattacharjya/CE/IITG
7 November 2013
Multi-modal optimization
51
R.K. Bhattacharjya/CE/IITG
Simple modification of Simple Genetic Algorithms can capture all the optimal solution of the problem including global optimal solutions Basic idea is that reduce the fitness of crowded solution, which can be implemented using following three steps.
Sharing function
Hand calculation
52
R.K. Bhattacharjya/CE/IITG
Maximize
Sol 1 2 3 4 5 6 String 110100 101100 011101 001011 110000 101110 Decoded value 52 44 29 11 48 46 x 1.651 1.397 0.921 0.349 1.524 1.460 f 0.890 0.942 0.246 0.890 0.997 0.992
7 November 2013
Distance table
53
R.K. Bhattacharjya/CE/IITG
dij 1 2 3 4 5 6
7 November 2013
R.K. Bhattacharjya/CE/IITG
sh(dij) 1 2 3 4 5 6
3 0 0.048 1 0 0 0
4 0 0 0 1 0 0
7 November 2013
R.K. Bhattacharjya/CE/IITG
Sol 1 2 3 4 5 6
Decoded value 52 44 29 11 48 46
nc
f 2.856 0.312 3.160 0.300 1.048 0.235 1.000 0.890 3.364 0.296 3.364 0.295
7 November 2013
56
7 November 2013
Evolutionary Strategies
57
R.K. Bhattacharjya/CE/IITG
ES use real parameter value ES does not use crossover operator It is just like a real coded genetic algorithms with selection and mutation operators only
7 November 2013
R.K. Bhattacharjya/CE/IITG
In each iteration one parent is used to create one offspring by using Gaussian mutation operator
7 November 2013
R.K. Bhattacharjya/CE/IITG
Step1: Choose a initial solution and a mutation strength Step2: Create a mutate solution
Step 3: If , replace with Step4: If termination criteria is satisfied, stop, else go to step 2
7 November 2013
R.K. Bhattacharjya/CE/IITG
7 November 2013
R.K. Bhattacharjya/CE/IITG
A mutation is defined as successful if the mutated offspring is better than the parent solution. If is the ratio of successful mutation over n trial, Schwefel (1981) suggested a factor in the following update rule
7 November 2013
Matlab code
62
R.K. Bhattacharjya/CE/IITG
7 November 2013
63
7 November 2013
R.K. Bhattacharjya/CE/IITG
5 4.5 4
10 0
0 10
20 0
50 50
3.5 3
10 0
20
10
20 0
0 10
1
20
50
5
5
50
10
20
2 10 20
50
20
20 0
10 0
10 0
20 0
0.5
1.5
2.5 X
3.5
4.5
20 0
7 November 2013
Multimember ES
65
R.K. Bhattacharjya/CE/IITG
ES Step1: Choose an initial population of and mutation strength Step2: Create mutated solution solutions
Step3: Combine and , and choose the best solutions Step4: Terminate? Else go to step 2
7 November 2013
Multimember ES
66
R.K. Bhattacharjya/CE/IITG
ES
Through selection
Through mutation
7 November 2013
Multimember ES
67
R.K. Bhattacharjya/CE/IITG
ES
Offspring
Through selection
Through mutation
7 November 2013
Multi-objective optimization
68
R.K. Bhattacharjya/CE/IITG
Comfort
Price
7 November 2013
Multi-objective optimization
69
R.K. Bhattacharjya/CE/IITG
7 November 2013
Multi-objective optimization
70
R.K. Bhattacharjya/CE/IITG
More than one objectives Objectives are conflicting in nature Dealing with two search space
Decision variable space Objective space
Unique mapping between the objectives and often the mapping is non-linear Properties of the two search space are not similar Proximity of two solutions in one search space does not mean a proximity in other search space
7 November 2013
Multi-objective optimization
71
R.K. Bhattacharjya/CE/IITG
7 November 2013
R.K. Bhattacharjya/CE/IITG
P1 P2 P3 P4 Pn New population
7 November 2013
Mating pool
R.K. Bhattacharjya/CE/IITG
Suppose is the number of sub-population and is the non-dominated solutions. Then total reduction is .
This can be implemented by subtracting from the dominated solution fitness value
The total reduction is then redistributed among the non-dominated solution by adding an amount / This method has two main implications Non-dominated solutions are given more importance Additional equal emphasis has been given to all the non-dominated solution
7 November 2013
R.K. Bhattacharjya/CE/IITG
Niche count
Modified fitness
7 November 2013
R.K. Bhattacharjya/CE/IITG
60
4.5
50
4
3.5
40
x2
2.5
30
f2
20
1.5
10
0.5
0 0.1
0 0.1
0.2 0.3 0.4 0.5 x1 0.6 0.7 0.8 0.9 1
0.2
0.3
0.4
0.5 f1
0.6
0.7
0.8
0.9
Solution space
Objective space
7 November 2013
Maximize f2
Maximize f1
R.K. Bhattacharjya/CE/IITG
Fonseca and Fleming (1993) first introduced multiple objective genetic algorithm (MOGA) The assigned fitness value based on the non-dominated ranking. The rank is assigned as = 1 + where is the ranking of the solution and is the number of solutions that dominate the solution.
1 4 1 1 4 1
7 November 2013
R.K. Bhattacharjya/CE/IITG
Fonseca and Fleming (1993) maintain the diversity among the non-dominated solution using niching among the solution of same rank. The normalize distance was calculated as,
7 November 2013
NSGA
79
R.K. Bhattacharjya/CE/IITG
Srinivas and Deb (1994) proposed NSGA The algorithm is based on the non-dominated sorting. The spread on the Pareto optimal front is maintained using sharing function
7 November 2013
NSGA II
80
R.K. Bhattacharjya/CE/IITG
7 November 2013
Non-dominated sorting
81
R.K. Bhattacharjya/CE/IITG
1
4 Feasible Region
Objective 2 (Minimize)
5 4 6 2 3
Objective 2 (Minimize) 1 2 3
Infeasible Region
Objective 1 (Minimize)
Objective 1 (Minimize)
7 November 2013
R.K. Bhattacharjya/CE/IITG 1 +1
Objective 2
Cd, the crowded distance is the perimeter of the rectangle constituted by the two neighboring solutions Cd value more means that the solution is less crowded Cd value less means that the solution is more crowded
Objective 1
7 November 2013
R.K. Bhattacharjya/CE/IITG
If they have the same rank, but has a better crowding distance than , i.e. = and > .
7 November 2013
P
84
Selected Rejected
Q
Non dominated sorting
85
No
Crossover
Termination Criteria?
Yes
Pareto-optimal solution
Non-dominating ranking on the combined population Calculate crowding distance of all the solutions Get the N member from the combined population on the basis of rank and crowding distance Replace parent population by the better members of the combined population
7 November 2013
Constraints handling in GA
86
R.K. Bhattacharjya/CE/IITG
55 45 35
f(X)
25 15 5 -5 0 2 4 6 8 10 12
()
7 November 2013
Constraints handling in GA
87
R.K. Bhattacharjya/CE/IITG
55 45 35
f(X)
25 15 5 -5 0 2 4 6 8 10 12
()
7 November 2013
Constraints handling in GA
88
R.K. Bhattacharjya/CE/IITG
55 45 35
f(X)
25 15 5 -5 0 2 4 6 8 10 12
()
7 November 2013
Constrain handling in GA
89
R.K. Bhattacharjya/CE/IITG
Minimize
= 0
= 1,2,3, ,
= 1,2,3, ,
= +
If is feasible Otherwise
7 November 2013
90
R.K. Bhattacharjya/CE/IITG
THANKS
7 November 2013