funLevy03

PURPOSE ^

% Levy 03 function

SYNOPSIS ^

function [p,dp]=funLevy03(xx)

DESCRIPTION ^

% Levy 03 function
L. LAURENT -- 17/03/2017 -- luc.laurent@lecnam.net

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Levy 03 function
0002 %L. LAURENT -- 17/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)=0 for xi=1
0026 %
0027 %Design space: -10<xi<10
0028 %
0029 
0030 
0031 function [p,dp]=funLevy03(xx)
0032 %constants
0033 a=pi;
0034 b=1;
0035 c=4;
0036 d=10;
0037 
0038 %evaluation and derivatives
0039 y=b+(xx-b)./c;
0040 %
0041 pa=sin(a*y(:,:,1));
0042 pb=y(:,:,1:end-1)-b;
0043 sc=sin(a*y(:,:,1:end-1)+b);
0044 pc=b+d*sc.^2;
0045 pd=y(:,:,end)-b;
0046 se=sin(2*a*y(:,:,end));
0047 pe=b+se.^2;
0048 %
0049 p=pa.^2+sum(pb.^2.*pc,3)+pd.^2.*pe;
0050 
0051 %
0052 if nargout==2
0053     %
0054     dp=zeros(size(xx));
0055     %
0056     cc=cos(a*y(:,:,1:end-1)+b);
0057     ce=cos(2*a*y(:,:,end));
0058     %
0059     dp(:,:,1)=2*a/c*pa.*cos(a*y(:,:,1))...
0060         +2/c.*pb(:,:,1).*pc(:,:,1)...
0061         +2*d*a/c*sc(:,:,1).*cc(:,:,1).*pb(:,:,1).^2;
0062     dp(:,:,end)=2/c*pd.*pe...
0063         +4*a/c*se.*ce.*pd.^2;
0064     dp(:,:,2:end-1)=2/c*pb(:,:,2:end).*pc(:,:,2:end)...
0065         +2*d*a/c*sc(:,:,2:end).*cc(:,:,2:end).*pb(:,:,2:end).^2;
0066 end

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