% Cross-in-Tray function L. LAURENT -- 05/11/2016 -- luc.laurent@lecnam.net
0001 %% Cross-in-Tray function 0002 %L. LAURENT -- 05/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 %4 global minimas : f(x1,x2,x3,x4)=-2.06261218 for 0026 % {(1.349406685353340,1.349406608602084), 0027 % (-1.349406685353340,1.349406608602084), 0028 % (1.349406685353340,-1.349406608602084), 0029 % (-1.349406685353340,-1.349406608602084)} 0030 % 0031 %Design space: -10<xi<10 0032 0033 0034 function [p,dp]=funCrossInTray(xx) 0035 0036 %constants 0037 a=1e-4; 0038 b=100; 0039 c=pi; 0040 d=1; 0041 e=0.1; 0042 0043 %variables 0044 xxx=xx(:,:,1); 0045 yyy=xx(:,:,2); 0046 0047 %evaluation and derivatives 0048 sx=sin(xxx); 0049 sy=sin(yyy); 0050 gxy=sqrt(xxx.^2+yyy.^2); 0051 hxy=exp(abs(b-gxy./c)); 0052 kxy=abs(sx.*sy.*hxy); 0053 p=-a*(kxy+d).^e; 0054 % 0055 if nargout==2 0056 cx=cos(xxx); 0057 cy=cos(yyy); 0058 % 0059 dgx=xxx./gxy; 0060 dgy=yyy./gxy; 0061 % 0062 dhx=hxy.*sign(b-gxy./c).*(-1/c.*dgx); 0063 dhy=hxy.*sign(b-gxy./c).*(-1/c.*dgy); 0064 % 0065 dkx=(cx.*sy.*hxy+sx.*sy.*dhx).*sign(sx.*sy.*hxy); 0066 dky=(cy.*sx.*hxy+sx.*sy.*dhy).*sign(sx.*sy.*hxy); 0067 % 0068 dp(:,:,1)=-a*e*dkx.*(kxy+d).^(e-1); 0069 dp(:,:,2)=-a*e*dky.*(kxy+d).^(e-1); 0070 end 0071 end