evox.problems.numerical

Submodules

Package Contents

Classes

Ackley

The Ackley function whose minimum is x = [0, …, 0]

Griewank

The Griewank function whose minimum is x = [0, …, 0]

Rastrigin

The Rastrigin function whose minimum is x = [0, …, 0]

Rosenbrock

The Rosenbrock function whose minimum is x = [1, …, 1]

Schwefel

The Schwefel function whose minimum is x = [420.9687, …, 420.9687]

Sphere

The sphere function whose minimum is x = [0, …, 0]

Ellipsoid

The Ellipsoid function whose minimum is x = [0, …, 0]

CEC2022

The CEC 2022 single-objective test suite Problem

DTLZ1

DTLZ2

DTLZ3

DTLZ4

DTLZ5

DTLZ6

DTLZ7

Functions

API

class evox.problems.numerical.Ackley(a: float = 20.0, b: float = 0.2, c: float = 2 * torch.pi, **kwargs)[source]

Bases: evox.problems.numerical.basic.ShiftAffineNumericalProblem

The Ackley function whose minimum is x = [0, …, 0]

Initialization

Initialize the Ackley function with the given parameters.

Parameters:
  • a – The parameter \(a\) in the equation. Defaults to 20.0.

  • b – The parameter \(b\) in the equation. Defaults to 0.2.

  • c – The parameter \(c\) in the equation. Defaults to 2 * pi.

  • **kwargs – The keyword arguments (shift and affine) to pass to the superclass ShiftAffineNumericalProblem.

_true_evaluate(x: torch.Tensor) torch.Tensor[source]
class evox.problems.numerical.Griewank(**kwargs)[source]

Bases: evox.problems.numerical.basic.ShiftAffineNumericalProblem

The Griewank function whose minimum is x = [0, …, 0]

Initialization

Initialize the Griewank function with the given parameters.

Parameters:

**kwargs – The keyword arguments (shift and affine) to pass to the superclass ShiftAffineNumericalProblem.

_true_evaluate(x: torch.Tensor) torch.Tensor[source]
class evox.problems.numerical.Rastrigin(**kwargs)[source]

Bases: evox.problems.numerical.basic.ShiftAffineNumericalProblem

The Rastrigin function whose minimum is x = [0, …, 0]

Initialization

Initialize the Griewank function with the given parameters.

Parameters:

**kwargs – The keyword arguments (shift and affine) to pass to the superclass ShiftAffineNumericalProblem.

_true_evaluate(x: torch.Tensor) torch.Tensor[source]
class evox.problems.numerical.Rosenbrock(**kwargs)[source]

Bases: evox.problems.numerical.basic.ShiftAffineNumericalProblem

The Rosenbrock function whose minimum is x = [1, …, 1]

Initialization

Initialize the Griewank function with the given parameters.

Parameters:

**kwargs – The keyword arguments (shift and affine) to pass to the superclass ShiftAffineNumericalProblem.

_true_evaluate(x: torch.Tensor) torch.Tensor[source]
class evox.problems.numerical.Schwefel(**kwargs)[source]

Bases: evox.problems.numerical.basic.ShiftAffineNumericalProblem

The Schwefel function whose minimum is x = [420.9687, …, 420.9687]

Initialization

Initialize the Griewank function with the given parameters.

Parameters:

**kwargs – The keyword arguments (shift and affine) to pass to the superclass ShiftAffineNumericalProblem.

_true_evaluate(x: torch.Tensor) torch.Tensor[source]
class evox.problems.numerical.Sphere(**kwargs)[source]

Bases: evox.problems.numerical.basic.ShiftAffineNumericalProblem

The sphere function whose minimum is x = [0, …, 0]

Initialization

Initialize the Griewank function with the given parameters.

Parameters:

**kwargs – The keyword arguments (shift and affine) to pass to the superclass ShiftAffineNumericalProblem.

_true_evaluate(x: torch.Tensor) torch.Tensor[source]
class evox.problems.numerical.Ellipsoid(**kwargs)[source]

Bases: evox.problems.numerical.basic.ShiftAffineNumericalProblem

The Ellipsoid function whose minimum is x = [0, …, 0]

Initialization

Initialize the Ellipsoid function with the given parameters.

Parameters:

**kwargs – The keyword arguments (shift and affine) to pass to the superclass ShiftAffineNumericalProblem.

_true_evaluate(x: torch.Tensor) torch.Tensor[source]
class evox.problems.numerical.CEC2022(problem_number: int, dimension: int, device: torch.device | None = None)[source]

Bases: evox.core.Problem

The CEC 2022 single-objective test suite Problem

Initialization

Initialize a single test function instance from the CEC2022 test suite.

Parameters:
  • problem_number – The index for the specific test function to be used. Must be ranged from 1 to 12.

  • (int) (dimension) – The dimensionality of the problem. Must be one of [2, 10, 20].

  • optional) (device (torch.device,) – The device on which tensors will be allocated. Defaults to None.

Raises:
  • AssertionError – If the dimension is not one of the allowed values or if the function is not defined.

  • FileNotFoundError – If the necessary data files for the problem are not found.

shift(x: torch.Tensor, offset: torch.Tensor) torch.Tensor[source]

Shift the input vector.

rotate(x: torch.Tensor, M: torch.Tensor) torch.Tensor[source]

Rotate the input vector.

cut(x: torch.Tensor, Gp: List[float], sh_flag: bool, rot_flag: bool, offset: torch.Tensor, M: torch.Tensor) List[torch.Tensor][source]
sr_func_rate(x: torch.Tensor, sh_rate: float, sh_flag: bool, rot_flag: bool, offset: torch.Tensor, M: torch.Tensor) torch.Tensor[source]

Shift and rotate function with rate.

cf_cal(x: torch.Tensor, fit: List[torch.Tensor], delta: List[int], bias: List[int]) torch.Tensor[source]
cec2022_f1(x: torch.Tensor) torch.Tensor[source]

Zakharov Function

cec2022_f2(x: torch.Tensor) torch.Tensor[source]

Rosenbrock Function

cec2022_f3(x: torch.Tensor) torch.Tensor[source]

Schaffer F7 Function

cec2022_f4(x: torch.Tensor) torch.Tensor[source]

Step Rastrigin Function (Noncontinuous Rastrigin’s)

cec2022_f5(x: torch.Tensor) torch.Tensor[source]

Levy Function

cec2022_f6(x: torch.Tensor) torch.Tensor[source]

Hybrid Function 2

cec2022_f7(x: torch.Tensor) torch.Tensor[source]

Hybrid Function 10

cec2022_f8(x: torch.Tensor) torch.Tensor[source]

Hybrid Function 6

cec2022_f9(x: torch.Tensor) torch.Tensor[source]

Composition Function 1

cec2022_f10(x: torch.Tensor) torch.Tensor[source]

Composition Function 2

cec2022_f11(x: torch.Tensor) torch.Tensor[source]

Composition Function 6

cec2022_f12(x: torch.Tensor) torch.Tensor[source]

Composition Function 7

zakharov_func(x: torch.Tensor) torch.Tensor[source]

Problem number = 1.

step_rastrigin_func(x: torch.Tensor) torch.Tensor[source]

Problem number = 4.

levy_func(x: torch.Tensor) torch.Tensor[source]

Problem number = 5.

bent_cigar_func(x: torch.Tensor) torch.Tensor[source]
hgbat_func(x: torch.Tensor) torch.Tensor[source]
rastrigin_func(x: torch.Tensor) torch.Tensor[source]
katsuura_func(x: torch.Tensor) torch.Tensor[source]
ackley_func(x: torch.Tensor) torch.Tensor[source]
schwefel_func(x: torch.Tensor) torch.Tensor[source]
schaffer_F7_func(x: torch.Tensor) torch.Tensor[source]
escaffer6_func(x: torch.Tensor) torch.Tensor[source]
happycat_func(x: torch.Tensor) torch.Tensor[source]
grie_rosen_func(x: torch.Tensor) torch.Tensor[source]
griewank_func(x: torch.Tensor) torch.Tensor[source]
rosenbrock_func(x: torch.Tensor) torch.Tensor[source]
discus_func(x: torch.Tensor) torch.Tensor[source]
ellips_func(x: torch.Tensor) torch.Tensor[source]
evaluate(pop: torch.Tensor) torch.Tensor[source]
class evox.problems.numerical.DTLZ1(d: int = 7, m: int = 3, ref_num: int = 1000)[source]

Bases: evox.problems.numerical.dtlz.DTLZ

evaluate(X: torch.Tensor) torch.Tensor[source]
class evox.problems.numerical.DTLZ2(d: int = 12, m: int = 3, ref_num: int = 1000)[source]

Bases: evox.problems.numerical.dtlz.DTLZ

evaluate(X: torch.Tensor) torch.Tensor[source]
pf()[source]
class evox.problems.numerical.DTLZ3(d: int = 12, m: int = 3, ref_num: int = 1000)[source]

Bases: evox.problems.numerical.dtlz.DTLZ2

evaluate(X: torch.Tensor) torch.Tensor[source]
class evox.problems.numerical.DTLZ4(d: int = 12, m: int = 3, ref_num: int = 1000)[source]

Bases: evox.problems.numerical.dtlz.DTLZ2

evaluate(X: torch.Tensor) torch.Tensor[source]
class evox.problems.numerical.DTLZ5(d: int = 12, m: int = 3, ref_num: int = 1000)[source]

Bases: evox.problems.numerical.dtlz.DTLZ

evaluate(X: torch.Tensor) torch.Tensor[source]
pf()[source]
class evox.problems.numerical.DTLZ6(d: int = 12, m: int = 3, ref_num: int = 1000)[source]

Bases: evox.problems.numerical.dtlz.DTLZ

evaluate(X: torch.Tensor) torch.Tensor[source]
pf()[source]
class evox.problems.numerical.DTLZ7(d: int = 21, m: int = 3, ref_num: int = 1000)[source]

Bases: evox.problems.numerical.dtlz.DTLZ

evaluate(X: torch.Tensor) torch.Tensor[source]
pf()[source]
evox.problems.numerical.ackley_func(a: float, b: float, c: float, x: torch.Tensor) torch.Tensor[source]
evox.problems.numerical.griewank_func(x: torch.Tensor) torch.Tensor[source]
evox.problems.numerical.rastrigin_func(x: torch.Tensor) torch.Tensor[source]
evox.problems.numerical.rosenbrock_func(x)[source]
evox.problems.numerical.schwefel_func(x)[source]
evox.problems.numerical.sphere_func(x)[source]
evox.problems.numerical.ellipsoid_func(x: torch.Tensor)[source]