Skip to content

Commit b711eae

Browse files
authored
Merge pull request #19 from zStupan/master
Add Test Function definitions
2 parents 3b414d1 + 1397b1e commit b711eae

File tree

4 files changed

+415
-15
lines changed

4 files changed

+415
-15
lines changed

Problems.md

Lines changed: 387 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,387 @@
1+
# Test Functions
2+
3+
Bellow You'll find the definitions of all the test functions implemented in this package.
4+
5+
## Ackley
6+
***Function name:*** `ackley`
7+
8+
```math
9+
f(x) = -20 e^{-0.2 \sqrt{D^{-1} \sum\nolimits_{i=1}^D x_i^2}} - e^{D^{-1} \sum\nolimits_{i=1}^D \cos(2 \pi x_i)} + 20 + e
10+
```
11+
12+
**Dimensions:** $D$
13+
14+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 0`$
15+
16+
## Alpine 1
17+
***Function name:*** `alpine1`
18+
19+
```math
20+
f(x) = \sum_{i=1}^{D} \lvert {x_i \sin \left( x_i \right) + 0.1 x_i} \rvert
21+
```
22+
23+
**Dimensions:** $D$
24+
25+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 0`$
26+
27+
## Alpine 2
28+
***Function name:*** `alpine2`
29+
30+
```math
31+
f(x) = \prod_{i=1}^{D} \sqrt{x_i} \sin(x_i)
32+
```
33+
34+
**Dimensions:** $D$
35+
36+
**Global optimum:** $`f(x^*) = 2.808^D`$ for $`x_i^* = 7.917`$
37+
38+
## Cigar
39+
***Function name:*** `cigar`
40+
41+
```math
42+
f(x) = x_1^2 + 10^6\sum_{i=2}^{D} x_i^2
43+
```
44+
45+
**Dimensions:** $D$
46+
47+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 0`$
48+
49+
## Cosine Mixture
50+
***Function name:*** `cosine_mixture`
51+
52+
```math
53+
f(x) = -0.1 \sum_{i=1}^D \cos (5 \pi x_i) - \sum_{i=1}^D x_i^2
54+
```
55+
56+
**Dimensions:** $D$
57+
58+
**Global optimum:** $`f(x^*) = -0.1 D`$ for $`x_i^* = 0`$
59+
60+
## Csendes
61+
***Function name:*** `csendes`
62+
63+
```math
64+
f(x) = \sum_{i=1}^D x_i^6 \left( 2 + \sin \frac{1}{x_i}\right)
65+
```
66+
67+
**Dimensions:** $D$
68+
69+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 0`$
70+
71+
## Dixon-Price
72+
***Function name:*** `dixon_price`
73+
74+
```math
75+
f(x) = (x_1 - 1)^2 + \sum_{i = 2}^D i (2x_i^2 - x_{i - 1})^2
76+
```
77+
78+
**Dimensions:** $D$
79+
80+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 2^{- \frac{(2^i - 2)}{2^i}}`$
81+
82+
## Griewank
83+
***Function name:*** `griewank`
84+
85+
```math
86+
f(x) = \sum_{i=1}^D \frac{x_i^2}{4000} - \prod_{i=1}^D \cos(\frac{x_i}{\sqrt{i}}) + 1
87+
```
88+
89+
**Dimensions:** $D$
90+
91+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 0`$
92+
93+
## Katsuura
94+
***Function name:*** `katsuura`
95+
96+
```math
97+
\prod_{i=1}^D \left(1 + i \sum_{j=1}^{32} \frac{\lvert 2^j x_i - round\left(2^j x_i \right) \rvert}{2^j} \right)
98+
```
99+
100+
**Dimensions:** $D$
101+
102+
**Global optimum:** $`f(x^*) = 1`$ for $`x_i^* = 0`$
103+
104+
## Levy
105+
***Function name:*** `levy`
106+
107+
```math
108+
\begin{gather}
109+
\sin^2 (\pi w_1) + \sum_{i = 1}^{D - 1} (w_i - 1)^2 \left( 1 + 10 \sin^2 (\pi w_i + 1) \right) + (w_d - 1)^2 (1 + \sin^2 (2 \pi w_d)),\,\text{where}\\
110+
w_i = 1 + \frac{x_i - 1}{4},\, \text{for all } i = 1, \ldots, D
111+
\end{gather}
112+
113+
```
114+
115+
**Dimensions:** $D$
116+
117+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 1`$
118+
119+
## Michalewicz
120+
***Function name:*** `michalewicz`
121+
122+
```math
123+
f(x) = - \sum_{i = 1}^{D} \sin(x_i) \sin^{2m}\left( \frac{ix_i^2}{\pi} \right)
124+
```
125+
126+
**Dimensions:** $D$
127+
128+
**Global optimum:** $`\text{at } D=2,\,f(x^*) = -1.8013`$ for $`x^* = (2.20, 1.57)`$
129+
130+
## Perm 1
131+
***Function name:*** `perm1`
132+
133+
```math
134+
f(x) = \sum_{i = 1}^D \left( \sum_{j = 1}^D (j^i + \beta) \left( \left(\frac{x_j}{j}\right)^i - 1 \right) \right)^2
135+
```
136+
137+
**Dimensions:** $D$
138+
139+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = i`$
140+
141+
## Perm 2
142+
***Function name:*** `perm2`
143+
144+
```math
145+
f(x) = \sum_{i = 1}^D \left( \sum_{j = 1}^D (j - \beta) \left( x_j^i - \frac{1}{j^i} \right) \right)^2
146+
```
147+
148+
**Dimensions:** $D$
149+
150+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = \frac{1}{i}`$
151+
152+
## Pinter
153+
***Function name:*** `pinter`
154+
155+
```math
156+
f(x) = \sum_{i=1}^D ix_i^2 + \sum_{i=1}^D 20i \sin^2 A + \sum_{i=1}^D i \log_{10} (1 + iB^2),\, \text{where}
157+
```
158+
```math
159+
\begin{align}
160+
A &= (x_{i-1}\sin(x_i)+\sin(x_{i+1})) \\
161+
B &= (x_{i-1}^2 - 2x_i + 3x_{i+1} - \cos(x_i) + 1)
162+
\end{align}
163+
```
164+
165+
**Dimensions:** $D$
166+
167+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 0`$
168+
169+
## Powell
170+
***Function name:*** `powell`
171+
172+
```math
173+
f(x) = \sum_{i = 1}^{D/4} \left[ (x_{4 i - 3} + 10 x_{4 i - 2})^2 + 5 (x_{4 i - 1} - x_{4 i})^2 + (x_{4 i - 2} - 2 x_{4 i - 1})^4 + 10 (x_{4 i - 3} - x_{4 i})^4 \right]
174+
```
175+
176+
**Dimensions:** $D$
177+
178+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 0`$
179+
180+
## Qing
181+
***Function name:*** `qing`
182+
183+
```math
184+
f(x) = \sum_{i=1}^D \left(x_i^2 - i\right)^2
185+
```
186+
187+
**Dimensions:** $D$
188+
189+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = \pm \sqrt{i}`$
190+
191+
## Quintic
192+
***Function name:*** `quintic`
193+
194+
```math
195+
f(x) = \sum_{i=1}^D \left| x_i^5 - 3x_i^4 + 4x_i^3 + 2x_i^2 - 10x_i - 4\right|
196+
```
197+
198+
**Dimensions:** $D$
199+
200+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = -1\quad \text{or} \quad x_i^* = 2`$
201+
202+
## Rastrigin
203+
***Function name:*** `rastrigin`
204+
205+
```math
206+
f(x) = 10D + \sum_{i=1}^D \left[x_i^2 -10\cos(2\pi x_i)\right]
207+
```
208+
209+
**Dimensions:** $D$
210+
211+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 0`$
212+
213+
## Rosenbrock
214+
***Function name:*** `rosenbrock`
215+
216+
```math
217+
f(x) = \sum_{i=1}^{D-1} \left[100 (x_{i+1} - x_i^2)^2 + (x_i - 1)^2 \right]
218+
```
219+
220+
**Dimensions:** $D$
221+
222+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 1`$
223+
224+
## Salomon
225+
***Function name:*** `salomon`
226+
227+
```math
228+
f(x) = 1 - \cos\left(2\pi\sqrt{\sum\nolimits_{i=1}^D x_i^2} \right)+ 0.1 \sqrt{\sum\nolimits_{i=1}^D x_i^2}
229+
```
230+
231+
**Dimensions:** $D$
232+
233+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 0`$
234+
235+
## Schaffer 2
236+
***Function name:*** `schaffer2`
237+
238+
```math
239+
f(x) = 0.5 + \frac{ \sin^2 \left( x_1^2 - x_2^2 \right) - 0.5 }{ \left[ 1 + 0.001 \left( x_1^2 + x_2^2 \right) \right]^2 }
240+
```
241+
242+
**Dimensions:** 2
243+
244+
**Global optimum:** $`f(x^*) = 0`$ for $`x^* = (0, 0)`$
245+
246+
## Schaffer 4
247+
***Function name:*** `schaffer4`
248+
249+
```math
250+
f(x) = 0.5 + \frac{ \cos^2 \left( \sin \left( \vert x_1^2 - x_2^2\vert \right) \right)- 0.5 }{ \left[ 1 + 0.001 \left( x_1^2 + x_2^2 \right) \right]^2 }
251+
```
252+
253+
**Dimensions:** 2
254+
255+
**Global optimum:** $`f(x^*) = 0.292579`$ for $`x^* = (0, \pm 1.25313) \text{or} (\pm 1.25313, 0)`$
256+
257+
## Schwefel
258+
***Function name:*** `schwefel`
259+
260+
```math
261+
f(x) = 418.9829D - \sum_{i=1}^{D} x_i \sin(\sqrt{\lvert x_i \rvert})
262+
```
263+
264+
**Dimensions:** $D$
265+
266+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 420.9687`$
267+
268+
## Schwefel 2.21
269+
***Function name:*** `schwefel221`
270+
271+
```math
272+
f(x) = \max_{1 \leq i \leq D} \vert x_i\vert
273+
```
274+
275+
**Dimensions:** $D$
276+
277+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 0`$
278+
279+
## Schwefel 2.22
280+
***Function name:*** `schwefel222`
281+
282+
```math
283+
f(x) = \sum_{i=1}^{D} \lvert x_i \rvert +\prod_{i=1}^{D} \lvert x_i \rvert
284+
```
285+
286+
**Dimensions:** $D$
287+
288+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 0`$
289+
290+
## Sphere
291+
***Function name:*** `sphere`
292+
293+
```math
294+
f(x) = \sum_{i=1}^D x_i^2
295+
```
296+
297+
**Dimensions:** $D$
298+
299+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 0`$
300+
301+
## Step
302+
***Function name:*** `step`
303+
304+
```math
305+
f(x) = \sum_{i=1}^D \left( \lfloor \lvert x_i \rvert \rfloor \right)
306+
```
307+
308+
**Dimensions:** $D$
309+
310+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 0`$
311+
312+
## Step 2
313+
***Function name:*** `step2`
314+
315+
```math
316+
f(x) = \sum_{i=1}^D \left( \lfloor x_i + 0.5 \rfloor \right)^2
317+
```
318+
319+
**Dimensions:** $D$
320+
321+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = -0.5`$
322+
323+
## Styblinski-Tang
324+
***Function name:*** `styblinski_tang`
325+
326+
```math
327+
328+
```
329+
330+
**Dimensions:** $D$
331+
332+
**Global optimum:** $`f(x^*) = -39.16599 D`$ for $`x_i^* = -2.903534`$
333+
334+
## Trid
335+
***Function name:*** `trid`
336+
337+
```math
338+
f(x) = \sum_{i = 1}^D \left( x_i - 1 \right)^2 - \sum_{i = 2}^D x_i x_{i - 1}
339+
```
340+
341+
**Dimensions:** $D$
342+
343+
**Global optimum:** $`f(x^*) = \frac{-D (D + 4) (D - 1)}{6}`$ for $`x_i^* = i (d + 1 - i)`$
344+
345+
## Weierstrass
346+
***Function name:*** `weierstrass`
347+
348+
```math
349+
f(x) = \sum_{i=1}^D \left[ \sum_{k=0}^{k_{max}} a^k \cos\left( 2 \pi b^k ( x_i + 0.5) \right) \right] - D \sum_{k=0}^{k_{max}} a^k \cos \left(\pi b^k \right)
350+
```
351+
352+
**Dimensions:** $D$
353+
354+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 0`$
355+
356+
## Whitley
357+
***Function name:*** `whitley`
358+
359+
```math
360+
f(x) = \sum_{i=1}^D \sum_{j=1}^D \left[\frac{(100(x_i^2-x_j)^2 + (1-x_j)^2)^2}{4000} - \cos(100(x_i^2-x_j)^2 + (1-x_j)^2)+1\right]
361+
```
362+
363+
**Dimensions:** $D$
364+
365+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 1`$
366+
367+
## Zakharov
368+
***Function name:*** `zakharov`
369+
370+
```math
371+
f(x) = \sum_{i = 1}^D x_i^2 + \left( \sum_{i = 1}^D 0.5 i x_i \right)^2 + \left( \sum_{i = 1}^D 0.5 i x_i \right)^4
372+
```
373+
374+
**Dimensions:** $D$
375+
376+
**Global optimum:** $`f(x^*) = 0`$ for $`x_i^* = 0`$
377+
378+
379+
# References
380+
381+
[1] P. Ernesto and U. Diliman, [“MVF–Multivariate Test Functions Library in C for Unconstrained Global Optimization,”](http://www.geocities.ws/eadorio/mvf.pdf) University of the Philippines Diliman, Quezon City, 2005.
382+
383+
[2] M. Jamil and X.-S. Yang, [“A literature survey of benchmark functions for global optimisation problems,”](https://arxiv.org/abs/1308.4008) International Journal of Mathematical Modelling and Numerical Optimisation, vol. 4, no. 2, p. 150, Jan. 2013, doi: 10.1504/ijmmno.2013.055204.
384+
385+
[3] J. J. Liang, B. Y. Qu, and P. N. Suganthan, [“Problem definitions and evaluation criteria for the CEC 2014 special session and competition on single objective real-parameter numerical optimization,”](http://bee22.com/manual/tf_images/Liang%20CEC2014.pdf) Computational Intelligence Laboratory, Zhengzhou University, Zhengzhou China and Technical Report, Nanyang Technological University, Singapore, vol. 635, no. 2, 2013.
386+
387+
[4] S. Surjanovic and D. Bingham, Virtual Library of Simulation Experiments: Test Functions and Datasets. Retrieved November 7, 2023, from https://www.sfu.ca/~ssurjano/.

0 commit comments

Comments
 (0)