cd v:\cursos\pos\otimiza\aulas v=rand(3,1) v = 0.9501 0.2311 0.6068 dw=v*v' dw = 0.9027 0.2196 0.5766 0.2196 0.0534 0.1403 0.5766 0.1403 0.3683 rank(dw) ans = 1 eig(dw) ans = 0.0000 -0.0000 1.3244 u=rand(3,1) u = 0.4860 0.8913 0.7621 dw2=u*u' dw2 = 0.2362 0.4332 0.3704 0.4332 0.7944 0.6793 0.3704 0.6793 0.5808 rank(1) ans = 1 eig(dw1) ??? Undefined function or variable 'dw1'. eig(dw2) ans = -0.0000 1.6114 0 dw1=v*v' dw1 = 0.9027 0.2196 0.5766 0.2196 0.0534 0.1403 0.5766 0.1403 0.3683 dw=dw1-dw2 dw = 0.6666 -0.2135 0.2062 -0.2135 -0.7410 -0.5390 0.2062 -0.5390 -0.2125 rank(dw) ans = 2 eig(dw) ans = 0.7932 -0.0000 -1.0801 what M-files in the current directory v:\cursos\pos\otimiza\aulas CATALIS fmincon1 minlp2 test0 EXTRATOR fminunc1 minlp3 test1 LUCRO fminusub minlp4 test10 MINQUA fun minlp5 test11 MODELO func44 minlp6 test12 Minqua44 gmilp1 minlpn test13 Modelo44 gminlp1 modelagem test14 OPT_RES gminlp2 naturais test15 PLANOS gminlp3 newton test16 READ2 gminlp4 newton_h test17 SEMIDEF gminlp5 newton_mod test18 SMODELO gminlp6 newtont test19 aurea gmodelagem nlconst test1gn bandem1 gmurray nlp_internal test1m bfgs grad pareto18 test2 bracket grg pareto19 test20 buscarnd gtest1 pareto20 test21 cgrad gtest10 pareto21 test22 checkbounds gtest12 powell test23 coggins gtest13 qpsub test3 compdir gtest2 refino test4 complex gtest9 restr test5 dados_ex6_44 hkjeeves restr1 test6 dfp htest1 restr14 test7 dual htest10 restr15 test8 ex2_karm htest2 restr16 test9 ex_karma htest9 restr17 teste_buscarnd ex_qp1 interior restr20 univar ex_qp2 karmarkar restr21 varmetr ex_qp3 lmarqua rosembr visual ex_swarm lp_nlp set1 writearq exmilp milp setoptim xplot exmilp2 milp1 sol_extrat exmilprog milprog sqp exmilprog2 minlp steepdes extrat minlp1 swarm setoptim setoptim help bfgs Unconstrained optimization using BFGS. [xo,Ot,nS]=bfgs(S,x0,ip,G,method,Lb,Ub,problem,tol,mxit) S: objective function x0: initial point ip: (0) no plot (default), (>0) plot figure ip with pause, (<0) plot figure ip G: gradient vector function method: line-search method: (0) quadratic+cubic (default), (1) cubic Lb, Ub: lower and upper bound vectors to plot (default = x0*(1+/-2)) problem: (-1): minimum (default), (1): maximum tol: tolerance (default = 1e-4) mxit: maximum number of iterations (default = 50*(1+4*~(ip>0))) xo: optimal point Ot: optimal value of S nS: number of objective function evaluations [xo,Ot,nS]=bfgs('test10',[1 1],1,'gtest10') Pause: hit any key to continue... Directional Iteration Func-count f(x) Step-size derivative 1 0 3 0.166667 -36 Warning: Divide by zero. > In C:\Apps\Matlab\toolbox\optim\cubici2.m at line 12 In C:\Apps\Matlab\toolbox\optim\searchq.m at line 65 In v:\cursos\pos\otimiza\aulas\fminusub.m at line 283 In v:\cursos\pos\otimiza\aulas\fminunc1.m at line 220 In v:\cursos\pos\otimiza\aulas\varmetr.m at line 115 In v:\cursos\pos\otimiza\aulas\bfgs.m at line 51 Warning: Divide by zero. > In C:\Apps\Matlab\toolbox\optim\cubici2.m at line 16 In C:\Apps\Matlab\toolbox\optim\searchq.m at line 65 In v:\cursos\pos\otimiza\aulas\fminusub.m at line 283 In v:\cursos\pos\otimiza\aulas\fminunc1.m at line 220 In v:\cursos\pos\otimiza\aulas\varmetr.m at line 115 In v:\cursos\pos\otimiza\aulas\bfgs.m at line 51 Pause: hit any key to continue... 2 4 0.75 0.125 0 Pause: hit any key to continue... 3 9 0.03 0.8 0.45 Warning: Divide by zero. > In C:\Apps\Matlab\toolbox\optim\cubici2.m at line 12 In C:\Apps\Matlab\toolbox\optim\searchq.m at line 65 In v:\cursos\pos\otimiza\aulas\fminusub.m at line 283 In v:\cursos\pos\otimiza\aulas\fminunc1.m at line 220 In v:\cursos\pos\otimiza\aulas\varmetr.m at line 115 In v:\cursos\pos\otimiza\aulas\bfgs.m at line 51 Warning: Divide by zero. > In C:\Apps\Matlab\toolbox\optim\cubici2.m at line 16 In C:\Apps\Matlab\toolbox\optim\searchq.m at line 65 In v:\cursos\pos\otimiza\aulas\fminusub.m at line 283 In v:\cursos\pos\otimiza\aulas\fminunc1.m at line 220 In v:\cursos\pos\otimiza\aulas\varmetr.m at line 115 In v:\cursos\pos\otimiza\aulas\bfgs.m at line 51 Pause: hit any key to continue... 4 14 5.77779e-034 1 -8.33e-018 Optimization terminated successfully: Search direction less than 2*options.TolX Pause: hit any key to continue... xo = 1.0e-017 * 0.0416 0.1665 Ot = 2.0800e-036 nS = 15 [xo,Ot,nS]=dfp('test10',[1 1],1,'gtest10') Pause: hit any key to continue... Directional Iteration Func-count f(x) Step-size derivative 1 0 3 0.166667 -36 Warning: Divide by zero. > In C:\Apps\Matlab\toolbox\optim\cubici2.m at line 12 In C:\Apps\Matlab\toolbox\optim\searchq.m at line 65 In v:\cursos\pos\otimiza\aulas\fminusub.m at line 283 In v:\cursos\pos\otimiza\aulas\fminunc1.m at line 220 In v:\cursos\pos\otimiza\aulas\varmetr.m at line 115 In v:\cursos\pos\otimiza\aulas\dfp.m at line 51 Warning: Divide by zero. > In C:\Apps\Matlab\toolbox\optim\cubici2.m at line 16 In C:\Apps\Matlab\toolbox\optim\searchq.m at line 65 In v:\cursos\pos\otimiza\aulas\fminusub.m at line 283 In v:\cursos\pos\otimiza\aulas\fminunc1.m at line 220 In v:\cursos\pos\otimiza\aulas\varmetr.m at line 115 In v:\cursos\pos\otimiza\aulas\dfp.m at line 51 Pause: hit any key to continue... 2 4 0.75 0.125 0 Pause: hit any key to continue... 3 9 0.00372096 0.758226 0.149 Pause: hit any key to continue... 4 14 9.93557e-006 0.948326 -0.000385 Optimization terminated successfully: Current search direction is a descent direction, and magnitude of directional derivative in search direction less than 2*options.TolFun Pause: hit any key to continue... xo = 1.0e-004 * 0.0644 0.2576 Ot = 4.9765e-010 nS = 15 [xo,Ot,nS]=gmurray('test10',[1 1],1,'gtest10') Pause: hit any key to continue... Directional Iteration Func-count f(x) Step-size derivative 1 0 3 0.166667 -36 Warning: Divide by zero. > In C:\Apps\Matlab\toolbox\optim\cubici2.m at line 12 In C:\Apps\Matlab\toolbox\optim\searchq.m at line 65 In v:\cursos\pos\otimiza\aulas\fminusub.m at line 283 In v:\cursos\pos\otimiza\aulas\fminunc1.m at line 220 In v:\cursos\pos\otimiza\aulas\varmetr.m at line 115 In v:\cursos\pos\otimiza\aulas\gmurray.m at line 51 Warning: Divide by zero. > In C:\Apps\Matlab\toolbox\optim\cubici2.m at line 16 In C:\Apps\Matlab\toolbox\optim\searchq.m at line 65 In v:\cursos\pos\otimiza\aulas\fminusub.m at line 283 In v:\cursos\pos\otimiza\aulas\fminunc1.m at line 220 In v:\cursos\pos\otimiza\aulas\varmetr.m at line 115 In v:\cursos\pos\otimiza\aulas\gmurray.m at line 51 Pause: hit any key to continue... 2 4 0.75 0.125 0 Pause: hit any key to continue... 3 9 0.03 0.8 0.45 Pause: hit any key to continue... 4 14 0.00103128 1.18541 0.0111 Pause: hit any key to continue... 5 18 3.61112e-035 1 -3.86e-019 Optimization terminated successfully: Search direction less than 2*options.TolX Pause: hit any key to continue... xo = 1.0e-019 * -0.0358 -0.1431 Ot = 1.5362e-040 nS = 19 [xo,Ot,nS]=bfgs('test1',[-1.2 1],1,'gtest1') Pause: hit any key to continue... Directional Iteration Func-count f(x) Step-size derivative 1 0 24.2 0.001 -5.42e+004 Pause: hit any key to continue... 2 4 4.12814 0.000786792 -68.5 Pause: hit any key to continue... 3 8 3.85717 0.140499 -0.23 Pause: hit any key to continue... 4 12 3.59745 1.42893 -0.0302 Pause: hit any key to continue... 5 17 2.53212 3.26342 -0.03 Pause: hit any key to continue... 6 21 2.30913 0.322518 -1.07e-006 Pause: hit any key to continue... 7 25 2.00527 0.849632 -0.296 Pause: hit any key to continue... 8 29 1.84151 0.173995 -0.5 Pause: hit any key to continue... 9 33 1.67682 0.878415 -0.0201 Pause: hit any key to continue... 10 39 0.868237 5.07515 -0.0428 Pause: hit any key to continue... 11 43 0.82685 0.24347 -1e-005 Pause: hit any key to continue... 12 47 0.668453 0.93938 -0.129 Pause: hit any key to continue... 13 51 0.589839 0.284767 -0.0882 Pause: hit any key to continue... 14 56 0.463144 1.65056 -0.00483 Pause: hit any key to continue... 15 60 0.31572 1.12036 -9.57e-005 Pause: hit any key to continue... 16 64 0.221455 0.759373 -0.017 Pause: hit any key to continue... 17 68 0.197201 0.842636 -0.000904 Pause: hit any key to continue... 18 74 0.0420617 4.35001 -0.00941 Pause: hit any key to continue... 19 78 0.0380113 0.338559 -3.48e-008 Pause: hit any key to continue... 20 82 0.0181601 1.28044 -0.00661 Pause: hit any key to continue... 21 86 0.0114946 0.893086 -0.000327 Pause: hit any key to continue... 22 91 0.00268658 1.43795 -2.44e-005 Pause: hit any key to continue... 23 95 0.000603063 0.788611 -8.17e-005 Pause: hit any key to continue... 24 100 6.06076e-005 2.27117 -6.87e-006 Optimization terminated successfully: Current search direction is a descent direction, and magnitude of directional derivative in search direction less than 2*options.TolFun Pause: hit any key to continue... xo = 1.0004 1.0000 Ot = 6.0608e-005 nS = 101 [xo,Ot,nS]=newton('test1',[-1.2 1],1,'gtest1','htest1') 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... xo = 1.0000 1.0000 Ot = 2.1254e-024 nS = 35 [xo,Ot,nS]=dfp('test1',[-1.2 1],1,'gtest1') Pause: hit any key to continue... Directional Iteration Func-count f(x) Step-size derivative 1 0 24.2 0.001 -5.42e+004 Pause: hit any key to continue... 2 4 4.12814 0.000786792 -68.5 Pause: hit any key to continue... 3 8 3.85717 0.140507 -0.23 Pause: hit any key to continue... 4 12 3.60311 1.53 -0.027 Pause: hit any key to continue... 5 17 3.02074 5.35075 -0.0153 Pause: hit any key to continue... 6 23 1.737 17.1805 -0.0156 Pause: hit any key to continue... 7 27 1.52148 2.78028 0.000801 Pause: hit any key to continue... 8 31 1.3912 1 -0.127 Pause: hit any key to continue... 9 35 1.26262 0.0277262 -3.8 Pause: hit any key to continue... 10 39 1.19888 0.387583 -0.00342 Pause: hit any key to continue... 11 44 1.17421 33.4478 -3.7e-006 Pause: hit any key to continue... 12 49 0.92106 330.109 -0.000135 Pause: hit any key to continue... 13 53 0.918667 0.54583 -0.00241 Pause: hit any key to continue... 14 58 0.915796 2.49044 -1.34e-006 Pause: hit any key to continue... 15 65 0.274341 1472.81 -0.000336 Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.016308e-019. > In C:\Apps\Matlab\toolbox\optim\cubici2.m at line 10 In C:\Apps\Matlab\toolbox\optim\searchq.m at line 71 In v:\cursos\pos\otimiza\aulas\fminusub.m at line 283 In v:\cursos\pos\otimiza\aulas\fminunc1.m at line 220 In v:\cursos\pos\otimiza\aulas\varmetr.m at line 115 In v:\cursos\pos\otimiza\aulas\dfp.m at line 51 Pause: hit any key to continue... 16 69 0.266194 0.0538338 -0.15 Pause: hit any key to continue... 17 73 0.189802 0.155923 -0.231 Pause: hit any key to continue... 18 78 0.184744 0.471964 -2.61e-006 Optimization terminated successfully: Current search direction is a descent direction, and magnitude of directional derivative in search direction less than 2*options.TolFun Pause: hit any key to continue... xo = 0.5864 0.3322 Ot = 0.1846 nS = 79 [xo,Ot,nS]=gmurray('test1',[-1.2 1],1,'gtest1') Pause: hit any key to continue... Directional Iteration Func-count f(x) Step-size derivative 1 0 24.2 0.001 -5.42e+004 Pause: hit any key to continue... 2 4 4.12814 0.000786792 -68.5 Pause: hit any key to continue... 3 8 3.85717 0.140499 -0.23 Pause: hit any key to continue... 4 12 3.59745 1.42893 -0.0302 Pause: hit any key to continue... 5 17 2.53212 3.26342 -0.03 Pause: hit any key to continue... 6 21 2.30913 0.322518 -1.07e-006 Pause: hit any key to continue... 7 25 2.00527 0.849632 -0.296 Pause: hit any key to continue... 8 29 1.84151 0.173995 -0.5 Pause: hit any key to continue... 9 33 1.67682 0.878415 -0.0201 Pause: hit any key to continue... 10 39 0.868237 5.07515 -0.0428 Pause: hit any key to continue... 11 43 0.82685 0.24347 -1e-005 Pause: hit any key to continue... 12 47 0.668453 0.93938 -0.129 Pause: hit any key to continue... 13 51 0.589839 0.284767 -0.0882 Pause: hit any key to continue... 14 56 0.463144 1.65056 -0.00483 Pause: hit any key to continue... 15 60 0.31572 1.12036 -9.57e-005 Pause: hit any key to continue... 16 64 0.221455 0.759373 -0.017 Pause: hit any key to continue... 17 68 0.197201 0.842636 -0.000904 Pause: hit any key to continue... 18 74 0.0420617 4.35001 -0.00941 Pause: hit any key to continue... 19 78 0.0380113 0.338559 -3.48e-008 Pause: hit any key to continue... 20 82 0.0181601 1.28044 -0.00661 Pause: hit any key to continue... 21 86 0.0114946 0.893086 -0.000327 Pause: hit any key to continue... 22 91 0.00268658 1.43795 -2.44e-005 Pause: hit any key to continue... 23 95 0.000603063 0.788611 -8.17e-005 Pause: hit any key to continue... 24 100 6.06076e-005 2.27117 -6.87e-006 Optimization terminated successfully: Current search direction is a descent direction, and magnitude of directional derivative in search direction less than 2*options.TolFun Pause: hit any key to continue... xo = 1.0004 1.0000 Ot = 6.0608e-005 nS = 101 [xo,Ot,nS]=dfp('test1',[-1.9 2],1,'gtest1') Pause: hit any key to continue... Directional Iteration Func-count f(x) Step-size derivative 1 0 267.62 0.001 -1.62e+006 Pause: hit any key to continue... 2 4 6.03794 0.000360666 -1.04e+004 Pause: hit any key to continue... 3 9 5.98743 0.096528 -0.000505 Pause: hit any key to continue... 4 13 5.4087 5.44211 -0.0521 Pause: hit any key to continue... 5 17 5.30215 0.603084 -0.0505 Pause: hit any key to continue... 6 22 4.91256 5.65483 -0.00319 Pause: hit any key to continue... 7 28 2.85058 46.3756 -0.0225 Pause: hit any key to continue... 8 32 2.78721 0.276213 -0.174 Pause: hit any key to continue... 9 36 2.60473 0.99804 -0.00799 Pause: hit any key to continue... 10 41 1.97167 8.26227 -0.0127 Pause: hit any key to continue... 11 46 1.16962 12.7433 -0.0118 Pause: hit any key to continue... 12 50 0.949089 3.86417 -0.000226 Pause: hit any key to continue... 13 54 0.713402 3.05938 -0.00734 Pause: hit any key to continue... 14 58 0.681774 1.054 -0.00217 Pause: hit any key to continue... 15 63 0.451165 10.9351 -0.0041 Pause: hit any key to continue... 16 67 0.301523 7.20005 -0.0021 Pause: hit any key to continue... 17 72 0.161768 9.08593 -6.21e-005 Pause: hit any key to continue... 18 76 0.104524 2.88953 -0.00541 Pause: hit any key to continue... 19 80 0.0972017 0.722583 -0.000697 Pause: hit any key to continue... 20 85 0.0503128 10.5318 0.000264 Pause: hit any key to continue... 21 90 0.0329279 4.46637 -2.62e-007 Pause: hit any key to continue... 22 94 0.0130232 5.81962 -0.000873 Pause: hit any key to continue... 23 98 0.00963236 1.42195 -0.000395 Pause: hit any key to continue... 24 104 5.2225e-006 9.06431 2.28e-006 Optimization terminated successfully: Current search direction is a descent direction, and magnitude of directional derivative in search direction less than 2*options.TolFun Pause: hit any key to continue... xo = 0.9993 0.9988 Ot = 5.2225e-006 nS = 105 bandem [xo,Ot,nS]=newton('test1',[-1.9 2],1,'gtest1','htest1') 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... Pause: hit any key to continue... Pause: hit any key to continue... xo = 1.0000 1.0000 Ot = 3.9613e-022 nS = 36 [xo,Ot,nS]=lmarqua('test1',[-1.9 2],1,'gtest1','htest1') Pause: hit any key to continue... Pause: hit any key to continue... Pause: hit any key to continue... beta = -0.5094 beta = -1.0188 Pause: hit any key to continue... Pause: hit any key to continue... beta = -0.8531 beta = -1.7062 Pause: hit any key to continue... Pause: hit any key to continue... beta = -1.6320 beta = -3.2640 Pause: hit any key to continue... Pause: hit any key to continue... beta = -3.9627 Pause: hit any key to continue... Pause: hit any key to continue... beta = -6.5625 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... xo = 1.0000 0.9999 Ot = 1.8999e-009 nS = 43 bandem foptions ans = Columns 1 through 7 0 0.0001 0.0001 0.0000 0 0 0 Columns 8 through 14 0 0 0 0 0 0 0 Columns 15 through 18 0 0.0000 0.1000 0 OPTIONS ??? Undefined function or variable 'OPTIONS'. op=foptions op = Columns 1 through 7 0 0.0001 0.0001 0.0000 0 0 0 Columns 8 through 14 0 0 0 0 0 0 0 Columns 15 through 18 0 0.0000 0.1000 0 optimset(op) ??? Error using ==> optimset Expected argument 1 to be a string parameter name or an options structure created with OPTIMSET. quit