| Optimization Toolbox | Search  Help Desk |
| fseminf | Examples See Also |
Find minimum of a semi-infinitely constrained multivariable nonlinear function
are continuous functions of both x and an additional set of variables
. The variables
are vectors of, at most, length two.
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(fun,x0,ntheta,seminfcon,A,b,Aeq,beq,... lb,ub,options,P1,P2,...) [x,fval] = fseminf(...) [x,fval,exitflag] = fseminf(...) [x,fval,exitflag,output] = fseminf(...) [x,fval,exitflag,output,lambda] = fseminf(...)
Description
fseminf finds the 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
(or
). Since it is impossible to calculate all possible values of
, a region must be chosen for
over which to calculate an appropriately sampled set of values.
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, 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 parameters specified in the structure options.
x = fseminf(fun,x0,ntheta,seminfcon,A,b,Aeq,beq,lb,ub,options,
P1,P2,...)
passes the problem-dependent parameters P1, P2, etc., directly to the functions fun and seminfcon. Pass empty matrices as placeholders for A, b, Aeq, beq, lb, ub, and options if these arguments are not needed.
[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.
Arguments
The arguments passed into the function are described in Table 1-1. The arguments returned by the function are described in Table 1-2. Details relevant tofseminf are included below for fun, ntheta, options, seminfcon, exitflag, lambda, and output.fun |
The function to be minimized. fun takes a vector x and returns a scalar value f of the objective function evaluated at x. You can specify fun to be an inline object. For example,
fun = inline('sin(x''*x)');Alternatively, fun can be a string containing the name of a function (an M-file, a built-in function, or a MEX-file). If fun='myfun' then the M-file function myfun.m would have the form
function f = myfun(x) f = ... % Compute function value at x |
If the gradient of fun can also be computed and options.GradObj is 'on', as set by
options = optimset('GradObj','on')then the function fun must return, in the second output argument, the gradient value g, a vector, at x. Note that by checking the value of nargout the function can avoid computing g when fun is called with only one output argument (in the case where the optimization algorithm only needs the value of f but not g):
function [f,g] = myfun(x) f = ... % compute the function value at x if nargout > 1 % fun called with 2 output arguments g = ... % compute the gradient evaluated at x end |
|
The gradient is the partial derivatives of f at the point x. That is, the ith component of g is the partial derivative of f with respect to the ith component of x.
|
|
ntheta |
The number of semi-infinite constraints. |
options |
Optimization parameter options. You can set or change the values of these parameters using the optimset function.
|
|
|
seminfcon |
The 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. seminfcon is a string containing the name of the function (an M-file, a built-in, or a MEX-file). For example, if seminfcon='myinfcon' then the M-file myinfcon.m would have the form
|
S is a recommended sampling interval, which may or may 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 Example" in the Examples section). On the first iteration S is NaN, so that some initial sampling interval must be determined by seminfcon.
|
|
exitflag |
Describes the exit condition: |
lambda |
A structure containing the Lagrange multipliers at the solution x (separated by constraint type):
|
output |
A structure whose fields contain information about the optimization: |
Notes
The recommended sampling interval,S, set in seminfcon, may be varied by the optimization routine fseminf during the computation because values other than the recommended interval may be more appropriate for efficiency or robustness. Also, the finite region
, over which
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
.
Examples
One-Dimensional Example
Find values of x that minimize
and
over the ranges
you will need to compute the constraints as
function f = myfun(x,s) % Objective function f = sum((x-0.2).^2);Second, write an M-file,
mycon.m, that computes the nonlinear equality and inequality constraints and the semi-infinite constraints:
function [c,ceq,K1,K2,s] = mycon(x,s)
% Initial sampling interval
if isnan(s(1,1)),
s = [0.2 0; 0.2 0];
end
% Sample set
w1 = 1:s(1,1):100;
w2 = 1:s(2,1):100;
% Semi-infinite constraints
K1 = sin(w1*X(1)).*cos(w1*X(2)) - 1/1000*(w1-50).^2 -...
sin(w1*X(3))-X(3)-1;
K2 = sin(w2*X(2)).*cos(w2*X(1)) - 1/1000*(w2-50).^2 -...
sin(w2*X(3))-X(3)-1;
% No constraints
c = []; ceq=[];
% Plot a graph of semi-infinite constraints
plot(w1,K1,'-',w2,K2,':'),title('Semi-infinite constraints')
drawnow
Then, invoke an optimization routine:
x0 = [0.5; 0.2; 0.3]; % Starting guess at the solution
[x,fval] = fseminf('myfun',x0,2,'mycon')
After eight iterations, the solution is
x =
0.6673
0.3013
0.4023
The function value and the maximum values of the semi-infinite constraints at the solution x are
fval =
0.0770
[c,ceq,K1,K2] = mycon(x,NaN);
max(K1)
ans =
-0.0017
max(K2)
ans =
-0.0845
A plot of the semi-infinite constraints is produced. 
'mycon.m' will slow down the computation; remove this line to improve the speed.
Two-Dimensional Example
Find values of x that minimize

and
over the ranges:
.
Note that the semi-infinite constraint is two-dimensional, that is, a matrix.
First, we reuse the file myfun.m for the objective function from the previous example.
Second, write an M-file for the constraints, called mycon.m:
function [c,ceq,K1,s] = mycon(x,s)
% Initial sampling interval
if isnan(s(1,1)),
s = [2 2];
end
%
% Sampling set
w1x = 1:s(1,1):100;
w1y = 1:s(1,2):100;
[wx,wy] = meshgrid(w1x,w1y);
%
% Semi-infinite constraint
K1 = sin(wx*X(1)).*cos(wy*X(2))-1/1000*(wx-50).^2 -...
sin(wx*X(3))-X(3)+sin(wy*X(2)).*cos(wx*X(1))-...
1/1000*(wy-50).^2-sin(wy*X(3))-X(3)-1.5;
%
% No finite nonlinear constraints
c = []; ceq=[];
%
% Mesh plot
mesh(K1,title('Semi-infinite constraint')
drawnow
Next, invoke an optimization routine:
x0 = [0.25, 0.25, 0.25]; % Starting guess at the solution
[x,fval] = fseminf('myfun',x0,1,'mycon')
After seven iterations, the solution is
x =
0.2081 0.2066 0.1965
[c,ceq,K1] = mycon(x,NaN);
The function value and the maximum value of the semi-infinite constraint at the solution x are
fval =
1.2066e-04
max(max(K1))
ans =
-0.0262
The following mesh plot is produced.
Algorithm
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 function fmincon. 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 more or fewer points need to be taken. The effectiveness of the interpolation is also taken into consideration 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.
See also the SQP implementation section in the Introduction to Algorithms chapter for more details on the algorithm used and the types of procedures printed under the Procedures heading for options.Display = 'iter' setting.
Limitations
The function to be minimized, the constraints, and semi-infinite constraints, must be continuous functions ofx and w. fseminf may only give local solutions.
When the problem is not feasible, fseminf attempts to minimize the maximum constraint value.
See Also
fmincon, optimset