cbx.objectives.McCormick#
- class cbx.objectives.McCormick(f_extra=None)[source]#
Bases:
cbx_objective
McCormick’s function
McCormick’s function is a multimodal function with two global minima at \((-0.54719,-1.54719)\) and \((1.54719,0.54719)\). The function is defined as
\[f(x,y) = \sin(x+y) + (x-y)^2 - 1.5x + 2.5y + 1\]See McCormick’s function.
Examples
>>> import numpy as np >>> from cbx.objectives import McCormick >>> x = np.array([[1,2], [3,4], [5,6]]) >>> f = McCormick() >>> f(x) array([5.64112001, 8.1569866 , 8.50000979])
Visualization#
(
Source code
,png
,hires.png
,pdf
)