from spotoptim.function import ackley
import numpy as np
X = np.array([0.0, 0.0, 0.0])
ackley(X)array([4.4408921e-16])
N-dimensional Ackley function.
The Ackley function is a widely used test function for optimization algorithms. It is characterized by a nearly flat outer region and a large hole at the center. The function is multimodal with many local minima but only one global minimum.
f(X) = -a * exp(-b * sqrt(sum(x_i^2) / n)) - exp(sum(cos(c * x_i)) / n) + a + e
| Name | Type | Description | Default |
|---|---|---|---|
| X | array - like |
Input points with shape (n_samples, n_features) or (n_features,). Can be a 1D array for a single point or 2D array for multiple points. | required |
| Name | Type | Description |
|---|---|---|
| np.ndarray | np.ndarray: Function values at the input points with shape (n_samples,). |
Single point evaluation at global minimum:
array([4.4408921e-16])
Multiple points evaluation:
Ackley, D. H. (1987). “A connectionist machine for genetic hillclimbing”. Kluwer Academic Publishers.