top of page
Music Apps

Python Implementation of LEVI N. 13 FUNCTION

Updated: Jul 19, 2021





Mathematical Definition


Input Domain


The Levi N. 13 Function is defined on input range x [-10,10] and y [-10,10].


Global Minima


The Levi N. 13 Function has one global minimum f(x*)=0 at x* = (1,1)


Description and Features


The Levi N. 13 Function is defined on two dimensional space. This function is used as a test function to evaluate the performance of optimization algorithms such as:

  • Convergence rate

  • Precision

  • Robustness

  • General Performance.

The Levi N.13 Function is a

  • Non-separable

  • Continuous

  • Multi-modal

  • 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 numpy import pi
from mpl_toolkits import mplot3d 

def f(x,y): 
     a= sin(3*pi*x)**2 + (x-1)**2*(1+sin(3*pi*y)*sin(3*pi*y))+ (y-1)*(y-1)*(1+sin(2*pi*y)*sin(2*pi*y))
    return a

x=np.linspace(-10,10)
y=np.linspace(-10,10)

x,y=np.meshgrid(x,y)
F=f(x,y)

fig =plt.figure(figsize=(9,9))
ax=fig.gca(projection='3d')
ax.contour3D(x,y,F,450)

ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.set_title('Levi N.13 Function')
ax.view_init(21,45)

#plt.contour(x,y,F,30)
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.



745 views0 comments
bottom of page