Professional Documents
Culture Documents
Basic Terminologies in GA
An Individual: An individual is a single solution while
population is the set of individuals
Genes: They are the basic instructions for building GA. A
gene is a bit string of arbitrary lengths
Fitness: The fitness of an individual in GA is the value of
an objective function. The fitness function not only
indicates how good the solution is but also corresponds
to how close the chromosome is to the optimal one
Simple GA
Start with the randomly generated solution
Calculate the fitness of each chromosome in the
population
Repeat the following steps until n offsprings have been
created
Select a pair of parent chromosomes from the current population
With crossover probability Pc, the pair is chosen to form two offsprings
at randomly
Mutate the two offsprings
Operators in GA
Encoding: It is a process of representing individual
genes. This process can be performed using bits,
numbers,lists etc.The most common way of encoding is
a binary string.
Selection: It is a process of choosing two parents from
the population for crossing
After deciding on an encoding, the next step is to decide
how to perform selection i.e how to choose individuals
from the population that will create offspring for next
generation and how many offsprings. According to
Darwins theory of evolution, the best ones survive to
create new offspring
10110 010
parent2
10101 111
child1
10110 111
child2
10101 010
parent
10110101
child
11110001
Parent
10110101
Mutation
chromosome
10001001
child
0011 1100
Flipping
parent
10110011
child
10110110
Reversing
Solution
Step1). To start, select initial population at random. Here a population
of 4 is chosen
String No
Initial
population
X value
Fitness
prob
01100
12
144
0.1247 12.47
0.4987 1
11001
25
625
0.5411
2.1645 2
00101
25
0.0216 2.16
0.0866 0
10011
19
361
0.3126 31.26
1.2502 1
sum
1155
1.000
100
4.000
Average
288.75 0.25
25
1.000
Maximum
625
54.11
2.1645
0.5411
% prob
54.11
Expected
count
Actual
count
Roulette wheel
31.26%
12.47%
2.16%
54.11%
Mating
pool
Cross over
point
Offspring
after
crossover
X value
Fitness
value
01100
01101
13
169
11001
11000
24
576
11001
11011
27
729
10011
10001
17
289
sum
1763
average
440.75
maximum
729
String no
offspring
Mutation
chromosome
New
offspring
X value
fitness
01101
10000
11101
29
841
1 1 0 00
00000
11000
24
576
11011
00000
11 0 1 1
27
729
10001
00100
10100
20
400
Sum
2546
Average
636.5
Maximum
841