You are on page 1of 26

Evolutionary Computation

Two variable function


Extracted from Book Artificial
Intelligence by Negnevitsky
Addison Wesley 2005

Genetic algorithms: case study


Suppose it is desired to find the maximum of the
peak function of two variables:
2 x 2 ( y 1) 2

f ( x, y ) (1 x ) e

(x x y ) e

x2 y 2

where parameters x and y vary between 3 and 3.


The first step is to represent the problem variables
as a chromosome parameters x
and y as a
concatenated
binary string:

1 0 0 0 1 0 1 0 0 0 1 1 1 0 1 1
x

We also choose the size of the chromosome


population, for instance 6, and randomly
generate
an initial population.
The next step is to calculate the fitness of each
chromosome. This is done in two stages.
First, a chromosome, that is a string of 16 bits, is
partitioned into two 8-bit strings:
1 0 0 0 1 0 1 0

and

0 0 1 1 1 0 1 1

Then these strings are converted from binary


(base 2) to decimal (base 10):
(10001010 ) 2 1 27 0 26 0 2 5 0 2 4 1 23 0 2 2 1 21 0 2 0 (138)10

and
(00111011 ) 2 0 2 7 0 2 6 1 25 1 2 4 1 2 3 0 2 2 1 21 1 2 0 (59)10

Now the range of integers that can be handled by


8-bits, that is the range from 0 to (28 1),
is
mapped to the actual range of
parameters x and y,
that is the
range from 3 to 3:6
256 1

0.0235294

To obtain the actual values of x and y, we multiply


their decimal values by
0.0235294 and subtract 3
from
the results:x (138) 0.0235294 3 0.2470588
10
and
y (59)10 0.0235294 3 1.6117647

Using decoded values of x and y as inputs in the


mathematical function, the GA calculates
the
fitness of each
chromosome.
To find the maximum of the peak function, we
will use crossover with the probability equal to 0.7
and mutation with the probability equal to 0.001.
As we mentioned earlier, a common practice in
GAs is to specify the number of generations.
Suppose the desired number of generations is 100.
That is, the GA will create 100 generations of 6
chromosomes before stopping.

Chromosome locations on the surface of the


peak function: initial population

Chromosome locations on the surface of the


peak function: first generation

Chromosome locations on the surface of the


peak function: local maximum

Chromosome locations on the surface of the


peak function: global maximum

Performance graphs for 100 generations of 6


chromosomes: local maximum
pc = 0.7, pm = 0.001

0. 7

0. 6

0. 5

Fitness

0. 4

0. 3

0. 2

0. 1

Best
Average

-0.1

10

20

30

40

50

60

Generations

70

80

90

100

Performance graphs for 100 generations of 6


chromosomes: global maximum
pc = 0.7, pm = 0.01

1.8

1.6

1.4

Fitness

1.2

1.0

0.8

0.6

Best
Average

0.4

0.2
0

10

20

30

40

50

60

Generations

70

80

90

100

Performance graphs for 20 generations of


60 chromosomes
pc = 0.7, pm = 0.001

1.8

1.6

1.4

Fitness

1. 2

1.0

0.8

0.6

Best
Average

0.4

0.2

46

10

12

Generations

14

16

18

20

Case study

Unit data and maintenance requirements


Unit
number
1
2
3
4
5
6
7

Unit capacity,
MW
20
15
35
40
15
15
10

Number of intervals required


for unit maintenance
2
2
1
1
1
1
1

Assume the maximum Capacity of Power


Plant is 150 MW.
Net_ Reserve = Maximum Capacity
Capacity of the down units- Actual power
Load
For example if 20MW unit is down for
maintenance and actual power demand is
100MW, then Net Reserve is
150-20-100=30MW

Constraints of the Problem:


1. Net Reserve should always be greater than 0
in all four quarters.
2. Maintenance of the unit starts at the
beginning of the quarter and ends at the end of
the quarter or the end of the adjacent quarter.

Constraints of the Problem:


Maximum Loads Expected during each
quarter are as follows:
Quarter 1

80MW

Quarter 2

90MW

Quarter 3

65MW

Quarter 4

70MW

GA Process:
1. Specify the problem, define constraints
and optimum criteria
2. Represent the problem domain as
chromosome
3. Define a fitness function to evalute the
chromosomes performance.
4. Construct the genetic operators
5. Run the GA and tune its parameters.

Optimization Criterion:
Net Reserve must be at the
maximum during any maintenance
period.

Case study

Unit gene pools


Unit 1:
Unit 2:
Unit 3:
Unit 4:
Unit 5:
Unit 6:
Unit 7:

1 1 0 0

0 1

0 0 1 1

1 1 0 0
1 0 0 0

0 1
0 1

0
0

0 0 1 1
0 0 1 0

0 0 0 1

1
1
1
1

0
0
0
0

0
0
0
0

0
0
0
0

0
0
0
0

0
0
0
0

0
0
0
0

0
0
0
0

1
1
1
1

0
0
0
0

1
1
1
1

0
0
0
0

0
0
0
0

0
0
0
0

1
1
1
1

Chromosome for the scheduling problem


Unit 1
Unit 2
Unit 3
Unit 4
Unit 5
Unit 6
Unit 7
0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0

Explanation of Chromosome
Unit 1:
0110 shows that this unit is down for
Maintenance in the second and third quarter.
1 represents maintenance.
Unit 3:
0001, This represents that unit 3 is
down for maintenance in the fourth quarter.

Case study

The crossover operator


Parent 1
0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0
Parent 2
1 1 0 0 0 1 1 0 0 1 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 1 0 0
Child 1
0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0
Child 2
1 1 0 0 0 1 1 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0

Case study

The mutation operator


1 1 0 0 0 1 1 0 0 1
10 0 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0
1 1 0 0 0 1 1 0 0 0
10 0 1 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0

Performance graphs and the best maintenance


schedules created in a population of 20
N = 20, p = 0.7, p = 0.001
chromosomes
c

Fitness

15

10
5

Best
Average

0
-5

-10

10

15

20

25

30

35

40

Generations
N e t r e s e r v e s:
150
120

15
Unit 4

35
Unit 2
Unit 7

25
Unit 1

Unit 1
Unit 6

Unit 5

MW

35
Unit 2

Unit 3

90
60
30
0

Ti meinterval

(a) 50 generations

45

50

Performance graphs and the best maintenance


schedules created in a population of 20
N = 20, p = 0.7, p = 0.001
chromosomes
20
Fitness

Be st
Average

10
0

-1 0

10

150
120

20

30

40
50
60
Generations
Net rese rves:

40
Unit 1
Unit 7

25

20

Unit 1

Unit 2

Unit 2

80

25
Unit 4

Unit 3
Unit 6

90

70

Unit 5

60
30
0

12

34

Time interval

(b) 100 generations

90

100

Performance graphs and the best maintenance


schedules created in a population of 100
N = 100, p = 0.7, p = 0.001
30
chromosomes
c

Fitness

20
10

Best
Average

-10

10

150

20

35
Unit 3

30

60
40
50
Generations

70

80

N e t r e s e r v e s:
25

25

Unit 1

Unit 1
Unit 2

120

Unit 5
Unit 7

90

25
Unit 4
Unit 6

60
30
0

12

34

Ti me

interval

(a) Mutation rate is 0.001

90

100

Performance graphs and the best maintenance


schedules created in a population of 100
N = 100,
= 0.7,
= 0.01
chromosomes
30
Fitness

20
10
0

Best
Average

-10
-20

10

150
120

20

25

30

40
50
60
G e n e r a ti o n s
N e t r e s e r v e s:
25

30

Unit 1

Unit 1

Unit 2

Unit 6
Unit 7

Unit 2

Unit 4

70

80

30
Unit 3
Unit 5

90
60
30
0

T im e i n t e r v a l

(b) Mutation rate is 0.01

90

100

You might also like