Functions
Functions
i=1
x
2
i
. (1)
Test area is usually restricted to hyphercube 5.12 x
i
5.12, i = 1, . . . , n.
Global minimum f(x) = 0 is obtainable for x
i
= 0, i = 1, . . . , n.
2
-4
-2
0
2
4
x
-4
-2
0
2
4
y
0
10
20
30
40
50
Rysunek 1: De Jongs function in 2D, f(x, y) = x
2
+ y
2
3
-4
-2
0
2
4
x
-4
-2
0
2
4
y
0
20
40
60
80
Rysunek 2: Axis parallel hyper-ellipsoid function in 2D, f(x, y) = x
2
+ 2y
2
2.2 Axis parallel hyper-ellipsoid function
The axis parallel hyper-ellipsoid is similar to function of De Jong. It is also known
as the weighted sphere model. Function is continuous, convex and unimodal. It
has the following general denition
f(x) =
n
i=1
(i x
2
i
). (2)
Test area is usually restricted to hyphercube 5.12 x
i
5.12, i = 1, . . . , n.
Global minimum equal f(x) = 0 is obtainable for x
i
= 0, i = 1, . . . , n.
4
-60
-40
-20
0
20
40
60
x
-60
-40
-20
0
20
40
60
y
0
2000
4000
6000
8000
10000
12000
Rysunek 3: Rotated hyper-ellipsoid function in 2D, f(x, y) = x
2
+ (x
2
+ y
2
)
2.3 Rotated hyper-ellipsoid function
An extension of the axis parallel hyper-ellipsoid is Schwefels function. With
respect to the coordinate axes, this function produces rotated hyper-ellipsoids. It
is continuous, convex and unimodal. Function has the following general denition
f(x) =
n
i=1
i
j=1
x
2
j
. (3)
Test area is usually restricted to hyphercube 65.536 x
i
65.536, i =
1, . . . , n. Its global minimum equal f(x) = 0 is obtainable for x
i
= 0, i =
1, . . . , n.
5
-2
-1
0
1
2
x
-2
-1
0
1
2
y
0
1000
2000
3000
Rysunek 4: Rosenbrocks valley in 2D, f(x, y) = 100(y x
2
)
2
+ (1 x)
2
2.4 Rosenbrocks valley
Rosenbrocks valley is a classic optimization problem, also known as banana
function or the second function of De Jong. The global optimum lays inside a
long, narrow, parabolic shaped at valley. To nd the valley is trivial, however
convergence to the global optimum is difcult and hence this problem has been
frequently used to test the performance of optimization algorithms. Function has
the following denition
f(x) =
n1
i=1
_
100(x
i+1
x
2
i
)
2
+ (1 x
i
)
2
. (4)
Test area is usually restricted to hyphercube 2.048 x
i
2.048, i = 1, . . . , n.
Its global minimum equal f(x) = 0 is obtainable for x
i
, i = 1, . . . , n.
6
-4
-2
0
2
4
x
-4
-2
0
2
4
y
0
10
20
30
40
50
60
70
Rysunek 5: An overview of Rastrigins function in 2D, f(x, y) = 10 2 + [x
2
10 cos(2x)] + [y
2
10 cos(2y)]
2.5 Rastrigins function
Rastrigins function is based on the function of De Jong with the addition of cosine
modulation in order to produce frequent local minima. Thus, the test function is
highly multimodal. However, the location of the minima are regularly distributed.
Function has the following denition
f(x) = 10n +
n
i=1
_
x
2
i
10 cos(2x
i
)
. (5)
Test area is usually restricted to hyphercube 5.12 x
i
5.12, i = 1, . . . , n. Its
global minimum equal f(x) = 0 is obtainable for x
i
= 0, i = 1, . . . , n.
7
-1
-0. 5
0
0.5
1
x
-1
-0. 5
0
0.5
1
y
0
10
20
30
40
Rysunek 6: Zoom on Rastrigins function in 2D, f(x, y) = 10 2 + [x
2
10 cos(2x)] + [y
2
10 cos(2y)]
8
-400
-200
0
200
400
x
-400
-200
0
200
400
y
-800
-600
-400
-200
0
200
400
600
800
Rysunek 7: An overview of Schwefels function in 2D, f(x, y) = x sin(
_
|x|
y sin(
_
|y|
2.6 Schwefels function
Schwefels function is deceptive in that the global minimum is geometrically di-
stant, over the parameter space, from the next best local minima. Therefore, the
search algorithms are potentially prone to convergence in the wrong direction.
Function has the following denition
f(x) =
n
i=1
_
x
i
sin(
_
|x
i
|)
_
. (6)
Test area is usually restricted to hyphercube 500 x
i
500, i = 1, . . . , n.
Its global minimum f(x) = 418.9829n is obtainable for x
i
= 420.9687, i =
1, . . . , n.
9
-100
-50
0
50
100
x
-100
-50
0
50
100
y
-100
-50
0
50
100
Rysunek 8: Zoom on Schwefels function in 2D, f(x, y) = x sin(
_
|x|
y sin(
_
|y|
10
-600
-400
-200
0
200
400
600
x
-600
-400
-200
0
200
400
600
y
0
20
40
60
80
100
120
140
160
180
Rysunek 9: An overview of Griewangks function in 2D, f(x, y) =
x
2
+y
2
4000
cos(x) cos(
y
2
) + 1
2.7 Griewangks function
Griewangks function is similar to the function of Rastrigin. It has many wide-
spread local minima regularly distributed. Function has the following denition
f(x) =
1
4000
n
i=1
x
2
i
n
i=1
cos(
x
i
i
) + 1. (7)
Test area is usually restricted to hyphercube 600 x
i
600, i = 1, . . . , n. Its
global minimum equal f(x) = 0 is obtainable for x
i
= 0, i = 1, . . . , n. The func-
tion interpretation changes with the scale; the general overview suggests convex
function, medium-scale view suggests existence of local extremum, and nally
zoom on the details indicates complex structure of numerous local extremum.
11
-10
-5
0
5
10
x
-10
-5
0
5
10
y
0
0.5
1
1.5
2
Rysunek 10: Medium-scale view of Griewangks function in 2D, f(x, y) =
x
2
+y
2
4000
cos(x) cos(
y
2
) + 1
12
-4
-2
0
2
4
x
-4
-2
0
2
4
y
0
0.5
1
1.5
2
Rysunek 11: Zoom on Griewangks function in 2D, f(x, y) =
x
2
+y
2
4000
cos(x) cos(
y
2
) + 1
13
-1
-0. 5
0
0.5
1
x
-1
-0. 5
0
0.5
1
y
0
0.5
1
1.5
2
Rysunek 12: Sum of different power functions in 2D, f(x, y) = |x|
2
+ |y|
3
2.8 Sum of different power functions
The sum of different powers is a commonly used unimodal test function. It has
the following denition
f(x) =
n
i=1
|x
i
|
i+1
. (8)
Test area is usually restricted to hyphercube 1 x
i
1, i = 1, . . . , n. Its global
minimum equal f(x) = 0 is obtainable for x
i
= 0, i = 1, . . . , n.
14
-30
-20
-10
0
10
20
30
x
-30
-20
-10
0
10
20
30
y
0
5
10
15
20
Rysunek 13: An overview of Ackleys function in 2D, f(x, y) = x sin(
_
|x|
y sin(
_
|y|
2.9 Ackleys function
Ackleys is a widely used multimodal test function. It has the following denition
f(x) = a exp(b
_
1
n
n
i=1
x
2
i
) exp(
1
n
n
i=1
cos(cx
i
)) + a + exp(1) (9)
It is recommended to set a = 20, b = 0.2, c = 2. Test area is usually restricted to
hyphercube 32.768 x
i
32.768, i = 1, . . . , n. Its global minimum f(x) = 0
is obtainable for x
i
= 0, i = 1, . . . , n.
15
-2
-1
0
1
2
x
-2
-1
0
1
2
y
0
2
4
6
Rysunek 14: Zoom on Ackleys function in 2D, f(x, y) = x sin(
_
|x|
y sin(
_
|y|
16
0
2
4
6
8
10
x
0
2
4
6
8
10
y
-4
-2
0
2
4
Rysunek 15: An overview of Langermanns function in 2D. f(x, y) =
m
i=1
c
i
exp((x a
j
)
2
/ (y b
j
)
2
/) cos((x a
j
)
2
+ (y b
j
)
2
), m = 5,
a = [3, 5, 2, 1, 7], b = [5, 2, 1, 4, 9], c = [1, 2, 5, 2, 3]
2.10 Langermanns function
The Langermann function is a multimodal test function. The local minima are
unevenly distributed. Function has the following denition
f(x) =
m
i=1
c
i
exp[
1
j=1
(x
j
a
ij
)
2
] cos[
n
j=1
(x
j
a
ij
)
2
] (10)
where (c
i
, i = 1, . . . , m), (a
ij
, j = 1, . . . , n, i = 1, . . . , m) are constant numbers
xed in advance. It is recommended to set m = 5.
17
0
1
2
3
4
x
-1
0
1
2
3
y
-4
-2
0
2
4
Rysunek 16: Medium-scale view on Langermanns function in 2D. f(x, y) =
m
i=1
c
i
exp((x a
j
)
2
/ (y b
j
)
2
/) cos((x a
j
)
2
+ (y b
j
)
2
), m = 5,
a = [3, 5, 2, 1, 7], b = [5, 2, 1, 4, 9], c = [1, 2, 5, 2, 3]
18
3
3.5
4
4.5
5
x
3
3.5
4
4.5
5
y
-1. 5
-1
-0. 5
0
0.5
1
1.5
Rysunek 17: Zoom on Langermanns function in 2D. f(x, y) =
m
i=1
c
i
exp((x a
j
)
2
/ (y b
j
)
2
/) cos((x a
j
)
2
+ (y b
j
)
2
), m = 5,
a = [3, 5, 2, 1, 7], b = [5, 2, 1, 4, 9], c = [1, 2, 5, 2, 3]
19
2.11 Michalewiczs function
The Michalewicz function is a multimodal test function (owns n! local optima).
The parameter m denes the steepness of the valleys or edges. Larger m leads
to more difcult search. For very large m the function behaves like a needle in
the haystack (the function values for points in the space outside the narrow peaks
give very little information on the location of the global optimum). Function has
the following denition
f(x) =
n
i=1
sin(x
i
)
_
sin(
ix
2
i
)
_
2m
(11)
It is usually set m = 10. Test area is usually restricted to hyphercube 0 x
i
,
i = 1, . . . , n. The global minimum value has been approximated by f(x) =
4.687 for n = 5 and by f(x) = 9.66 for n = 10. Respective optimal solutions
are not given.
20
0
0.5
1
1.5
2
2.5
3
x
0
0.5
1
1.5
2
2.5
3
y
-1. 8
-1. 6
-1. 4
-1. 2
-1
-0. 8
-0. 6
-0. 4
-0. 2
0
Rysunek 18: Michalewiczs function in 2D for m = 1, f(x, y) =
sin(x)(sin(
x
2
)
2m
sin(y)(sin(
y
2
)
2m
21
0
0.5
1
1.5
2
2.5
3
x
0
0.5
1
1.5
2
2.5
3
y
-1. 8
-1. 6
-1. 4
-1. 2
-1
-0. 8
-0. 6
-0. 4
-0. 2
0
Rysunek 19: Michalewiczs function in 2D for m = 10, f(x, y) =
sin(x)(sin(
x
2
)
2m
sin(y)(sin(
y
2
)
2m
22
-4
-2
0
2
4
6
8
10
x
0
2
4
6
8
10
12
14
y
0
50
100
150
200
250
300
Rysunek 20: Braninss function
2.12 Braninss function
The Branin function is a global optimization test function having only two va-
riables. The function has three equal-sized global optima, and has the following
denition
f(x
1
, x
2
) = a(x
2
bx
2
1
+ cx
1
d)
2
+ e(1 f) cos(x
1
) + e. (12)
It is recommended to set the following values of parameters: a = 1, b =
5.1
4
2
,
c =
5
, d = 6, e = 10, f =
1
8
. Three global optima equal f(x
1
, x
2
) = 0.397887
are located as follows: (x
1
, x
2
) = (, 12.275), (, 2.275), (9.42478, 2.475).
23
-20
-10
0
10
20
x
-20
-10
0
10
20
y
-0. 8
-0. 6
-0. 4
-0. 2
0
Rysunek 21: Easoms function
2.13 Easoms function
The Easom function is a unimodal test function, where the global minimum has a
small area relative to the search space. The function was inverted for minimiza-
tion. It has only two variables and the following denition
f(x
1
, x
2
) = cos(x
1
) cos(x
2
) exp((x
1
)
2
(x
2
)
2
) (13)
Test area is usually restricted to square 100 x
1
100, 100 x
2
100. Its
global minimum equal f(x) = 1 is obtainable for (x
1
, x
2
) = (, ).
24
1
2
3
4
5
x
1
2
3
4
5
y
-1
-0. 8
-0. 6
-0. 4
-0. 2
0
Rysunek 22: Zoom on Easoms function
25
-2
-1
0
1
2
x
-2
-1
0
1
2
y
0
200000
400000
600000
800000
1e+06
Rysunek 23: Goldstein-Prices function
2.14 Goldstein-Prices function
The Goldstein-Price function is a global optimization test function. It has only
two variables and the following denition
f(x
1
, x
2
) = [1 + (x
1
+ x
2
+ 1)
2
(19 14x
1
+ 3x
2
1
14x
2
+ 6x
1
x
2
+ 3x
2
2
]
[30 + (2x
1
3x
2
)
2
(18 32x
1
+ 12x
2
1
+ 48x
2
36x
1
x
2
+ 27x
2
2
]. (14)
Test area is usually restricted to the square 2 x
1
2, 2 x
2
2. Its global
minimum equal f(x) = 3 is obtainable for (x
1
, x
2
) = (0, 1).
26
-2
-1
0
1
2
x
-2
-1
0
1
2
y
0
10
20
30
40
50
Rysunek 24: Six-hump camel back function
2.15 Six-hump camel back function
The Six-hump camel back function is a global optimization test function. Wi-
thin the bounded region it owns six local minima, two of them are global ones.
Function has only two variables and the following denition
f(x
1
, x
2
) = (4 2.1x
2
1
+
x
4
1
3
)x
2
1
+ x
1
x
2
+ (4 + 4x
2
2
)x
2
2
. (15)
Test area is usually restricted to the rectangle 3 x
1
3, 2 x
2
2. Two
global minima equal f(x) = 1.0316 are located at (x
1
, x
2
) = (0.0898, 0.7126)
and (0.0898, 0.7126).
27
-2
-1
0
1
2
x
-1
-0. 5
0
0.5
1
y
-1
0
1
2
3
4
5
Rysunek 25: Zoom on six-hump camel back function
28
2.16 Fifth function of De Jong
This is a multimodal test function. The given form of function has only two va-
riables and the following denition
f(x
1
, x
2
) = {0.002 +
25
j=1
[j + (x
1
a
1j
)
6
+ (x
2
a
2j
)
6
]
1
}
1
, (16)
where
(a
ij
) =
_
32 16 0 16 32 32 . . . 0 16 32
32 32 32 32 32 16 . . . 32 32 32
_
The function can also be rewritten as follows
f(x
1
, x
2
) = {0.002+
2
i=2
2
j=2
[5(i +2)+j +3+(x
1
16j)
6
+(x
2
16i)
6
]
1
}
1
,
(17)
Test area is usually restricted to the square 65.536 x
1
65.536, 65.536
x
2
65.536.
29
-40
-20
0
20
40
x
-40
-20
0
20
40
y
0
100
200
300
400
500
Rysunek 26: An overview of fth function of De Jong
30
-20
-10
0
10
20
x
-20
-10
0
10
20
y
0
100
200
300
400
500
Rysunek 27: Medium-scale view on the fth function of De Jong
31
-10
-5
0
5
10
x
-10
-5
0
5
10
y
100
200
300
400
500
Rysunek 28: Zoom on fth function of De Jong
32
-4
-2
0
2
4
x
-4
-2
0
2
4
y
-0. 8
-0. 6
-0. 4
-0. 2
0
Rysunek 29: An overview of drop wave function
2.17 Drop wave function
This is a multimodal test function. The given form of function has only two va-
riables and the following denition
f(x
1
, x
2
) =
1 + cos(12
_
x
2
+ x
2
2
)
1
2
(x
2
1
+ x
2
2
) + 2
(18)
Test area is usually restricted to the square 5.12 x
1
5.12, 5.12 x
2
5.12.
33
-2
-1
0
1
2
x
-2
-1
0
1
2
y
-0. 8
-0. 6
-0. 4
-0. 2
0
Rysunek 30: Medium-scale view on drop wave function
34
-1
-0. 5
0
0.5
1
x
-1
-0. 5
0
0.5
1
y
-0. 8
-0. 6
-0. 4
-0. 2
0
Rysunek 31: Zoom on drop wave function
35
-4
-2
0
2
4
x
-4
-2
0
2
4
y
-150
-100
-50
0
50
100
150
Rysunek 32: An overview of Shuberts function
2.18 Shuberts function
This is a multimodal test function. The given form of function has only two va-
riables and the following denition
f(x
1
, x
2
) =
5
i=1
i cos((i + 1)x
1
+ 1)
5
i=1
i cos((i + 1)x
2
+ 1), (19)
Test area is usually restricted to the square 5.12 x
1
5.12, 5.12 x
2
5.12.
36
-2
-1
0
1
2
x
-2
-1
0
1
2
y
-200
-100
0
100
Rysunek 33: Medium-scale view on Shuberts function
37
-1
-0. 5
0
0.5
1
x
-1
-0. 5
0
0.5
1
y
-200
-100
0
100
Rysunek 34: Zoom on Shuberts function
38
-10
0
10
20
30
x
-10
0
10
20
30
y
-2
-1. 5
-1
-0. 5
0
Rysunek 35: An overview of Shekels foxholes in 2D. f(x, y) =
m
i=1
[(x
a
j
)
2
+ (y b
j
)
2
+ c
j
]
1
2.19 Shekels foxholes
This is a multimodal test function. It has the following denition
f(x) =
m
i=1
(
n
j=1
[(x
j
a
ij
)
2
+ c
j
])
1
, (20)
where (c
i
, i = 1, . . . , m), (a
ij
, j = 1, . . . , n, i = 1, . . . , m) are constant numbers
xed in advance. It is recommended to set m = 30.
39
0
2
4
6
8
10
x
10
12
14
16
18
20
y
-2
-1. 5
-1
-0. 5
Rysunek 36: Zoom on Shekels foxholes in 2D. f(x, y) =
m
i=1
[(x a
j
)
2
+
(y b
j
)
2
+ c
j
]
1
40
2.20 Deceptive functions
A deceptive problem is a class of problems in which the total size of the basins for
local optimum solutions is much larger than the basin size of the global optimum
solution. Clearly, this is a multimodal function. The general form of deceptive
function is given by the following formulae
f(x) =
_
1
n
n
i=1
g
i
(x
i
)
_
, (21)
where is an xed non-linearity factor.
It has been dened in the literature at least three types of deceptive problems,
depending the form of g
i
(x
i
). A complex deceptive problem (Type III), in which
the global optimum is located at x
i
=
i
, where
i
is a unique random number
between 0 and 1 depending on the dimension i. To this aim the following form of
auxiliary functions has been proposed
g
i
(x
i
) =
_
i
+
4
5
if 0 x
i
4
5
i
5x
i
4 if
4
5
i
< x
i
i
5(x
i
)
i
1
+ 1 if
i
< x
i
1+4
i
5
x1
1
i
+
4
5
if
1+4
i
5
< x
i
1
(22)
The two other types of deceptive problems (Types I and II) are special cases
of the complex deceptive problem, with
i
= 1 (Type I), or
i
= 0 or 1 at random
(Type II) for each dimension i, i = 0, . . . , n. Clearly formulae (22) should be
suitable adjusted for type I and II.
For all three types of g
i
(x
i
), the region with local optima is 5
n
1 times larger
than the region with a global optimum in the n-dimensional space. The number
of local optima is 2
n
1 for Type I and Type II deceptive problems and 3
n
1 for
Type III.
41
0
0.2
0.4
0.6
0.8
1
x
0
0.2
0.4
0.6
0.8
1
y
0.6
0.7
0.8
0.9
1
1.1
Rysunek 37: Deceptive function of Type III in 2D.
1
= 0.3,
2
= 0.7, = 0.2
42
0
0.2
0.4
0.6
0.8
1
x
0
0.2
0.4
0.6
0.8
1
y
0
1
2
3
Rysunek 38: Deceptive function of Type III in 2D.
1
= 0.3,
2
= 0.7, = 2.5
43