funHartmann6

PURPOSE ^

% Hartmann 6 function

SYNOPSIS ^

function [p,dp]=funHartmann6(xx)

DESCRIPTION ^

% Hartmann 6 function
L. LAURENT -- 16/11/2016 -- luc.laurent@lecnam.net

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Hartmann 6 function
0002 %L. LAURENT -- 16/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 %global minimum : f(x1,x2)=-3.32236801141551 for (x1,x2)=(0.20168952, 0.15001069, 0.47687398, 0.27533243, 0.31165162, 0.65730054)
0026 %
0027 %Design space: 0<xi<1
0028 
0029 
0030 function [p,dp]=funHartmann6(xx)
0031 %constants
0032 ma=[10.00,  0.05,  3.00, 17.00;
0033     3.00, 10.00,  3.50,  8.00;
0034     17.00, 17.00,  1.70,  0.05;
0035     3.50,  0.10, 10.00, 10.00;
0036     1.70,  8.00, 17.00,  0.10;
0037     8.00, 14.00,  8.00, 14.00];
0038 mp=[0.1312, 0.2329, 0.2348, 0.4047;
0039     0.1696, 0.4135, 0.1451, 0.8828;
0040     0.5569, 0.8307, 0.3522, 0.8732;
0041     0.0124, 0.3736, 0.2883, 0.5743;
0042     0.8283, 0.1004, 0.3047, 0.1091;
0043     0.5886, 0.9991, 0.6650, 0.0381];
0044 c=[1.0, 1.2, 3.0, 3.2];
0045 b=4;
0046 dim=6;
0047 
0048 
0049 %evaluation and derivatives
0050 sX=size(xx);
0051 p=zeros(sX(1),sX(2));
0052 for it=1:b
0053     pa=bsxfun(@minus,xx,reshape(mp(:,it),1,1,dim));    
0054     pb=bsxfun(@times,reshape(ma(:,it),1,1,dim),pa.^2);
0055     p=p-c(it)*exp(-sum(pb,3));
0056 end
0057 
0058 if nargout==2
0059     dp=zeros(sX);
0060     %
0061     for it=1:b
0062         pa=bsxfun(@minus,xx,reshape(mp(:,it),1,1,dim));
0063         pb=bsxfun(@times,reshape(ma(:,it),1,1,dim),pa.^2);
0064         pc=exp(-sum(pb,3));
0065         pe=bsxfun(@times,reshape(ma(:,it),1,1,dim),pa);
0066         %
0067         for itD=1:dim
0068             dp(:,:,itD)=dp(:,:,itD)+2*c(it)*pe(:,:,itD).*pc;
0069         end
0070     end
0071 end
0072 end

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