objfun must calculate the objective function Fx and possibly its gradient as well for a specified n-element vector x.

Syntax

C#
public delegate void E04DG_OBJFUN(
	ref int mode,
	int n,
	double[] x,
	out double objf,
	double[] objgrd,
	int nstate
)
Visual Basic
Public Delegate Sub E04DG_OBJFUN ( _
	ByRef mode As Integer, _
	n As Integer, _
	x As Double(), _
	<OutAttribute> ByRef objf As Double, _
	objgrd As Double(), _
	nstate As Integer _
)
Visual C++
public delegate void E04DG_OBJFUN(
	int% mode, 
	int n, 
	array<double>^ x, 
	[OutAttribute] double% objf, 
	array<double>^ objgrd, 
	int nstate
)
F#
type E04DG_OBJFUN = 
    delegate of 
        mode : int byref * 
        n : int * 
        x : float[] * 
        objf : float byref * 
        objgrd : float[] * 
        nstate : int -> unit

Parameters

mode
Type: System..::..Int32%
On entry: indicates which values must be assigned during each call of objfun. Only the following values need be assigned:
mode=0
objf.
mode=2
objf and objgrd.
On exit: may be set to a negative value if you wish to terminate the solution to the current problem, and in this case e04dg will terminate with ifail set to mode.
n
Type: System..::..Int32
On entry: n, the number of variables.
x
Type: array<System..::..Double>[]()[][]
On entry: x, the vector of variables at which the objective function and its gradient are to be evaluated.
objf
Type: System..::..Double%
On exit: the value of the objective function at x.
objgrd
Type: array<System..::..Double>[]()[][]
On exit: if mode=2, objgrd[i-1] must contain the value of Fxi evaluated at x, for i=1,2,,n.
nstate
Type: System..::..Int32
On entry: will be 1 on the first call of objfun by e04dg, and 0 for all subsequent calls. Thus, you may wish to test, nstate within objfun in order to perform certain calculations once only. For example, you may read data or initialize global variables when nstate=1.

See Also