funDeceptive

PURPOSE ^

% Deceptive function

SYNOPSIS ^

function [p,dp]=funDeceptive(xx)

DESCRIPTION ^

% Deceptive function 
L. LAURENT -- 14/03/2017 -- luc.laurent@lecnam.net

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Deceptive function
0002 %L. LAURENT -- 14/03/2017 -- 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 %global minimum : f(x)=-1 for xi=alphai=i/(dim+1)
0026 %
0027 %Design space: 0<xi<10
0028 
0029 
0030 function [p,dp]=funDeceptive(xx)
0031 %constants
0032 a=4/5;
0033 b=5;
0034 c=4;
0035 d=1;
0036 beta=2;
0037 
0038 %evaluation and derivatives
0039 sX=[size(xx,1) size(xx,2) size(xx,3)]; 
0040 %
0041 alpha=(1:sX(3))./(sX(3)+1);
0042 alphaR=repmat(reshape(alpha,1,1,sX(3)),sX(1),sX(2),1);
0043 %
0044 la=zeros(sX);
0045 ua=a*alphaR;
0046 IXa=find(xx>=la&xx<ua);
0047 %
0048 lb=ua;
0049 ub=alphaR;
0050 IXb=find(xx>=lb&xx<ub);
0051 %
0052 lc=ub;
0053 uc=1/b+a*alphaR;
0054 IXc=find(xx>=lc&xx<uc);
0055 %
0056 ld=uc;
0057 ud=d*ones(sX);
0058 IXd=find(xx>=ld&xx<=ud);
0059 %
0060 g=zeros(sX);
0061 g(IXa)=a-xx(IXa)./alphaR(IXa);
0062 g(IXb)=b*xx(IXb)./alphaR(IXb)-c;
0063 g(IXc)=b*(xx(IXc)-alphaR(IXc))./(alphaR(IXc)-d)+d;
0064 g(IXd)=(xx(IXd)-d)./(d-alphaR(IXd))+a;
0065 %
0066 pa=sum(g,3);
0067 %
0068 p=-(1/sX(3)*pa).^beta;
0069 %
0070         
0071 %keyboard
0072 %
0073 if nargout==2
0074     %
0075     dg=zeros(sX);
0076     %
0077     dg(IXa)=-1./alphaR(IXa);
0078     dg(IXb)=-b./alphaR(IXb);
0079     dg(IXc)=b./(alphaR(IXc)-d);
0080     dg(IXd)=1./(d-alphaR(IXd));
0081     %
0082     dp=-beta./sX(3).*dg.*1/sX(3).*pa(:,:,ones(1,sX(3)));   
0083 end
0084 end

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