Nonlinear Optimization Examples |
You can specify constraints in the following ways:
The input argument "blc" specifies an constraint matrix, where is two more than the number of linear constraints, and is given by
The following rows of the "blc" argument specify linear equality or inequality constraints:
For example, suppose you have a problem with the following constraints on ,, , :
proc iml; con = { 2 . . 0 . . , 100 40 . . . . , 4 3 -1 . -1 30 , . 1 . 6 1 17 , 1 -1 . . 0 8 };
The input argument "nlc" specifies an IML module that returns a vector, , of length , with the values, , of the linear or nonlinear constraints
Note: You must specify the number of equality constraints, , and the total number of constraints, , returned by the "nlc" module to allocate memory for the return vector. You can do this with the opt[11] and opt[10] arguments, respectively.
For example, consider the problem of minimizing the objective function in the interior of the unit circle, . The constraint can also be written as . The following statements specify modules for the objective and constraint functions and call the NLPNMS subroutine to solve the minimization problem:
proc iml; start F_UC2D(x); f = x[1] * x[2]; return(f); finish F_UC2D; start C_UC2D(x); c = 1. - x * x`; return(c); finish C_UC2D; x = j(1,2,1.); optn= j(1,10,.); optn[2]= 3; optn[10]= 1; CALL NLPNMS(rc,xres,"F_UC2D",x,optn) nlc="C_UC2D";
To avoid typing multiple commas, you can specify the "nlc" input argument with a keyword, as in the preceding code. The number of elements of the return vector is specified by OPTN. There is a missing value in OPTN, so the subroutine assumes there are zero equality constraints.
The NLPQN algorithm uses the Jacobian matrix of first-order derivatives
Note: The COBYLA algorithm in the NLPNMS subroutine and the NLPQN subroutine are the only optimization techniques that enable you to specify nonlinear constraints with the "nlc" input argument.
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.