polarcbo.objectives.Himmelblau
- class polarcbo.objectives.Himmelblau(factor=1.0)[source]
Bases:
objective
Himmelblau’s function
Himmelblau’s function is a multimodal function with 4 global minima at \((3,2)\), \((-2.805118,3.131312)\), \((-3.779310,-3.283186)\), and \((3.584428,-1.848126)\). The function is defined as
\[f(x,y) = (x^2 + y - 11)^2 + (x + y^2 - 7)^2\]- Parameters:
factor (float, optional) – The factor by which the input is multiplied. The default is 1.0.
Examples
>>> import numpy as np >>> from polarcbo.objectives import Himmelblau >>> x = np.array([[1,2], [3,4], [5,6]]) >>> f = Himmelblau() >>> f(x) array([ 68., 148., 1556.])
- __call__(x)[source]
Call method for classes that inherit from
objective
- Parameters:
x (array_like, shape (J, d)) – For a system of \(J\) particles, the i-th row of this array
x[i,:]
represents the position of the i-th particle.- Returns:
y – The value of the objective function at the positions
x
.- Return type:
array_like, shape (J,)