cbx.objectives.Rosenbrock#
- class cbx.objectives.Rosenbrock(a=1.0, b=100.0)[source]#
Bases:
cbx_objective
Rosenbrock’s function
Rosenbrock’s function is a multimodal function with a global minimum at \((1,1)\). The function is defined as
\[f(x,y) = (a-x)^2 + b(y-x^2)^2\]- Parameters:
a (float, optional) – The first parameter of the function. The default is 1.0.
b (float, optional) – The second parameter of the function. The default is 100.0.
Examples
>>> import numpy as np >>> from cbx.objectives import Rosenbrock >>> x = np.array([[1,2], [3,4], [5,6]]) >>> f = Rosenbrock() >>> f(x) array([ 0., 76., 76.])
Visualization#
(
Source code
,png
,hires.png
,pdf
)