% OBJECTIVE FUNCTION
f = @(x) -abs(sin(x(:,1)).*cos(x(:,2)).*exp(abs(1 - (sqrt(x(:,1).^2 + x(:,2).^2)./pi))))

% OPTIMIZATION SETTINGS
o = struct	% initializing struct
o.d = 2	% dimension of decision variable
o.lb = -10	% lower bounds
o.ub = 10	% upper bounds

% GRAPHIC REPRESENTATION
[x,y] = meshgrid(-10:0.4:10)
surf(x,y,f([x(:),y(:)]))

% OPTIMIZATION 
rng(0)	% for tractability 
[xmin,fmin,popPos,popCost] = ga(f,o)	% running minimization  

% ANIMATION
% Uncomment the following code to generate animation % 
% rng(0)
% [~,~,~,~,info] = ga(f,o)
% info.sol = [-8.05502 9.66459 -19.2085]	% solution 
% info.animate = true	% plot animation 
% info.animfreq = 2	% frame frequency 
% info.np = 40	% number of points for meshgrid 
% optimview('ga',info)