confun must calculate the vector of nonlinear constraint functions and (optionally) its Jacobian, , for a specified -vector . If there are no nonlinear constraints (i.e., ), e04wd will never call confun, so it may be the dummy method E04WDP. (E04WDP is included in the NAG Library). If there are nonlinear constraints, the first call to confun will occur before the first call to objfun.
If all constraint gradients (Jacobian elements) are known (i.e., or ), any constant elements may be assigned to cjac once only at the start of the optimization. An element of cjac that is not subsequently assigned in confun will retain its initial value throughout. Constant elements may be loaded in cjac during the first call to confun (signalled by the value of ). The ability to preload constants is useful when many Jacobian elements are identically zero, in which case cjac may be initialized to zero and nonzero elements may be reset by confun.
It must be emphasized that, if , unassigned elements of cjac are not treated as constant; they are estimated by finite differences, at nontrivial expense.
Syntax
C# |
---|
public delegate void E04WD_CONFUN( ref int mode, int ncnln, int n, int[] needc, double[] x, double[] ccon, double[,] cjac, int nstate ) |
Visual Basic |
---|
Public Delegate Sub E04WD_CONFUN ( _ ByRef mode As Integer, _ ncnln As Integer, _ n As Integer, _ needc As Integer(), _ x As Double(), _ ccon As Double(), _ cjac As Double(,), _ nstate As Integer _ ) |
Visual C++ |
---|
public delegate void E04WD_CONFUN( int% mode, int ncnln, int n, array<int>^ needc, array<double>^ x, array<double>^ ccon, array<double,2>^ cjac, int nstate ) |
F# |
---|
type E04WD_CONFUN = delegate of mode : int byref * ncnln : int * n : int * needc : int[] * x : float[] * ccon : float[] * cjac : float[,] * nstate : int -> unit |
Parameters
- mode
- Type: System..::..Int32%On entry: is set by e04wd to indicate which values must be assigned during each call of confun. Only the following values need be assigned, for each value of such that :
- The components of ccon corresponding to positive values in needc must be set. Other components and the array cjac are ignored.
- The known components of the rows of cjac corresponding to positive values in needc must be set. Other rows of cjac and the array ccon will be ignored.
- Only the elements of ccon corresponding to positive values of needc need to be set (and similarly for the known components of the rows of cjac).
On exit: may be used to indicate that you are unable or unwilling to evaluate the constraint functions at the current .During the linesearch, the constraint functions are evaluated at points of the form after they have already been evaluated satisfactorily at . At any such , if you set , e04wd will evaluate the functions at some point closer to (where they are more likely to be defined).If for some reason you wish to terminate the current problem, set .
- ncnln
- Type: System..::..Int32On entry: , the number of nonlinear constraints.
- n
- Type: System..::..Int32On entry: , the number of variables.
- needc
- Type: array<System..::..Int32>[]()[][]
- x
- Type: array<System..::..Double>[]()[][]On entry: , the vector of variables at which the constraint functions and/or the available elements of the constraint Jacobian are to be evaluated.
- ccon
- Type: array<System..::..Double>[]()[][]
- cjac
- Type: array<System..::..Double,2>[,](,)[,][,]On entry: the elements of cjac are set to special values that enable e04wd to detect whether they are reset by confun.On exit: if and or , the th row of cjac must contain the available elements of the vector given bywhere is the partial derivative of the th constraint with respect to the th variable, evaluated at the point . See also the parameter nstate. The remaining rows of cjac, corresponding to non-positive elements of needc, are ignored.If all elements of the constraint Jacobian are known (i.e., or ), any constant elements may be assigned to cjac one time only at the start of the optimization. An element of cjac that is not subsequently assigned in confun will retain its initial value throughout. Constant elements may be loaded into cjac during the first call to confun (signalled by the value ). The ability to preload constants is useful when many Jacobian elements are identically zero, in which case cjac may be initialized to zero and nonzero elements may be reset by confun.Note that constant nonzero elements do affect the values of the constraints. Thus, if is set to a constant value, it need not be reset in subsequent calls to confun, but the value must nonetheless be added to . For example, if and then the term must be included in the definition of .It must be emphasized that, if or , unassigned elements of cjac are not treated as constant; they are estimated by finite differences, at nontrivial expense. If you do not supply a value for the optional parameter Difference Interval, an interval for each element of is computed automatically at the start of the optimization. The automatic procedure can usually identify constant elements of cjac, which are then computed once only by finite differences.
- nstate
- Type: System..::..Int32