confun must calculate the vector cx of nonlinear constraint functions and (optionally) its Jacobian (=cx) for a specified n-element vector x. If there are no nonlinear constraints (i.e., ncnln=0), confun will never be called by e05uc and confun may be the dummy method E04UDM. (E04UDM is included in the NAG Library.) If there are nonlinear constraints, the first call to confun will occur before the first call to objfun.

Syntax

C#
public delegate void E05UC_CONFUN(
	ref int mode,
	int ncnln,
	int n,
	int[] needc,
	double[] x,
	double[] c,
	double[,] cjsl,
	int nstate
)
Visual Basic
Public Delegate Sub E05UC_CONFUN ( _
	ByRef mode As Integer, _
	ncnln As Integer, _
	n As Integer, _
	needc As Integer(), _
	x As Double(), _
	c As Double(), _
	cjsl As Double(,), _
	nstate As Integer _
)
Visual C++
public delegate void E05UC_CONFUN(
	int% mode, 
	int ncnln, 
	int n, 
	array<int>^ needc, 
	array<double>^ x, 
	array<double>^ c, 
	array<double,2>^ cjsl, 
	int nstate
)
F#
type E05UC_CONFUN = 
    delegate of 
        mode : int byref * 
        ncnln : int * 
        n : int * 
        needc : int[] * 
        x : float[] * 
        c : float[] * 
        cjsl : float[,] * 
        nstate : int -> unit

Parameters

mode
Type: System..::..Int32%
On entry: indicates which values must be assigned during each call of confun. Only the following values need be assigned, for each value of i such that needc[i-1]>0:
mode=0
c[i-1].
mode=1
All available elements in the ith row of cjsl.
mode=2
c[i-1] and all available elements in the ith row of cjsl.
On exit: may be set to a negative value if you wish to abandon the solution to the current local minimization problem. In this case e05uc will move to the next local minimization problem.
ncnln
Type: System..::..Int32
On entry: nN, the number of nonlinear constraints.
n
Type: System..::..Int32
On entry: n, the number of variables.
needc
Type: array<System..::..Int32>[]()[][]
On entry: the indices of the elements of c and/or cjsl that must be evaluated by confun. If needc[i-1]>0, c[i-1] and/or the available elements of the ith row of cjsl (see parameter mode) must be evaluated at x.
x
Type: array<System..::..Double>[]()[][]
On entry: x, the vector of variables at which the constraint functions and/or the available elements of the constraint Jacobian are to be evaluated.
c
Type: array<System..::..Double>[]()[][]
On exit: if needc[k-1]>0 and mode=0 or 2, c[k-1] must contain the value of ckx. The remaining elements of c, corresponding to the non-positive elements of needc, need not be set.
cjsl
Type: array<System..::..Double,2>[,](,)[,][,]
cjsl may be regarded as a two-dimensional ‘slice’ of the three-dimensional array cjac of e05uc.
On entry: unless Derivative Level=2 or 3 (the default setting is Derivative Level=3, the elements of cjsl are set to special values which enable e05uc to detect whether they are changed by confun.
On exit: if needc[k-1]>0 and mode=1 or 2, the kth row of cjsl must contain the available elements of the vector ck given by
ck=ckx1,ckx2,,ckxnT,
where ckxj is the partial derivative of the kth constraint with respect to the jth variable, evaluated at the point x. See also the parameter nstate. The remaining rows of cjsl, corresponding to non-positive elements of needc, need not be set.
If all elements of the constraint Jacobian are known (i.e., Derivative Level=2 or 3), any constant elements may be assigned to cjsl one time only at the start of each local optimization. An element of cjsl that is not subsequently assigned in confun will retain its initial value throughout the local optimization. Constant elements may be loaded into cjsl during the first call to confun for the local optimization (signalled by the value nstate=1). The ability to preload constants is useful when many Jacobian elements are identically zero, in which case cjsl 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 cjsl[k-1,j-1] is set to a constant value, it need not be reset in subsequent calls to confun, but the value cjsl[k-1,j-1]×x[j-1] must nonetheless be added to c[k-1]. For example, if cjsl[0,0]=2 and cjsl[0,1]=-5 then the term 2×x[0]-5×x[1] must be included in the definition of c[0].
It must be emphasized that, if Derivative Level=0 or 1, unassigned elements of cjsl 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 x is computed automatically at the start of each local optimization. The automatic procedure can usually identify constant elements of cjsl, which are then computed once only by finite differences.
nstate
Type: System..::..Int32
On entry: if nstate=1 then e05uc is calling confun for the first time on the current local optimization problem. This parameter setting allows you to save computation time if certain data must be calculated only once.

See Also