GA EncodingTechniques TSPexample
GA EncodingTechniques TSPexample
1 Encoding
2 Convergence test
3 Mating pool
4 Fitness Evaluation
5 Crossover
6 Mutation
7 Inversion
1 Encoding
2 Convergence test
3 Mating pool
4 Fitness Evaluation
5 Crossover
6 Mutation
7 Inversion
For example:
Encoding Scheme
Tree encoding
1 Individual
2 Population
Genotype
Phenotype
a b c 1 0 1 2 9 6 7 $ α β..................
Chromosome
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 01.03.2016 7 / 42
Individual Representation :Phenotype and
Genotype
Note :
A: 0 1 1 0 0 1 0 1 0 1 0 1 0 1 1 1 1 0 Individual 1
B: 0 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 0 0 Individual 2
There are n items, each item has its own cost (ci ) and weight (wi ).
Maximize :
P
i ci ∗ wi ∗ xi
Subject to
P
xi ∗ wi ≤ W
where xi ∈ [0 · · · 1]
The encoding for the 0-1 Knapsack, problem, in general, for n items
set would look as follows.
Genotype :
1 2 3 4 ..... n-1 n
.....
Phenotype :
0 1 0 1 1 0 1 0 1 0 1 0 1. . . . . .1 0 1
A binary string of n-bits
Genotype :
Phenotype :
01101
A binary string of 5-bits
Genotype :
x y
Phenotype :
01101 11001
Two binary string of 5-bits each
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 01.03.2016 15 / 42
Order Encoding
TSP
- Visit all the cities
- One city once only
- Starting and ending city is the same
d A B C D E 6
2 4
A 0 2 6 4
B 2 0 7 5
5 D
C 7 0 3 1 B
E
D 6 3 0 3
7
E 4 5 1 0
d= Distance matrix C
Minimizing
Pn−2
cost = i=0 d(ci , ci+1 ) + d(cn−1 , c0 )
Subject to
P = [c0 , c1 , c2 , · · · , cn−1 , c0 ]
where ci ∈ X ;
Here, P is an ordered collection of cities and ci 6= cj such that
∀i, j = 0, 1, · · · , n − 1
Note: P represents a possible tour with the starting cities as c0 .
and
X = x1 , x2 , · · · , xn , set of n number of cities,
d(xi , xj ) is the distance between any two cities xi and xj .
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 01.03.2016 25 / 42