evox.problems.numerical.basic#

模块内容#

#

ShiftAffineNumericalProblem

一个数值问题,包含对输入点的平移和仿射变换。

Ackley

Ackley 函数的最小值为 x = [0, ..., 0]

Griewank

Griewank 函数的最小值是 x = [0, ..., 0]

Rastrigin

Rastrigin 函数的最小值是 x = [0, ..., 0]

Rosenbrock

Rosenbrock 函数的最小值为 x = [1, ..., 1]

Schwefel

Schwefel 函数的最小值为 x = [420.9687, ..., 420.9687]

Sphere

球体函数(sphere function),其最小值为 x = [0, ..., 0]

函数#

API#

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

Bases: evox.core.Problem

一个数值问题,包含对输入点的平移和仿射变换。

初始化

初始化 ShiftAffineNumericalProblem。

参数:
  • shift -- 偏移向量。默认为 None。None 表示没有偏移。

  • affine -- 仿射变换矩阵。默认为 None。None 表示没有仿射变换。

evaluate(pop: torch.Tensor) torch.Tensor[源代码]#

首先对给定的种群进行平移和仿射变换,然后用实际函数评估这些点。

参数:

pop -- 要评估的点的种群。

返回:

种群的适应度评估结果。

evox.problems.numerical.basic.ackley_func(a: float, b: float, c: float, x: torch.Tensor) torch.Tensor[源代码]#
class evox.problems.numerical.basic.Ackley(a: float = 20.0, b: float = 0.2, c: float = 2 * torch.pi, **kwargs)[源代码]#

Bases: evox.problems.numerical.basic.ShiftAffineNumericalProblem

Ackley 函数的最小值为 x = [0, ..., 0]

初始化

用给定的参数初始化 Ackley 函数。

参数:
  • a -- 方程中的参数a。默认值为20.0。

  • b -- 方程中的参数 b。默认值为 0.2。

  • c -- 方程中的参数c。默认值为2 * pi。

  • **kwargs -- 传递给超类 ShiftAffineNumericalProblem 的关键字参数(shift 和 affine)。

_true_evaluate(x: torch.Tensor) torch.Tensor[源代码]#
evox.problems.numerical.basic.griewank_func(x: torch.Tensor) torch.Tensor[源代码]#
class evox.problems.numerical.basic.Griewank(**kwargs)[源代码]#

Bases: evox.problems.numerical.basic.ShiftAffineNumericalProblem

Griewank 函数的最小值是 x = [0, ..., 0]

初始化

用给定的参数初始化 Griewank 函数。

参数:

**kwargs -- 传递给超类 ShiftAffineNumericalProblem 的关键字参数(shift 和 affine)。

_true_evaluate(x: torch.Tensor) torch.Tensor[源代码]#
evox.problems.numerical.basic.rastrigin_func(x: torch.Tensor) torch.Tensor[源代码]#
class evox.problems.numerical.basic.Rastrigin(**kwargs)[源代码]#

Bases: evox.problems.numerical.basic.ShiftAffineNumericalProblem

Rastrigin 函数的最小值是 x = [0, ..., 0]

初始化

用给定的参数初始化 Griewank 函数。

参数:

**kwargs -- 传递给超类 ShiftAffineNumericalProblem 的关键字参数(shift 和 affine)。

_true_evaluate(x: torch.Tensor) torch.Tensor[源代码]#
evox.problems.numerical.basic.rosenbrock_func(x)[源代码]#
class evox.problems.numerical.basic.Rosenbrock(**kwargs)[源代码]#

Bases: evox.problems.numerical.basic.ShiftAffineNumericalProblem

Rosenbrock 函数的最小值为 x = [1, ..., 1]

初始化

用给定的参数初始化 Griewank 函数。

参数:

**kwargs -- 传递给超类 ShiftAffineNumericalProblem 的关键字参数(shift 和 affine)。

_true_evaluate(x: torch.Tensor) torch.Tensor[源代码]#
evox.problems.numerical.basic.schwefel_func(x)[源代码]#
class evox.problems.numerical.basic.Schwefel(**kwargs)[源代码]#

Bases: evox.problems.numerical.basic.ShiftAffineNumericalProblem

Schwefel 函数的最小值为 x = [420.9687, ..., 420.9687]

初始化

用给定的参数初始化 Griewank 函数。

参数:

**kwargs -- 传递给超类 ShiftAffineNumericalProblem 的关键字参数(shift 和 affine)。

_true_evaluate(x: torch.Tensor) torch.Tensor[源代码]#
evox.problems.numerical.basic.sphere_func(x)[源代码]#
class evox.problems.numerical.basic.Sphere(**kwargs)[源代码]#

Bases: evox.problems.numerical.basic.ShiftAffineNumericalProblem

球体函数(sphere function),其最小值为 x = [0, ..., 0]

初始化

用给定的参数初始化 Griewank 函数。

参数:

**kwargs -- 传递给超类 ShiftAffineNumericalProblem 的关键字参数(shift 和 affine)。

_true_evaluate(x: torch.Tensor) torch.Tensor[源代码]#