Indusmic Private Limited

Jul 7, 20211 min

Xin-She Yang Function

Updated: Jul 18, 2021

Mathematical Definition

where is a random number that is drawn uniformly from [0,1]

Input Domain

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

Global Minima

The global minima f(x∗) =0 are located at x∗=(0,…,0).

Characteristics

  • The function is not convex.

  • The function is defined on n-dimensional space.

  • The function is separable.

  • The function is non-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: SHIVANGI CHANDRA DUBEY
 

 
#For n=2
 
#xinSheYang 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 xinSheYang(x1,x2):
 
return np.random.random(1)*pow(abs(x1),1) +
 
np.random.random(1)*pow(abs(x2),2)
 

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

 
X1,X2=np.meshgrid(x1,x2)
 
Z=xinSheYang(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 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

#optimization #benchmarkfunction

    990
    1