13.2 Genetic Algorithms 695String of length 20
1 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 1 0 0
x 1 x 2 x 3 x 4In general, if a binary number is given bybqbq− 1 · · ·b 2 b 1 b 0 , wherebk= 0 or 1,
k= 0 , 1 , 2 ,... , q, then its equivalent decimal numbery(integer) is given by
y=∑qk= 02 kbk (13.1)This indicates that a continuous design variablexcan only be represented by a set
of discrete values if binary representation is used. If a variablex(whose bounds are
given byx(l)andx(u)) is represented by a string ofqbinary numbers, as shown in
Eq. (13.1), its decimal value can be computed as
x=x(l)+x(u)−x(l)
2 q− 1∑qk= 02 kbk (13.2)Thus if a continuous variable is to be represented with high accuracy, we need to use a
large value ofqin its binary representation. In fact, the number of binary digits needed
(q)to represent a continuous variable in steps (accuracy) ofxcan be computed from
the relation
2 q≥x(u)−x(l)
x+ 1 (13.3)
For example, if a continuous variablexwith bounds 1 and 5 is to be represented with
an accuracy of 0.01, we need to use a binary representation withqdigits where
2 q≥5 − 1
0. 01
+ 1 =401 or q= 9 (13.4)Equation (13.2) shows why GAs are naturally suited for solving discrete optimization
problems.
Example 13.1 Steel plates are available in thicknesses (in inches) of
1
32 ,
1
16 ,3
32 ,1
8 ,5
32 ,3
16 ,7
32 ,1
4 ,9
32 ,5
16 ,11
32 ,3
8 ,13
32 ,7
16 ,15
32 ,1
2from a manufacturer. If the thickness of the steel plate, to beused in the construction
of a pressure vessel, is considered as a discrete design variable, determine the size of
the binary string to be used to select a thickness from the available values.
SOLUTION The lower and upper bounds on the steel plate (design variable,x) are
given by 321 and^12 in., respectively, and the resolution or difference between any two
adjacent thicknesses is 321 in. Equation (13.3) gives
2 q≥x(u)−x(l)
x+ 1 =
1
2 in.−1
32 in.
1
32 in.+ 1 = 15
from which the size of the binary string to be used can be obtained asq=4.