propulate.utils.benchmark_functions
Benchmark function module.
Module Contents
Functions
|
Rosenbrock function. This function has a narrow minimum inside a parabola-shaped valley. |
|
Step function. |
|
Quartic function. |
|
Rastrigin function: continuous, non-convex, separable, differentiable, multimodal. |
|
Griewank function. |
|
Schwefel 2.20 function: continuous, convex, separable, non-differentiable, non-multimodal. |
|
Lunacek's double-sphere benchmark function. |
|
Lunacek's double-Rastrigin benchmark function. |
|
Bukin N.6 function: continuous, convex, non-separable, non-differentiable, multimodal. |
|
Egg-crate function: continuous, non-convex, separable, differentiable, multimodal. |
|
Himmelblau function: continuous, non-convex, non-separable, differentiable, multimodal. |
|
Keane function: continuous, non-convex, non-separable, differentiable, multimodal. |
|
Leon function: continuous, non-convex, non-separable, differentiable, non-multimodal, non-random, non-parametric. |
|
Sphere function: continuous, convex, separable, differentiable, unimodal. |
|
Get search space limits and function from function name. |
|
Set up argument parser for Propulate optimization of simple mathematical functions. |
- propulate.utils.benchmark_functions.rosenbrock(params: Dict[str, float]) float
Rosenbrock function. This function has a narrow minimum inside a parabola-shaped valley.
Input domain: -2.048 <= (x, y) <= 2.048 Global minimum 0 at (x, y) = (1, 1)
- Parameters:
params (Dict[str, float]) – The function parameters.
- Returns:
The function value.
- Return type:
float
- propulate.utils.benchmark_functions.step(params: Dict[str, float]) float
Step function.
This function represents the problem of flat surfaces. Plateaus pose obstacles to optimizers as they lack information about which direction is favorable.
Input domain: -5.12 <= x_i <= 5.12, i = 1,…,N Global minimum -5N at (x_i)_N <= (-5)_N
The Propulate paper uses N = 5.
- Parameters:
params (Dict[str, float]) – The function parameters.
- Returns:
The function value.
- Return type:
float
- propulate.utils.benchmark_functions.quartic(params: Dict[str, float]) float
Quartic function.
A unimodal function padded with Gaussian noise. As it never returns the same value on the same point, algorithms that do not perform well on this function will do poorly on noisy data.
Input domain: -1.28 <= x_i <= 1.28, i = 1,…,N Global minimum ∑ Gauss(0, 1)_i at (x_i)_N = (0)_N The Propulate paper uses N = 30.
- Parameters:
params (Dict[str, float]) – The function parameters.
- Returns:
The function value.
- Return type:
float
- propulate.utils.benchmark_functions.rastrigin(params: Dict[str, float]) float
Rastrigin function: continuous, non-convex, separable, differentiable, multimodal.
A non-linear and highly multimodal function. Its surface is determined by two external variables, controlling the modulation’s amplitude and frequency. The local minima are located at a rectangular grid with size 1. Their functional values increase with the distance to the global minimum.
Input domain: -5.12 <= x_i <= 5.12, i = 1,…,N Global minimum 0 at (x_i)_N = (0)_N The Propulate paper uses N = 20.
- Parameters:
params (Dict[str, float]) – The function parameters.
- Returns:
The function value.
- Return type:
float
- propulate.utils.benchmark_functions.griewank(params: Dict[str, float]) float
Griewank function.
Griewank’s product creates subpopulations strongly codependent to parallel GAs, while the summation produces a parabola. Its local optima lie above parabola level but decrease with increasing dimensions, i.e., the larger the search range, the flatter the function.
Input domain: -600 <= x_i <= 600, i = 1,…,N Global minimum 0 at (x_i)_N = (0)_N The Propulate paper uses N = 10.
- Parameters:
params (Dict[str, float]) – The function parameters.
- Returns:
The function value.
- Return type:
float
- propulate.utils.benchmark_functions.schwefel(params: Dict[str, float]) float
Schwefel 2.20 function: continuous, convex, separable, non-differentiable, non-multimodal.
This function has a second-best minimum far away from the global optimum.
Input domain: -500 <= x_i <= 500, i = 1,…,N Global minimum 0 at (x_i)_N = (420.968746)_N The Propulate paper uses N = 10.
- Parameters:
params (Dict[str, float]) – The function parameters.
- Returns:
The function value.
- Return type:
float
- propulate.utils.benchmark_functions.bisphere(params: Dict[str, float]) float
Lunacek’s double-sphere benchmark function.
Lunacek, M., Whitley, D., & Sutton, A. (2008, September). The impact of global structure on search. In International Conference on Parallel Problem Solving from Nature (pp. 498-507). Springer, Berlin, Heidelberg.
This function’s landscape structure is the minimum of two quadratic functions, each creating a single funnel in the search space. The spheres are placed along the positive search-space diagonal, with the optimal and sub-optimal sphere in the middle of the positive and negative quadrant, respectively. Their distance and the barrier’s height increase with dimensionality, creating a globally non-separable underlying surface.
Input domain: -5.12 <= x_i <= 5.12, i = 1,…,N Global minimum 0 at (x_i)_N = (µ_1)_N with µ_1 = 2.5 The Propulate paper uses N = 30.
- Parameters:
params (Dict[str, float]) – The function parameters.
- Returns:
The function value.
- Return type:
float
- propulate.utils.benchmark_functions.birastrigin(params: Dict[str, float]) float
Lunacek’s double-Rastrigin benchmark function.
Lunacek, M., Whitley, D., & Sutton, A. (2008, September). The impact of global structure on search. In International Conference on Parallel Problem Solving from Nature (pp. 498-507). Springer, Berlin, Heidelberg.
A double-funnel version of Rastrigin. This function isolates global structure as the main difference impacting problem difficulty on a well understood test case.
Input domain: -5.12 <= x_i <= 5.12, i = 1,…,N Global minimum 0 at (x_i)_N = (µ_1)_N with µ_1 = 2.5 The Propulate paper uses N = 30.
- Parameters:
params (Dict[str, float]) – The function parameters.
- Returns:
The function value.
- Return type:
float
- propulate.utils.benchmark_functions.bukin_n6(params: Dict[str, float]) float
Bukin N.6 function: continuous, convex, non-separable, non-differentiable, multimodal.
Input domain: -15 <= x <= -5, -3 <= y <= 3 Global minimum 0 at (x, y) = (-10, 1)
- Parameters:
params (Dict[str, float]) – The function parameters.
- Returns:
The function value.
- Return type:
float
- propulate.utils.benchmark_functions.egg_crate(params: Dict[str, float]) float
Egg-crate function: continuous, non-convex, separable, differentiable, multimodal.
Input domain: -5 <= x, y <= 5 Global minimum -1 at (x, y) = (0, 0)
- Parameters:
params (Dict[str, float]) – The function parameters.
- Returns:
The function value.
- Return type:
float
- propulate.utils.benchmark_functions.himmelblau(params: Dict[str, float]) float
Himmelblau function: continuous, non-convex, non-separable, differentiable, multimodal.
Input domain: -6 <= x, y <= 6 Global minimum 0 at (x, y) = (3, 2)
- Parameters:
params (Dict[str, float]) – The function parameters.
- Returns:
The function value.
- Return type:
float
- propulate.utils.benchmark_functions.keane(params: Dict[str, float]) float
Keane function: continuous, non-convex, non-separable, differentiable, multimodal.
Input domain: -10 <= x, y <= 10 Global minimum 0.6736675 at (x, y) = (1.3932491, 0) and (x, y) = (0, 1.3932491)
- Parameters:
params (Dict[str, float]) – The function parameters.
- Returns:
The function value.
- Return type:
float
- propulate.utils.benchmark_functions.leon(params: Dict[str, float]) float
Leon function: continuous, non-convex, non-separable, differentiable, non-multimodal, non-random, non-parametric.
Input domain: 0 <= x, y <= 10 Global minimum 0 at (x, y) =(1, 1)
- Parameters:
params (Dict[str, float]) – The function parameters.
- Returns:
The function value.
- Return type:
float
- propulate.utils.benchmark_functions.sphere(params: Dict[str, float]) float
Sphere function: continuous, convex, separable, differentiable, unimodal.
Input domain: -5.12 <= x, y <= 5.12 Global minimum 0 at (x, y) = (0, 0)
- Parameters:
params (Dict[str, float]) – The function parameters.
- Returns:
The function value.
- Return type:
float
- propulate.utils.benchmark_functions.get_function_search_space(fname: str) Tuple[Callable, Dict[str, Tuple[float, float]]]
Get search space limits and function from function name.
- Parameters:
fname (str) – The function name.
- Returns:
Callable – The callable function.
Dict[str, tuple[float, float]] – The search space.
- propulate.utils.benchmark_functions.parse_arguments(propulate_comm: mpi4py.MPI.Comm = MPI.COMM_WORLD) Tuple[argparse.Namespace, Dict[str, bool]]
Set up argument parser for Propulate optimization of simple mathematical functions.
- Parameters:
propulate_comm (MPI.Comm, optional) – The communicator used to run the Propulate optimization. Default is
MPI.COMM_WORLD.- Returns:
Namespace – The namespace of all parsed arguments.
Dict[str, bool] – A dictionary logging if one of the PSO hyperparameters was actually set. Only relevant for PSO.