NAG CL Interface
e04rnc (handle_set_linmatineq)
1
Purpose
e04rnc is a part of the NAG optimization modelling suite and defines one or more linear matrix constraints of the problem.
2
Specification
void |
e04rnc (void *handle,
Integer nvar,
Integer dima,
const Integer nnza[],
Integer nnzasum,
const Integer irowa[],
const Integer icola[],
const double a[],
Integer nblk,
const Integer blksizea[],
Integer *idblk,
NagError *fail) |
|
The function may be called by the names: e04rnc or nag_opt_handle_set_linmatineq.
3
Description
After the initialization function
e04rac has been called,
e04rnc may be used to add one or more linear matrix inequalities
to the problem definition. Here
are
by
symmetric matrices. The expression
stands for a constraint on eigenvalues of a symmetric matrix
, namely, all the eigenvalues should be non-negative, i.e., the matrix
should be positive semidefinite.
Typically, this will be used in linear semidefinite programming problems (SDP)
or to define the linear part of bilinear matrix inequalities
(3)(b) in (BMI-SDP)
e04rnc can be called repeatedly to accumulate more matrix inequalities. See
Section 4.1 in the
E04 Chapter Introduction for more details about the NAG optimization modelling suite.
All the matrices
, for
, are symmetric and thus only their upper triangles are passed to the function. They are stored in sparse coordinate storage format (see
Section 2.1.1 in the
F11 Chapter Introduction), i.e., every nonzero from the upper triangles is coded as a triplet of row index, column index and the numeric value. These triplets of all (upper triangle) nonzeros from all
matrices are passed to the function in three arrays:
irowa for row indices,
icola for column indices and
a for the values. No particular order of nonzeros within one matrix is enforced but all nonzeros from
must be stored first, followed by all nonzero from
, followed by
, etc.
The number of stored nonzeros from each
matrix is given in
, thus this array indicates which section of arrays
irowa,
icola and
a belongs to which
matrix. See
Table 1 and the example in
Section 9. See also
e04rdc which uses the same data organization.
irowa |
upper triangle |
upper triangle |
|
upper triangle
|
icola |
nonzeros |
nonzeros |
|
nonzeros |
a |
|
|
|
|
|
|
|
|
|
Table 1
Coordinate storage format of matrices in input arrays
There are two possibilities for defining more matrix inequality constraints
to the problem. The first is to call
e04rnc times and define a single matrix inequality at a time. This might be more straightforward and therefore it is recommended. Alternatively, it is possible to merge all
constraints into one inequality and pass them in a single call to
e04rnc. It is easy to see that
(4) can be equivalently expressed as one bigger matrix inequality with the following block diagonal structure
If
denotes the dimension of inequality
, the new merged inequality has dimension
and each of the
matrices is formed by
stored as
diagonal blocks. In such a case,
nblk is set to
and
to
, the size of the
th diagonal blocks. This might be useful in connection with
e04rdc.
On the other hand, if there is no block structure and just one matrix inequality is provided,
nblk should be set to
and
blksizea is not referenced.
3.2
Definition of Bilinear Matrix Inequalities (BMI)
e04rnc is designed to be used together with
e04rpc to define bilinear matrix inequalities
(3)(b).
e04rnc sets the linear part of the constraint and
e04rpc expands it by higher order terms. To distinquish which linear matrix inequality (or more precisely, which block) is to be expanded,
e04rpc needs the number of the block,
idblk. The blocks are numbered as they are added, starting from
.
Whenever a matrix inequality (or a set of them expressed as diagonal blocks) is stored, the function returns
idblk of the last inequality added.
idblk is just the order of the inequality amongst all matrix inequalities accumulated through the calls. The first inequality has
, the second one
, etc. Therefore if you call
e04rnc for the very first time with
, it adds
inequalities with
idblk from
to
and the function returns
(the number of the last one). A subsequent call with
would add only one inequality, this time with
which would be returned.
4
References
None.
5
Arguments
-
1:
– void *
Input
-
On entry: the handle to the problem. It needs to be initialized by
e04rac and
must not be changed between calls to the NAG optimization modelling suite.
-
2:
– Integer
Input
-
On entry:
, the number of decision variables
in the problem. It must be unchanged from the value set during the initialization of the handle by
e04rac.
-
3:
– Integer
Input
-
On entry: , the dimension of the matrices
, for .
Constraint:
.
-
4:
– const Integer
Input
-
On entry: , for , gives the number of nonzero elements in the upper triangle of matrix . To define as a zero matrix, set . However, there must be at least one matrix with at least one nonzero.
Constraints:
- ;
- .
-
5:
– Integer
Input
-
On entry: the dimension of the arrays
irowa,
icola and
a, at least the total number of all nonzeros in all matrices
.
Constraints:
- ;
- .
-
6:
– const Integer
Input
-
7:
– const Integer
Input
-
8:
– const double
Input
-
On entry: nonzero elements in upper triangle of matrices stored in coordinate storage. The first elements belong to , the following elements belong to , etc. See explanation above.
Constraints:
- , ;
- irowa and icola match the block diagonal pattern set by blksizea.
-
9:
– Integer
Input
-
On entry: , number of diagonal blocks in matrices. As explained above it is equivalent to the number of matrix inequalities supplied in this call.
Constraint:
.
-
10:
– const Integer
Input
-
On entry: if
, sizes
of the diagonal blocks.
If
,
blksizea is not referenced and may be
NULL.
Constraints:
- ;
- .
-
11:
– Integer *
Input/Output
-
On entry: if , new matrix inequalities are created. This is the only value allowed at the moment; nonzero values are reserved for future releases of the NAG Library.
Constraint:
.
On exit: the number of the last matrix inequality added. By definition, it is the number of the matrix inequalities already defined plus
nblk.
-
12:
– NagError *
Input/Output
-
The NAG error argument (see
Section 7 in the Introduction to the NAG Library CL Interface).
6
Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_HANDLE
-
The supplied
handle does not define a valid handle to the data structure for the NAG optimization modelling suite. It has not been initialized by
e04rac or it has been corrupted.
- NE_INT
-
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INT_2
-
On entry, and .
Constraint: .
- NE_INT_ARRAY_1
-
On entry, and .
Constraint: .
On entry, .
Constraint: .
- NE_INT_ARRAY_2
-
On entry, and .
Constraint: .
- NE_INTARR_INT
-
On entry, and .
Constraint: .
- NE_INTERNAL_ERROR
-
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
See
Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
- NE_INVALID_CS
-
An error occurred in matrix , (counting indices ).
On entry, , and .
Constraint: .
An error occurred in matrix , (counting indices ).
On entry, , and .
Constraint: .
An error occurred in matrix , (counting indices ).
On entry, , and .
Constraint: (elements within the upper triangle).
An error occurred in matrix
,
(counting indices
).
On entry,
,
and
. Maximum column index in this row given by the block structure defined by
blksizea is
.
Constraint: all elements of
must respect the block structure given by
blksizea.
An error occurred in matrix , (counting indices ).
On entry, more than one element of has row index and column index .
Constraint: each element of must have a unique row and column index.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library CL Interface for further information.
- NE_PHASE
-
The problem cannot be modified in this phase any more, the solver has already been called.
- NE_REF_MATCH
-
On entry, .
Constraint: .
On entry,
, expected
.
Constraint:
nvar must match the value given during initialization of
handle.
7
Accuracy
Not applicable.
8
Parallelism and Performance
e04rnc is not threaded in any implementation.
The following example demonstrates how the elements of the
matrices are organized within the input arrays. Let us assume that there are two blocks defined (
). The first has dimension
by
(
) and the second
by
(
). For simplicity, the number of variables is
. Please note that the values were chosen to ease orientation rather than to define a valid problem.
Both inequalities will be passed in a single call to
e04rnc, therefore the matrices are merged into the following block diagonal form:
All matrices are symmetric and therefore only the upper triangles are passed to the function. The coordinate storage format is used. Note that elements within the same matrix do not need to be in any specific order. The table below shows one of the ways the arrays could be populated.
irowa |
|
|
|
icola |
|
|
|
a |
|
|
|
|
|
|
|
nnza |
|
|
|
10
Example
There are various problems which can be successfully reformulated and solved as an SDP problem. The following example shows how a maximization of the minimal eigenvalue of a matrix depending on certain parameters can be utilized in statistics.
For further examples, please refer to
Section 10 in
e04rac.
Given a series of
vectors of length
,
this example solves the SDP problem:
This formulation comes from an area of statistics called experimental design and corresponds to finding an approximate optimal design for a linear regression.
A linear regression model has the form:
where
is a vector of observed values,
is a design matrix of (known) independent variables and
is a vector of errors. In experimental design it is assumed that each row of
is chosen from a set of
possible vectors,
. The goal of experimental design is to choose the rows of
so that the error covariance is ‘small’. For an
optimal design this is defined as the
that maximizes the minimum eigenvalue of
.
In this example we construct the
optimal design for a polynomial regression model of the form:
where
.
10.1
Program Text
10.2
Program Data
10.3
Program Results