evox.problems.numerical.basic#

Module Contents#

Classes#

ShiftAffineNumericalProblem

A numerical problem with a shift and affine transformations to the input points.

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]

Functions#

API#

class evox.problems.numerical.basic.ShiftAffineNumericalProblem(shift: torch.Tensor | None = None, affine: torch.Tensor | None = None)[source]#

Bases: evox.core.Problem

A numerical problem with a shift and affine transformations to the input points.

Initialization

Initialize the ShiftAffineNumericalProblem.

Parameters:
  • shift – The shift vector. Defaults to None. None represents no shift.

  • affine – The affine transformation matrix. Defaults to None. None represents no affine transformation.

evaluate(pop: torch.Tensor) torch.Tensor[source]#

Evaluate the given population by shifting and applying an affine transformation to the input points first, and then evaluating the points with the actual function.

Parameters:

pop – The population of points to evaluate.

Returns:

The evaluated fitness of the population.

evox.problems.numerical.basic.ackley_func(a: float, b: float, c: float, x: torch.Tensor) torch.Tensor[source]#
class evox.problems.numerical.basic.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]#
evox.problems.numerical.basic.griewank_func(x: torch.Tensor) torch.Tensor[source]#
class evox.problems.numerical.basic.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]#
evox.problems.numerical.basic.rastrigin_func(x: torch.Tensor) torch.Tensor[source]#
class evox.problems.numerical.basic.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]#
evox.problems.numerical.basic.rosenbrock_func(x)[source]#
class evox.problems.numerical.basic.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]#
evox.problems.numerical.basic.schwefel_func(x)[source]#
class evox.problems.numerical.basic.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]#
evox.problems.numerical.basic.sphere_func(x)[source]#
class evox.problems.numerical.basic.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]#