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.

Examples That Use Standard Algorithmsoptions = optimset('LargeScale','off');options = optimset(options,'GradObj','on','GradConstr','on');lb = [ ]; ub = [ ]; % No upper or lower bounds[x,fval] = fmincon(@objfungrad,x0,[],[],[],[],lb,ub,...@confungrad,options)[c,ceq] = confungrad(x) % Check the constraint values at xAfter 20 function evaluations, the solution produced isx =-9.5474 1.0474fval =0.0236c =1.0e-14 *0.1110-0.1776ceq =[]Gradient Check: Analytic Versus NumericWhen analytically determined gradients are provided, you can compare thesupplied gradients with a set calculated by finite-difference evaluation. Thisis particularly useful for detecting mistakes in either the objective function orthe gradient function formulation.Ifyouwantsuchgradientchecks,settheDerivativeCheck option to 'on'using optimset:options = optimset(options,'DerivativeCheck','on');Thefirstcycleoftheoptimizationchecks the analytically determinedgradients (of the objective function and, if they exist, the nonlinearconstraints). If they do not match the finite-differencing gradients within agiven tolerance, a warning message indicates the discrepancy and gives theoption to abort the optimization or to continue.2-17

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

Saved successfully!

Ooh no, something went wrong!