e04vj Method
関数リスト一覧   NagLibrary Namespaceへ  ライブラリイントロダクション  本ヘルプドキュメントのchm形式版

e04vj may be used before e04vh to determine the sparsity pattern for the Jacobian.

Syntax

C#
public static void e04vj(
	int nf,
	int n,
	E04..::.E04VJ_USRFUN usrfun,
	int[] iafun,
	int[] javar,
	out int nea,
	double[] a,
	int[] igfun,
	int[] jgvar,
	out int neg,
	double[] x,
	double[] xlow,
	double[] xupp,
	E04..::.e04vhOptions options,
	out int ifail
)
Visual Basic (Declaration)
Public Shared Sub e04vj ( _
	nf As Integer, _
	n As Integer, _
	usrfun As E04..::.E04VJ_USRFUN, _
	iafun As Integer(), _
	javar As Integer(), _
	<OutAttribute> ByRef nea As Integer, _
	a As Double(), _
	igfun As Integer(), _
	jgvar As Integer(), _
	<OutAttribute> ByRef neg As Integer, _
	x As Double(), _
	xlow As Double(), _
	xupp As Double(), _
	options As E04..::.e04vhOptions, _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void e04vj(
	int nf, 
	int n, 
	E04..::.E04VJ_USRFUN^ usrfun, 
	array<int>^ iafun, 
	array<int>^ javar, 
	[OutAttribute] int% nea, 
	array<double>^ a, 
	array<int>^ igfun, 
	array<int>^ jgvar, 
	[OutAttribute] int% neg, 
	array<double>^ x, 
	array<double>^ xlow, 
	array<double>^ xupp, 
	E04..::.e04vhOptions^ options, 
	[OutAttribute] int% ifail
)
F#
static member e04vj : 
        nf:int * 
        n:int * 
        usrfun:E04..::.E04VJ_USRFUN * 
        iafun:int[] * 
        javar:int[] * 
        nea:int byref * 
        a:float[] * 
        igfun:int[] * 
        jgvar:int[] * 
        neg:int byref * 
        x:float[] * 
        xlow:float[] * 
        xupp:float[] * 
        options:E04..::.e04vhOptions * 
        ifail:int byref -> unit 

Parameters

nf
Type: System..::.Int32
On entry: nf, the number of problem functions in Fx , including the objective function (if any) and the linear and nonlinear constraints. Simple upper and lower bounds on x  can be defined using the parameters xlow and xupp and should not be included in F .
Constraint: nf>0.
n
Type: System..::.Int32
On entry: n , the number of variables.
Constraint: n>0.
usrfun
Type: NagLibrary..::.E04..::.E04VJ_USRFUN
usrfun must define the problem functions Fx . This method is passed to e04vj as the external parameter usrfun.

A delegate of type E04VJ_USRFUN.

iafun
Type: array< System..::.Int32 >[]()[]
An array of size [lena]
Note: lena must satisfy the constraint: lena1
On exit: define the coordinates i,j  and values Aij  of the nonzero elements of the linear part A  of the function Fx=fx + Ax .
In particular, nea triples iafun[k-1],javar[k-1],a[k-1]  define the row and column indices i=iafun[k-1]  and j=javar[k-1]  of the element Aij=a[k-1] .
javar
Type: array< System..::.Int32 >[]()[]
An array of size [lena]
Note: lena must satisfy the constraint: lena1
On exit: define the coordinates i,j  and values Aij  of the nonzero elements of the linear part A  of the function Fx=fx + Ax .
In particular, nea triples iafun[k-1],javar[k-1],a[k-1]  define the row and column indices i=iafun[k-1]  and j=javar[k-1]  of the element Aij=a[k-1] .
nea
Type: System..::.Int32 %
On exit: is the number of nonzero entries in A  such that Fx=fx + Ax .
a
Type: array< System..::.Double >[]()[]
An array of size [lena]
Note: lena must satisfy the constraint: lena1
On exit: define the coordinates i,j  and values Aij  of the nonzero elements of the linear part A  of the function Fx=fx + Ax .
In particular, nea triples iafun[k-1],javar[k-1],a[k-1]  define the row and column indices i=iafun[k-1]  and j=javar[k-1]  of the element Aij=a[k-1] .
igfun
Type: array< System..::.Int32 >[]()[]
An array of size [leng]
Note: leng must satisfy the constraint: leng1
On exit: define the coordinates i,j  of the nonzero elements of G , the nonlinear part of the derivatives Jx=Gx + A  of the function Fx=fx + Ax .
jgvar
Type: array< System..::.Int32 >[]()[]
An array of size [leng]
Note: leng must satisfy the constraint: leng1
On exit: define the coordinates i,j  of the nonzero elements of G , the nonlinear part of the derivatives Jx=Gx + A  of the function Fx=fx + Ax .
neg
Type: System..::.Int32 %
On exit: the number of nonzero entries in G .
x
Type: array< System..::.Double >[]()[]
An array of size [n]
On entry: an initial estimate of the variables x . The contents of x  will be used by e04vj in the call of usrfun, and so each element of x should be within the bounds given by xlow and xupp.
xlow
Type: array< System..::.Double >[]()[]
An array of size [n]
On entry: contain the lower and upper bounds lx  and ux  on the variables x .
To specify a nonexistent lower bound lx j =- , set xlow[j-1] -bigbnd , where bigbnd  is the optional parameter Infinite Bound Size. To specify a nonexistent upper bound xupp[j-1] bigbnd .
To fix the j th variable (say, xj=β , where β < bigbnd ), set xlow[j-1]=xupp[j-1]=β .
xupp
Type: array< System..::.Double >[]()[]
An array of size [n]
On entry: contain the lower and upper bounds lx  and ux  on the variables x .
To specify a nonexistent lower bound lx j =- , set xlow[j-1] -bigbnd , where bigbnd  is the optional parameter Infinite Bound Size. To specify a nonexistent upper bound xupp[j-1] bigbnd .
To fix the j th variable (say, xj=β , where β < bigbnd ), set xlow[j-1]=xupp[j-1]=β .
options
Type: NagLibrary..::.E04..::.e04vhOptions
An object of type E04.e04vjOptions. Used to configure optional parameters to this method.
ifail
Type: System..::.Int32 %
On exit: ifail=0 unless the method detects an error (see [Error Indicators and Warnings]).

Note

Description

When using e04vh, if you set the optional parameter Derivative Option=0 and usrfun provides none of the derivatives, you may need to call e04vj to determine the input arrays iafun, javar, a, igfun and jgvar. These arrays define the pattern of nonzeros in the Jacobian matrix. A typical sequence of calls could be
e04vj determines the sparsity pattern for the Jacobian and identifies the constant elements automatically. To do so, e04vj approximates the problem functions, Fx , at three random perturbations of the given initial point x . If an element of the approximate Jacobian is the same at all three points, then it is taken to be constant. If it is zero, it is taken to be identically zero. Since the random points are not chosen close together, the heuristic will correctly classify the Jacobian elements in the vast majority of cases. In general, e04vj finds that the Jacobian can be permuted to the form:
Gx A3 A2 A4 ,
where A2 , A3  and A4  are constant. Note that Gx  might contain elements that are also constant, but e04vj must classify them as nonlinear. This is because e04vh ‘removes’ linear variables from the calculation of F  by setting them to zero before calling usrfun. A knowledgeable user would be able to move such elements from Fx  in usrfun and enter them as part of iafun, javar and a for e04vh.

References

Error Indicators and Warnings

Accuracy

Further Comments

Example

This example shows how to call e04vj to determine the sparsity pattern of the Jacobian before calling e04vj to solve a sparse nonlinear programming problem without providing the Jacobian information in usrfun.
It is a reformulation of Problem 74 from Hock and Schittkowski (1981) and involves the minimization of the nonlinear function
fx = 10-6 x33 + 23 × 10-6 x43+3 x3+2 x4
subject to the bounds
-0.55x1 0.55, -0.55x2 0.55, 0x3 1200, 0x4 1200,
to the nonlinear constraints
1000sin-x1-0.25+1000sin-x2-0.25-x3 = -894.8, 1000sinx1-0.25+1000sinx1-x2-0.25-x4 = -894.8, 1000sinx2-0.25+1000sinx2-x1-0.25 = -1294.8,
and to the linear constraints
-x1+x2-0.55, -x1-x2-0.55.
The initial point, which is infeasible, is
x0 = 0, 0, 0, 0 T ,
and fx0=0.
The optimal solution (to five figures) is
x*=0.11887,-0.39623,679.94,1026.0T,
and fx*=5126.4. All the nonlinear constraints are active at the solution.
The formulation of the problem combines the constraints and the objective into a single vector ( F ).
F = 1000 sin -x1 - 0.25 + 1000 sin -x2 - 0.25 - x3 1000 sin x1 - 0.25 + 1000 sin x1 - x2 - 0.25 - x4 1000 sin x2 - 0.25 + 1000 sin x2 - x1 - 0.25 -x1 + x2 x1 - x2 10-6 x33 + 23 × 10-6 x43 + 3x3 + 2x4

Example program (C#): e04vje.cs

Example program data: e04vje.d

Example program results: e04vje.r

See Also