top of page
Music Apps
Writer's pictureIndusmic Private Limited

Xin-She Yang N. 4 Function





Mathematical Definition



Input Domain


The function can be defined on any input range but it is usually evaluated on xi ∈ [10,10] for i=1,…, n.


Global Minima


The global minimum f(x*)­ =−1 are located at x*=(0,.., 0).


Characteristics


  • The function is not convex.

  • The function is defined on n-dimensional space.

  • The function is non-differentiable.

  • The function is non-separable.


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: SHIVANGI CHANDRA DUBEY

#For n=2
#xinSheYangN4 accepts the values of 2 MxM dimension   matrices X1, X2
#it returns the computation of the matrices in an MxM   matrix Z
#the function is then plotted using (X1,X2,Z)
#thus giving us a contour plot

from mpl_toolkits import mplot3d
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt 
from matplotlib import cm

def xinSheYangN4(x1,x2):
 return   (np.sin(x1)*np.sin(x1)-np.exp(-(x1**2+x2**2)))*np.exp(-((pow(np.sin(np.sqrt(abs(x1))),2))))+(np.sin(x2)*np.sin(x2)-np.exp(-(x1**2+x2**2)))*np.exp(-pow(np.sin(np.sqrt(abs(x2))),2))

x1=np.linspace(-10,10,30)
x2=np.linspace(-10,10,30)

X1,X2=np.meshgrid(x1,x2)
Z=xinSheYangN4(X1,X2)

def plotFunction(e,a): 
 fig=plt.figure(figsize=[12,8])
 ax=plt.axes(projection='3d')
 surf=ax.plot_surface(X1,X2,Z,cmap=cm.coolwarm)
 ax.view_init(elev=e,azim=a)
 ax.set_xlabel('X1')
 ax.set_ylabel('X2')
 ax.set_zlabel('fx')
 ax.set_title('Xin-She Yang N. 4 Function')
  fig.colorbar(surf,   shrink=0.5, aspect=5)
 plt.show()
 plt.contour(X1,X2,Z)
 plt.show()
 
from ipywidgets import interactive 
iplot=interactive(plotFunction,
 e=(-90,90,5),
 a=(-90,90,5))

iplot

References:


[1] Survajonic, Sonja & Bingham, Derek, “Virtual Library of Simulation Experiments”, sfu.ca,

https://www.sfu.ca/~ssurjano/optimization.html


208 views0 comments

Comments


bottom of page