% Langermann 5 2D function L. LAURENT -- 17/11/2016 -- luc.laurent@lecnam.net
0001 %% Langermann 5 2D function 0002 %L. LAURENT -- 17/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)=-1.4 for (x1,x2)=() 0026 % 0027 %Design space:0<xi<10 0028 0029 0030 function [p,dp]=funLangermann52(xx) 0031 %constants 0032 ma = [3,5,2,1,7]; 0033 mb = [5,2,1,4,9]; 0034 mc = [1,2,5,2,3]; 0035 d=pi; 0036 m=5; 0037 %variables 0038 xxx=xx(:,:,1); 0039 yyy=xx(:,:,2); 0040 0041 %evaluation and derivatives 0042 vx=bsxfun(@minus,xxx,reshape(ma,1,1,m)); 0043 vy=bsxfun(@minus,yyy,reshape(mb,1,1,m)); 0044 vxy=vx.^2+vy.^2; 0045 ex=exp(-1/d*vxy); 0046 cx=cos(d*vxy); 0047 cc=bsxfun(@times,cx,reshape(mc,1,1,m)); 0048 % 0049 p=sum(-ex.*cc,3); 0050 % 0051 if nargout==2 0052 sx=sin(d*vxy); 0053 cs=bsxfun(@times,sx,reshape(mc,1,1,m)); 0054 pvx=vx.*ex; 0055 pvy=vy.*ex; 0056 % 0057 dp(:,:,1)=sum(2/d*pvx.*cc+2*d*pvx.*cs,3); 0058 dp(:,:,2)=sum(2/d*pvy.*cc+2*d*pvy.*cs,3); 0059 end 0060 end