funGoldsteinPrice

PURPOSE ^

% Goldstein & Price function

SYNOPSIS ^

function [p,dp]=funGoldsteinPrice(xx)

DESCRIPTION ^

% Goldstein & Price function
L. LAURENT -- 13/12/2010 -- luc.laurent@lecnam.net

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Goldstein & Price function
0002 %L. LAURENT -- 13/12/2010 -- 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)=3 for (x1,x2)=(0,-1)
0026 %
0027 %Design space: -2<x1<2, -2<x<2
0028 
0029 
0030 function [p,dp]=funGoldsteinPrice(xx)
0031 %constants
0032 a=1;
0033 b=19;
0034 c=14;
0035 d=3;
0036 e=6;
0037 f=3;
0038 g=30;
0039 h=2;
0040 k=18;
0041 l=32;
0042 m=12;
0043 n=48;
0044 o=36;
0045 pp=27;
0046 
0047 %variables
0048 xxx=xx(:,:,1);
0049 yyy=xx(:,:,2);
0050 
0051 %evaluation and derivatives
0052 qq=xxx+yyy+a;
0053 rr=b-c*xxx+d*xxx.^2-c*yyy+e*xxx.*yyy+f*yyy.^2;
0054 ss=h*xxx-f*yyy;
0055 tt=k-l*xxx+m*xxx.^2+n*yyy-o*xxx.*yyy+pp*yyy.^2;
0056 %
0057 a = a+qq.^2.*rr;
0058 b = g+ss.^2.*tt;
0059 p = a.*b;
0060 
0061 if nargout==2
0062     dqqX=1;
0063     dqqY=1;
0064     drrX=-c+2*d*xxx+e*yyy;
0065     drrY=-c+e*xxx+2*f*yyy;
0066     dssX=h;
0067     dssY=-f;
0068     dttX=-l+2*m*xxx-o*yyy;
0069     dttY=n-o*xxx+2*pp*yyy;
0070     %
0071     dp(:,:,1)=(2*dqqX.*qq.*rr+qq.^2.*drrX).*b...
0072         +(2*dssX.*ss.*tt+ss.^2.*dttX).*a;
0073     dp(:,:,2)=(2*dqqY.*qq.*rr+qq.^2.*drrY).*b...
0074         +(2*dssY.*ss.*tt+ss.^2.*dttY).*a;
0075 end
0076 end

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