unc_n2_rastrigin.m

来自「it contains many classic Test Problems f」· M 代码 · 共 36 行

M
36
字号
function [fval]=unc_n2_rastrigin(x)
%reference:
%note that you can get the formulation of unc_n2_rastrigin from some
%aritcles,such as
%(1)X Liu 'Finding Global Minima with a Computable Filled Function',
%Journal of Global Optimization,151-161'
%
%algorithm:
%below code is  edited according to 
%(1)X Liu 'Finding Global Minima with a Computable Filled Function',
%Journal of Global Optimization,151-161'
%
%solution:
% where the bounds are -1<=x1,x2<=1;
% The global minimum is at x*=(0,0)  and f(x*)= -2;
%This function has about 25 minima in the bounds.



%Copyright:
% programmers:oiltowater.
% It comply with the GPL2.0
% Copyright 2006  oiltowater 





if size(x,1)~=2,
    error('the row of x is 2');
end

x1=x(1,1);
x2=x(2,1);

fval=x1*x1+x2*x2-cos(18*x1)-cos(18*x2);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?