top of page

McCORMICK FUNCTION

Updated: Jul 19, 2021





Mathematical Definition


Input Domain

The McCormick Function is defined on input range [-1.5<x< 4] and [-3<y<3].


Global Minima

The McCormick Function has one global minimum

fx* = -1.9133 at x* = (-0.547, -1.547).


Description and Features


The McCormick Function is defined on two dimensional spaces. This function is used as a test function in order to evaluate the performance of optimization algorithms such as:

  • Convergence rate

  • Precision

  • Robustness

  • General Performance.

The McCormick Function is a

  • Multi-modal

  • Continuous

  • Convex

  • Differentiable


Python Implementation


% Please forward any comments or bug reports in chat
Copyright 2021. INDUSMIC PRIVATE LIMITED.THERE IS NO WARRANTY, EXPRESS OR IMPLIED. WE DO NOT ASSUME ANY LIABILITY FOR THE USE OF THIS PROGRAM. If software is modified to produce derivative works, such modified software should be clearly marked. Additionally, user can redistribute it and/or modify it under the terms of the GNU General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. See the GNU General Public License for more details.
% for any support connect with us on help.indusmic@gmail.com
% Author: RIYA SHIVHARE

import matplotlib.pyplot as plt
import numpy as np
from numpy import sin
from mpl_toolkits import mplot3d 

def f(x,y):
 
    return  sin(x+y)+((x-y)**2)-1.5*x+2.5*y+1

x=np.linspace(4,-2)
y=np.linspace(4,-4)

x,y=np.meshgrid(x,y)
results=f(x,y)
 
fig =plt.figure(figsize=(9,9))
axis=fig.gca(projection='3d')
axis.contour3D(x,y,results,450)

axis.set_xlabel('X')
axis.set_ylabel('Y')
axis.set_zlabel('Z')
axis.set_title('McCormick Function')
axis.view_init(50,50)

#plt.contour(x,y,results,15)
plt.show()



References:


[1] Jamil, Momin, and Xin-She Yang. "A literature survey of benchmark functions for global optimization problems." International Journal of Mathematical Modelling and Numerical Optimization 4.2 (2013): 150-194.



#optimization #benchmarkfunction

95 views0 comments
bottom of page