Test functions for optimization explained

In applied mathematics, test functions, known as artificial landscapes, are useful to evaluate characteristics of optimization algorithms, such as:

Here some test functions are presented with the aim of giving an idea about the different situations that optimization algorithms have to face when coping with these kinds of problems. In the first part, some objective functions for single-objective optimization cases are presented. In the second part, test functions with their respective Pareto fronts for multi-objective optimization problems (MOP) are given.

The artificial landscapes presented herein for single-objective optimization problems are taken from Bäck,[1] Haupt et al.[2] and from Rody Oldenhuis software.[3] Given the number of problems (55 in total), just a few are presented here.

The test functions used to evaluate the algorithms for MOP were taken from Deb,[4] Binh et al.[5] and Binh.[6] The software developed by Deb can be downloaded,[7] which implements the NSGA-II procedure with GAs, or the program posted on Internet,[8] which implements the NSGA-II procedure with ES.

Just a general form of the equation, a plot of the objective function, boundaries of the object variables and the coordinates of global minima are given herein.

Test functions for single-objective optimization

Name Plot Formula Global minimum Search domain
Rastrigin function

f(x)=An+

n
\sum
i=1
2
\left[x
i

-A\cos(2\pixi)\right]

where:A=10

f(0,...,0)=0

-5.12\lexi\le5.12

Ackley function

f(x,y)=-20\exp\left[-0.2\sqrt{0.5\left(x2+y2\right)}\right]

-\exp\left[0.5\left(\cos2\pix+\cos2\piy\right)\right]+e+20

f(0,0)=0

-5\lex,y\le5

Sphere function

f(\boldsymbol{x})=

n
\sum
i=1
2
x
i

f(x1,...,xn)=f(0,...,0)=0

-infty\lexi\leinfty

,

1\lei\len

f(\boldsymbol{x})=

n-1
\sum
i=1

\left[100\left(xi+1-

2
x
i

\right)2+\left(1-xi\right)2\right]

Min= \begin{cases} n=2&f(1,1)=0,\\ n=3&f(1,1,1)=0,\\ n>3&f(\underbrace{1,...,1}n)=0\\ \end{cases}

-infty\lexi\leinfty

,

1\lei\len

Beale function

f(x,y)=\left(1.5-x+xy\right)2+\left(2.25-x+xy2\right)2

+\left(2.625-x+xy3\right)2

f(3,0.5)=0

-4.5\lex,y\le4.5

Goldstein–Price function

f(x,y)=\left[1+\left(x+y+1\right)2\left(19-14x+3x2-14y+6xy+3y2\right)\right]

\left[30+\left(2x-3y\right)2\left(18-32x+12x2+48y-36xy+27y2\right)\right]

f(0,-1)=3

-2\lex,y\le2

Booth function

f(x,y)=\left(x+2y-7\right)2+\left(2x+y-5\right)2

f(1,3)=0

-10\lex,y\le10

Bukin function N.6

f(x,y)=100\sqrt{\left|y-0.01x2\right|}+0.01\left

x+10 \right.\quad

f(-10,1)=0

-15\lex\le-5

,

-3\ley\le3

Matyas function

f(x,y)=0.26\left(x2+y2\right)-0.48xy

f(0,0)=0

-10\lex,y\le10

Lévi function N.13

f(x,y)=\sin23\pix+\left(x-1\right)2\left(1+\sin23\piy\right)

+\left(y-1\right)2\left(1+\sin22\piy\right)

f(1,1)=0

-10\lex,y\le10

Himmelblau's function

f(x,y)=(x2+y-11)2+(x+y2-7)2.

Min= \begin{cases} f\left(3.0,2.0\right)&=0.0\\ f\left(-2.805118,3.131312\right)&=0.0\\ f\left(-3.779310,-3.283186\right)&=0.0\\ f\left(3.584428,-1.848126\right)&=0.0\\ \end{cases}

-5\lex,y\le5

Three-hump camel function

f(x,y)=2x2-1.05x4+

x6
6

+xy+y2

f(0,0)=0

-5\lex,y\le5

Easom function

f(x,y)=-\cos\left(x\right)\cos\left(y\right)\exp\left(-\left(\left(x-\pi\right)2+\left(y-\pi\right)2\right)\right)

f(\pi,\pi)=-1

-100\lex,y\le100

Cross-in-tray function

f(x,y)=-0.0001\left[\left|\sinx\siny\exp\left(\left|100-

\sqrt{x2+y2
} \right|\right)\right| + 1 \right]^

Min= \begin{cases} f\left(1.34941,-1.34941\right)&=-2.06261\\ f\left(1.34941,1.34941\right)&=-2.06261\\ f\left(-1.34941,1.34941\right)&=-2.06261\\ f\left(-1.34941,-1.34941\right)&=-2.06261\\ \end{cases}

-10\lex,y\le10

Eggholder function[9] [10]

f(x,y)=-\left(y+47\right)\sin\sqrt{\left|

x
2

+\left(y+47\right)\right|}-x\sin\sqrt{\left|x-\left(y+47\right)\right|}

f(512,404.2319)=-959.6407

-512\lex,y\le512

Hölder table function

f(x,y)=-\left

\sin x \cos y \exp \left(\left1 - \frac \right\right)\right

Min= \begin{cases} f\left(8.05502,9.66459\right)&=-19.2085\\ f\left(-8.05502,9.66459\right)&=-19.2085\\ f\left(8.05502,-9.66459\right)&=-19.2085\\ f\left(-8.05502,-9.66459\right)&=-19.2085 \end{cases}

-10\lex,y\le10

McCormick function

f(x,y)=\sin\left(x+y\right)+\left(x-y\right)2-1.5x+2.5y+1

f(-0.54719,-1.54719)=-1.9133

-1.5\lex\le4

,

-3\ley\le4

Schaffer function N. 2

f(x,y)=0.5+

\sin2\left(x2-y2\right)-0.5
\left[1+0.001\left(x2+y2\right)\right]2

f(0,0)=0

-100\lex,y\le100

Schaffer function N. 4

f(x,y)=0.5+

\cos2\left[\sin\left(\left|x2-y2\right|\right)\right]-0.5
\left[1+0.001\left(x2+y2\right)\right]2

Min= \begin{cases} f\left(0,1.25313\right)&=0.292579\\ f\left(0,-1.25313\right)&=0.292579\\ f\left(1.25313,0\right)&=0.292579\\ f\left(-1.25313,0\right)&=0.292579 \end{cases}

-100\lex,y\le100

Styblinski–Tang function

f(\boldsymbol{x})=

n
\sum
4
x
i
-
2
16x
i
+5xi
i=1
2

-39.16617n<f(\underbrace{-2.903534,\ldots,-2.903534}n)<-39.16616n

-5\lexi\le5

,

1\lei\len

..
Shekel function

f(\vec{x})=

m
\sum
i=1

\left(ci+

n
\sum\limits
j=1

(xj-aji)2\right)-1

or, similarly,

f(x1,x2,...,xn-1,xn)=

m
\sum
i=1

\left(ci+

n
\sum\limits
j=1

(xj-aij)2\right)-1

-infty\lexi\leinfty

,

1\lei\len

Test functions for constrained optimization

Name Plot Formula Global minimum Search domain
Rosenbrock function constrained with a cubic and a line[11]

f(x,y)=(1-x)2+100(y-x2)2

,

subjected to:

(x-1)3-y+1\le0andx+y-2\le0

f(1.0,1.0)=0

-1.5\lex\le1.5

,

-0.5\ley\le2.5

Rosenbrock function constrained to a disk[12]

f(x,y)=(1-x)2+100(y-x2)2

,

subjected to:

x2+y2\le2

f(1.0,1.0)=0

-1.5\lex\le1.5

,

-1.5\ley\le1.5

Mishra's Bird function - constrained[13] [14]

f(x,y)=\sin(y)

\left[(1-\cosx)2\right]
e

+\cos(x)

\left[(1-\siny)2\right]
e

+(x-y)2

,subjected to:

(x+5)2+(y+5)2<25

f(-3.1302468,-1.5821422)=-106.7645367

-10\lex\le0

,

-6.5\ley\le0

Townsend function (modified)[15]

f(x,y)=-[\cos((x-0.1)y)]2-x\sin(3x+y)

,subjected to:

x2+y2<\left[2\cost-

1
2

\cos2t-

1
4

\cos3t-

1
8

\cos4t\right]2+[2\sint]2

where:

f(2.0052938,1.1944509)=-2.0239884

-2.25\lex\le2.25

,

-2.5\ley\le1.75

Gomez and Levy function (modified)[16]

f(x,y)=4x2-2.1x4+

1
3

x6+xy-4y2+4y4

,subjected to:

-\sin(4\pix)+2\sin2(2\piy)\le1.5

f(0.08984201,-0.7126564)=-1.031628453

-1\lex\le0.75

,

-1\ley\le1

Simionescu function[17]

f(x,y)=0.1xy

,subjected to:

x2+y

2\le\left[r
T

+rS\cos\left(n\arctan

x
y

\right)\right]2

where:rT=1,rS=0.2andn=8

f(\pm0.84852813,\mp0.84852813)=-0.072

-1.25\lex,y\le1.25

Test functions for multi-objective optimization

Name Plot Functions Constraints Search domain
Binh and Korn function

Minimize= \begin{cases} f1\left(x,y\right)=4x2+4y2\\ f2\left(x,y\right)=\left(x-5\right)2+\left(y-5\right)2\\ \end{cases}

s.t.= \begin{cases} g1\left(x,y\right)=\left(x-5\right)2+y2\leq25\\ g2\left(x,y\right)=\left(x-8\right)2+\left(y+3\right)2\geq7.7\\ \end{cases}

0\lex\le5

,

0\ley\le3

Chankong and Haimes function

[18]

Minimize= \begin{cases} f1\left(x,y\right)=2+\left(x-2\right)2+\left(y-1\right)2\\ f2\left(x,y\right)=9x-\left(y-1\right)2\\ \end{cases}

s.t.= \begin{cases} g1\left(x,y\right)=x2+y2\leq225\\ g2\left(x,y\right)=x-3y+10\leq0\\ \end{cases}

-20\lex,y\le20

Fonseca–Fleming function

[19]

Minimize= \begin{cases} f1\left(\boldsymbol{x}\right)=1-\exp

n
\left[-\sum
i=1

\left(xi-

1
\sqrt{n
} \right)^ \right] \\ f_\left(\boldsymbol\right) = 1 - \exp \left[-\sum_{i=1}^{n} \left(x_{i} + \frac{1}{\sqrt{n}} \right)^{2} \right] \\\end

-4\lexi\le4

,

1\lei\len

Test function 4:

Minimize= \begin{cases} f1\left(x,y\right)=x2-y\\ f2\left(x,y\right)=-0.5x-y-1\\ \end{cases}

s.t.= \begin{cases} g1\left(x,y\right)=6.5-

x
6

-y\geq0\\ g2\left(x,y\right)=7.5-0.5x-y\geq0\\ g3\left(x,y\right)=30-5x-y\geq0\\ \end{cases}

-7\lex,y\le4

Kursawe function

[20]

Minimize= \begin{cases} f1\left(\boldsymbol{x}\right)=

2
\sum
i=1

\left[-10\exp\left(-0.2

2
\sqrt{x
i

+

2
x
i+1
} \right) \right] \\ & \\ f_\left(\boldsymbol\right) = \sum_^ \left[\left|x_{i}\right|^{0.8} + 5 \sin \left(x_{i}^{3} \right) \right] \\\end

-5\lexi\le5

,

1\lei\le3

.
Schaffer function N. 1:[21]

Minimize= \begin{cases} f1\left(x\right)=x2\\ f2\left(x\right)=\left(x-2\right)2\\ \end{cases}

-A\lex\leA

. Values of

A

from

10

to

105

have been used successfully. Higher values of

A

increase the difficulty of the problem.
Schaffer function N. 2:

Minimize= \begin{cases} f1\left(x\right)=\begin{cases} -x,&ifx\le1\\ x-2,&if1<x\le3\\ 4-x,&if3<x\le4\\ x-4,&ifx>4\\ \end{cases}\\ f2\left(x\right)=\left(x-5\right)2\\ \end{cases}

-5\lex\le10

.
Poloni's two objective function:

Minimize= \begin{cases} f1\left(x,y\right)=\left[1+\left(A1-B1\left(x,y\right)\right)2+\left(A2-B2\left(x,y\right)\right)2\right]\\ f2\left(x,y\right)=\left(x+3\right)2+\left(y+1\right)2\\ \end{cases}

where= \begin{cases} A1=0.5\sin\left(1\right)-2\cos\left(1\right)+\sin\left(2\right)-1.5\cos\left(2\right)\\ A2=1.5\sin\left(1\right)-\cos\left(1\right)+2\sin\left(2\right)-0.5\cos\left(2\right)\\ B1\left(x,y\right)=0.5\sin\left(x\right)-2\cos\left(x\right)+\sin\left(y\right)-1.5\cos\left(y\right)\\ B2\left(x,y\right)=1.5\sin\left(x\right)-\cos\left(x\right)+2\sin\left(y\right)-0.5\cos\left(y\right) \end{cases}

-\pi\lex,y\le\pi

Zitzler–Deb–Thiele's function N. 1:[22]

Minimize= \begin{cases} f1\left(\boldsymbol{x}\right)=x1\\ f2\left(\boldsymbol{x}\right)=g\left(\boldsymbol{x}\right)h\left(f1\left(\boldsymbol{x}\right),g\left(\boldsymbol{x}\right)\right)\\ g\left(\boldsymbol{x}\right)=1+

9
29
30
\sum
i=2

xi\\ h\left(f1\left(\boldsymbol{x}\right),g\left(\boldsymbol{x}\right)\right)=1-\sqrt{

f1\left(\boldsymbol{x
\right)}{g\left(\boldsymbol{x}\right)}}

\\ \end{cases}

0\lexi\le1

,

1\lei\le30

.
Zitzler–Deb–Thiele's function N. 2:

Minimize= \begin{cases} f1\left(\boldsymbol{x}\right)=x1\\ f2\left(\boldsymbol{x}\right)=g\left(\boldsymbol{x}\right)h\left(f1\left(\boldsymbol{x}\right),g\left(\boldsymbol{x}\right)\right)\\ g\left(\boldsymbol{x}\right)=1+

9
29
30
\sum
i=2

xi\\ h\left(f1\left(\boldsymbol{x}\right),g\left(\boldsymbol{x}\right)\right)=1-\left(

f1\left(\boldsymbol{x
\right)}{g\left(\boldsymbol{x}\right)}\right)

2\\ \end{cases}

0\lexi\le1

,

1\lei\le30

.
Zitzler–Deb–Thiele's function N. 3:

Minimize= \begin{cases} f1\left(\boldsymbol{x}\right)=x1\\ f2\left(\boldsymbol{x}\right)=g\left(\boldsymbol{x}\right)h\left(f1\left(\boldsymbol{x}\right),g\left(\boldsymbol{x}\right)\right)\\ g\left(\boldsymbol{x}\right)=1+

9
29
30
\sum
i=2

xi\\ h\left(f1\left(\boldsymbol{x}\right),g\left(\boldsymbol{x}\right)\right)=1-\sqrt{

f1\left(\boldsymbol{x
\right)}{g\left(\boldsymbol{x}

\right)}}-\left(

f1\left(\boldsymbol{x
\right)}{g\left(\boldsymbol{x}\right)}

\right)\sin\left(10\pif1\left(\boldsymbol{x}\right)\right) \end{cases}

0\lexi\le1

,

1\lei\le30

.
Zitzler–Deb–Thiele's function N. 4:

Minimize= \begin{cases} f1\left(\boldsymbol{x}\right)=x1\\ f2\left(\boldsymbol{x}\right)=g\left(\boldsymbol{x}\right)h\left(f1\left(\boldsymbol{x}\right),g\left(\boldsymbol{x}\right)\right)\\ g\left(\boldsymbol{x}\right)=91+

10
\sum
i=2
2
\left(x
i

-10\cos\left(4\pixi\right)\right)\\ h\left(f1\left(\boldsymbol{x}\right),g\left(\boldsymbol{x}\right)\right)=1-\sqrt{

f1\left(\boldsymbol{x
\right)}{g\left(\boldsymbol{x}

\right)}} \end{cases}

0\lex1\le1

,

-5\lexi\le5

,

2\lei\le10

Zitzler–Deb–Thiele's function N. 6:

Minimize= \begin{cases} f1\left(\boldsymbol{x}\right)=1-\exp\left(-4x1\right)\sin6\left(6\pix1\right)\\ f2\left(\boldsymbol{x}\right)=g\left(\boldsymbol{x}\right)h\left(f1\left(\boldsymbol{x}\right),g\left(\boldsymbol{x}\right)\right)\\ g\left(\boldsymbol{x}\right)=1+9\left[

10
\sumxi
i=2
9

\right]0.25\\ h\left(f1\left(\boldsymbol{x}\right),g\left(\boldsymbol{x}\right)\right)=1-\left(

f1\left(\boldsymbol{x
\right)}{g\left(\boldsymbol{x}

\right)}\right)2\\ \end{cases}

0\lexi\le1

,

1\lei\le10

.
Osyczka and Kundu function:[23]

Minimize= \begin{cases} f1\left(\boldsymbol{x}\right)=-25\left(x1-2\right)2-\left(x2-2\right)2-\left(x3-1\right)2-\left(x4-4\right)2-\left(x5-1\right)2\\ f2\left(\boldsymbol{x}\right)=

6
\sum
i=1
2
x
i

\\ \end{cases}

s.t.= \begin{cases} g1\left(\boldsymbol{x}\right)=x1+x2-2\geq0\\ g2\left(\boldsymbol{x}\right)=6-x1-x2\geq0\\ g3\left(\boldsymbol{x}\right)=2-x2+x1\geq0\\ g4\left(\boldsymbol{x}\right)=2-x1+3x2\geq0\\ g5\left(\boldsymbol{x}\right)=4-\left(x3-3\right)2-x4\geq0\\ g6\left(\boldsymbol{x}\right)=\left(x5-3\right)2+x6-4\geq0 \end{cases}

0\lex1,x2,x6\le10

,

1\lex3,x5\le5

,

0\lex4\le6

.
CTP1 function (2 variables):[24]

Minimize= \begin{cases} f1\left(x,y\right)=x\\ f2\left(x,y\right)=\left(1+y\right)\exp\left(-

x
1+y

\right) \end{cases}

s.t.= \begin{cases} g1\left(x,y\right)=

f2\left(x,y\right)
0.858\exp\left(-0.541f1\left(x,y\right)\right)

\geq1\\ g2\left(x,y\right)=

f2\left(x,y\right)
0.728\exp\left(-0.295f1\left(x,y\right)\right)

\geq1 \end{cases}

0\lex,y\le1

.
Constr-Ex problem:

Minimize= \begin{cases} f1\left(x,y\right)=x\\ f2\left(x,y\right)=

1+y
x

\\ \end{cases}

s.t.= \begin{cases} g1\left(x,y\right)=y+9x\geq6\\ g2\left(x,y\right)=-y+9x\geq1\\ \end{cases}

0.1\lex\le1

,

0\ley\le5

Viennet function:

Minimize= \begin{cases} f1\left(x,y\right)=0.5\left(x2+y2\right)+\sin\left(x2+y2\right)\\ f2\left(x,y\right)=

\left(3x-2y+4\right)2
8

+

\left(x-y+1\right)2
27

+15\\ f3\left(x,y\right)=

1
x2+y2+1

-1.1\exp\left(-\left(x2+y2\right)\right)\\ \end{cases}

-3\lex,y\le3

.

References

  1. Book: Bäck, Thomas. Evolutionary algorithms in theory and practice : evolution strategies, evolutionary programming, genetic algorithms. 1995. Oxford University Press. Oxford. 978-0-19-509971-3. 328.
  2. Book: Haupt, Randy L. Haupt, Sue Ellen. Practical genetic algorithms with CD-Rom. 2004. J. Wiley. New York. 978-0-471-45565-3. 2nd.
  3. Web site: Oldenhuis. Rody. Many test functions for global optimizers. Mathworks. 1 November 2012.
  4. Deb, Kalyanmoy (2002) Multiobjective optimization using evolutionary algorithms (Repr. ed.). Chichester [u.a.]: Wiley. .
  5. Binh T. and Korn U. (1997) MOBES: A Multiobjective Evolution Strategy for Constrained Optimization Problems. In: Proceedings of the Third International Conference on Genetic Algorithms. Czech Republic. pp. 176–182
  6. Binh T. (1999) A multiobjective evolutionary algorithm. The study cases. Technical report. Institute for Automation and Communication. Barleben, Germany
  7. Deb K. (2011) Software for multi-objective NSGA-II code in C. Available at URL: https://www.iitk.ac.in/kangal/codes.shtml
  8. Web site: Ortiz. Gilberto A.. Multi-objective optimization using ES as Evolutionary Algorithm.. Mathworks. 1 November 2012.
  9. Whitley . Darrell . Rana . Soraya . Dzubera . John . Mathias . Keith E. . Evaluating evolutionary algorithms . Artificial Intelligence . Elsevier BV . 85 . 1–2 . 1996 . 0004-3702 . 10.1016/0004-3702(95)00124-7 . 264. free .
  10. Vanaret C. (2015) Hybridization of interval methods and evolutionary algorithms for solving difficult optimization problems. PhD thesis. Ecole Nationale de l'Aviation Civile. Institut National Polytechnique de Toulouse, France.
  11. Simionescu, P.A. . Beale, D. . New Concepts in Graphic Visualization of Objective Functions . ASME 2002 International Design Engineering Technical Conferences and Computers and Information in Engineering Conference . Montreal, Canada . September 29 – October 2, 2002. 891–897 . 7 January 2017 .
  12. Web site: Solve a Constrained Nonlinear Problem - MATLAB & Simulink. www.mathworks.com. 2017-08-29.
  13. Web site: Bird Problem (Constrained) Phoenix Integration. 2017-08-29. bot: unknown. https://web.archive.org/web/20161229032528/http://www.phoenix-int.com/software/benchmark_report/bird_constrained.php. 2016-12-29.
  14. Mishra. Sudhanshu. 2006. Some new test functions for global optimization and performance of repulsive particle swarm method. MPRA Paper.
  15. Web site: Constrained optimization in Chebfun. Townsend. Alex. January 2014. chebfun.org. 2017-08-29.
  16. Simionescu . P.A. . 2020 . A collection of bivariate nonlinear optimisation test problems with graphical representations . International Journal of Mathematical Modelling and Numerical Optimisation . 10 . 4 . 365–398 . 10.1504/IJMMNO.2020.110704 .
  17. Book: Simionescu, P.A.. Computer Aided Graphing and Simulation Tools for AutoCAD Users. 2014. CRC Press. Boca Raton, FL. 978-1-4822-5290-3. 1st.
  18. Book: Chankong . Vira . Haimes . Yacov Y. . Multiobjective decision making. Theory and methodology. . 0-444-00710-5. 1983 . North Holland .
  19. C. M. . Fonseca . P. J. . Fleming . An Overview of Evolutionary Algorithms in Multiobjective Optimization . . 3 . 1 . 1–16 . 1995 . 10.1162/evco.1995.3.1.1 . 10.1.1.50.7779 . 8530790 .
  20. F. Kursawe, “A variant of evolution strategies for vector optimization,” in PPSN I, Vol 496 Lect Notes in Comput Sc. Springer-Verlag, 1991, pp. 193–197.
  21. Book: Schaffer, J. David . 1984 . Multiple Objective Optimization with Vector Evaluated Genetic Algorithms . Proceedings of the First International Conference on Genetic Algorithms . G.J.E Grefensette . J.J. Lawrence Erlbraum . 20004572 .
  22. Book: Deb . Kalyan . Thiele . L. . Laumanns . Marco . Zitzler . Eckart . Proceedings of the 2002 Congress on Evolutionary Computation. CEC'02 (Cat. No.02TH8600) . Scalable multi-objective optimization test problems . 2002 . 1 . 825–830 . 10.1109/CEC.2002.1007032. 0-7803-7282-4 . 61001583 .
  23. Osyczka . A. . Kundu . S. . A new method to solve generalized multicriteria optimization problems using the simple genetic algorithm . Structural Optimization . 1 October 1995 . 10 . 2 . 94–99 . 10.1007/BF01743536 . 123433499 . 1615-1488.
  24. Book: Jimenez . F. . Gomez-Skarmeta . A. F. . Sanchez . G. . Deb . K. . Proceedings of the 2002 Congress on Evolutionary Computation. CEC'02 (Cat. No.02TH8600) . An evolutionary algorithm for constrained multi-objective optimization . May 2002 . 2 . 1133–1138 . 10.1109/CEC.2002.1004402. 0-7803-7282-4 . 56563996 .