funHartmann3

PURPOSE ^

% Hartmann 3 function

SYNOPSIS ^

function [p,dp]=funHartmann3(xx)

DESCRIPTION ^

% Hartmann 3 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 3 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.86278214782076 for (x1,x2)=[0.114614,0.555649,0.852547]
0026 %
0027 %Design space: 0<xi<10
0028 
0029 
0030 function [p,dp]=funHartmann3(xx)
0031 %constants
0032 ma=[3.0,  0.1,  3.0,  0.1;
0033     10.0, 10.0, 10.0, 10.0;
0034     30.0, 35.0, 30.0, 35.0];
0035 mp=[0.36890, 0.46990, 0.10910, 0.03815;
0036     0.11700, 0.43870, 0.87320, 0.57430;
0037     0.26730, 0.74700, 0.55470, 0.88280];
0038 c=[1,1.2,3,3.2];
0039 b=4;
0040 dim=3;
0041 
0042 %evaluation and derivatives
0043 sX=size(xx);
0044 p=zeros(sX(1),sX(2));
0045 for it=1:b
0046     pa=bsxfun(@minus,xx,reshape(mp(:,it),1,1,dim));    
0047     pb=bsxfun(@times,reshape(ma(:,it),1,1,dim),pa.^2);
0048     p=p-c(it)*exp(-sum(pb,3));
0049 end
0050 
0051 if nargout==2
0052     dp=zeros(sX);
0053     %
0054     for it=1:b
0055         pa=bsxfun(@minus,xx,reshape(mp(:,it),1,1,dim));
0056         pb=bsxfun(@times,reshape(ma(:,it),1,1,dim),pa.^2);
0057         pc=exp(-sum(pb,3));
0058         pe=bsxfun(@times,reshape(ma(:,it),1,1,dim),pa);
0059         %
0060         for itD=1:dim
0061             dp(:,:,itD)=dp(:,:,itD)+2*c(it)*pe(:,:,itD).*pc;
0062         end
0063     end
0064 end
0065 end

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