What Is Optimization Toolbox?

What Is Optimization Toolbox? What Is Optimization Toolbox?

cda.psych.uiuc.edu
from cda.psych.uiuc.edu More from this publisher
12.07.2015 Views

fgoalattain“Avoiding Global Variables via Anonymous and Nested Functions” onpage 2-20 explains how to parameterize the objective function fun, ifnecessary.Note If the specified input bounds for a problem are inconsistent, theoutput x is x0 and the output fval is [].InputArguments“Function Arguments” on page 6-2 contains general descriptionsof arguments passed into fgoalattain. This section providesfunction-specific details for fun, goal, nonlcon, options, andweight:8-14

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

fgoalattain“Avoiding Global Variables via Anonymous and Nested Functions” onpage 2-20 explains how to parameterize the objective function fun, ifnecessary.Note If the specified input bounds for a problem are inconsistent, theoutput x is x0 and the output fval is [].InputArguments“Function Arguments” on page 6-2 contains general descriptionsof arguments passed into fgoalattain. This section providesfunction-specific details for fun, goal, nonlcon, options, andweight:8-14

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

Saved successfully!

Ooh no, something went wrong!