You are on page 1of 30

Simple Genetic Algorithms

General idea of Genetic Algorithms


Components of a GA
A problem to solve, and ...
• Encoding technique (gene, chromosome)
• Initialization procedure (creation)
• Evaluation function (environment)
• Selection of parents (reproduction)
• Genetic operators (mutation, recombination)
• Parameter settings (practice and art)
Simple Genetic Algorithm
{
initialize population;
evaluate population;
while TerminationCriteriaNotSatisfied
{
select parents for reproduction;
perform recombination and mutation;
evaluate population;
}
}
Encoding
Roulette wheel selection
The most commonly used chromosome selection
techniques is the roulette wheel selection.

100 0
X1: 16.5%
X2: 20.2%
75.2 X3: 6.4%
X4: 6.4%
X5: 25.3%
36.7 X6: 24.8%
49.5 43.1
Example 2:

Suppose that the size of the chromosome population


N is 6, the crossover probability pc equals 0.7, and
the mutation probability pm equals 0.001. The
fitness function in our example is defined by

f(x) = 15 x – x2
The fitness function and chromosome locations
Chromosome Chromosome Decoded Chromosome Fitness
label string integer fitness ratio, %
X1 1 1 00 12 36 16.5
X2 0 1 00 4 44 20.2
X3 0 0 01 1 14 6.4
X4 1 1 10 14 14 6.4
X5 0 1 11 7 56 25.7
X6 1 0 01 9 54 24.8
60 60
f(x)
50 50

40 40

30 30

20 20

10 10

0 0
0 5 10 15 0 5 10 15
x x
(a) Chromosome initial locations. (b) Chromosome final locations.
100 0
X1: 16.5%
X2: 20.2%
75.2 X3: 6.4%
X4: 6.4%
X5: 25.3%
36.7 X6: 24.8%
49.5 43.1
Crossover

X6i 1 0 00 1 0 1 00 00 X2i

X1i 0 11 00 00
1 0 11 11 11 X5i

X2i 0 1 0 0 0 1 1 1 X5i
Mutation
X6'i 1 0 0 0

X2'i 0 1 0 10

X1'i 10 1 1 1 1 1 X1"i

X5'i 0 1 01 01

X2i 0 1 0 0 1 0 X2"i

X5i 0 1 1 1
The genetic algorithm cycle

C rossover
Generation i
X1i 1 1 0 0 f = 36 X6i 1 0 00 1 0 1 00 00 X2i
X2i 0 1 0 0 f = 44
X3i 0 0 0 1 f = 14
X4i 1 1 1 0 f = 14 X1i 0 11 00 00
1 0 11 11 11 X5i
X5i 0 1 1 1 f = 56
X6i 1 0 0 1 f = 54
X2i 0 1 0 0 0 1 1 1 X5i
Generation (i + 1)
X1i+1 1 0 0 0 f = 56 Mutation
X2i+1 0 1 0 1 f = 50 X6'i 1 0 0 0
X3i+1 1 0 1 1 f = 44
X2'i 0 1 0 1
0
X4i+1 0 1 0 0 f = 44
X1'i 1
0 1 1 1 1 1 X1"i
X5i+1 0 1 1 0 f = 54
X6i+1 0 1 1 1 f = 56 X5'i 0 1 0
1 0
1

X2i 0 1 0 0 1 0 X2"i

X5i 0 1 1 1
Report
Optimal power dispatch to achieve minimum cost
C =  + *P + *P2

cost = [500 5.3 0.004


400 5.5 0.006
200 5.8 0.009]
mwlimits=[200 450
150 350
100 225]
Pdt = 975 MW

You might also like