niapy.problems

Module with implementations of optimization problems.

class niapy.problems.Ackley(dimension=4, lower=-32.768, upper=32.768, a=20.0, b=0.2, c=6.283185307179586, *args, **kwargs)[source]

Bases: Problem

Implementation of Ackley function.

Date: 2018

Author: Lucija Brezočnik

License: MIT

Function: Ackley function

\(f(\mathbf{x}) = -a\;\exp\left(-b \sqrt{\frac{1}{D}\sum_{i=1}^D x_i^2}\right) - \exp\left(\frac{1}{D}\sum_{i=1}^D \cos(c\;x_i)\right) + a + \exp(1)\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-32.768, 32.768]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(\textbf{x}^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = -a;expleft(-b sqrt{frac{1}{D} sum_{i=1}^D x_i^2}right) - expleft(frac{1}{D} sum_{i=1}^D cos(c;x_i)right) + a + exp(1)$

Equation:

begin{equation}f(mathbf{x}) = -a;expleft(-b sqrt{frac{1}{D} sum_{i=1}^D x_i^2}right) - expleft(frac{1}{D} sum_{i=1}^D cos(c;x_i)right) + a + exp(1) end{equation}

Domain:

$-32.768 leq x_i leq 32.768$

Reference:

https://www.sfu.ca/~ssurjano/ackley.html

Initialize Ackley problem.

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

  • a (Optional[float]) – a parameter.

  • b (Optional[float]) – b parameter.

  • c (Optional[float]) – c parameter.

__init__(dimension=4, lower=-32.768, upper=32.768, a=20.0, b=0.2, c=6.283185307179586, *args, **kwargs)[source]

Initialize Ackley problem.

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

  • a (Optional[float]) – a parameter.

  • b (Optional[float]) – b parameter.

  • c (Optional[float]) – c parameter.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Alpine1(dimension=4, lower=-10.0, upper=10.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Alpine1 function.

Date: 2018

Author: Lucija Brezočnik

License: MIT

Function: Alpine1 function

\(f(\mathbf{x}) = \sum_{i=1}^{D} \lvert x_i \sin(x_i)+0.1x_i \rvert\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-10, 10]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = sum_{i=1}^{D} lvert x_i sin(x_i)+0.1x_i rvert$

Equation:

begin{equation} f(mathbf{x}) = sum_{i=1}^{D} lvert x_i sin(x_i)+0.1x_i rvert end{equation}

Domain:

$-10 leq x_i leq 10$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Alpine1 problem.

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-10.0, upper=10.0, *args, **kwargs)[source]

Initialize Alpine1 problem.

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code

Return type

str

class niapy.problems.Alpine2(dimension=4, lower=0.0, upper=10.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Alpine2 function.

Date: 2018

Author: Lucija Brezočnik

License: MIT

Function: Alpine2 function

\(f(\mathbf{x}) = \prod_{i=1}^{D} \sqrt{x_i} \sin(x_i)\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [0, 10]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 2.808^D\), at \(x^* = (7.917,...,7.917)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = prod_{i=1}^{D} sqrt{x_i} sin(x_i)$

Equation:

begin{equation} f(mathbf{x}) = prod_{i=1}^{D} sqrt{x_i} sin(x_i) end{equation}

Domain:

$0 leq x_i leq 10$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Alpine2 problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=0.0, upper=10.0, *args, **kwargs)[source]

Initialize Alpine2 problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.BentCigar(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Implementations of Bent Cigar functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: Bent Cigar Function

\(f(\textbf{x}) = x_1^2 + 10^6 \sum_{i=2}^D x_i^2\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (420.968746,...,420.968746)\)

LaTeX formats:
Inline:

$f(textbf{x}) = x_1^2 + 10^6 sum_{i=2}^D x_i^2$

Equation:

begin{equation} f(textbf{x}) = x_1^2 + 10^6 sum_{i=2}^D x_i^2 end{equation}

Domain:

$-100 leq x_i leq 100$

Reference:

http://www5.zzu.edu.cn/__local/A/69/BC/D3B5DFE94CD2574B38AD7CD1D12_C802DAFE_BC0C0.pdf

Initialize Bent Cigar problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize Bent Cigar problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.ChungReynolds(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Chung Reynolds functions.

Date: 2018

Authors: Lucija Brezočnik

License: MIT

Function: Chung Reynolds function

\(f(\mathbf{x}) = \left(\sum_{i=1}^D x_i^2\right)^2\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\)

Global minimum: \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = left(sum_{i=1}^D x_i^2right)^2$

Equation:

begin{equation} f(mathbf{x}) = left(sum_{i=1}^D x_i^2right)^2 end{equation}

Domain:

$-100 leq x_i leq 100$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Chung Reynolds problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize Chung Reynolds problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.CosineMixture(dimension=4, lower=-1.0, upper=1.0, *args, **kwargs)[source]

Bases: Problem

Implementations of Cosine mixture function.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: Cosine Mixture Function

\(f(\textbf{x}) = - 0.1 \sum_{i = 1}^D \cos (5 \pi x_i) - \sum_{i = 1}^D x_i^2\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-1, 1]\), for all \(i = 1, 2,..., D\).

Global maximum: \(f(x^*) = -0.1 D\), at \(x^* = (0.0,...,0.0)\)

LaTeX formats:
Inline:

$f(textbf{x}) = - 0.1 sum_{i = 1}^D cos (5 pi x_i) - sum_{i = 1}^D x_i^2$

Equation:

begin{equation} f(textbf{x}) = - 0.1 sum_{i = 1}^D cos (5 pi x_i) - sum_{i = 1}^D x_i^2 end{equation}

Domain:

$-1 leq x_i leq 1$

Reference:

http://infinity77.net/global_optimization/test_functions_nd_C.html#go_benchmark.CosineMixture

Initialize Cosine mixture problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-1.0, upper=1.0, *args, **kwargs)[source]

Initialize Cosine mixture problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Csendes(dimension=4, lower=-1.0, upper=1.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Csendes function.

Date: 2018

Author: Lucija Brezočnik

License: MIT

Function: Csendes function

\(f(\mathbf{x}) = \sum_{i=1}^D x_i^6\left( 2 + \sin \frac{1}{x_i}\right)\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-1, 1]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = sum_{i=1}^D x_i^6left( 2 + sin frac{1}{x_i}right)$

Equation:

begin{equation} f(mathbf{x}) = sum_{i=1}^D x_i^6left( 2 + sin frac{1}{x_i}right) end{equation}

Domain:

$-1 leq x_i leq 1$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Csendes problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-1.0, upper=1.0, *args, **kwargs)[source]

Initialize Csendes problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Discus(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Implementations of Discus functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: Discus Function

\(f(\textbf{x}) = x_1^2 10^6 + \sum_{i=2}^D x_i^2\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (420.968746,...,420.968746)\)

LaTeX formats:
Inline:

$f(textbf{x}) = x_1^2 10^6 + sum_{i=2}^D x_i^2$

Equation:

begin{equation} f(textbf{x}) = x_1^2 10^6 + sum_{i=2}^D x_i^2 end{equation}

Domain:

$-100 leq x_i leq 100$

Reference:

http://www5.zzu.edu.cn/__local/A/69/BC/D3B5DFE94CD2574B38AD7CD1D12_C802DAFE_BC0C0.pdf

Initialize Discus problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize Discus problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.DixonPrice(dimension=4, lower=-10.0, upper=10.0, *args, **kwargs)[source]

Bases: Problem

Implementations of Dixon Price function.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: Dixon Price Function

\(f(\textbf{x}) = (x_1 - 1)^2 + \sum_{i = 2}^D i (2x_i^2 - x_{i - 1})^2\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-10, 10]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(\textbf{x}^*) = 0\) at \(\textbf{x}^* = (2^{-\frac{2^1 - 2}{2^1}}, \cdots , 2^{-\frac{2^i - 2}{2^i}} , \cdots , 2^{-\frac{2^D - 2}{2^D}})\)

LaTeX formats:
Inline:

$f(textbf{x}) = (x_1 - 1)^2 + sum_{i = 2}^D i (2x_i^2 - x_{i - 1})^2$

Equation:

begin{equation} f(textbf{x}) = (x_1 - 1)^2 + sum_{i = 2}^D i (2x_i^2 - x_{i - 1})^2 end{equation}

Domain:

$-10 leq x_i leq 10$

Reference:

https://www.sfu.ca/~ssurjano/dixonpr.html

Initialize Dixon Price problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-10.0, upper=10.0, *args, **kwargs)[source]

Initialize Dixon Price problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Elliptic(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Implementations of High Conditioned Elliptic functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: High Conditioned Elliptic Function

\(f(\textbf{x}) = \sum_{i=1}^D \left( 10^6 \right)^{ \frac{i - 1}{D - 1} } x_i^2\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (420.968746,...,420.968746)\)

LaTeX formats:
Inline:

$f(textbf{x}) = sum_{i=1}^D left( 10^6 right)^{ frac{i - 1}{D - 1} } x_i^2$

Equation:

begin{equation} f(textbf{x}) = sum_{i=1}^D left( 10^6 right)^{ frac{i - 1}{D - 1} } x_i^2 end{equation}

Domain:

$-100 leq x_i leq 100$

Reference:

http://www5.zzu.edu.cn/__local/A/69/BC/D3B5DFE94CD2574B38AD7CD1D12_C802DAFE_BC0C0.pdf

Initialize High Conditioned Elliptic problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize High Conditioned Elliptic problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.ExpandedGriewankPlusRosenbrock(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Expanded Griewank’s plus Rosenbrock function.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: Expanded Griewank’s plus Rosenbrock function

\(f(\textbf{x}) = h(g(x_D, x_1)) + \sum_{i=2}^D h(g(x_{i - 1}, x_i)) \\ g(x, y) = 100 (x^2 - y)^2 + (x - 1)^2 \\ h(z) = \frac{z^2}{4000} - \cos \left( \frac{z}{\sqrt{1}} \right) + 1\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (420.968746,...,420.968746)\)

LaTeX formats:
Inline:

$f(textbf{x}) = h(g(x_D, x_1)) + sum_{i=2}^D h(g(x_{i - 1}, x_i)) \ g(x, y) = 100 (x^2 - y)^2 + (x - 1)^2 \ h(z) = frac{z^2}{4000} - cos left( frac{z}{sqrt{1}} right) + 1$

Equation:

begin{equation} f(textbf{x}) = h(g(x_D, x_1)) + sum_{i=2}^D h(g(x_{i - 1}, x_i)) \ g(x, y) = 100 (x^2 - y)^2 + (x - 1)^2 \ h(z) = frac{z^2}{4000} - cos left( frac{z}{sqrt{1}} right) + 1 end{equation}

Domain:

$-100 leq x_i leq 100$

Reference:

http://www5.zzu.edu.cn/__local/A/69/BC/D3B5DFE94CD2574B38AD7CD1D12_C802DAFE_BC0C0.pdf

Initialize Expanded Griewank’s plus Rosenbrock problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize Expanded Griewank’s plus Rosenbrock problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.ExpandedSchaffer(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Implementations of Expanded Schaffer functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function:

Expanded Schaffer Function \(f(\textbf{x}) = g(x_D, x_1) + \sum_{i=2}^D g(x_{i - 1}, x_i) \\ g(x, y) = 0.5 + \frac{\sin \left(\sqrt{x^2 + y^2} \right)^2 - 0.5}{\left( 1 + 0.001 (x^2 + y^2) \right)}^2\)

Input domain:

The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (420.968746,...,420.968746)\)

LaTeX formats:
Inline:

$f(textbf{x}) = g(x_D, x_1) + sum_{i=2}^D g(x_{i - 1}, x_i) \ g(x, y) = 0.5 + frac{sin left(sqrt{x^2 + y^2} right)^2 - 0.5}{left( 1 + 0.001 (x^2 + y^2) right)}^2$

Equation:

begin{equation} f(textbf{x}) = g(x_D, x_1) + sum_{i=2}^D g(x_{i - 1}, x_i) \ g(x, y) = 0.5 + frac{sin left(sqrt{x^2 + y^2} right)^2 - 0.5}{left( 1 + 0.001 (x^2 + y^2) right)}^2 end{equation}

Domain:

$-100 leq x_i leq 100$

Reference:

http://www5.zzu.edu.cn/__local/A/69/BC/D3B5DFE94CD2574B38AD7CD1D12_C802DAFE_BC0C0.pdf

Initialize Expanded Schaffer problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize Expanded Schaffer problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Griewank(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Griewank function.

Date: 2018

Authors: Iztok Fister Jr. and Lucija Brezočnik

License: MIT

Function: Griewank function

\(f(\mathbf{x}) = \sum_{i=1}^D \frac{x_i^2}{4000} - \prod_{i=1}^D \cos(\frac{x_i}{\sqrt{i}}) + 1\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = sum_{i=1}^D frac{x_i^2}{4000} - prod_{i=1}^D cos(frac{x_i}{sqrt{i}}) + 1$

Equation:

begin{equation} f(mathbf{x}) = sum_{i=1}^D frac{x_i^2}{4000} - prod_{i=1}^D cos(frac{x_i}{sqrt{i}}) + 1 end{equation}

Domain:

$-100 leq x_i leq 100$

Reference paper: Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Griewank problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bound of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bound of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize Griewank problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bound of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bound of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.HGBat(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Implementations of HGBat functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function:

HGBat Function \(f(\textbf{x}) = \left| \left( \sum_{i=1}^D x_i^2 \right)^2 - \left( \sum_{i=1}^D x_i \right)^2 \right|^{\frac{1}{2}} + \frac{0.5 \sum_{i=1}^D x_i^2 + \sum_{i=1}^D x_i}{D} + 0.5\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (420.968746,...,420.968746)\)

LaTeX formats:
Inline:

$$f(textbf{x}) = left| left( sum_{i=1}^D x_i^2 right)^2 - left( sum_{i=1}^D x_i right)^2 right|^{frac{1}{2}} + frac{0.5 sum_{i=1}^D x_i^2 + sum_{i=1}^D x_i}{D} + 0.5

Equation:

begin{equation} f(textbf{x}) = left| left( sum_{i=1}^D x_i^2 right)^2 - left( sum_{i=1}^D x_i right)^2 right|^{frac{1}{2}} + frac{0.5 sum_{i=1}^D x_i^2 + sum_{i=1}^D x_i}{D} + 0.5 end{equation}

Domain:

$-100 leq x_i leq 100$

Reference:

http://www5.zzu.edu.cn/__local/A/69/BC/D3B5DFE94CD2574B38AD7CD1D12_C802DAFE_BC0C0.pdf

Initialize HGBat problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize HGBat problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.HappyCat(dimension=4, lower=-100.0, upper=100.0, alpha=0.25, *args, **kwargs)[source]

Bases: Problem

Implementation of Happy cat function.

Date: 2018

Author: Lucija Brezočnik

License: MIT

Function: Happy cat function

\(f(\mathbf{x}) = {\left |\sum_{i = 1}^D {x_i}^2 - D \right|}^{1/4} + (0.5 \sum_{i = 1}^D {x_i}^2 + \sum_{i = 1}^D x_i) / D + 0.5\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (-1,...,-1)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = {left|sum_{i = 1}^D {x_i}^2 - D right|}^{1/4} + (0.5 sum_{i = 1}^D {x_i}^2 + sum_{i = 1}^D x_i) / D + 0.5$

Equation:

begin{equation} f(mathbf{x}) = {left| sum_{i = 1}^D {x_i}^2 - D right|}^{1/4} + (0.5 sum_{i = 1}^D {x_i}^2 + sum_{i = 1}^D x_i) / D + 0.5 end{equation}

Domain:

$-100 leq x_i leq 100$

Reference: http://bee22.com/manual/tf_images/Liang%20CEC2014.pdf & Beyer, H. G., & Finck, S. (2012). HappyCat - A Simple Function Class Where Well-Known Direct Search Algorithms Do Fail. In International Conference on Parallel Problem Solving from Nature (pp. 367-376). Springer, Berlin, Heidelberg.

Initialize Happy cat problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, alpha=0.25, *args, **kwargs)[source]

Initialize Happy cat problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Katsuura(dimension=5, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Implementations of Katsuura functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function:

Katsuura Function

\(f(\textbf{x}) = \frac{10}{D^2} \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)^\frac{10}{D^{1.2}} - \frac{10}{D^2}\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (420.968746,...,420.968746)\)

LaTeX formats:
Inline:

$f(textbf{x}) = frac{10}{D^2} prod_{i=1}^D left( 1 + i sum_{j=1}^{32} frac{lvert 2^j x_i - roundleft(2^j x_i right) rvert}{2^j} right)^frac{10}{D^{1.2}} - frac{10}{D^2}$

Equation:

begin{equation} f(textbf{x}) = frac{10}{D^2} prod_{i=1}^D left( 1 + i sum_{j=1}^{32} frac{lvert 2^j x_i - roundleft(2^j x_i right) rvert}{2^j} right)^frac{10}{D^{1.2}} - frac{10}{D^2} end{equation}

Domain:

$-100 leq x_i leq 100$

Reference:

http://www5.zzu.edu.cn/__local/A/69/BC/D3B5DFE94CD2574B38AD7CD1D12_C802DAFE_BC0C0.pdf

Initialize Katsuura problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=5, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize Katsuura problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Levy(dimension=4, lower=-10.0, upper=10.0, *args, **kwargs)[source]

Bases: Problem

Implementations of Levy functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: Levy Function

\(f(\textbf{x}) = \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)) \\ w_i = 1 + \frac{x_i - 1}{4}\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-10, 10]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(\textbf{x}^*) = 0\) at \(\textbf{x}^* = (1, \cdots, 1)\)

LaTeX formats:
Inline:

$f(textbf{x}) = 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)) \ w_i = 1 + frac{x_i - 1}{4}$

Equation:

begin{equation} f(textbf{x}) = 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)) \ w_i = 1 + frac{x_i - 1}{4} end{equation}

Domain:

$-10 leq x_i leq 10$

Reference:

https://www.sfu.ca/~ssurjano/levy.html

Initialize Levy problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-10.0, upper=10.0, *args, **kwargs)[source]

Initialize Levy problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Michalewicz(dimension=4, lower=0.0, upper=3.141592653589793, m=10, *args, **kwargs)[source]

Bases: Problem

Implementations of Michalewicz’s functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: High Conditioned Elliptic Function

\(f(\textbf{x}) = \sum_{i=1}^D \left( 10^6 \right)^{ \frac{i - 1}{D - 1} } x_i^2\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [0, \pi]\), for all \(i = 1, 2,..., D\).

Global minimum: at \(d = 2\) \(f(\textbf{x}^*) = -1.8013\) at \(\textbf{x}^* = (2.20, 1.57)\) at \(d = 5\) \(f(\textbf{x}^*) = -4.687658\) at \(d = 10\) \(f(\textbf{x}^*) = -9.66015\)

LaTeX formats:
Inline:

$f(textbf{x}) = - sum_{i = 1}^{D} sin(x_i) sinleft( frac{ix_i^2}{pi} right)^{2m}$

Equation:

begin{equation} f(textbf{x}) = - sum_{i = 1}^{D} sin(x_i) sinleft( frac{ix_i^2}{pi} right)^{2m} end{equation}

Domain:

$0 leq x_i leq pi$

Reference URL:

https://www.sfu.ca/~ssurjano/michal.html

Initialize Michalewicz problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

  • m (float) – Steepness of valleys and ridges. Recommended value is 10.

__init__(dimension=4, lower=0.0, upper=3.141592653589793, m=10, *args, **kwargs)[source]

Initialize Michalewicz problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

  • m (float) – Steepness of valleys and ridges. Recommended value is 10.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.ModifiedSchwefel(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Implementations of Modified Schwefel functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: Modified Schwefel Function

\(f(\textbf{x}) = 418.9829 \cdot D - \sum_{i=1}^D h(x_i) \\ h(x) = g(x + 420.9687462275036) \\ g(z) = \begin{cases} z \sin \left( \lvert z \rvert^{\frac{1}{2}} \right) &\quad \lvert z \rvert \leq 500 \\ \left( 500 - \mod (z, 500) \right) \sin \left( \sqrt{\lvert 500 - \mod (z, 500) \rvert} \right) - \frac{ \left( z - 500 \right)^2 }{ 10000 D } &\quad z > 500 \\ \left( \mod (\lvert z \rvert, 500) - 500 \right) \sin \left( \sqrt{\lvert \mod (\lvert z \rvert, 500) - 500 \rvert} \right) + \frac{ \left( z - 500 \right)^2 }{ 10000 D } &\quad z < -500\end{cases}\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (420.968746,...,420.968746)\)

LaTeX formats:
Inline:

$f(textbf{x}) = 418.9829 cdot D - sum_{i=1}^D h(x_i) \ h(x) = g(x + 420.9687462275036) \ g(z) = begin{cases} z sin left( lvert z rvert^{frac{1}{2}} right) &quad lvert z rvert leq 500 \ left( 500 - mod (z, 500) right) sin left( sqrt{lvert 500 - mod (z, 500) rvert} right) - frac{ left( z - 500 right)^2 }{ 10000 D } &quad z > 500 \ left( mod (lvert z rvert, 500) - 500 right) sin left( sqrt{lvert mod (lvert z rvert, 500) - 500 rvert} right) + frac{ left( z - 500 right)^2 }{ 10000 D } &quad z < -500end{cases}$

Equation:

begin{equation} f(textbf{x}) = 418.9829 cdot D - sum_{i=1}^D h(x_i) \ h(x) = g(x + 420.9687462275036) \ g(z) = begin{cases} z sin left( lvert z rvert^{frac{1}{2}} right) &quad lvert z rvert leq 500 \ left( 500 - mod (z, 500) right) sin left( sqrt{lvert 500 - mod (z, 500) rvert} right) - frac{ left( z - 500 right)^2 }{ 10000 D } &quad z > 500 \ left( mod (lvert z rvert, 500) - 500 right) sin left( sqrt{lvert mod (lvert z rvert, 500) - 500 rvert} right) + frac{ left( z - 500 right)^2 }{ 10000 D } &quad z < -500end{cases} end{equation}

Domain:

$-100 leq x_i leq 100$

Reference:

http://www5.zzu.edu.cn/__local/A/69/BC/D3B5DFE94CD2574B38AD7CD1D12_C802DAFE_BC0C0.pdf

Initialize Modified Schwefel problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize Modified Schwefel problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Perm(dimension=4, beta=0.5, *args, **kwargs)[source]

Bases: Problem

Implementations of Perm functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: Perm Function

\(f(\textbf{x}) = \sum_{i = 1}^D \left( \sum_{j = 1}^D (j - \beta) \left( x_j^i - \frac{1}{j^i} \right) \right)^2\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-D, D]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(\textbf{x}^*) = 0\) at \(\textbf{x}^* = (1, \frac{1}{2}, \cdots , \frac{1}{i} , \cdots , \frac{1}{D})\)

LaTeX formats:
Inline:

$f(textbf{x}) = sum_{i = 1}^D left( sum_{j = 1}^D (j - beta) left( x_j^i - frac{1}{j^i} right) right)^2$

Equation:

begin{equation} f(textbf{x}) = sum_{i = 1}^D left( sum_{j = 1}^D (j - beta) left( x_j^i - frac{1}{j^i} right) right)^2 end{equation}

Domain:

$-D leq x_i leq D$

Reference:

https://www.sfu.ca/~ssurjano/perm0db.html

Initialize Perm problem.

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • beta (Optional[float]) – Beta parameter.

__init__(dimension=4, beta=0.5, *args, **kwargs)[source]

Initialize Perm problem.

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • beta (Optional[float]) – Beta parameter.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Pinter(dimension=4, lower=-10.0, upper=10.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Pintér function.

Date: 2018

Author: Lucija Brezočnik

License: MIT

Function: Pintér function

\(f(\mathbf{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);\) \(A = (x_{i-1}\sin(x_i)+\sin(x_{i+1}))\quad \text{and} \quad\) \(B = (x_{i-1}^2 - 2x_i + 3x_{i+1} - \cos(x_i) + 1)\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-10, 10]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(mathbf{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); A = (x_{i-1}sin(x_i)+sin(x_{i+1}))quad text{and} quad B = (x_{i-1}^2 - 2x_i + 3x_{i+1} - cos(x_i) + 1)$

Equation:

begin{equation} f(mathbf{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); A = (x_{i-1}sin(x_i)+sin(x_{i+1}))quad text{and} quad B = (x_{i-1}^2 - 2x_i + 3x_{i+1} - cos(x_i) + 1) end{equation}

Domain:

$-10 leq x_i leq 10$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Pinter problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-10.0, upper=10.0, *args, **kwargs)[source]

Initialize Pinter problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Powell(dimension=4, lower=-4.0, upper=5.0, *args, **kwargs)[source]

Bases: Problem

Implementations of Powell functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: Powell Function

\(f(\textbf{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)\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-4, 5]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(\textbf{x}^*) = 0\) at \(\textbf{x}^* = (0, \cdots, 0)\)

LaTeX formats:
Inline:

$f(textbf{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)$

Equation:

begin{equation} f(textbf{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) end{equation}

Domain:

$-4 leq x_i leq 5$

Reference:

https://www.sfu.ca/~ssurjano/powell.html

Initialize Powell problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-4.0, upper=5.0, *args, **kwargs)[source]

Initialize Powell problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Problem(dimension=1, lower=None, upper=None, *args, **kwargs)[source]

Bases: ABC

Class representing an optimization problem.

Variables
  • dimension (int) – Dimension of the problem.

  • lower (numpy.ndarray) – Lower bounds of the problem.

  • upper (numpy.ndarray) – Upper bounds of the problem.

Initialize Problem.

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__call__(x)[source]

Evaluate solution.

Parameters

x (numpy.ndarray) – Solution.

Returns

Function value of x.

Return type

float

__init__(dimension=1, lower=None, upper=None, *args, **kwargs)[source]

Initialize Problem.

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

abstract _evaluate(x)[source]

Evaluate solution.

evaluate(x)[source]

Evaluate solution.

Parameters

x (numpy.ndarray) – Solution.

Returns

Function value of x.

Return type

float

name()[source]

Get class name.

class niapy.problems.Qing(dimension=4, lower=-500.0, upper=500.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Qing function.

Date: 2018

Author: Lucija Brezočnik

License: MIT

Function: Qing function

\(f(\mathbf{x}) = \sum_{i=1}^D \left(x_i^2 - i\right)^2\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-500, 500]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (\pm √i))\)

LaTeX formats:
Inline:

$f(mathbf{x}) = sum_{i=1}^D left (x_i^2 - iright)^2$

Equation:

begin{equation} f(mathbf{x}) = sum_{i=1}^D left{(x_i^2 - iright)}^2 end{equation}

Domain:

$-500 leq x_i leq 500$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Qing problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-500.0, upper=500.0, *args, **kwargs)[source]

Initialize Qing problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Quintic(dimension=4, lower=-10.0, upper=10.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Quintic function.

Date: 2018

Author: Lucija Brezočnik

License: MIT

Function: Quintic function

\(f(\mathbf{x}) = \sum_{i=1}^D \left| x_i^5 - 3x_i^4 + 4x_i^3 + 2x_i^2 - 10x_i - 4\right|\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-10, 10]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = f(-1\; \text{or}\; 2)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = sum_{i=1}^D left| x_i^5 - 3x_i^4 + 4x_i^3 + 2x_i^2 - 10x_i - 4right|$

Equation:

begin{equation} f(mathbf{x}) = sum_{i=1}^D left| x_i^5 - 3x_i^4 + 4x_i^3 + 2x_i^2 - 10x_i - 4right| end{equation}

Domain:

$-10 leq x_i leq 10$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Quintic problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-10.0, upper=10.0, *args, **kwargs)[source]

Initialize Quintic problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Rastrigin(dimension=4, lower=-5.12, upper=5.12, *args, **kwargs)[source]

Bases: Problem

Implementation of Rastrigin problem.

Date: 2018

Authors: Lucija Brezočnik and Iztok Fister Jr.

License: MIT

Function: Rastrigin function

\(f(\mathbf{x}) = 10D + \sum_{i=1}^D \left(x_i^2 -10\cos(2\pi x_i)\right)\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-5.12, 5.12]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = 10D + sum_{i=1}^D left(x_i^2 -10cos(2pi x_i)right)$

Equation:

begin{equation} f(mathbf{x}) = 10D + sum_{i=1}^D left(x_i^2 -10cos(2pi x_i)right) end{equation}

Domain:

$-5.12 leq x_i leq 5.12$

Reference:

https://www.sfu.ca/~ssurjano/rastr.html

Initialize Rastrigin problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-5.12, upper=5.12, *args, **kwargs)[source]

Initialize Rastrigin problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Ridge(dimension=4, lower=-64.0, upper=64.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Ridge function.

Date: 2018

Author: Lucija Brezočnik

License: MIT

Function: Ridge function

\(f(\mathbf{x}) = \sum_{i=1}^D (\sum_{j=1}^i x_j)^2\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-64, 64]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = sum_{i=1}^D (sum_{j=1}^i x_j)^2 $

Equation:

begin{equation} f(mathbf{x}) = sum_{i=1}^D (sum_{j=1}^i x_j)^2 end{equation}

Domain:

$-64 leq x_i leq 64$

Reference:

http://www.cs.unm.edu/~neal.holts/dga/benchmarkFunction/ridge.html

Initialize Ridge problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-64.0, upper=64.0, *args, **kwargs)[source]

Initialize Ridge problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Rosenbrock(dimension=4, lower=-30.0, upper=30.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Rosenbrock problem.

Date: 2018

Authors: Iztok Fister Jr. and Lucija Brezočnik

License: MIT

Function: Rosenbrock function

\(f(\mathbf{x}) = \sum_{i=1}^{D-1} \left (100 (x_{i+1} - x_i^2)^2 + (x_i - 1)^2 \right)\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-30, 30]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (1,...,1)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = sum_{i=1}^{D-1} (100 (x_{i+1} - x_i^2)^2 + (x_i - 1)^2)$

Equation:

begin{equation} f(mathbf{x}) = sum_{i=1}^{D-1} (100 (x_{i+1} - x_i^2)^2 + (x_i - 1)^2) end{equation}

Domain:

$-30 leq x_i leq 30$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Rosenbrock problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-30.0, upper=30.0, *args, **kwargs)[source]

Initialize Rosenbrock problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Salomon(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Salomon function.

Date: 2018

Author: Lucija Brezočnik

License: MIT

Function: Salomon function

\(f(\mathbf{x}) = 1 - \cos\left(2\pi\sqrt{\sum_{i=1}^D x_i^2} \right)+ 0.1 \sqrt{\sum_{i=1}^D x_i^2}\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = f(0, 0)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = 1 - cosleft(2pisqrt{sum_{i=1}^D x_i^2} right)+ 0.1 sqrt{sum_{i=1}^D x_i^2}$

Equation:

begin{equation} f(mathbf{x}) = 1 - cosleft(2pisqrt{sum_{i=1}^D x_i^2} right)+ 0.1 sqrt{sum_{i=1}^D x_i^2} end{equation}

Domain:

$-100 leq x_i leq 100$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Salomon problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize Salomon problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.SchafferN2(lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Implementations of Schaffer N. 2 functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: Schaffer N. 2 Function \(f(\textbf{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 }\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (420.968746,...,420.968746)\)

LaTeX formats:
Inline:

$f(textbf{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 }$

Equation:

begin{equation} f(textbf{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 } end{equation}

Domain:

$-100 leq x_i leq 100$

Reference:

http://www5.zzu.edu.cn/__local/A/69/BC/D3B5DFE94CD2574B38AD7CD1D12_C802DAFE_BC0C0.pdf

Initialize SchafferN2 problem..

Parameters
  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize SchafferN2 problem..

Parameters
  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.SchafferN4(lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Implementations of Schaffer N. 2 functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: Schaffer N. 2 Function \(f(\textbf{x}) = 0.5 + \frac{ \cos^2 \left( \sin \left( x_1^2 - x_2^2 \right) \right)- 0.5 }{ \left( 1 + 0.001 \left( x_1^2 + x_2^2 \right) \right)^2 }\)

Input domain:

The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (420.968746,...,420.968746)\)

LaTeX formats:
Inline:

$f(textbf{x}) = 0.5 + frac{ cos^2 left( sin left( x_1^2 - x_2^2 right) right)- 0.5 }{ left( 1 + 0.001 left( x_1^2 + x_2^2 right) right)^2 }$

Equation:

begin{equation} f(textbf{x}) = 0.5 + frac{ cos^2 left( sin left( x_1^2 - x_2^2 right) right)- 0.5 }{ left( 1 + 0.001 left( x_1^2 + x_2^2 right) right)^2 } end{equation}

Domain:

$-100 leq x_i leq 100$

Reference:

http://www5.zzu.edu.cn/__local/A/69/BC/D3B5DFE94CD2574B38AD7CD1D12_C802DAFE_BC0C0.pdf

Initialize SchafferN4 problem..

Parameters
  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize SchafferN4 problem..

Parameters
  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.SchumerSteiglitz(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Schumer Steiglitz function.

Date: 2018

Author: Lucija Brezočnik

License: MIT

Function: Schumer Steiglitz function

\(f(\mathbf{x}) = \sum_{i=1}^D x_i^4\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = sum_{i=1}^D x_i^4$

Equation:

begin{equation} f(mathbf{x}) = sum_{i=1}^D x_i^4 end{equation}

Domain:

$-100 leq x_i leq 100$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Schumer Steiglitz problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize Schumer Steiglitz problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Schwefel(dimension=4, lower=-500.0, upper=500.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Schwefel function.

Date: 2018

Author: Lucija Brezočnik

License: MIT

Function: Schwefel function

\(f(\textbf{x}) = 418.9829d - \sum_{i=1}^{D} x_i \sin(\sqrt{\lvert x_i \rvert})\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-500, 500]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (420.968746,...,420.968746)\)

LaTeX formats:
Inline:

$f(textbf{x}) = 418.9829d - sum_{i=1}^{D} x_i sin(sqrt{lvert x_i rvert})$

Equation:

begin{equation} f(textbf{x}) = 418.9829d - sum_{i=1}^{D} x_i sin(sqrt{lvert x_i rvert}) end{equation}

Domain:

$-500 leq x_i leq 500$

Reference:

https://www.sfu.ca/~ssurjano/schwef.html

Initialize Schwefel problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-500.0, upper=500.0, *args, **kwargs)[source]

Initialize Schwefel problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Schwefel221(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Schwefel 2.21 function implementation.

Date: 2018

Author: Grega Vrbančič

Licence: MIT

Function: Schwefel 2.21 function

\(f(\mathbf{x})=\max_{i=1,...,D}|x_i|\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(mathbf{x})=max_{i=1,…,D} lvert x_i rvert$

Equation:

begin{equation}f(mathbf{x}) = max_{i=1,…,D} lvert x_i rvert end{equation}

Domain:

$-100 leq x_i leq 100$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Schwefel221 problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize Schwefel221 problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Schwefel222(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Schwefel 2.22 function implementation.

Date: 2018

Author: Grega Vrbančič

Licence: MIT

Function: Schwefel 2.22 function

\(f(\mathbf{x})=\sum_{i=1}^{D} \lvert x_i \rvert +\prod_{i=1}^{D} \lvert x_i \rvert\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(mathbf{x})=sum_{i=1}^{D} lvert x_i rvert +prod_{i=1}^{D} lvert x_i rvert$

Equation:

begin{equation}f(mathbf{x}) = sum_{i=1}^{D} lvert x_i rvert + prod_{i=1}^{D} lvert x_i rvert end{equation}

Domain:

$-100 leq x_i leq 100$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Schwefel222 problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize Schwefel222 problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Sphere(dimension=4, lower=-5.12, upper=5.12, *args, **kwargs)[source]

Bases: Problem

Implementation of Sphere functions.

Date: 2018

Authors: Iztok Fister Jr.

License: MIT

Function: Sphere function

\(f(\mathbf{x}) = \sum_{i=1}^D x_i^2\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [0, 10]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = sum_{i=1}^D x_i^2$

Equation:

begin{equation}f(mathbf{x}) = sum_{i=1}^D x_i^2 end{equation}

Domain:

$0 leq x_i leq 10$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Sphere problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-5.12, upper=5.12, *args, **kwargs)[source]

Initialize Sphere problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Sphere2(dimension=4, lower=-1.0, upper=1.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Sphere with different powers function.

Date: 2018

Authors: Klemen Berkovič

License: MIT

Function: Sun of different powers function

\(f(\textbf{x}) = \sum_{i = 1}^D \lvert x_i \rvert^{i + 1}\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-1, 1]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(textbf{x}) = sum_{i = 1}^D lvert x_i rvert^{i + 1}$

Equation:

begin{equation} f(textbf{x}) = sum_{i = 1}^D lvert x_i rvert^{i + 1} end{equation}

Domain:

$-1 leq x_i leq 1$

Reference URL:

https://www.sfu.ca/~ssurjano/sumpow.html

Initialize Sphere2 problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-1.0, upper=1.0, *args, **kwargs)[source]

Initialize Sphere2 problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Sphere3(dimension=4, lower=-65.536, upper=65.536, *args, **kwargs)[source]

Bases: Problem

Implementation of rotated hyper-ellipsoid function.

Date: 2018

Authors: Klemen Berkovič

License: MIT

Function: Sun of rotated hyper-ellipsoid function

\(f(\textbf{x}) = \sum_{i = 1}^D \sum_{j = 1}^i x_j^2\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-65.536, 65.536]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(textbf{x}) = sum_{i = 1}^D sum_{j = 1}^i x_j^2$

Equation:

begin{equation} f(textbf{x}) = sum_{i = 1}^D sum_{j = 1}^i x_j^2 end{equation}

Domain:

$-65.536 leq x_i leq 65.536$

Reference URL:

https://www.sfu.ca/~ssurjano/rothyp.html

Initialize Sphere3 problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-65.536, upper=65.536, *args, **kwargs)[source]

Initialize Sphere3 problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Step(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Step function.

Date: 2018

Author: Lucija Brezočnik

License: MIT

Function: Step function

\(f(\mathbf{x}) = \sum_{i=1}^D \left( \lfloor \left | x_i \right | \rfloor \right)\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = sum_{i=1}^D left( lfloor left | x_i right | rfloor right)$

Equation:

begin{equation} f(mathbf{x}) = sum_{i=1}^D left( lfloor left | x_i right | rfloor right) end{equation}

Domain:

$-100 leq x_i leq 100$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Step problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize Step problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Step2(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Step2 function implementation.

Date: 2018

Author: Lucija Brezočnik

Licence: MIT

Function: Step2 function

\(f(\mathbf{x}) = \sum_{i=1}^D \left( \lfloor x_i + 0.5 \rfloor \right)^2\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (-0.5,...,-0.5)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = sum_{i=1}^D left( lfloor x_i + 0.5 rfloor right)^2$

Equation:

begin{equation}f(mathbf{x}) = sum_{i=1}^D left( lfloor x_i + 0.5 rfloor right)^2 end{equation}

Domain:

$-100 leq x_i leq 100$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Step2 problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize Step2 problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Step3(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Bases: Problem

Step3 function implementation.

Date: 2018

Author: Lucija Brezočnik

Licence: MIT

Function: Step3 function

\(f(\mathbf{x}) = \sum_{i=1}^D \left( \lfloor x_i^2 \rfloor \right)\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = sum_{i=1}^D left( lfloor x_i^2 rfloor right)$

Equation:

begin{equation}f(mathbf{x}) = sum_{i=1}^D left( lfloor x_i^2 rfloor right)end{equation}

Domain:

$-100 leq x_i leq 100$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Step3 problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-100.0, upper=100.0, *args, **kwargs)[source]

Initialize Step3 problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Stepint(dimension=4, lower=-5.12, upper=5.12, *args, **kwargs)[source]

Bases: Problem

Implementation of Stepint functions.

Date: 2018

Author: Lucija Brezočnik

License: MIT

Function: Stepint function

\(f(\mathbf{x}) = \sum_{i=1}^D x_i^2\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-5.12, 5.12]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (-5.12,...,-5.12)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = sum_{i=1}^D x_i^2$

Equation:

begin{equation}f(mathbf{x}) = sum_{i=1}^D x_i^2 end{equation}

Domain:

$0 leq x_i leq 10$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Stepint problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-5.12, upper=5.12, *args, **kwargs)[source]

Initialize Stepint problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.StyblinskiTang(dimension=4, lower=-5.0, upper=5.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Styblinski-Tang functions.

Date: 2018

Authors: Lucija Brezočnik

License: MIT

Function: Styblinski-Tang function

\(f(\mathbf{x}) = \frac{1}{2} \sum_{i=1}^D \left( x_i^4 - 16x_i^2 + 5x_i \right)\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-5, 5]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = -78.332\), at \(x^* = (-2.903534,...,-2.903534)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = frac{1}{2} sum_{i=1}^D left( x_i^4 - 16x_i^2 + 5x_i right) $

Equation:

begin{equation}f(mathbf{x}) = frac{1}{2} sum_{i=1}^D left( x_i^4 - 16x_i^2 + 5x_i right) end{equation}

Domain:

$-5 leq x_i leq 5$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Styblinski Tang problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-5.0, upper=5.0, *args, **kwargs)[source]

Initialize Styblinski Tang problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.SumSquares(dimension=4, lower=-10.0, upper=10.0, *args, **kwargs)[source]

Bases: Problem

Implementation of Sum Squares functions.

Date: 2018

Authors: Lucija Brezočnik

License: MIT

Function: Sum Squares function

\(f(\mathbf{x}) = \sum_{i=1}^D i x_i^2\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-10, 10]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (0,...,0)\)

LaTeX formats:
Inline:

$f(mathbf{x}) = sum_{i=1}^D i x_i^2$

Equation:

begin{equation}f(mathbf{x}) = sum_{i=1}^D i x_i^2 end{equation}

Domain:

$0 leq x_i leq 10$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Sum Squares problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-10.0, upper=10.0, *args, **kwargs)[source]

Initialize Sum Squares problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Trid(dimension=4, *args, **kwargs)[source]

Bases: Problem

Implementations of Trid functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: Trid Function

\(f(\textbf{x}) = \sum_{i = 1}^D \left( x_i - 1 \right)^2 - \sum_{i = 2}^D x_i x_{i - 1}\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-D^2, D^2]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(\textbf{x}^*) = \frac{-D(D + 4)(D - 1)}{6}\) at \(\textbf{x}^* = (1 (D + 1 - 1), \cdots , i (D + 1 - i) , \cdots , D (D + 1 - D))\)

LaTeX formats:
Inline:

$f(textbf{x}) = sum_{i = 1}^D left( x_i - 1 right)^2 - sum_{i = 2}^D x_i x_{i - 1}$

Equation:

begin{equation} f(textbf{x}) = sum_{i = 1}^D left( x_i - 1 right)^2 - sum_{i = 2}^D x_i x_{i - 1} end{equation}

Domain:

$-D^2 leq x_i leq D^2$

Reference:

https://www.sfu.ca/~ssurjano/trid.html

Initialize Trid problem..

Parameters

dimension (Optional[int]) – Dimension of the problem.

__init__(dimension=4, *args, **kwargs)[source]

Initialize Trid problem..

Parameters

dimension (Optional[int]) – Dimension of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Weierstrass(dimension=4, lower=-100.0, upper=100.0, a=0.5, b=3, k_max=20, *args, **kwargs)[source]

Bases: Problem

Implementations of Weierstrass functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: Weierstrass Function

\(f(\textbf{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( 2 \pi b^k \cdot 0.5 \right)\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-100, 100]\), for all \(i = 1, 2,..., D\). Default value of a = 0.5, b = 3 and k_max = 20.

Global minimum: \(f(x^*) = 0\), at \(x^* = (420.968746,...,420.968746)\)

LaTeX formats:
Inline:

$$f(textbf{x}) = sum_{i=1}^D left( sum_{k=0}^{k_{max}} a^k cosleft( 2 pi b^k ( x_i + 0.5) right) right) - D sum_{k=0}^{k_{max}} a^k cos left( 2 pi b^k cdot 0.5 right)

Equation:

begin{equation} f(textbf{x}) = sum_{i=1}^D left( sum_{k=0}^{k_{max}} a^k cosleft( 2 pi b^k ( x_i + 0.5) right) right) - D sum_{k=0}^{k_{max}} a^k cos left( 2 pi b^k cdot 0.5 right) end{equation}

Domain:

$-100 leq x_i leq 100$

Reference:

http://www5.zzu.edu.cn/__local/A/69/BC/D3B5DFE94CD2574B38AD7CD1D12_C802DAFE_BC0C0.pdf

Initialize Bent Cigar problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

  • a (Optional[float]) – The a parameter.

  • b (Optional[float]) – The b parameter.

  • k_max (Optional[int]) – Number of elements of the series to compute.

__init__(dimension=4, lower=-100.0, upper=100.0, a=0.5, b=3, k_max=20, *args, **kwargs)[source]

Initialize Bent Cigar problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

  • a (Optional[float]) – The a parameter.

  • b (Optional[float]) – The b parameter.

  • k_max (Optional[int]) – Number of elements of the series to compute.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Whitley(dimension=4, lower=-10.24, upper=10.24, *args, **kwargs)[source]

Bases: Problem

Implementation of Whitley function.

Date: 2018

Authors: Grega Vrbančič and Lucija Brezočnik

License: MIT

Function: Whitley function

\(f(\mathbf{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)\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-10.24, 10.24]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(x^*) = 0\), at \(x^* = (1,...,1)\)

LaTeX formats:
Inline:

$f(mathbf{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)+1right)$

Equation:

begin{equation}f(mathbf{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)+1right) end{equation}

Domain:

$-10.24 leq x_i leq 10.24$

Reference paper:

Jamil, M., and Yang, X. S. (2013). A literature survey of benchmark functions for global optimisation problems. International Journal of Mathematical Modelling and Numerical Optimisation, 4(2), 150-194.

Initialize Whitley problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-10.24, upper=10.24, *args, **kwargs)[source]

Initialize Whitley problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str

class niapy.problems.Zakharov(dimension=4, lower=-5.0, upper=10.0, *args, **kwargs)[source]

Bases: Problem

Implementations of Zakharov functions.

Date: 2018

Author: Klemen Berkovič

License: MIT

Function: Zakharov Function

\(f(\textbf{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\)

Input domain: The function can be defined on any input domain but it is usually evaluated on the hypercube \(x_i ∈ [-5, 10]\), for all \(i = 1, 2,..., D\).

Global minimum: \(f(\textbf{x}^*) = 0\) at \(\textbf{x}^* = (0, \cdots, 0)\)

LaTeX formats:
Inline:

$f(textbf{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$

Equation:

begin{equation} f(textbf{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 end{equation}

Domain:

$-5 leq x_i leq 10$

Reference:

https://www.sfu.ca/~ssurjano/zakharov.html

Initialize Zakharov problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

__init__(dimension=4, lower=-5.0, upper=10.0, *args, **kwargs)[source]

Initialize Zakharov problem..

Parameters
  • dimension (Optional[int]) – Dimension of the problem.

  • lower (Optional[Union[float, Iterable[float]]]) – Lower bounds of the problem.

  • upper (Optional[Union[float, Iterable[float]]]) – Upper bounds of the problem.

static latex_code()[source]

Return the latex code of the problem.

Returns

Latex code.

Return type

str