function.so.michalewicz

function.so.michalewicz(X, m=10)

N-dimensional Michalewicz function.

The Michalewicz function is a multimodal test function with steep ridges and valleys. The parameter m defines the steepness of the valleys and ridges. Larger values of m result in more difficult search problems. The number of local minima increases exponentially with the dimension.

Mathematical formula

f(X) = -sum_{i=1}^{n} sin(x_i) * [sin(i * x_i^2 / π)]^(2m)

Parameters

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
m int Steepness parameter. Higher values make the function more difficult to optimize. Defaults to 10. 10

Returns

Name Type Description
np.ndarray np.ndarray: Function values at the input points with shape (n_samples,).

Note

  • Global minimum depends on dimension:
    • 2D: f(2.20, 1.57) ≈ -1.8013
    • 5D: f ≈ -4.687658
    • 10D: f ≈ -9.66015
  • Typical search domain: [0, π]^N
  • Characteristics: Non-convex, multimodal, non-separable

Examples

Single point evaluation:

from spotoptim.function import michalewicz
import numpy as np
X = np.array([2.20, 1.57])
result = michalewicz(X)
result[0]  # Should be close to -1.8013
np.float64(-1.801140718473825)

Multiple points evaluation:

from spotoptim.function import michalewicz
import numpy as np
X = np.array([[2.20, 1.57], [1.0, 1.0]])
michalewicz(X)
array([-1.80114072e+00, -2.55738728e-05])

Using different steepness parameter:

from spotoptim.function import michalewicz
import numpy as np
X = np.array([2.20, 1.57])
michalewicz(X, m=5)
array([-1.80481006])

References

Michalewicz, Z. (1996). “Genetic Algorithms + Data Structures = Evolution Programs”. Springer-Verlag.