Schaffer2
Problem definition
Objective function
f = @(x) 0.5 + (sin(x(:,1).^2 - x(:,2).^2).^2 - 0.5)./(1 + 0.001*(x(:,1).^2 + x(:,2).^2)).^2
Optimization settings
o = struct% initializing struct
o.lb = -100% lower bounds
o.ub = 100% upper bounds
Graphic representation
[x,y] = meshgrid(o.lb:5:o.ub) surf(x,y,f([x(:),y(:)]))
Problem properties
convexity | smoothness | minimum |
0 | ∞ | f(0,0) = 0 |
Optimization example with fminsearch
Optimization
rng(0)% for tractability
x0 = [60,40]% initial guess
[xmin,fmin,info] = fminsearch(f,x0,o)% running minimization
Animation
rng(0) x0 = [60,40] [~,~,info] = fminsearch(f,x0,o) info.sol = [0 0 0]% solution
info.animate = true% plot animation
info.animfreq = 5% frame frequency
info.np = 21% number of points for meshgrid
optimview('fminsearch',info)
References
[1] J.D. Schaffer, R. A. Caruana, L. J. Eshelman, R. Das, "A Study of Control Parameters Affecting Online Performance of Genetic Algorithms for Function Optimization", Proceedings of the 3rd International Conference on Genetic Algorithms
Pages 51-60, San Francisco, 1989