matlab fseminf,Find minimum of semi-infinitely constrained multivariable nonlinear function - MATLAB...

fseminf

Find minimum of semi-infinitely constrained multivariable nonlinear

function

Equation

Finds the minimum of a problem specified by

minxf(x)such that{A⋅x≤b,Aeq⋅x=beq,lb≤x≤ub,c(x)≤0,ceq(x)=0,Ki(x,wi)≤0,1≤i≤n.

b and beq are vectors, A

and Aeq are matrices, c(x),

ceq(x), and

Ki(x,wi)

are functions that return vectors, and f(x) is

a function that returns a scalar. f(x),

c(x), and

ceq(x) can be nonlinear functions. The

vectors (or matrices) Ki(x,wi) ≤ 0 are continuous functions of both x and an

additional set of variables w1,w2,...,wn. The variables w1,w2,...,wn are vectors of, at most, length two.

x, lb, and ub can be

passed as vectors or matrices; see Matrix Arguments.

Syntax

x = fseminf(fun,x0,ntheta,seminfcon)

x = fseminf(fun,x0,ntheta,seminfcon,A,b)

x = fseminf(fun,x0,ntheta,seminfcon,A,b,Aeq,beq)

x = fseminf(fun,x0,ntheta,seminfcon,A,b,Aeq,beq,lb,ub)

x = fseminf(fun,x0,ntheta,seminfcon,A,b,Aeq,beq,lb,ub,options)

x = fseminf(problem)

[x,fval] = fseminf(...)

[x,fval,exitflag] = fseminf(...)

[x,fval,exitflag,output] = fseminf(...)

[x,fval,exitflag,output,lambda] = fseminf(...)

Description

fseminf finds a minimum of a semi-infinitely constrained scalar

function of several variables, starting at an initial estimate. The aim is to

minimize f(x) so the constraints hold for all

possible values of wi∈ℜ1 (or wi∈ℜ2). Because it is impossible to calculate all possible values of Ki(x,wi), a region must be chosen for

wi over which to calculate an

appropriately sampled set of values.

Note

Passing Extra Parameters explains how to pass extra parameters to

the objective function and nonlinear constraint functions, if necessary.

x = fseminf(fun,x0,ntheta,seminfcon) starts

at x0 and finds a minimum of the function fun

constrained by ntheta semi-infinite constraints defined in

seminfcon.

x = fseminf(fun,x0,ntheta,seminfcon,A,b)

also tries to satisfy the linear inequalities

A*x ≤ b.

x = fseminf(fun,x0,ntheta,seminfcon,A,b,Aeq,beq)

minimizes subject to the linear equalities Aeq*x = beq

as well. Set A = [] and

b = [] if no inequalities exist.

x = fseminf(fun,x0,ntheta,seminfcon,A,b,Aeq,beq,lb,ub)

defines a set of lower and upper bounds on the design variables in

x, so that the solution is always in the range

lb≤x≤ub.

x = fseminf(fun,x0,ntheta,seminfcon,A,b,Aeq,beq,lb,ub,options)

minimizes with the optimization options specified in options. Use

optimoptions to set these

options.

x = fseminf(problem) finds the minimum for

problem, where problem is a structure

described in Input Arguments.

Create the problem structure by exporting a problem from

Optimization app, as described in Exporting Your Work.

[x,fval] = fseminf(...) returns the value of

the objective function fun at the solution

x.

[x,fval,exitflag] = fseminf(...) returns a

value exitflag that describes the exit condition.

[x,fval,exitflag,output] = fseminf(...)

returns a structure output that contains information about the

optimization.

[x,fval,exitflag,output,lambda] = fseminf(...)

returns a structure lambda whose fields contain the Lagrange

multipliers at the solution x.

Note

If the specified input bounds for a problem are inconsistent, the output

x is x0 and the output

fval is [].

Input Arguments

Function Input Arguments contains general descriptions of arguments passed

into fseminf. This section provides function-specific details for

fun, ntheta, options,

seminfcon, and problem:

funThe

function to be minimized. fun is a function

that accepts a vector x and returns a scalar

f, the objective function evaluated at

x. The function fun

can be specified as a function handle for a

file

x = fseminf(@myfun,x0,ntheta,seminfcon)

where

myfun is a MATLAB® function such

as

function f = myfun(x)

f = ... % Compute function value at x

fun

can also be a function handle for an anonymous

function.

fun = @(x)sin(x''*x);

If

the gradient of fun can also be computed

and the

SpecifyObjectiveGradient option is

true, as set

by

options = optimoptions('fseminf','SpecifyObjectiveGradient',true)

then

the function fun must return, in the second

output argument, the gradient value g, a

vector, at x.

nthetaThe

number of semi-infinite constraints.

optionsOptions provides the

function-specific details for the options

values.

seminfconThe

function that computes the vector of nonlinear inequality

constraints, c, a vector of nonlinear

equality constraints, ceq, and

ntheta semi-infinite constraints (vectors

or matrices) K1,

K2,...,

Kntheta evaluated over an interval

S at the point x. The

function seminfcon can be specified as a

function

handle.

x = fseminf(@myfun,x0,ntheta,@myinfcon)

where

myinfcon is a MATLAB function such

as

function [c,ceq,K1,K2,...,Kntheta,S] = myinfcon(x,S)

% Initial sampling interval

if isnan(S(1,1)),

S = ...% S has ntheta rows and 2 columns

end

w1 = ...% Compute sample set

w2 = ...% Compute sample set

...

wntheta = ... % Compute sample set

K1 = ... % 1st semi-infinite constraint at x and w

K2 = ... % 2nd semi-infinite constraint at x and w

...

Kntheta = ...% Last semi-infinite constraint at x and w

c = ... % Compute nonlinear inequalities at x

ceq = ... % Compute the nonlinear equalities at x

S

is a recommended sampling interval, which might or might not be

used. Return [] for c and

ceq if no such constraints

exist.

The vectors or matrices

K1, K2,

..., Kntheta contain

the semi-infinite constraints evaluated for a sampled set of

values for the independent variables w1,

w2, ...,

wntheta, respectively. The two-column

matrix, S, contains a recommended sampling

interval for values of w1,

w2, ...,

wntheta, which are used to evaluate

K1, K2,

..., Kntheta. The

ith row of S contains

the recommended sampling interval for evaluating

Ki.

When

Ki

is a vector, use only S(i,1) (the second

column can be all zeros). When

Ki

is a matrix, S(i,2) is used for the sampling

of the rows in

Ki,

S(i,1) is used for the sampling interval

of the columns of

Ki

(see Two-Dimensional Semi-Infinite Constraint). On

the first iteration S is

NaN, so that some initial sampling

interval must be determined by

seminfcon.

Note

Because Optimization

Toolbox™ functions only accept inputs of type

double, user-supplied objective and

nonlinear constraint functions must return outputs of type

double.

Passing Extra Parameters

explains how to parametrize seminfcon, if

necessary. Example of Creating Sampling Points contains an

example of both one- and two-dimensional sampling

points.

problemobjectiveObjective function

x0Initial point for

x

nthetaNumber of semi-infinite constraints

seminfconSemi-infinite constraint function

AineqMatrix for linear inequality

constraints

bineqVector for linear inequality

constraints

AeqMatrix for linear equality

constraints

beqVector for linear equality

constraints

lbVector of lower bounds

ubVector of upper bounds

solver'fseminf'

optionsOptions created with optimoptions

Output Arguments

Function Input Arguments contains general descriptions of arguments returned

by fseminf. This section provides function-specific details for

exitflag, lambda, and

output:

exitflagInteger identifying the reason

the algorithm terminated. The following lists the values of

exitflag and the corresponding reasons

the algorithm terminated.

1Function converged to a solution

x.

4Magnitude of the search direction was less than the

specified tolerance and constraint violation was less than

options.ConstraintTolerance.

5Magnitude of directional derivative was less than the

specified tolerance and constraint violation was less than

options.ConstraintTolerance.

0Number of iterations exceeded

options.MaxIterations or number of

function evaluations exceeded

options.MaxFunctionEvaluations.

-1Algorithm was terminated by the output

function.

-2No feasible point was found.

lambdaStructure containing the

Lagrange multipliers at the solution x

(separated by constraint type). The fields of the structure

are

lowerLower bounds lb

upperUpper bounds ub

ineqlinLinear inequalities

eqlinLinear equalities

ineqnonlinNonlinear inequalities

eqnonlinNonlinear equalities

outputStructure containing

information about the optimization. The fields of the structure

are

iterationsNumber of iterations taken

funcCountNumber of function evaluations

lssteplengthSize of line search step relative to search

direction

stepsizeFinal displacement in x

algorithmOptimization algorithm used

constrviolationMaximum of constraint functions

firstorderoptMeasure of first-order optimality

messageExit message

Options

Optimization options used by fseminf. Use optimoptions to set or change options. See Optimization Options Reference for detailed information.

Some options are absent from the

optimoptions display. These options appear in italics in the following

table. For details, see View Options.

CheckGradientsCompare user-supplied derivatives

(gradients of objective or constraints) to finite-differencing

derivatives. The choices are true or the

default false.

For

optimset, the name is

DerivativeCheck and the values are

'on' or 'off'. See

Current and Legacy Option Name Tables.

ConstraintToleranceTermination tolerance on the

constraint violation, a positive scalar. The default is

1e-6. See Tolerances and Stopping Criteria.

DiagnosticsDisplay diagnostic information about

the function to be minimized or solved. The choices are

'on' or the default

'off'.

DiffMaxChangeMaximum change in variables for

finite-difference gradients (a positive scalar). The default is

Inf.

DiffMinChangeMinimum change in variables for

finite-difference gradients (a positive scalar). The default is

0.

DisplayLevel of display (see Iterative Display):

'off' or

'none' displays no

output.

'iter' displays output at each

iteration, and gives the default exit

message.

'iter-detailed' displays output

at each iteration, and gives the technical exit

message.

'notify' displays output only

if the function does not converge, and gives the

default exit message.

'notify-detailed' displays

output only if the function does not converge, and

gives the technical exit message.

'final' (default) displays just

the final output, and gives the default exit

message.

'final-detailed' displays just

the final output, and gives the technical exit

message.

FiniteDifferenceStepSizeScalar or vector step size factor for finite differences. When

you set FiniteDifferenceStepSize to a vector v, the

forward finite differences delta are

delta = v.*sign′(x).*max(abs(x),TypicalX);where sign′(x) = sign(x) except sign′(0) = 1.

Central finite differences are

delta = v.*max(abs(x),TypicalX);Scalar FiniteDifferenceStepSize expands to a vector. The default

is sqrt(eps) for forward finite differences, and eps^(1/3)

for central finite differences.

For optimset, the name is

FinDiffRelStep. See Current and Legacy Option Name Tables.

FiniteDifferenceTypeFinite differences, used to estimate

gradients, are either 'forward' (the

default), or 'central' (centered).

'central' takes twice as many function

evaluations, but should be more accurate.

The

algorithm is careful to obey bounds when estimating both types

of finite differences. So, for example, it could take a

backward, rather than a forward, difference to avoid evaluating

at a point outside bounds.

For

optimset, the name is

FinDiffType. See Current and Legacy Option Name Tables.

FunctionToleranceTermination tolerance on the function

value, a positive scalar. The default is

1e-4. See Tolerances and Stopping Criteria.

FunValCheckCheck whether objective function and

constraints values are valid. 'on' displays

an error when the objective function or constraints return a

value that is complex,

Inf, or NaN. The default

'off' displays no error.

MaxFunctionEvaluationsMaximum number of function

evaluations allowed, a positive integer. The default is

100*numberOfVariables. See Tolerances and Stopping Criteria and Iterations and Function Counts.

For

optimset, the name is

MaxFunEvals. See Current and Legacy Option Name Tables.

MaxIterationsMaximum number of iterations allowed,

a positive integer. The default is 400. See

Tolerances and Stopping Criteria and Iterations and Function Counts.

For

optimset, the name is

MaxIter. See Current and Legacy Option Name Tables.

MaxSQPIterMaximum number of SQP iterations

allowed, a positive integer. The default is

10*max(numberOfVariables, numberOfInequalities +

numberOfBounds).

OptimalityToleranceTermination tolerance on the first-order optimality (a positive

scalar). The default is 1e-6. See First-Order Optimality Measure.

OutputFcnSpecify one or more user-defined

functions that an optimization function calls at each iteration.

Pass a function handle or a cell array of function handles. The

default is none ([]). See Output Function Syntax.

PlotFcnPlots various measures of progress

while the algorithm executes; select from predefined plots or

write your own. Pass a name, a function handle, or a cell array

of names or function handles. For custom plot functions, pass

function handles. The default is none

([]):

'optimplotx' plots the current

point.

'optimplotfunccount' plots the

function count.

'optimplotfval' plots the

function value.

'optimplotconstrviolation'

plots the maximum constraint violation.

'optimplotstepsize' plots the

step size.

'optimplotfirstorderopt' plots

the first-order optimality measure.

For information on writing a custom plot

function, see Plot Function Syntax.

For optimset, the name is

PlotFcns. See Current and Legacy Option Name Tables.

RelLineSrchBndRelative bound (a real nonnegative

scalar value) on the line search step length such that the total

displacement in x satisfies |Δx(i)| ≤ relLineSrchBnd·

max(|x(i)|,|typicalx(i)|). This option provides control over the

magnitude of the displacements in x for cases

in which the solver takes steps that

fseminf considers too large. The

default is no bounds ([]).

RelLineSrchBndDurationNumber of iterations for which the

bound specified in RelLineSrchBnd should be

active (default is 1)

SpecifyObjectiveGradientGradient for the objective function

defined by the user. See the preceding description of

fun to see how to define the gradient in

fun. Set to true to

have fseminf use a user-defined gradient of

the objective function. The default false

causes fseminf to estimate gradients using

finite differences.

For optimset,

the name is GradObj and the values are

'on' or 'off'. See

Current and Legacy Option Name Tables.

StepToleranceTermination tolerance on

x, a positive scalar. The default value

is 1e-4. See Tolerances and Stopping Criteria.

TolConSQPTermination tolerance on inner

iteration SQP constraint violation, a positive scalar. The

default is 1e-6.

TypicalXTypical x values.

The number of elements in TypicalX is equal

to the number of elements in x0, the starting

point. The default value is

ones(numberofvariables,1).

fseminf uses

TypicalX for scaling finite differences

for gradient estimation.

Notes

The optimization routine fseminf might vary the

recommended sampling interval, S, set in

seminfcon, during the computation because values other than

the recommended interval might be more appropriate for efficiency or robustness.

Also, the finite region wi, over which Ki(x,wi) is calculated, is allowed to vary during the optimization,

provided that it does not result in significant changes in the number of local

minima in Ki(x,wi).

Examples

This example minimizes the function

(x – 1)2,

subject to the constraints

0 ≤ x ≤

2

g(x,

t) = (x – 1/2) – (t

– 1/2)2 ≤ 0 for all 0 ≤ t ≤

1.

The unconstrained objective function is minimized at x = 1. However, the constraint,

g(x, t) ≤ 0

for all 0 ≤ t ≤ 1, implies x ≤ 1/2. You can see this by noticing that (t – 1/2)2 ≥ 0, so

maxt g(x,

t) = (x– 1/2). Therefore

maxt g(x,

t) ≤ 0 when

x ≤ 1/2.

To solve this problem using fseminf:

Write the objective function as an anonymous function:

objfun = @(x)(x-1)^2;

Write the semi-infinite constraint function, which includes the nonlinear

constraints ([ ] in this case), initial sampling interval for

t (0 to 1 in steps of 0.01 in this case), and the

semi-infinite constraint function

g(x, t):

function [c, ceq, K1, s] = seminfcon(x,s)

% No finite nonlinear inequality and equality constraints

c = [];

ceq = [];

% Sample set

if isnan(s)

% Initial sampling interval

s = [0.01 0];

end

t = 0:s(1):1;

% Evaluate the semi-infinite constraint

K1 = (x - 0.5) - (t - 0.5).^2;

Call fseminf with initial point 0.2, and view the

result:

x = fseminf(objfun,0.2,1,@seminfcon)

Local minimum found that satisfies the constraints.

Optimization completed because the objective function is

non-decreasing in feasible directions, to within the

default value of the function tolerance, and constraints

are satisfied to within the default value of the

constraint tolerance.

Active inequalities (to within options.ConstraintTolerance = 1e-006):

lower upper ineqlin ineqnonlin

1

x =

0.5000

Limitations

The function to be minimized, the constraints, and semi-infinite constraints, must

be continuous functions of x and w.

fseminf might only give local solutions.

When the problem is not feasible, fseminf attempts to minimize

the maximum constraint value.

Algorithms

fseminf uses cubic and quadratic interpolation techniques to

estimate peak values in the semi-infinite constraints. The peak values are used to

form a set of constraints that are supplied to an SQP method as in the fmincon function. When the number of constraints changes, Lagrange

multipliers are reallocated to the new set of constraints.

The recommended sampling interval calculation uses the difference between the

interpolated peak values and peak values appearing in the data set to estimate

whether the function needs to take more or fewer points. The function also evaluates

the effectiveness of the interpolation by extrapolating the curve and comparing it

to other points in the curve. The recommended sampling interval is decreased when

the peak values are close to constraint boundaries, i.e., zero.

For more details on the algorithm used and the types of procedures displayed under

the Procedures heading when the Display option

is set to 'iter' with optimoptions, see also

SQP Implementation. For more details on the fseminf

algorithm, see fseminf Problem Formulation and Algorithm.

Introduced before R2006a

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值