evox.problems.numerical
¶
Submodules¶
Package Contents¶
Classes¶
The Ackley function whose minimum is x = [0, …, 0] |
|
The Griewank function whose minimum is x = [0, …, 0] |
|
The Rastrigin function whose minimum is x = [0, …, 0] |
|
The Rosenbrock function whose minimum is x = [1, …, 1] |
|
The Schwefel function whose minimum is x = [420.9687, …, 420.9687] |
|
The sphere function whose minimum is x = [0, …, 0] |
|
The Ellipsoid function whose minimum is x = [0, …, 0] |
|
The CEC 2022 single-objective test suite Problem |
|
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
andaffine
) to pass to the superclassShiftAffineNumericalProblem
.
- 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
andaffine
) to pass to the superclassShiftAffineNumericalProblem
.
- 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
andaffine
) to pass to the superclassShiftAffineNumericalProblem
.
- 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
andaffine
) to pass to the superclassShiftAffineNumericalProblem
.
- 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
andaffine
) to pass to the superclassShiftAffineNumericalProblem
.
- 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
andaffine
) to pass to the superclassShiftAffineNumericalProblem
.
- 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
andaffine
) to pass to the superclassShiftAffineNumericalProblem
.
- 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.
- 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]¶