help aurea Performs line search procedure for unconstrained optimization using golden section. [stepsize,xo,Ot,nS]=aurea(S,x0,d,ip,problem,tol,mxit,stp) S: objective function x0: initial point d: search direction vector ip: (0): no plot (default), (>0) plot figure ip with pause, (<0) plot figure ip problem: (-1): minimum (default), (1): maximum tol: tolerance (default = 1e-4) mxit: maximum number of iterations (default = 50*(1+4*~(ip>0))) stp: initial stepsize (default = 0.01*sqrt(d'*d)) stepsize: optimal stepsize xo: optimal point in the search direction Ot: optimal value of S in the search direction nS: number of objective function evaluations type test0 function S=test(x) % x0 = 2 % xo = 0.5 % S(xo) = 0.5 S=4*(x-0.5).^2+0.5; [stepsize,xo,Ot,nS]=aurea('test0',2,1,1) Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... stepsize = -1.5000 xo = 0.5000 Ot = 0.5000 nS = 34 [stepsize,xo,Ot,nS]=aurea('test0',2,-1,1) Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... stepsize = 1.5000 xo = 0.5000 Ot = 0.5000 nS = 33 type test1 function S=test(x) % Rosenbrock, 1960 % x0 = [-1.2, 1]' % xo = [1, 1]' % S(xo) = 0 % x0=[-0.8 0], d=[8 5] (busca Coggins) S=100*(x(2)-x(1).^2).^2+(1-x(1)).^2; bandemo BANDEMO Banana function minimization demonstration. This script-file demonstrates the minimization of the the banana function: f(x)= 100*(x(2)-x(1)^2)^2+(1-x(1))^2 It is called the banana function because of the way the curvature bends around the origin (also called Rosenbrock's function). It is notorious in optimization examples because of the slow convergence with which most methods exhibit when trying to solve this problem. This function has a unique minimum at the point X=[1,1] f(x)=0. We demonstrate here a number of techniques for its minimization starting at the point X=[-1.9,2]. In this demo we focus on the algorithms in the Optimization Toolbox for medium-scale problems. Strike any key for a mesh plot of the banana function Strike any key for a contour plot of the banana function Error in ==> C:\Apps\Matlab\toolbox\optim\bandemo.m On line 44 ==> pause help aurea Performs line search procedure for unconstrained optimization using golden section. [stepsize,xo,Ot,nS]=aurea(S,x0,d,ip,problem,tol,mxit,stp) S: objective function x0: initial point d: search direction vector ip: (0): no plot (default), (>0) plot figure ip with pause, (<0) plot figure ip problem: (-1): minimum (default), (1): maximum tol: tolerance (default = 1e-4) mxit: maximum number of iterations (default = 50*(1+4*~(ip>0))) stp: initial stepsize (default = 0.01*sqrt(d'*d)) stepsize: optimal stepsize xo: optimal point in the search direction Ot: optimal value of S in the search direction nS: number of objective function evaluations type test1 function S=test(x) % Rosenbrock, 1960 % x0 = [-1.2, 1]' % xo = [1, 1]' % S(xo) = 0 % x0=[-0.8 0], d=[8 5] (busca Coggins) S=100*(x(2)-x(1).^2).^2+(1-x(1)).^2; [stepsize,xo,Ot,nS]=aurea('test1',[-1.2 1],[1 0],1) Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... stepsize = 0.2050 xo = -0.9950 1.0000 Ot = 3.9900 nS = 25 type test1 function S=test(x) % Rosenbrock, 1960 % x0 = [-1.2, 1]' % xo = [1, 1]' % S(xo) = 0 % x0=[-0.8 0], d=[8 5] (busca Coggins) S=100*(x(2)-x(1).^2).^2+(1-x(1)).^2; [stepsize,xo,Ot,nS]=aurea('test1',[-1.2 1],[5 0],1) Pause: hit any key to continue... Error in ==> v:\cursos\pos\otimiza\aulas\aurea.m On line 83 ==> disp('Pause: hit any key to continue...'); pause; [stepsize,xo,Ot,nS]=aurea('test1',[-1.2 1],[10 0],1) Pause: hit any key to continue... Error in ==> v:\cursos\pos\otimiza\aulas\aurea.m On line 83 ==> disp('Pause: hit any key to continue...'); pause; [stepsize,xo,Ot,nS]=aurea('test1',[-1.2 1],[100 0],1) Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... stepsize = 0.0020 xo = -0.9983 1.0000 Ot = 3.9944 nS = 26 type test1 function S=test(x) % Rosenbrock, 1960 % x0 = [-1.2, 1]' % xo = [1, 1]' % S(xo) = 0 % x0=[-0.8 0], d=[8 5] (busca Coggins) S=100*(x(2)-x(1).^2).^2+(1-x(1)).^2; [stepsize,xo,Ot,nS]=aurea('test1',[-1.2 1],[15 0],1) Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... stepsize = 0.1467 xo = 1.0005 1.0000 Ot = 9.6933e-005 nS = 23 type test1 function S=test(x) % Rosenbrock, 1960 % x0 = [-1.2, 1]' % xo = [1, 1]' % S(xo) = 0 % x0=[-0.8 0], d=[8 5] (busca Coggins) S=100*(x(2)-x(1).^2).^2+(1-x(1)).^2; [stepsize,xo,Ot,nS]=aurea('test1',[-0.8 0],[8 5],1) Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... stepsize = 0.2357 xo = 1.0854 1.1784 Ot = 0.0073 nS = 22 bandemo BANDEMO Banana function minimization demonstration. This script-file demonstrates the minimization of the the banana function: f(x)= 100*(x(2)-x(1)^2)^2+(1-x(1))^2 It is called the banana function because of the way the curvature bends around the origin (also called Rosenbrock's function). It is notorious in optimization examples because of the slow convergence with which most methods exhibit when trying to solve this problem. This function has a unique minimum at the point X=[1,1] f(x)=0. We demonstrate here a number of techniques for its minimization starting at the point X=[-1.9,2]. In this demo we focus on the algorithms in the Optimization Toolbox for medium-scale problems. Strike any key for a mesh plot of the banana function Strike any key for a contour plot of the banana function Error in ==> C:\Apps\Matlab\toolbox\optim\bandemo.m On line 44 ==> pause [stepsize,xo,Ot,nS]=coggins('test1',[-0.8 0],[8 5],1) Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... stepsize = 0.0432 xo = -0.4543 0.2160 Ot = 2.1243 nS = 20 [stepsize,xo,Ot,nS]=aurea('test1',[-0.8 0],[8 5],1) Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Error in ==> v:\cursos\pos\otimiza\aulas\aurea.m On line 108 ==> disp('Pause: hit any key to continue...'); pause; [stepsize,xo,Ot,nS]=cogings('test1',[-1.2 1],[1 0],1) ??? Undefined function or variable 'cogings'. [stepsize,xo,Ot,nS]=coggins('test1',[-1.2 1],[1 0],1) Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... stepsize = 0.2050 xo = -0.9950 1.0000 Ot = 3.9900 nS = 15 [stepsize,xo,Ot,nS]=coggins('test1',xo,[0 1],1) Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... stepsize = -0.0100 xo = -0.9950 0.9900 Ot = 3.9799 nS = 9 [stepsize,xo,Ot,nS]=coggins('test1',xo,[1 0],0) stepsize = 0.0051 xo = -0.9899 0.9900 Ot = 3.9698 nS = 10 [stepsize,xo,Ot,nS]=coggins('test1',xo,[0 1],0) stepsize = -0.0101 xo = -0.9899 0.9799 Ot = 3.9597 nS = 9 [stepsize,xo,Ot,nS]=coggins('test1',xo,[1 0],0) stepsize = 0.0051 xo = -0.9848 0.9799 Ot = 3.9496 nS = 10 [stepsize,xo,Ot,nS]=coggins('test1',xo,[0 1],0) stepsize = -0.0101 xo = -0.9848 0.9698 Ot = 3.9395 nS = 9 quit