% Modified Rosenbrock function (Sobester 2005) L. LAURENT -- 16/05/2012 -- luc.laurent@lecnam.net
0001 %% Modified Rosenbrock function (Sobester 2005) 0002 % L. LAURENT -- 16/05/2012 -- luc.laurent@lecnam.net 0003 0004 % A. S\'obester, S. J. Leary, and A. J. Keane. On the design of optimization strategies based on global response surface approximation models. Journal of Global Optimization, 33(1):31?59, 2005. 0005 0006 % sources available here: 0007 % https://bitbucket.org/luclaurent/optigtest/ 0008 % https://github.com/luclaurent/optigtest/ 0009 0010 % optiGTest - set of testing functions A toolbox to easy manipulate functions. 0011 % Copyright (C) 2017 Luc LAURENT <luc.laurent@lecnam.net> 0012 % 0013 % This program is free software: you can redistribute it and/or modify 0014 % it under the terms of the GNU General Public License as published by 0015 % the Free Software Foundation, either version 3 of the License, or 0016 % (at your option) any later version. 0017 % 0018 % This program is distributed in the hope that it will be useful, 0019 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0020 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0021 % GNU General Public License for more details. 0022 % 0023 % You should have received a copy of the GNU General Public License 0024 % along with this program. If not, see <http://www.gnu.org/licenses/>. 0025 0026 function [p,dp] = funRosenbrockMS(xx) 0027 0028 %constants 0029 a=100; 0030 b=1; 0031 c=75; 0032 d=5; 0033 0034 %evaluation and derivatives 0035 pa=xx(:,:,2:end)-xx(:,:,1:end-1).^2; 0036 pb=xx(:,:,1:end-1)-b; 0037 calA=a*pa.^2+pb.^2; 0038 sd=sin(d*(1-xx)); 0039 calB=c*sd; 0040 % 0041 p=sum(calA,3)+sum(calB,3); 0042 0043 if nargout==2 0044 dgi=-4*a*pa.*xx(:,:,1:end-1)... 0045 +2*pb; 0046 dB=-c*d*cos(d*(1-xx)); 0047 % 0048 dp=zeros(size(xx)); 0049 dp(:,:,1)=dgi(:,:,1)+dB(:,:,1); 0050 dp(:,:,2:end-1)=dgi(:,:,2:end)... 0051 +2*a*pa(:,:,1:end-1)... 0052 +dB(:,:,2:end-1); 0053 dp(:,:,end)=2*a*pa(:,:,end)+dB(:,:,end); 0054 end 0055 end