12.07.2015 Views

What Is Optimization Toolbox?

What Is Optimization Toolbox?

What Is Optimization Toolbox?

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Large-Scale Examples024681012141618200 2 4 6 8 10 12 14 16 18 20nz = 94Use optimset to set the HessPattern parameter to Hstr. Whenaproblemaslargeasthishasobvioussparsitystructure,notsettingtheHessPatternparameter requires a huge amount of unnecessary memory and computation.This is because fmincon attempts to use finite differencing on a full Hessianmatrix of 640,000 nonzero entries.You must also set the GradObj parameter to 'on' using optimset, sincethegradient is computed in tbroyfg.m. Thenexecutefmincon asshowninStep2.Step 2: Call a nonlinear minimization routine with a startingpoint xstart.fun = @tbroyfg;load tbroyhstr% Get Hstr, structure of the Hessiann = 800;xstart = -ones(n,1); xstart(2:2:n) = 1;lb = -10*ones(n,1); ub = -lb;options = optimset('GradObj','on','HessPattern',Hstr);[x,fval,exitflag,output] = ...fmincon(fun,xstart,[],[],[],[],lb,ub,[],options);After seven iterations, the exitflag, fval, andoutput values are2-57

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!