From dc73a43d42d6a42155a89583bb6a66d464afb6c4 Mon Sep 17 00:00:00 2001 From: Chang-SHAO <101379630+Chang-SHAO@users.noreply.github.com> Date: Sun, 30 Jun 2024 16:12:28 +0800 Subject: [PATCH 1/3] Update base_functions.py --- pypop7/benchmarks/base_functions.py | 30 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pypop7/benchmarks/base_functions.py b/pypop7/benchmarks/base_functions.py index f72c2f40e..5d4a1f4a7 100644 --- a/pypop7/benchmarks/base_functions.py +++ b/pypop7/benchmarks/base_functions.py @@ -69,7 +69,7 @@ def __call__(self, x): def cigar(x): """**Cigar** test function. - .. note:: It's LaTeX formulation is ``. Its dimensionality should `> 1`. + .. note:: It's LaTeX formulation is `$x_1^2 + 10^6 \sum_{i = 2}^{n} x_i^2$`. Its dimensionality should `> 1`. Parameters ---------- @@ -106,7 +106,7 @@ def __call__(self, x): def discus(x): """**Discus** (also called **Tablet**) test function. - .. note:: It's LaTeX formulation is ``. Its dimensionality should `> 1`. + .. note:: It's LaTeX formulation is `$10^6 x_1^2 + \sum_{i = 2}^{n} x_i^2$`. Its dimensionality should `> 1`. Parameters ---------- @@ -183,7 +183,7 @@ def __call__(self, x): def ellipsoid(x): """**Ellipsoid** test function. - .. note:: It's LaTeX formulation is ``. Its dimensionality should `> 1`. + .. note:: It's LaTeX formulation is `$\sum_{i = 1}^{n} 10^{\frac{6(i- 1)}{n - 1}} x_i^2$`. Its dimensionality should `> 1`. Parameters ---------- @@ -220,7 +220,7 @@ def __call__(self, x): def different_powers(x): """**Different-Powers** test function. - .. note:: It's LaTeX formulation is ``. Its dimensionality should `> 1`. + .. note:: It's LaTeX formulation is `$\sum_{i = 1}^{ n} \left | x_i \right | ^{\frac{2 + 4(i - 1)}{n - 1}}$`. Its dimensionality should `> 1`. Parameters ---------- @@ -257,7 +257,7 @@ def __call__(self, x): def schwefel221(x): """**Schwefel221** test function. - .. note:: It's LaTeX formulation is ``. + .. note:: It's LaTeX formulation is `$\max(\left | x_1 \right |, \cdots, \left | x_n \right |)$`. Parameters ---------- @@ -293,7 +293,7 @@ def __call__(self, x): def step(x): """**Step** test function. - .. note:: It's LaTeX formulation is ``. + .. note:: It's LaTeX formulation is `$\sum_{i = 1}^{n} (\lfloor x_i + 0.5 \rfloor)^2$`. Parameters ---------- @@ -366,7 +366,7 @@ def __call__(self, x): def rosenbrock(x): """**Rosenbrock** test function. - .. note:: It's LaTeX formulation is ``. Its dimensionality should `> 1`. + .. note:: It's LaTeX formulation is `$100 \sum_{i = 1}^{n -1} (x_i^2 - x_{i + 1})^2 + \sum_{i = 1}^{n - 1} (x_i - 1)^2$`. Its dimensionality should `> 1`. Parameters ---------- @@ -403,7 +403,7 @@ def __call__(self, x): def schwefel12(x): """**Schwefel12** test function. - .. note:: It's LaTeX formulation is ``. Its dimensionality should `> 1`. + .. note:: It's LaTeX formulation is `$\sum_{i = 1}^{n} (\sum_{j = 1}^{i} x_j)^2$`. Its dimensionality should `> 1`. Parameters ---------- @@ -478,7 +478,7 @@ def __call__(self, x): def griewank(x): """**Griewank** test function. - .. note:: It's LaTeX formulation is ``. + .. note:: It's LaTeX formulation is `$\frac{1}{4000} \sum_{i = 1}^{n} x_i^2 - \prod_{i = 1}^{n} \cos(\frac{x_i}{i ^ {0.5}}) + 1$`. Parameters ---------- @@ -515,7 +515,7 @@ def __call__(self, x): def bohachevsky(x): """**Bohachevsky** test function. - .. note:: It's LaTeX formulation is ``. + .. note:: It's LaTeX formulation is `$\sum_{i = 1}^{ n - 1} (x_i^2 + 2 x_{i + 1}^2 - 0.3\cos(3\pi x_i) - 0.4\cos(4\pi x_{i + 1}) + 0.7)$`. Parameters ---------- @@ -554,7 +554,7 @@ def __call__(self, x): def ackley(x): """**Ackley** test function. - .. note:: It's LaTeX formulation is ``. + .. note:: It's LaTeX formulation is `$20 e^{-0.2 \sqrt{\frac{1}{n} \sum_{i = 1}^{n} x_i^2}} - e^{\frac{1}{n} \sum_{i = 1}^{n} \cos(2 \pi x_i)} + 20 + e$`. Parameters ---------- @@ -592,7 +592,7 @@ def __call__(self, x): def rastrigin(x): """**Rastrigin** test function. - .. note:: It's LaTeX formulation is ``. + .. note:: It's LaTeX formulation is `$10 n + \sum_{i = 1}^{n} (x_i^2 - 10 \cos(2 \pi x_i))$`. Parameters ---------- @@ -629,7 +629,7 @@ def __call__(self, x): def scaled_rastrigin(x): """**Scaled-Rastrigin** test function. - .. note:: It's LaTeX formulation is ``. + .. note:: It's LaTeX formulation is `$10 n + \sum_{i = 1}^{n} ((10^{\frac{i - 1}{n - 1}} x_i)^2 -10\cos(2\pi 10^{\frac{i - 1}{n - 1}} x_i))$`. Parameters ---------- @@ -667,7 +667,7 @@ def __call__(self, x): def skew_rastrigin(x): """**Skew-Rastrigin** test function. - .. note:: It's LaTeX formulation is ``. + .. note:: It's LaTeX formulation is `$10 n + \sum_{i = 1}^{n} (y_i^2 - 10\cos(2\pi y_i))$, with$y_i = \begin{cases} 10 x_i, \mbox{if} x_i > 0 \\ x_i, \mbox{otherweise} \end{cases}$`. Parameters ---------- @@ -784,7 +784,7 @@ def __call__(self, x): def salomon(x): """**Salomon** test function. - .. note:: It's LaTeX formulation is ``. + .. note:: It's LaTeX formulation is `$1 - \cos(2\pi\sqrt{\sum_{i=1}^{n}x_i^2}) + 0.1 \sqrt{\sum_{i=1}^{n}x_i^2}$`. Parameters ---------- From 0d720c853707386db2197f41bd693a6e0dbf15b3 Mon Sep 17 00:00:00 2001 From: Chang-SHAO <101379630+Chang-SHAO@users.noreply.github.com> Date: Sun, 30 Jun 2024 16:50:15 +0800 Subject: [PATCH 2/3] Update base_functions.py --- pypop7/benchmarks/base_functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pypop7/benchmarks/base_functions.py b/pypop7/benchmarks/base_functions.py index 5d4a1f4a7..1f52e94e8 100644 --- a/pypop7/benchmarks/base_functions.py +++ b/pypop7/benchmarks/base_functions.py @@ -667,7 +667,7 @@ def __call__(self, x): def skew_rastrigin(x): """**Skew-Rastrigin** test function. - .. note:: It's LaTeX formulation is `$10 n + \sum_{i = 1}^{n} (y_i^2 - 10\cos(2\pi y_i))$, with$y_i = \begin{cases} 10 x_i, \mbox{if} x_i > 0 \\ x_i, \mbox{otherweise} \end{cases}$`. + .. note:: It's LaTeX formulation is `$10 n + \sum_{i = 1}^{n} (y_i^2 - 10\cos(2\pi y_i))$, with $y_i = \begin{cases} 10 x_i, \mbox{if}~x_i > 0 \\ x_i, \mbox{otherweise} \end{cases}$`. Parameters ---------- @@ -746,7 +746,7 @@ def __call__(self, x): def michalewicz(x): """**Michalewicz** test function. - .. note:: It's LaTeX formulation is ``. + .. note:: It's LaTeX formulation is `$f(x) = -\sum_{i = 1}^{n}\sin(x_i)(\sin(\frac{ix_i^2}{\pi}))^{20}$`. Parameters ---------- From 677cd7c974650d39d40fac33046366d1ab3004b7 Mon Sep 17 00:00:00 2001 From: Chang-SHAO <101379630+Chang-SHAO@users.noreply.github.com> Date: Sun, 30 Jun 2024 16:51:24 +0800 Subject: [PATCH 3/3] Update base_functions.py --- pypop7/benchmarks/base_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pypop7/benchmarks/base_functions.py b/pypop7/benchmarks/base_functions.py index bd9e61c84..2b408e2ca 100644 --- a/pypop7/benchmarks/base_functions.py +++ b/pypop7/benchmarks/base_functions.py @@ -746,7 +746,7 @@ def __call__(self, x): def michalewicz(x): """**Michalewicz** test function. - .. note:: It's LaTeX formulation is `$f(x) = -\sum_{i = 1}^{n}\sin(x_i)(\sin(\frac{ix_i^2}{\pi}))^{20}$`. + .. note:: It's LaTeX formulation is `$-\sum_{i = 1}^{n}\sin(x_i)(\sin(\frac{ix_i^2}{\pi}))^{20}$`. Parameters ----------