Griewank

Problem definition

Objective function
f = @(x) (x(:,1).^2 + x(:,2).^2)/4000 - cos(x(:,1)).*cos(x(:,2)./sqrt(2)) + 1
Optimization settings
o = struct	

% initializing struct

o.d = 2

% dimension of decision variable

o.lb = -600

% lower bounds

o.ub = 600

% upper bounds

Graphic representation
[x,y] = meshgrid(o.lb:40:o.ub)
surf(x,y,f([x(:),y(:)]))
Zoom around global minimum
[x,y] = meshgrid(-6:0.3:6)
surf(x,y,f([x(:),y(:)]))

Problem properties

convexity smoothness minimum
0 f(0,0) = 0

Optimization example with ga

Algorithm options
o.maxit = 60	

% number of iterations

Optimization
rng(0)	

% for tractability

[xmin,fmin,popPos,popCost] = ga(f,o)

% running minimization

Animation
rng(0)
[~,~,~,~,info] = ga(f,o)
info.sol = [0 0 0]	

% solution

info.animate = true

% plot animation

info.animfreq = 4

% frame frequency

info.np = 21

% number of points for meshgrid

optimview('ga',info)

References

[1] A. O. Griewank, "Generalized Decent for Global Optimization", J. Opt. Th. Appl. 34, 1139, 1981

Related functions

ga | meshgrid | surf