% Judge function L. LAURENT -- 16/03/2017 -- luc.laurent@lecnam.net
0001 %% Judge function 0002 %L. LAURENT -- 16/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)=16.0817307 for x=[0.86479 1.2357] 0026 % 0027 %Design space: -10<xi<10 0028 % 0029 0030 0031 function [p,dp]=funJudge(xx) 0032 %constants 0033 m=20; 0034 C=[4.284, 4.149, 3.877, 0.533, 2.211,... 0035 2.389, 2.145, 3.231, 1.998, 1.379,... 0036 2.106, 1.428, 1.011, 2.179, 2.858,... 0037 1.388, 1.651, 1.593, 1.046, 2.152]; 0038 C=reshape(C,1,1,m); 0039 0040 B=[0.286, 0.973, 0.384, 0.276, 0.973,... 0041 0.543, 0.957, 0.948, 0.543, 0.797,... 0042 0.936, 0.889, 0.006, 0.828, 0.399,... 0043 0.617, 0.939, 0.784, 0.072, 0.889]; 0044 B=reshape(B,1,1,m); 0045 0046 A=[0.645, 0.585, 0.310, 0.058, 0.455,... 0047 0.779, 0.259, 0.202, 0.028, 0.099,... 0048 0.142, 0.296, 0.175, 0.180, 0.842,... 0049 0.039, 0.103, 0.620, 0.158, 0.704]; 0050 A=reshape(A,1,1,m); 0051 0052 0053 %evaluation and derivatives 0054 x=xx(:,:,1); 0055 y=xx(:,:,2); 0056 % 0057 pa=x+B.*y+A.*y.^2-C; 0058 % 0059 p=sum(pa.^2,3); 0060 0061 % 0062 if nargout==2 0063 % 0064 dp=zeros(size(xx)); 0065 % 0066 dp(:,:,1)=sum(2*pa,3); 0067 dp(:,:,2)=sum(2*(B+2*A.*y).*pa,3); 0068 end 0069 end