cbx.objectives.Rastrigin_multimodal#

class cbx.objectives.Rastrigin_multimodal(alpha=None, z=None)[source]#

Bases: cbx_objective

Multimodal Rastrigin’s function

Let \(V\) be the Rastrigin’s function. Then the multimodal Rastrigin’s function is defined as

\[f(x) = \prod_{i=1}^n V(\alpha_i (x - z_i))\]
Parameters:
  • alpha (list of floats, optional) – The factor for each multiplicative term. The default is [1.0].

  • z (numpy array, optional) – The shift vectors in each term. The default is np.array([[0]]).

Examples

>>> import numpy as np
>>> from cbx.objectives import Rastrigin_multimodal
>>> x = np.array([[1,2], [3,4], [5,6]])
>>> alpha = [2., 3.]
>>> z = np.array([[2,3], [4,5]])
>>> f = Rastrigin_multimodal(alpha = alpha, z = z)
>>> f(x)
array([324.,  36., 324.])

See also

Rastrigin

The Rastrigin’s function

Ackley_multimodal

The multimodal Ackley’s function