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.

fgoalattainfunThefunctiontobeminimized. fun is a function thataccepts a vector x and returns a vector F, theobjectivefunctions evaluated at x. The function fun can be specifiedas a function handle for an M-file functionx = fgoalattain(@myfun,x0,goal,weight)where myfun is a MATLAB function such asfunction F = myfun(x)F = ... % Compute function values at x.fun can also be a function handle for an anonymousfunction.x = fgoalattain(@(x)sin(x.*x),x0,goal,weight);If the user-defined values for x and F are matrices, they areconverted to a vector using linear indexing.Tomakeanobjectivefunctionasnearaspossibletoagoal value, (i.e., neither greater than nor less than) useoptimset to set the GoalsExactAchieve option to thenumber of objectives required to be in the neighborhood ofthe goal values. Such objectives must be partitioned intothe first elements of the vector F returned by fun.If the gradient of the objective function can also becomputed and the GradObj option is 'on', assetbyoptions = optimset('GradObj','on')then the function fun must return, in the second outputargument, the gradient value G, amatrix,atx. Notethatby checking the value of nargout the function can avoidcomputing G when fun is called with only one outputargument (in the case where the optimization algorithmonly needs the value of F but not G).function [F,G] = myfun(x)F = ...% Compute the function values at xif nargout > 1 % Two output argumentsG = ...% Gradients evaluated at xendThe gradient consists of the partial derivative dF/dx ofeach F at the point x. IfF is a vector of length m and x has8-15

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

Saved successfully!

Ooh no, something went wrong!