Geatbx: Examples of Objective Functions
Geatbx: Examples of Objective Functions
GEATbx Examples
com
Contents
1 Introduction ..................................................................................................... 1
1.1 Examples of Parametric Optimization............................................................................ 1 1.2 Examples of Multi-objective Optimization .................................................................... 1
Index ................................................................................................................... 17
www.geatbx.com
GEATbx Examples
1 Introduction
This document describes a number of test functions implemented for use with the Genetic and Evolutionary Algorithm Toolbox for Matlab (GEATbx). These functions are drawn from the literature on evolutionary algorithms and global optimization. The first Section describes a set of common parametric test problems implemented as Matlab m-files. The second Section presents a number of dynamic systems, implemented in Simulink, as s-files and m-files as appropriate.
www.geatbx.com
GEATbx Examples
2 Parametric Optimization
f1 ( x ) = xi2
i =1
5.12 xi 5.12
f1(x)=sum(x(i)^2), i=1:n, -5.12<=x(i)<=5.12. global minimum: f(x)=0, x(i)=0, i=1:n. This function is implemented in objfun1. Fig. 2-1: Visualization of De Jong's function 1 using different domains of the variables; however, both graphics look similar, just the scaling changed; left: surf plot of the function in a very large area from -500 to 500 for each of both variables, right: the function at a smaller area from -10 to 10
f1a ( x ) = i xi2
i =1
5.12 xi 5.12
2 Parametric Optimization
f(x)=0; x(i)= 0, i=1:n. This function is implemented in objfun1a. Fig. 2-2: Visualization of Axis parallel hyper-ellipsoid function; surf/mesh plot of the function in an area from -5 to 5
i f1b ( x ) = x j i =1 j =1
n
65.536 xi 65.536
f1b(x)=sum(sum(x(j)^2), j=1:i), i=1:n, -65.536<=x(i)<=65.536. global minimum: f(x)=0; x(i)=0, i=1:n. This function is implemented in objfun1b. Fig. 2-3: Visualization of Rotated hyper-ellipsoid function; surf/mesh plot of the first two variables in an area from 50 to 50
GEATbx Examples
www.geatbx.com
f1c (x ) = 5i xi2
i =1
5.12 xi 5.12
f1c(x)=sum(5*ix(i)^2), i=1:n, -5.12<=x(i)<=5.12. global minimum: f(x)=0; x(i)= 5*i, i=1:n. This function is implemented in objfun1c. Fig. 2-4: Visualization of Moved axis parallel hyper-ellipsoid function; surf/mesh plot of the of the first and fourth variable, the objective values were calculated from the 4-dimensional function with second and third variable set to 0
f 2 ( x ) = 100 xi +1 xi2 + (1 xi )
2 i =1
n 1
2.048 xi 2.048
f2(x)=sum(100(x(i+1)-x(i)^2)^2+(1-x(i))^2) i=1:n-1; -2.048<=x(i)<=2.048. global minimum: f(x)=0; x(i)=1, i=1:n. This function is implemented in objfun2.
www.geatbx.com
GEATbx Examples
2 Parametric Optimization
Fig. 2-5:
Visualization of Rosenbrock's function; left: full definition range of the function, right: focus around the area of the global optimum at [1, 1]
f 6 ( x ) = 10 n + xi2 10 cos(2 xi )
i =1
5.12 xi 5.12
f6(x)=10n+sum(x(i)^2-10cos(2pix(i))), i=1:n; -5.12<=x(i)<=5.12. global minimum: f(x)=0; x(i)=0, i=1:n. This function is implemented in objfun6. Fig. 2-6: Visualization of Rastrigin's function; left: surf plot in an area from 5 to 5, right: focus around the area of the global optimum at [0, 0] in an area from 1 to 1
GEATbx Examples
www.geatbx.com
f 7 ( x ) = xi sin
i =1
( x)
i
500 xi 500
f7(x)=sum(-x(i)sin(sqrt(abs(x(i))))), i=1:n; -500<=x(i)<=500. global minimum: f(x)=-n418.9829; x(i)=420.9687, i=1:n. This function is implemented in objfun7. Fig. 2-7: Visualization of Schwefel's function; surf plot in an area from 500 to 500
f8 ( x ) =
i =1
600 xi 600
f8(x)=sum(x(i)^2/4000)-prod(cos(x(i)/sqrt(i)))+1, i=1:n -600<=x(i)<= 600. global minimum: f(x)=0; x(i)=0, i=1:n. This function is implemented in objfun8. The graphics in Figure 2-8 below depict Griewangk's function using three different resolutions. Each of the graphics represents different properties of the function. The graphic on the top left side shows the full definition range of the function. Here, the function looks very similar to De'Jong's function 1. When approaching the inner area, the function looks different. Many small peaks and valleys are visible in the right graphic. When zooming in on the area of the optimum, grahic on the bottom left side, the peaks and valleys look smooth.
www.geatbx.com
GEATbx Examples
2 Parametric Optimization
Fig. 2-8:
Visualization of Griewangk's function; top left: full definition area from 500 to 500, right: inner area of the function from 50 to 50, bottom left: area from 8 to 8 around the optimum at [0, 0]
f 9 ( x ) = xi
i =1
( i +1 )
1 xi 1
f9(x)=sum(abs(x(i))^(i+1)), i=1:n; -1<=x(i)<=1. global minimum: f(x)=0; x(i)=0, i=1:n. This function is implemented in objfun9.
GEATbx Examples
www.geatbx.com
Fig. 2-9:
f10 (x ) = a e
i =1
xi n
i =1
cos (c xi ) n
+ a + e1
1 xi 1
f10(x)=-aexp(-bsqrt(1/nsum(x(i)^2)))-exp(1/nsum(cos(cx(i))))+a+exp(1) a=20; b=0.2; c=2pi; i=1:n; -32.768<=x(i)<=32.768. global minimum: f(x)=0; x(i)=0, i=1:n. This function is implemented in objfun10. Figure 2-10 shows the function at two different zoom ratios. The graphic on the left side employs the whole definition area of the function from -30 to 30. The graphic on the right side zooms into the area of the global minimum giving a better impression of the properties of the function. Fig. 2-10: Visualization of Ackley's Path function; left: surf plot in an area from 30 to 30, right: focus around the area of the global optimum at [0, 0] in an area from 2 to 2
www.geatbx.com
GEATbx Examples
10
2 Parametric Optimization
i = 1 : m, 2 m 10, 0 xi 10
f11(x)=-sum(c(i)(exp(-1/pisum((x-A(i))^2))cos(pisum((x-A(i))^2)))) i=1:m, 2<=m<=10; 0<=x(i)<=10. for the value of A and c look at the mfile objfun11. global minimum: f(x)=-1.4 (for m=5); x(i)=???, i=1:n. This function is implemented in objfun11. Figure 2-11 displays Langermann's function with different variables. The graphic on the left side shows a mesh plot of the first and second variable. The graphic on the right side uses the second and third variable while the first variable is set to 0. Fig. 2-11: Visualization of Langermann's function; left: surf plot in an area from 0 to 10 for the first and second variable, right: same as left, but for the second and third variable
2 m
i = 1 : n, m = 10, 0 xi
f12(x)=-sum(sin(x(i))(sin(ix(i)^2/pi))^(2m)), i=1:n, m=10 0<=x(i)<=pi. global minimum: f(x)=-4.687 (n=5); x(i)=???, i=1:n. f(x)=-9.66 (n=10); x(i)=???, i=1:n.
GEATbx Examples www.geatbx.com
11
This function is implemented in objfun12. The first two graphics below represent a global and a local view to Michalewicz's function, both for the first two variables. The third graphic on the right side displays the function using the third and fourth variable, the first two variables were set to 0. By comparing the left and the right graphic the increasing difficulty of the function can be seen. As higher the dimension as more valleys are introduced into the function. Fig. 2-12: Visualization of Michalewicz's function; top left: surf plot in an area from 0 to 3 for the first and second variable, right: area around the optimum, bottom left: same as top left for the third and fourth variable, variable 1 and 2 are set 0
f Bran ( x1 , x2 ) = a x2 b x 12 + c x1 d + e (1 f ) cos( x1 ) + e
2
5 x1 10, 0 x2 15
a = 1, b =
5 .1 5 , c = , d = 6, e = 10, 2 4
f =
1 8
fBran(x1,x2)=a(x2-bx1^2+cx1-d)^2+e(1-f)cos(x1)+e a=1, b=5.1/(4pi^2), c=5/pi, d=6, e=10, f=1/(8pi) -5<=x1<=10, 0<=x2<=15. global minimum: f(x1,x2)=0.397887; (x1,x2)=(-pi,12.275), (pi,2.275), (9.42478,2.475). This function is implemented in objbran.
www.geatbx.com GEATbx Examples
12
2 Parametric Optimization
Fig. 2-13:
+ ( x 2 )2
100 xi 100, i = 1 : 2
fEaso(x1,x2)=-cos(x1)cos(x2)exp(-((x1-pi)^2+(x2-pi)^2)) -100<=x(i)<=100, i=1:2. global minimum: f(x1,x2)=-1; (x1,x2)=(pi,pi). This function is implemented in objeaso. Fig. 2-14: Visualization of Easom's function; left: surf plot of a large area around the optimum the definition range, right: the direct area around the optimum
13
( ( (30 + (2 x 3 x ) (18 32 x + 12 x
2 xi 2, i = 1 : 2
))
2 + 48 x2 36 x1 x2 + 27 x2
))
fGold(x1,x2)=[1+(x1+x2+1)^2(19-14x1+3x1^2-14x2+6x1x2+3x2^2)] [30+(2x1-3x2)^2(18-32x1+12x1^2+48x2-36x1x2+27x2^2)] -2<=x(i)<=2, i=1:2. global minimum: f(x1,x2)=3; (x1,x2)=(0,-1). This function is implemented in objgold. Fig. 2-15: Visualization of Goldstein-Price's function; surf plot of the definition range
3 x1 3, 2 x1 2
fSixh(x1,x2)=(4-2.1x1^2+x1^4/3)x1^2+x1x2+(-4+4x2^2)x2^2 -3<=x1<=3, -2<=x2<=2. global minimum: f(x1,x2)=-1.0316; (x1,x2)=(-0.0898,0.7126), (0.0898,-0.7126). This function is implemented in objsixh.
www.geatbx.com
GEATbx Examples
14
2 Parametric Optimization
Fig. 2-16:
Visualization of Six-hump camel back function; left: surf plot of the area surrounding the minima, right: smaller area around the minima
GEATbx Examples
www.geatbx.com
15
3 Multi-objective Optimization
www.geatbx.com
GEATbx Examples
Index
A
Ackley's Path function visualization 9 Axis parallel hyper-ellipsoid function visualization 4
L
Langermann's function visualization 10
M
Michalewicz's function visualization 11 Moved axis parallel hyper-ellipsoid function visualization 5
B
Banana function visualization 6 Branins's rcos function visualization 12
R
Rastrigin's function visualization 6 Rosenbrock's function visualization 6 Rotated hyper-ellipsoid function visualization 4
D
De Jong's function 1 visualization 3 De Jong's function 2 visualization 6
E
Easom's function visualization 12
S
Schwefel's function visualization 7 Six-hump camel back function visualization 14 Sum of different power function visualization 9
G
Goldstein-Price's function visualization 13 Griewangk's function visualization 8
www.geatbx.com
GEATbx Examples