Вы находитесь на странице: 1из 88

..

-

-
,

.

..


2007
32.97 : 22.12
16

, . . [] : -
/ . . . . :
, 2007. 87 [3] .
:

- , . .
( );
, . .
( );
, . .
( - )

,
. -
MATLAB 7.0.1,
. -
, -
MATLAB 7.0.1.
V ,
.

ISBN 5-88200-913-8

c
. ., 2007
c

, 2007

1. ................................................................................... 5

2. ........................................................... 6
2.1. . . . . . . . . . . . . 6
2.2. . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3. . . . . . . . . . . . . . . . . . . . 15
2.4. () . . . . . . . . . . . . . . . . . 18
2.4.1. . . . . . . . . . . . . . . . . 18
2.4.2. ( ) . . . . . . . . 20
2.5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.6. . . . . . . . . . 26
2.7. . . . . . . . . . . . . . 28
2.7.1. . . . . . . . . . . . . . . . . . . . . . 28
2.7.2. . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.7.3. . . . . . . . . . . . . . 29
2.7.4. . . . . . . . . . . . . . . . . . . . 29
2.7.5. CHC . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.7.6. . . . . . . 30
2.8. . . . . . . . . . . . . . . . . . . 31
2.8.1. . . . . . . . . . . . . . . . . . . . . . 31
2.8.2. . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.8.3. . . . . . . . . 34
2.8.4. , . . . . . 35

3. .......................................................................... 37

4. ..................................................................... 37
4.1. . . . . . . . . . . . . . . . . . 38
4.1.1. . . . . . . . . . . . . . . . . . . 38
4.1.2. . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.1.3. . . . . . . . . . . . . . . . . . . . 39
4.1.4. . . . . . . . . . . . . . . . . . . 40

5. .............................................................. 41
5.1. . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.2. . . . . . . . . . . . . . . . . . . . . . . . . 41
5.3. . . . . . . 43
5.4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
5.5. . . . . . . . . . . . . . . . . . . . . . . . . 48

3
5.6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

6. ................................................ 50

7. .............................................................................. 54

A. .............................................................................. 55
A.1. . . . . . . . . . . . . . . . . . . . . . . . . . . 55
A.2. . . . . . . . . . . 56
A.3. . . . . . . . . . . . . . . . . . . . . . . . . . 58
A.3.1. . . . . . . . . . . . . . . . . . . . . 58
A.3.2. . . . . . . . . . . 58
A.4. NP- () . . . . . . . . . . . . . . . 59
A.5. . . . . . . . . . . . . . . . . . . . . . . . . . 60

B. MATLAB 7.0.1 ................................ 66


B.1. . . . . . . . . . . . . . . . . . . . . . . . . . . 66
B.2. ga . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
B.3. gaoptimset . . . . . . . . . . . . . . . . . . . . . . . . 69
B.4. . . . . . . . . . . . . . . . . . 73
B.5. . . . . . . . . . . . . . . . . . . . . . . . 75
B.5.1. 1 . . . . . . . . . . . . . . . . . 75
B.5.2. 2 . . . . . . . . . . . . . . . . 79
B.5.3. 3 . . . . . . . . . . . . . . . . 81
B.6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

........................................................... 86

4
1.
.
,
() . .
, ,
.
, -
() . -
.
, ( ) -
(, -). -
,
, .
-
. -
.
.
-
. 1975 -
() -
. .
. -
(, , ..). -
.
,
.
. -
1994 [?].
, , , -
, 1 ,
-
.
1975 -
(John Holland) [8], -
1 web of trust ,

(.. ,
) ,
(, ,
).

5
. [2] ( ) -
.., .. , .. [?]
, -
(1966)2 .
-
. -
(Kenneth De Jong)
() [22] (David E. Goldberg)
[6]. , ,
(
).
,
. -
, -
. -
.

2.
2.1.


.

11 3 1 4
y(x) = 5 24x + 17x2 x + x
3 4
[0; 7] (. 1).
x = 1. , x = 6
. -
,
.

. , x -
, .. x {0, 1, 2, 3, 4, 5, 6, 7}.
2 -

.
. .

6
, -
.
[0; 7]:
{2, 3, 5, 4}.
.

. 1.

-
-
. : {010, 011, 101, 100}.
,
. , -
, ,
, .
, ,
. -
:
, , ..
,
(. . 1).
: -
, -
-

7
.
.
1 4.
. -
,
. - -
.
()
. , 111111
000000. , ,
3: 111|111 000|000. ,
, : 111000
000111.

1



1 2 010 0,33
2 3 011 7,25
3 5 101 7,92
4 4 100 10,33


2.

2

-
-
1 010 1 010 1 000
2 011 4 100 110
3 101 3 101 2 100
4 100 1 010 011

-
, .. -
. 0,3. -
[0; 1], 0,3,

8
( 0 1 ) (.
. 3).

1 000 0,1 3 001 5


1 000 0,1 3 001 5 5,42
2 110 0,6 110 5 5
3 100 0,5 100 10,33 10,33
4 011 0,2 1 111 7,25 12,58

, ( )
( ) -.
, .. -
.
, , . -
, -
,
(. . 2).
- -
.
-
- (. . 4).
, . 3.
-
, . ,
-
.
( )
. , ,

9
001 , , -
5,42, -
x = 1. -
! -
.
.

. 2.

10
. 3.

4

- -
- -


1 010 0,33 001 5,42
2 011 7,25 010 0,33
3 101 7,92 110 5
4 100 10,33 011 7,25
5 001 5,42
6 110 5
7 100 10,33
8 111 12,58

11
2.2.

, .
,
3 . ,
.
,
() , , {0, 1} {1, 1}.

.
, -
() .
n -
n- .

, .
( ) - . -
, , 1010011,
,
(. A.3). ()
.
( , ) ( -
). , -
.
.

() , -
. , 1100&1010 1110&1000.
-
. , 1010011 1010001.

. , 1100 0011.
.
() ,
.

.

, . -
3 , , -

12
, .
-
. -
, .
, -
.
, , , -
() . , .
4 -
. -
.
-
, .

, -
. -
.
, -
.
, -
. -
. . ,
10 , ..
10- . ,
, .
.
() 5.
(. -
. 4):
1. n .
2. .
3. -
.
4. pc ,
.
5. pm .
4 .

13
6. 35,
, n .
7. 26,
.

5
()


, ,


. .
, ,

. .

, pm



, pc

. 4.

-
(convergence) .
,
.
,
-
.

14
,
,
. , ,
.
, , -
( ).
. -
,
, . -
.

2.3.
. -
-
.
.
-
[1; n], n .
, .
- -
, . - -

. ,
.
, ,
, .

, -
,
. , ,
( )
. -
()
. -
1010001 . 6.

.
.
-
. , -
,

15
-
.
,
, .
(
) (
).

6

1010001

1000000 2
1010101 1
1111111 4
1100001 2
0110011 3
0100011 4
0011100 4
0000000 3

, ,
, -
, .
. -
, -
,
, , .
,
-
. -

, .
-
. -
. (-
) .
(tournament selection) , -
N , t ,

16
(. 5).
N . -
( ).
, , 2.
() . t .
, -
.

t=3

F=72.9


F=12.8
F=72.9
F=24.9

. 5.

(roulette-wheel selection) -
N , N .
. i-
P (i),
:

f (i)
P (i) = N
,
P
f (i)
i=1

f (i) i- . i-
Ni = P (i)N .
-
,
(. 7).

17
. , , -
.

2.4. ()

-.
,
.
.

2.4.1.
(Discrete recombination) -
.
,
, .
-
. :

1 12 25 7
2 116 4 34

:
1 2 2 1
2 1 2 1

7
. = 200,
= 1
5
C1 52 52/200 = 0,26
C2 85 85/200 = 0,425
C3 37 37/200 = 0,185
C4 3 3/200 = 0,015
C5 23 23/200 = 0,115

18
:
1 116 4 7
2 12 4 7
(-
, ).
(Intermediate recombination) -
, .
,
.
:

= 1 + ( 2 1),

[d, 1 + d], d > 0.


, -
d = 0,25.
.
. :
1 12 25 7
2 116 4 34
[0,25; 1,25]
:
1 0,5 1,1 0,1
2 0,1 0,8 0,5
:
1 12 + 0,5(116 12) = 64 25 + 1,1(4 25) = 1,9 4,3
2 12 + 0,1(116 12) = 22,4 25 + 0,8(4 25) = 8,2 20,5
, -
-.
, ,
.
.
(Line recombination) -
, .
. -
:

19
1 0,5
2 0,1
:
1 12 + 0,5(116 12) = 64 25 + 0,5(4 25) = 14,5 20,5
2 12 + 0,1(116 12) = 22,4 25 + 0,1(4 25) = 22,9 9,7
k- -
, k , ,
,
.

2.4.2. ( )

(-
) .
(Single-point crossover)
. -
X = {xi , i [0; L]} Y = {yi , i [0; L]} . -
( ),
. -
, -
.


x1 x2 x3 . . . xn1 xn . . . xm x1 x2 x3 . . . xn1 yn . . . ym
y1 y2 y3 . . . yn1 yn . . . ym y1 y2 y3 . . . yn1 xn . . . xm

. 6.

- N - .
( -
) , -
.
.
,
, , -
. , -
, , . ,
, -
,

20
(. 7). ,
, .

. 7.

(Multipoint crossover), -
m ki {1, 2, . . . , N var}, i = 1 : m, N var
() . -
. -
,
.
. 11
.
1 0 1 1 1 0 0 1 1 0 1 0
2 1 0 1 0 1 1 0 0 1 0 1
:
(m = 3) 2 6 10

21
:
1 0 1 1 0 1 1 1 1 0 1 1
2 1 0 1 1 0 0 0 0 1 0 0
-
( ),
.
-
, .
(Uniform crossover) () ,
.
, . -
: 0 < p0 < 1,
p0 , n- 0, 1. -
, (0
1). , (
= 0) ( = 1) -.
, :
1 0 1 1 1 0 0 1 1 0 1 0
2 1 0 1 0 1 1 0 0 1 0 1
11 -
{0; 1}:
1 0 1 1 0 0 0 1 1 0 1 0
2 1 0 0 1 1 1 0 0 1 0 1
: i- -
1, 1 ,
. :
1 1 1 0 1 1 1 1 1 1 1 1
2 0 0 1 1 0 0 0 0 0 0 0
,
. , -
-.

. -
.
(Triadic crossover).
, -

22
, . 10 %
. -
: , ,
-
.
, ,
,
.
(Shuffler crossover). -
, , -
.
. -
. ,
, ( -
),
.
(Crossover with reduced
surrogate). , -
, , .
: -
, .
, (
-) , . -
, -
, -
. , , ,
, . -
, .
-
,
. -
. .

.

2.5.

(mutation). -
-

23
.
, (. 8).

x1 x2 . . . xn1 xn xn+1 . . . xm x1 x2 . . . xn1 x


n xn+1 . . . xm

. 8. xn

,
.
, .
.
pm ( , pm  1)
[0; 1],
- . ,
, -
().
-
. , ,
(,
5 ). -
.
.
(Real valued mutation). . 9
-
.

,
.
.
-
. ,
. -
:

= ,
5 .

24
+ , = 0,5
( ),
m
X
= a(i)2i ,
i=1

1
a(i) = 1 m , a(i) = 0, m .
, ,
. , -
, . m = 20,
-
219 .
(Binary mutation). , -
, -
(0 1 ).
. , -
,
, .
(Density mutation). -
-
. , -
-
,
, 1 10 % .

. 9.

25
. t -
ti : t = t1 , . . . , tk .
:

1. -
: t t1 , . . . , tk , s.
2.
: t
t1 , . . . , ti1 , s, ti , . . . , tk .
3. : t
t1 , . . . , ti1 , ti+1 , . . . , tk .
4.
: t t1 , . . . , ti+1 , s, ti1 , . . . , tk .

, 1
2. ( -
) 4 , 1 2
3.

2.6.

.
(Truncation selection). -
, -, -
,
. -
T [0; 1]. , ,
( ), . ,
1, -
, . ,
,
. N ,
. -
,
, ,
, .

26
- , -
,
.
(Elite selection). -
, , .
, N
(), .
, ,
10 % , 90 %
. 90 % ,
-
.
, .
, , -
,
, ,
. , -
,
.
(Exclusion selection). -
,
, -
.
.
. , -
: -, , -
, -, -
.
,
, . -
,

, .
, (Bolzman selection).

T .
-
:
1
p= ,
1 + exp f (i)f
T
(j)

27
f (i) f (j) i j , .
i j . p -
(0; 1),
f (i), f (j).
:

exp(f (i)/T )
p= ,
hexp(f (i)/T )i

hi t. p
(0; 1), f (i)
.
-
, (
). -
,
, . -
(,
).

2.7.

, -
, . -
.

2.7.1.

.
[8]. ,
N . -
, -
.
, ( )
.
. , -
.

28
2.7.2.

(Genitor) -
[4]. , , ,
. , -
, ,
(
!). ,
-
. ,
. , -
. -
. ,
, .

2.7.3.

-
,
. -

,
. -
.
. -
,
.
. -
-
, -
. . :
, -
[?].

2.7.4.

(Hybrid algorithms) -

, . -

29
. , -
, .
: , -
.
. , -
.
.
,
,
.
, .
.

2.7.5. CHC

CHC (Eshelman, 1991) Cross-population


selection, Heterogeneous recombination and Cataclysmic mutation.
- , -
, ,
,
, .
, ,

.
HUX (Half Uniform
Crossover),
. N
. .
50 .

.
(. ) CHC cataclysmic mutation:
, ,
( ). ,
, .

2.7.6.


(Genetic Algorithm with Varying Population Size GAVaPS)

30
, .. ,
. -
.
. -
t -
.
(AuxP opsize(t)) (P opsize(t))

AuxP opsize(t) = [P opsize(t)pc ],
pc . -

.
.
(
). , -
, .
, :

P opsize(t + 1) = P opsize(t) + AuxP opsize(t) D(t),

D(t) , t.

2.8.

-
(Parallel implementations).
. -
.
. -
, ,
. .

2.8.1.


.
. N/2 (
, , ). -
4 , 2

31
, . -
. ,
.

2.8.2.
(Migration)
. -
.
T ( ). -
(-
). , ( ),
-

.
:

;
:
.


. -
.
(. . 10),
. -
-
.
.
-
, -
. -
, 1.
. -
, - .
(.
. 11). ( -
) . ,
.

32
. 10.

. 11.

33
. 12 ,
. , -
.
( ).

. 12.

2.8.3.

(Global model worker/farmer) -



(. . 13). .
,
-
. -
,
. -
.

34
. 13.

2.8.4. ,

-
. , , -
,
.
. -
, , ,
. -
.
16 , -
1000 .
, 16 .
.
,
. ,
, -, , -
, (25 ). -,
.
. -
, . -
, ,
. -

35
(
2 ), -
.
-
.

- , -
. .
-
.
.
. -

.
: 25 -
. ,
. , -
,
. , (. 14).

. 14.

, -
. ,
-
,
.

36
3.

8095 %. , -
60 %.
: 0,51 %.
, -
( -
). 2030 ,
, , 50100 .
, -
(). , 32-
, 16- -
.
, -
. , -
. ,
, .
-
.
( )
.

4.
, -
, . -
,
-
: ( ) ,
.
,
.
:
, -
.
, ,
. , ,

37
-
.
,
.
, , -
.
.

, .
.
,
,
.
-
.

4.1.

4.1.1.

-
[10]. yi ,
yi0 [mini , maxi ]:
 b
y + (max y ) 1 r (1 Tt ) , q = 0,


i i i

yi0 =
y (y min ) 1 r(1 Tt )b ,

 
i i i q = 1,

q 0 1; r -
, [0; 1]; t ; T
; b ,
; mini maxi -
yi .

4.1.2.

-
. , (
) -

38
. ,
.
-
, ..
. -
, -
, . ,
,
.

, -
. -

[1215]. -

. -
. .
, .

4.1.3.

-
( ) .
[1215] , -
. -
, ,
. A = (a1 , . . . , ai , . . . an )
B = (b1 , . . . , bi , . . . bn ) , mini maxi
i- :
n d
1 X ai bi
dist (A, B) = ,
n i=1 maxi mini
d , .
M (A, B) = 1 dist(A, B) ,
. dist (A, B) [0, 1] M (A, B) [0, 1]. M (A, B) -
dist(A, B) = 0; A B
M (A, B) = 1.
M (A, B) = 1, -
. , , -

39
Mm , -
M (A, B). Pr :
Pr (A, B) = M (A, B) Mm = (1 dist (A, B)) Mm , Mm -
.
: d = 0,2 Mm = 0,9.

4.1.4.

[1215]
, -
. :
N = 20;
Pc = 0,8;
rep
Pm = 0,01;
Mm = 0,9.
100 .
15.

. 15.

40
5.
5.1.
(
. A.2): max f (x)

D = {x = (x1 , x2 , . . . , xN ) |xi [ai , bi ] , i = 1, 2, . . . , N },

f (x) ()
, , -
D , D RN . -
, f (x) ,
D. -
(, ..)
.
x =
(x1 , x2 , . . . , xN ). x = x ,
f (x) .
f (x),
.

5.2.

, -
-
f (x). x -
s. f (x),
(s), , , f (x) -
. ,
-
.
(s). , s, -
(s), x.
D -
x1 , x2 , . . . , xN -
. -
. -
,
. ,

41
x1 x2 ,
D = {0 < x1 < 1; 0 < x2 < 1},
x 106 .

(bi ai )/(106 ) 106 .
l = 20 , l
106 < 2l + 1. ,
2 20 = 40 . -

, D. ,
,
.
. -
, ( -
?!). ,
.
, -
, ,
, . , , -
,
. (l-) ,
2l -
. , -
,
-. , , -
,
, ..
. ,
( ) -
. , -
(
):

x = (x1 , x2 , . . . , xN ) D RN .
s , -
() s =
(1 , 2 , . . . , l ) S, S -
l.
,
x (): = f (x).

42
, , -
.
, -
, (
, , ). -
,
S
. , -
, .

5.3.
, -

( ).
f (x) = 10 + x sin x,
[0, 10]. -
3 (. . 16), [0, 10]
23 = 8 , -
, -
, , .
h = 10 : 8 = 1,25.

. 16.

43
, , -
3. -
, , -
,
1 (. . 17).

. 17.

, ,
, , -
D.

5.4.
, ,
,
.
.
-
. -
.
(schema) l ( -
), {0; 1; }, {}
.
l, 0, 1,

44
, .
, , -
.
, . , , 10 1,
{10001; 10011;
10101; 10111}. , r- -
2r . ,
m 2m . , n
n2m !
6 ,
.
.
.
.
o(S) (order) (0
1) S.
(S) (defining length) -
S. -
. ,
. ,
S = ( 001 110) o(S) = 6 (S) = 10 4 = 6.
-
.
, () -
,
-
m. 2m ,
m.
. -
. 3,
23 = 8 . .
,
,
"000" (. . 18).
" 0", ,
"10" . , " " -
. 4 ,
6 ,

45
-
(. . 19).

. 18.

"1 " ,
, " 10"
.
.
. -
, -
,
(. . 20).
, ,
. K -
"111 . . . 111".
, "0 " ,
" 1 " 4 ,
"0 10 " , -
.
.

46
. 19.

. 20.

47
5.5.

, :
;
;
.
-
, .
. , , -
, . -
,
. , -
.
, , n
, n3
(
useful schemata (. [8]) ).
(implicit parallelism). ,
, -
-
.

5.6.

(The schema theorem) ,


-
, .
m(H, t) H t- .
H m(H, t + 1)
m(H, t). -

(, ). , H
m(H, t)(f (H)/f ) , f ,
f (H) ,
H.
, -
, -
. , H

48
1 pc ((H)/l 1), pc .
, ,
.
, H (1 pm )o(H) ,
pm .
(1 o(H)) pm o(H). -
:

 
f (H, t) (H) o(H)
hm (H, t + 1)i > m (H, t) 1 pc (1 pm ) .
f (t) `1

, -
,
.
, ,
, (. [6]).

.

, .
, f (H) f . -
, , .
. , -

, -
. ,
, , .
,
.
-
. ,
.
, -

. , -
,
: (selection pressure).
pc , pm , -
,
,

49
. pc , pm ,
, -
.
,
.
,
, -
, .

.
, :

;
,
, .
;

, , -
,
. , , -
.

6.
, , -
:
(,
);
, , -
;
;
;
;
;

50
.
-
, :
;

, -
;
;
;
-
: (. 21)
, x = 0;

. 21.

.
( ) -
, ,
, (. 22).

51

(. 22);

. 22.

(noise) -
,
, (. 23).

. 23.


. -
(deception). , 10 -
. ui i- -
. g(u) :

u 0 1 2 3 4
g(u) 3 2 1 0 4
g(ui )
i = 1 . . . 10:

10
X
f= g(ui ).
i=1

, 0, -
1.

52
( -
, 1).
1 0 . -
,
, .
.
,
. -
.
, -
. -
,
, . -
. . :
. . . , , ,
:
,
( ) ,
, -
, -
(. [17]).
pp -
pp -
. ( ) -
. ,
, p-
p, , ,
( )
.

-
.

53
7.
,
-
. -

4 :
,
;
, ;
() , -
;
, -
.
-
() .
,
, . ,
,
, , -
,
.
, , -
,
-
. ,
,
.
, :

;
;
;
;
;

54
;
.

A.
A.1.
1859 . -
.
.
, -
. -
(). -
, .
(). -
() .
-
-
. , -
,
(.. ). , -
, ,
, (,
).
-
, , ,
, , . ,
. , -
,
, . -
,
-
.
, , ,
, .

.
:

55
.
, -
.
,
.
, () -
. -
, , ..
. .
.

.

A.2.

-
.
,
; , , -
,
, -
.
(
)
. ( -
, ,
, ,
..), , -
..
:
1) () ;
2) .
.
f (x) max, f (x) min
.
, -
.
-
, ,
.

56
:
, -
, , x > 0, x = (x1 , . . . , xn );
, -
, , -
, gi (x) 6 0, x = (x1 , . . . , xn ), i = 1 ;
( ), , fi (x) > 0,
x = (x1 , . . . , xn ), i = 1 f ;
(), , fi (x) = 0, x = (x1 , . . . , xn ),
i = 1 f ;
, , xi min 6 xi 6 xi max .
, (-
, );
.
, , -
( ) : ,
, ..
-
.
x = (x1 , . . . , xn ), , -
( ).

.
(..
), ,
, .
x0 , :
;

( ) , .
-
:
1 ;

57
-
;
: , -
, .

A.3.

-
(
, 2) ( -
). -
.
, () .
,
. -
,
.

A.3.1.

(0 1)
. ,
.
,
.

0 1,
(1,
0). . ,
00, 01, 11, 10, , -
,
(10, 11, 01, 00). ,
.

A.3.2.

,
: 2

58
8


0 000 000
1 001 001
2 010 011
3 011 010
4 100 110
5 101 111
6 110 101
7 111 100

. , -
, .
:
2
.

A.4. NP- ()
, -
, -
, ,
. -
I, ,
P, .
P -
( ), -
, ( ).
I P,
. -
:
.
m ,
, - -
. , A P,
I P A I (.. -
) I P A I.

59
, P ,
.

, -
-
(, m! ). -
(
). -
,
, I P ,
I. P -
.
,
. -
. ,
P . ,
P B , -
: ,
B?
(). P -
, : P NP.
, , ..,
, NP-. ,
-
,
.
, .

A.5.

, -
, , ,
, .
, ,
a.
(n). -
n (, 10 20),
n = 50, 100, 200, . . .
. ,
, , ,

60
,
. -
(x = (x1 , x2 , . . . , xn )) [?].
1. , 1 (Sphere model, De
Jongs function 1):

n
X
f (x) = x2i , x (5,12; 5,12).
i=1

f (x) = 0; xi = 0; i = 1 : n.

2. (Axis parallel
hyper-ellipsoid function) 1.
. ,
:

n
X
f (x) = ix2i , 5,12 6 xi 6 5,12.
i=1

f (x) = 0; xi = 0; i = 1 : n.

3. (Rotated hyper-ellipsoid
function).
, .

n X
X i
f (x) = x2j , 65,536 6 xi 6 65,536
i=1 j=1

f (x) = 0; xi = 0; i=1:n

61
4. (Step function (De Jong)):

n
X
f (x) = |[xi ]|, x (5,12; 5,12) ,
i=1

|[xi ]| .
5. , 2 (Rosenbrocks saddle
(valley), De Jongs function 2) -
( ).
-
. , -


:
n1
X 
2 2
f (x) = 100 xi+1 x2i + (xi 1) , x (2,048; 2,048) .
i=1

f (x) = 0; xi = 1, i = 1 : n.

6.
(Gaussian quartic, De Jong):

n
X
x4i + gauss(0, 1) ,

f (x) = x (1,28; 1,28),
i=1

gauss(0, 1) , -
, 0 -
1.
7. (Rastrigins function)
. -
:
n
X
x2i 10 cos(2xi ) ,

f (x) = 10n + x (5,12; 5,12) .
i=1

62
:

f (x) = 0; xi = 0; i = 1 : n.

8. (Schwefels (Sine root) function)


.
:

n 
X p 
f (x) = 418,9829n + xi sin |xi | , x (500; 50).
i=1

f (x) = 0; xi = 420,9829, i = 1 : n.

9. (Griewangks function) -
. .
:
n n
x2i
 
X Y xi
f (x) = 1 + cos , x (600; 600).
i=1
4000 i=1 i

f (x) = 0; xi = 0; i = 1 : n.

10. (ckleys function):

v !
u n n
u1 X 1X
f (x) = 20 + e 20 exp 0,2t x2 exp cos (2xi ) ,
n i=1 i n i=1

x (30; 30).

f (x) = 0; xi = 0; i = 1 : n.

63
11. (Sum of different power) -
:

n
X i+1
f (x) = |xi | , 1 6 xi 6 1.
i=1

f (x) = 0; xi = 0; i = 1 : n.

12. (Michalewiczs function) -


n! . m
(steepness) . m
. m

),
( ):

n   
X i 2
f (x) = sin (xi ) sin20 x , 0 6 xi 6 .
i=1
i

f (x) = 4,687 (n = 5);


f (x) = 9,66 (n = 10).

13. (Braninss rcos function).


:

 2  
5,1 2 5 1
f (x1 , x2 ) = x2 x + x1 6 + 10 1 cos(x1 ) + 10,
4 2 1 8
5 6 x1 6 10, 0 6 x2 6 15.

f (x1 , x1 ) = 0,397887,
(x1 , x1 ) = {(, 12,275); (, 2,275); (9,42478; 2,475)} .

64
14. (Easoms function). -

. -
:

f (x1 , x2 ) = cos(x1 ) cos(x2 ) exp (x1 )2 + (x2 )2 ,




100 6 xi 6 100, i = 1 : 2.

f (x1 , x2 ) = 1; (x1 , x2 ) = (, ).

15. (GoldsteinPrice function):

f (x1 , x2 ) = [1+(1+x1 +x2 )2 (1914x1 +3x21 14x2 +6x1 x2 +3x22 )]


[30 + (2x1 3x2 )2 (18 32x1 + 12x21 + 48x2 36x1 x2 + 27x22 )];
2 6 xi 6 2, i = 1 : 2.

f (x1 , x2 ) = 3; (x1 , x2 ) = (0, 1).

16. (Sixhump camel back function) -


.
:

x4
 
2
x21 + x1 x2 + 4 4x22 ;

f (x1 , x2 ) = 4 2,1x1 + 1
3
3 6 x1 6 3, 2 6 x2 6 2.

f (x1 , x2 ) = 1,0316;
(x1 , x2 ) = {(0,0898; 0,7126); (0,0898, 0,7126)}.

65
B. MATLAB 7.0.1
B.1.
MATLAB 7.0.1 Genetic Algorithm
and Direct Search Toolbox, -
, Optimization Toolbox, -
.
, ,
,
. -
.
Genetic
Algorithm gatool ga.
-
Direct Search Toolbox.
psearchtool ( poll search tool
).
. 4 -
:
ga ;
gaoptimget -
;
gaoptimset ;
gatool Genetic Algorithm Tool.
, , -
M-file .

B.2. ga

ga -
:
[x fval] = ga(@fitnessfun, nvars, options)

fitnessfun M-file, -
;
nvars ;
options , .
, ;

66
:
fval ;
x , .
ga:

x = ga(fitnessfun, nvars)

x = ga(fitnessfun, nvars, options)

x = ga(problem)

[x, fval] = ga(...)

[x, fval, reason] = ga(...)

[x, fval, reason, output] = ga(...)

[x, fval, reason, output, population] = ga(...)

[x, fval, reason, output, population, scores] = ga(...)

x = ga(fitnessfun, nvars)
, fitnessfun -
nvars x,
.
x = ga(fitnessfun, nvars, options)
, (options) .
x = ga(problem) , -
:
fitnessfcn ;
nvars ;
options , gaoptimset.
[x, fval] = ga(...) fval,
x.
[x, fval, reason] = ga(...) reason , -
.
[x, fval, reason, output] = ga(...) output
-
. output :

67
Randstate (randnstate) -
. (
.);
generations ;
funccount ;
message .
.
[x, fval, reason, output, population] = ga(...) -
,
.
[x, fval, reason, output, population, scores] = ga(...)
.
:
. ga
.
-
, .

[x fval, reason] = ga(@rastriginsFcn, 10)

x =

Columns 1 through 7

0.9977 0.9598 0.0085 0.0097 -0.0274 -0.0173 0.9650

Columns 8 through 10

-0.0021 -0.0210 0.0065

fval =

3.7456

reason =

generations

68
B.3. gaoptimset


gaoptimset. , -
.
.

options = gaoptimset

gaoptimset

options = gaoptimset(param1,value1,param2,value2,...)

options = gaoptimset(oldopts,param1,value1,...)

options = gaoptimset(oldopts,newopts)

options = gaoptimset ( ) -
,
.
gaoptimset . -
.
options = gaoptimset(param1,value1,param2,value2,...)
.

.
options = gaoptimset(oldopts,param1,value1,...) -
oldopts,
.
options = gaoptimset(oldopts,newopts)
oldopts,
newopts. newopts -
oldopts.


gaoptimset. {} .

69
9
gaoptimset

CreationFcn {@gacreationuniform}

CrossoverFraction , |
- {0.8}
, -

CrossoverFcn @crossoverheuristic (-
)
{@crossoverscattered}
@crossoverintermediate
@crossoversinglepoint
( -
)
@crossovertwopoint
( )
EliteCount - | {2}
, -
-
, -

FitnessLimit . - | {-Inf}
-
FitnessLimit, -

FitnessScalingFcn , - @fitscalinggoldberg
- {@fitscalingrank}
@fitscalingprop
@fitscalingtop
Generations , - |{100}

70

PopInitRange , - | [0;1]
-

PopulationType , - bitstring | custom |
- {doubleVector}

HybridFcn | {[]}
-
ga
InitialPopulation | {[]}
InitialScores - | {[]}
MigrationDirection both | {forward}
MigrationFraction 0 1, - | {0.2}
-


MigrationInterval - | {20}

-

MutationFcn @mutationuniform
{@mutationgaussian}
OutputFcns , - | {[]}
,

OutputInterval - | {1}
-

71

PlotFcns - @gaplotbestf
, - @gaplotbestgenome
. @gaplotdistance
@gaplotexpectation
@gaplotgeneology
@gaplotselection
@gaplotrange
@gaplotscorediversity
@gaplotscores
@gaplotstopping | {[]}
PlotInterval | {1}
-

plot
PopulationSize | {20}
SelectionFcn - @selectiongoldberg
- @selectionrandom
{@selectionstochunif}
@selectionroulette
@selectiontournament
StallGenLimit . - | {50}
,
StallGenLimit -


StallTimeLimit . - | {20}
,
StallTimeLimit -


TimeLimit . - | {30}

TimeLimit

Vectorized , - on | {off}

1. gaoptimget
gaoptimget :

72
val = gaoptimget(options, name);
2. gatool.
3. -
gatool.
. 24.
, -
, -
start. ,
gaoptimset ga.
plots ,
.

B.4.

,
. -
, ,
,
. ,

f (x1 , x2 ) = x21 2x1 x2 + 6x1 + x22 6x2 .


M-file, :

z =x(:,1).\ 2 - 2*x(:,1).*x(:,2) + 6*x(:,1) +x(:,2).\ 2


-6*x(:,2);

x(:, 1) , .\ .*
.
Vectorize option -
On.

. :
tic;ga(@rastriginsfcn,20);toc
, :

elapsed_time =
4.3660

73
74
. 24.
, -
:
options=gaoptimset(Vectorize,on);
tic;ga(@rastriginsfcn,20,options);toc \
:

elapsed_time = 0.581

B.5.

1!

B.5.1. 1

1

p
f (x) = 8x 16 12 3 (x + 4)2 .


M-file
ex2.m.
function y = ex2(x)
y=-12*(x+4)\ (2/3)+8*x-16;
gatool.
fitness function @ex2
:
= 10, = 100 ( -
), = [4; 1]. plots
best fitness, best individual, distance. start.
final point
x, , status and
result .
-
x = 2.9972 f (2.9972) = 51.99998959105959
(. 25).

75
. 25.

76
. -
, , 80 , .
. -
. -
( = 0) 18 .
, .
, -
.
,
(. 26).

. 26.

, gaoptimset
ga. M-File File Genetic
Algoritm Tool Generate M-file, -
. :
function [X,FVAL,REASON,OUTPUT,POPULATION,SCORES] = ex2q

% This is an auto generated M file to do optimization


% with the Genetic Algorithm and

77
% Direct Search Toolbox. Use GAOPTIMSET for default
% GA options structure.

% Fitness function

fitnessFunction = @ex2;

% Number of Variables

nvars = 1 ;

% Start with default options

options = gaoptimset;

% Modify some parameters

options = gaoptimset(options,PopInitRange,[-4 ; -1 ]);

options = gaoptimset(options,PopulationSize,10);

options = gaoptimset(options,MutationFcn,
{@mutationgaussian 1 1});

options = gaoptimset(options,Display,off);

options = gaoptimset(options,PlotFcns, {@gaplotbestf


@gaplotbestindiv @gaplotdistance });

% Run GA

[X,FVAL,REASON,OUTPUT,POPULATION,SCORES] =
ga(fitnessFunction,nvars,options);

78
2
:

z(x, y) = exp(x2 y 2 ) + sin(x + y).


,
f (x) f (x).
, f (x)
f (x), .
M-file z(x) = f (x)
ex13.m:

function z = ex13(x)

z=-(exp(-x(1)\ 2-x(2)\ 2)+sin(x(1)+x(2)));

gatool.
fitness function @ex13.
: = 2, -
= 10, = 100 (
), = [-1; 3]. -
plots best fitness, best
individual, distance. start.
final point
x, , status and
result
z(x).
: -
x = 0.46419, y = 0.42406 f (0.46419; 0.42406) =
1.449.
. 27.

B.5.2. 2

1 p
y(x) = 3 3 (x + 4)2 2x 8.
2
z(x, y) = (y 3) exp(x2 y 2 ).
3
.

79
. 27. . 1

80
B.5.3. 3

1
6 3 6(x3)2
y(x) = (x1)2 +8 .
2
z(x, y) = x exp(x2 y 2 ).
3
.

B.6.
2
1
x = 3.99927, y(x) = 0.999 (. 28).
M-File:
function y = ex1(x)
y=-(3*(x+4)\ (2/3)-2*x-8);
29.

. 28. . 2

2
x = 0.01224, y = 0.16747, z(x, y) = 3.0794 (. 29).
M-File:

81
function z = ex14(x)

z=(x(2)-3)*exp(-x(1)\ 2-x(2)\ 2);


150 .

. 29. . 2

3
30.
3
1
x = 4.97881, y(x) = 1.31 (. 31).
M-File:
function y = ex3(x)

y=-6*(6*(x-3))\ (2/3)/(8+(x-1)\ 2);

82
. 30.

. 31. . 3

83
2
x = 0.7428, y = 0.01912, z(x, y) = 0.4276.
M-File:
function z = ex12(x)

z=x(1)*exp(-x(1)\ 2-x(2)\ 2);


x = 0.7442, y = 0.07576, z(x, y) = 0.425275 (. 32).
M-File:
function z = ex122(x)

z=-x(1)*exp(-x(1)\ 2-x(2)\ 2);

. 32. . 3

3
33.

84
. 33.

, (-
, , , ,
, ) -
. ,
Direct Search Toolbox.
psearchtool.

85

1. , ..
[]/ .. ; .
: 1995.c. 62.
2. .
[]/ .
. .: , 1939. .3.
3. .., .., ..
[]/ . .. . 2- ., . . .:
, 2006. 320 . ISBN 5-9221-0510-8.
4. Darrel Whitley: A Genetic Algorithm Tutorial; November 10, 1993;
Technical Report CS-93-103 (Revised); Department of Computer Science,
Colorado State University, Fort Collins, US
5. Fogel D. B. Evolutionary computation: towards a new philosophy of
machine intelligence []/D. B. Fogel. Piscatway: IEEE Press,
2000. ISBN 0-7803-3481-7
6. Goldberg D. Genetic Algorithms in Search, Optimization, and Machine
Learning []/ D. Goldberg. Massachusetts: Addison-Wesley,
1989. ISBN 0201157675
7. Hartmann A.K., Rieger H. Optimization Algorithms in Physics. Berlin:
Wiley-VCH, 2002. 383 c. ISBN 3527403078.
8. Holland J. H. Adaptation in Natural and Artificial Systems: An
Introductory Analysis With Applications to Biology, Control, and Artificial
Intelligence []/J. H. Holland. The MIT Press, Cambridge, 1992.
ISBN 0262581116
9. Koza J. R. Genetic Programming []/J. R. Koza. Cambridge: The
MIT Press, 1998. 609 c. ISBN 0-262-11170-5
10. Michalewicz Z. Genetic algorithms + Data Structures = Evolution
Programs []/Z. Michalewicz. New York: Springer-Verlag, 1996.
387 c. ISBN 3540606769
11. Mitchell M. An Introduction to Genetic Algorithms []/M.
Mitchell. Cambridge: MIT Press, 1999 158 c. ISBN 0-262-13316-4
(HB), 0-262-63185-7 (PB)

86
12. Periaux J., Sefrioui M., Ganascia J.-G. Fast Convergence Thanks to
Diversity // Evolutionary computing. San Diego, 1998. 9 c.
13. Periaux J., Sefrioui M. Evolutionary computational methods for complex
design in aerodynamics // AIAA-98-0222. Reno, 1998. 15 c.

14. Periaux J. Combining Game Theory and Genetic Algorithms with


Application to DDM-Nozzle Optimization Problems // Proceedings of
DDM. Greenwich, 1998. 17 c.
15. Periaux J. Genetic Algorithms for electromagnetic backscattering
multiobjective optimization // Genetic algorithms for Electromagnetic
Computation. Ed: Erir. Miechelssen, 1998. 30 c.
16. Schwefel H.-P. Evolution and Optimum Seeking []/H.-P.
Schwefel. New York: John Wiley & Sons, 1995.
17. , . http://www.algolist.manual.ru
18. - -
, .
http://rain.ifmo.ru/cat
19. .
http://garage.cps.msu.edu
20. .
http://www.cs.colostate.edu
21. . http://www.genetic-
programming.org
22. -
. http://www.cs.gmu.edu/research/gag

87



..

..
, .. , ..

1072. 50 .
.-. . 7,6. . . . 7,1


414056, . , . , 20
./ (8512) 54-01-89, 54-01-87, e-mail: asupress@yandex.ru

Оценить