funDeVilliersGlasser2

PURPOSE ^

% deVilliers Glasser 2 function

SYNOPSIS ^

function [p,dp]=funDeVilliersGlasser2(xx)

DESCRIPTION ^

% deVilliers Glasser 2 function
L. LAURENT -- 15/11/2016 -- luc.laurent@lecnam.net

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% deVilliers Glasser 2 function
0002 %L. LAURENT -- 15/11/2016 -- luc.laurent@lecnam.net
0003 
0004 % sources available here:
0005 % https://bitbucket.org/luclaurent/optigtest/
0006 % https://github.com/luclaurent/optigtest/
0007 
0008 % optiGTest - set of testing functions    A toolbox to easy manipulate functions.
0009 % Copyright (C) 2017  Luc LAURENT <luc.laurent@lecnam.net>
0010 %
0011 % This program is free software: you can redistribute it and/or modify
0012 % it under the terms of the GNU General Public License as published by
0013 % the Free Software Foundation, either version 3 of the License, or
0014 % (at your option) any later version.
0015 %
0016 % This program is distributed in the hope that it will be useful,
0017 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0018 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0019 % GNU General Public License for more details.
0020 %
0021 % You should have received a copy of the GNU General Public License
0022 % along with this program.  If not, see <http://www.gnu.org/licenses/>.
0023 
0024 %
0025 %4 global minimas : f(x1,x2,x3,x4)=0
0026 %
0027 %Design space: -500<xi<500
0028 
0029 
0030 %derivatives check using Mathematica (a small difference remains with
0031 %finite difference)
0032 
0033 function [p,dp]=funDeVilliersGlasser2(xx)
0034 
0035 %constants
0036 a=16;
0037 b=0.1;
0038 c=1;
0039 d=53.81;
0040 f=1.27;
0041 g=3.012;
0042 h=2.13;
0043 k=0.507;
0044 %
0045 ii=1:a;
0046 t=reshape(b*(ii-c),[1,1,a]);
0047 y=d*f.^t.*tanh(g*t+sin(h*t)).*cos(exp(k)*t);
0048 
0049 %variables
0050 xxx=xx(:,:,1);
0051 yyy=xx(:,:,2);
0052 zzz=xx(:,:,3);
0053 vvv=xx(:,:,4);
0054 www=xx(:,:,5);
0055 
0056 %evaluation and derivatives
0057 zt=bsxfun(@times,zzz,t);
0058 vt=bsxfun(@times,vvv,t);
0059 wt=bsxfun(@times,exp(www),t);
0060 %
0061 svt=sin(vt);
0062 %
0063 yt=bsxfun(@power,yyy,t);
0064 xyt=bsxfun(@times,yt,xxx);
0065 %
0066 pa=tanh(zt+svt);
0067 pb=cos(wt);
0068 pc=xyt.*pa.*pb;
0069 pd=bsxfun(@minus,pc,y);
0070 %
0071 p=sum(pd.^2,3);
0072 %
0073 if nargout==2
0074     xt=bsxfun(@times,xxx,t);
0075     ytm=bsxfun(@power,yyy,t-1);
0076     cvt=cos(vt);
0077     pe=-sin(wt);
0078     %
0079     dp(:,:,1)=sum(2*yt.*pa.*pb.*pd,3);    
0080     dp(:,:,2)=sum(2*xt.*ytm.*pa.*pb.*pd,3);
0081     dp(:,:,3)=sum(2*xt.*yt.*(1-pa.^2).*pb.*pd,3);
0082     dp(:,:,4)=sum(2*xt.*yt.*cvt.*(1-pa.^2).*pb.*pd,3);
0083     dp(:,:,5)=sum(2*xyt.*wt.*pe.*pa.*pd,3);
0084 end
0085 end

Generated on Tue 28-May-2019 16:00:34 by m2html © 2005