funEggHolder

PURPOSE ^

% Egg Holder function

SYNOPSIS ^

function [p,dp]=funEggHolder(xx)

DESCRIPTION ^

% Egg Holder function
L. LAURENT -- 16/11/2016 -- luc.laurent@lecnam.net

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Egg Holder 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 %one local minimum
0026 %1 global minimum : x=(512.0, 404.2319) >> f(x)=-959.640662711
0027 %
0028 %design space -512<xi<512
0029 
0030 
0031 function [p,dp]=funEggHolder(xx)
0032 
0033 %constants
0034 a=47;
0035 b=0.5;
0036 
0037 %variables
0038 dim=size(xx,3);
0039 
0040 %evaluations and derivatives
0041 pa=xx(:,:,2:end)+a;
0042 pb=xx(:,:,2:end)+xx(:,:,1:end-1).*0.5+a;
0043 pc=xx(:,:,1:end-1)-xx(:,:,2:end)-a;
0044 %
0045 sqpb=sqrt(abs(pb));
0046 sqpc=sqrt(abs(pc));
0047 sipb=sin(sqpb);
0048 sipc=sin(sqpc);
0049 %
0050 g=-pa.*sipb-xx(:,:,1:end-1).*sipc;
0051 p=sum(g,3);
0052 
0053 if nargout==2
0054     dgi=-b*pa.*sign(pb).*1./(2*sqpb).*cos(sqpb)...
0055         -sipc...
0056         -xx(:,:,1:end-1).*sign(pc).*1./(2*sqpc).*cos(sqpc);
0057     dgii=-sipb...
0058         -pa.*sign(pb).*1./(2*sqpb).*cos(sqpb)...
0059         +xx(:,:,1:end-1).*sign(pc).*1./(2*sqpc).*cos(sqpc);
0060     %
0061     dp=zeros(size(xx));
0062     dp(:,:,1)=dgi(:,:,1);    
0063     for it=2:dim-1
0064         dp(:,:,it)=dgi(:,:,it)+dgii(:,:,it-1);
0065     end    
0066     dp(:,:,dim)=dgii(:,:,end);
0067 end
0068 end

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