Levi13
Problem definition
Objective function
f = @(x) sin(3*pi*x(:,1)).^2 + ((x(:,1) - 1).^2).*(1 + sin(3*pi*x(:,1)).^2) + ((x(:,2) - 1).^2).*(1 + sin(2*pi*x(:,2).^2))
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(o.lb:0.8:o.ub) surf(x,y,f([x(:),y(:)]))
Problem properties
convexity | smoothness | minimum |
0 | ∞ | f(1,1) = 0 |
Optimization example with ga
Algorithm options
o.maxit = 21% 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 = [1 1 0]% solution
info.animate = true% plot animation
info.animfreq = 2% frame frequency
info.np = 20% number of points for meshgrid
optimview('ga',info)