Eggholder
Problem definition
Objective function
f = @(x) -(x(:,2)+47).*sin(sqrt(abs(x(:,1)./2 + x(:,2) + 47))) - x(:,1).*sin(sqrt(abs(x(:,1) - x(:,2) - 47)))
Optimization settings
o = struct% initializing struct
o.d = 2% dimension of decision variable
o.lb = -512% lower bounds
o.ub = 512% upper bounds
Graphic representation
[x,y] = meshgrid(linspace(o.lb,o.ub,50)) surf(x,y,f([x(:),y(:)]))
Problem properties
convexity | smoothness | minimum |
0 | ∞ | f(512,404.2319) = -959.6407 |
Optimization example with ga
Algorithm options
o.maxit = 50% number of iterations
o.pop = 12% number of population
Optimization
rng(0)% for tractability
[xmin,fmin,popPos,popCost] = ga(f,o)% running minimization
Animation
rng(0) [~,~,~,~,info] = ga(f,o) info.sol = [512 404.2319 -959.6407]% solution
info.animate = true% plot animation
info.animfreq = 5% frame frequency
info.np = 30% number of points for meshgrid
optimview('ga',info)