Introduction to Genetic Algorithm

Introduction to Genetic Algorithm
Principle: survival-of-the-fitness
Characteristics of GA




Robust
Error-tolerant
Flexible
When you have no idea about solving
problems…
Population
Crossover Crossover
Mutation
Fitness
Selection
Mutation
...........
Component of Genetic Algorithm
Representation
Genetic operations:

Crossover, mutation,inversion, as you wish
Selection

Elitism, total, steady state,…as you wish
Fitness

Problem dependent
Everybody has different survival approaches.
How to implement a GA ?
Representation
Fitness
Operators design
Selection strategy
Example(I)
Maximize
f ( x)  (2 x  4 x )  sin( x)  cos( x)  tan( x)
2
3
10  x  10
-500
-1000
-1500
-2000
-2500
9.8
9.2
8
8.6
7.4
6.8
6.2
5.6
5
4.4
3.8
3.2
2.6
2
1.4
0.8
0.2
-1
-0
.4
-1
.6
-2
.2
-2
.8
-4
-3
.4
-4
.6
-5
.2
-5
.8
-7
-6
.4
-7
.6
-8
.2
-1
0
-9
.4
-8
.8
2500
2000
1500
1000
500
0
Example(I): Representation
Standard GA binary string



x = 5,  x = 101
x = 3.25 x = 011.1
…
Something noticeable


Length is predefined.
Not the only way.
chromosome
gene
Example(I): Fitness function
In this case, it is known already
Example(I): Genetic Operator
Standard crossover (one-point crossover)
Example(I): Genetic Operator
Standard mutation (point mutation)
Randomly
Randomly
Example(I): Selection
Standard selection (roulette wheel)
Population
Crossover Crossover
Mutation
Fitness
Selection
Mutation
...........
-500
-1000
-1500
-2000
-2500
9.8
9.2
8
8.6
7.4
6.8
6.2
5.6
5
4.4
3.8
3.2
2.6
2
1.4
0.8
0.2
-1
-0
.4
-1
.6
-2
.2
-2
.8
-4
-3
.4
-4
.6
-5
.2
-5
.8
-7
-6
.4
-7
.6
-8
.2
-1
0
-9
.4
-8
.8
2500
2000
1500
1000
500
0
Example(II)
Minimize
n
f ( x)   xi sin( xi )
i 1
 500  xi  500
繪圖中
嘿嘿~~畫不出來
Example(II): Representation
Standard GA binary string

Too complex
Intuitively

Real numbered coding
( x1 , x2 ,..., xn )  (18.5, 13, ..., 9.77)
Example(II): Fitness function
In this case, it is known already
Example(II): Genetic Operator
Standard crossover (multi-point crossover)
0.3, 0.7, 1.2, 3.5, -9.87, 2.334, 34
0.1, 0.3, -1 , 2.5, 1.33, 0.434, 9
0.1, 0.3, 1.2, 3.5, 1.33, 0.434, 9
0.3, 0.7, -1 , 2.5, -9.87, 2.334, 34
Example(II): Genetic Operator
Standard mutation (multi-point mutation)
0.3, 0.7, 1.2, 3.5, -9.87, 2.334, 34
Cauchy
Gaussian
0.3, 0.7, 0.9, 3.5, -9.87, 2.557, 34
Example(II): Selection
Standard selection (rank selection)
Comparing Two Selection
Population
Crossover Crossover
Mutation
Fitness
Selection
Mutation
...........