NAG CL Interface
e04rnc (handle_​set_​linmatineq)

Settings help

CL Name Style:

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

#include <nag.h>
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
i=1 n xi Ai - A0 0 (1)
to the problem definition. Here Ai are d×d symmetric matrices. The expression S0 stands for a constraint on eigenvalues of a symmetric matrix S, namely, all the eigenvalues should be non-negative, i.e., the matrix S should be positive semidefinite.
Typically, this will be used in linear semidefinite programming problems (SDP)
minimize xn cTx   (a) subject to   i=1 n xi Aik - A0k 0 ,  k=1,,mA   (b) lBBxuB   (c) lxxux   (d) (2)
or to define the linear part of bilinear matrix inequalities (3)(b) in (BMI-SDP)
minimize xn 12 xTHx + cTx   (a) subject to   i,j=1 n xi xj Qijk + i=1 n xi Aik - A0k 0 ,  k=1,,mA   (b) lBBxuB   (c) lxxux   (d) (3)
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.

3.1 Input data organization

All the matrices Ai, for i=0,1,,n, 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 Ai 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 A0 must be stored first, followed by all nonzero from A1, followed by A2, etc.
The number of stored nonzeros from each Ai matrix is given in nnza[i], thus this array indicates which section of arrays irowa, icola and a belongs to which Ai matrix. See Table 1 and the example in Section 9. See also e04rdc which uses the same data organization.
Table 1
Coordinate storage format of matrices A0, A1,, An in input arrays
irowa upper triangle upper triangle upper triangle
icola nonzeros nonzeros nonzeros
a from ​ A0 from ​ A1 from ​ An
nnza[0] nnza[1] nnza[n]
There are two possibilities for defining more matrix inequality constraints
i=1 n xi A i k - A 0 k 0 ,  k=1,2,,mA (4)
to the problem. The first is to call e04rnc mA 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 mA 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
i=1 n xi ( Ai1 Ai2 AimA ) - ( A01 A02 A0mA ) 0 .  
If dk denotes the dimension of inequality k, the new merged inequality has dimension d= k=1 mA dk and each of the Ai matrices is formed by A i 1 , A i 2 ,, A i mA stored as mA diagonal blocks. In such a case, nblk is set to mA and blksizea[k-1] to dk, the size of the kth 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 1 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 1.
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 idblk=1, the second one idblk=2, etc. Therefore, if you call e04rnc for the very first time with nblk=42, it adds 42 inequalities with idblk from 1 to 42 and the function returns idblk=42 (the number of the last one). A subsequent call with nblk=1 would add only one inequality, this time with idblk=43 which would be returned.

4 References


5 Arguments

1: handle void * Input
On entry: the handle to the problem. It needs to be initialized (e.g., by e04rac) and must not be changed between calls to the NAG optimization modelling suite.
2: nvar Integer Input
On entry: n, the current number of decision variables x in the model.
3: dima Integer Input
On entry: d, the dimension of the matrices Ai, for i=0,1,,nvar.
Constraint: dima>0.
4: nnza[nvar+1] const Integer Input
On entry: nnza[i], for i=0,1,,nvar, gives the number of nonzero elements in the upper triangle of matrix Ai. To define Ai as a zero matrix, set nnza[i]=0. However, there must be at least one matrix with at least one nonzero.
  • nnza[i-1]0;
  • i=1 n+1 nnza[i-1]1.
5: nnzasum Integer Input
On entry: the dimension of the arrays irowa, icola and a, at least the total number of all nonzeros in all matrices Ai.
  • nnzasum>0;
  • i=1 n+1 nnza[i-1] nnzasum.
6: irowa[nnzasum] const Integer Input
7: icola[nnzasum] const Integer Input
8: a[nnzasum] const double Input
On entry: nonzero elements in upper triangle of matrices Ai stored in coordinate storage. The first nnza[0] elements belong to A0, the following nnza[1] elements belong to A1, etc. See explanation above.
  • 1irowa[i-1]dima, irowa[i-1]icola[i-1]dima;
  • irowa and icola match the block diagonal pattern set by blksizea.
9: nblk Integer Input
On entry: mA, number of diagonal blocks in Ai matrices. As explained above it is equivalent to the number of matrix inequalities supplied in this call.
Constraint: nblk1.
10: blksizea[nblk] const Integer Input
On entry: if nblk>1, sizes dk of the diagonal blocks.
If nblk=1, blksizea is not referenced and may be NULL.
  • blksizea[i-1]1;
  • i=1 mA blksizea[i-1]=dima.
11: idblk Integer * Input/Output
On entry: if idblk=0, 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: idblk=0.
On exit: the number of the last matrix inequality added. By definition, it is the number of matrix inequalities already defined plus nblk.
12: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument value had an illegal value.
The supplied handle does not define a valid handle to the data structure for the NAG optimization modelling suite. It has not been properly initialized or it has been corrupted.
On entry, dima=value.
Constraint: dima>0.
On entry, nblk=value.
Constraint: nblk>0.
On entry, nnzasum=value and sum(nnza)=value.
Constraint: nnzasumsum(nnza).
On entry, i=value and nnza[i-1]=value.
Constraint: nnza[i-1]0.
On entry, sum(nnza)=value.
Constraint: sum(nnza)1.
On entry, i=value and blksizea[i-1]=value.
Constraint: blksizea[i-1]1.
On entry, dima=value and sum(blksizea)=value.
Constraint: sum(blksizea)=dima.
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.
An error occurred in matrix Ai, i=value.
On entry, j=value, icola[j-1]=value and dima=value.
Constraint: 1icola[j-1]dima.
An error occurred in matrix Ai, i=value.
On entry, j=value, irowa[j-1]=value and dima=value.
Constraint: 1irowa[j-1]dima.
An error occurred in matrix Ai, i=value.
On entry, j=value, irowa[j-1]=value and icola[j-1]=value.
Constraint: irowa[j-1]icola[j-1] (elements within the upper triangle).
An error occurred in matrix Ai, i=value.
On entry, j=value, irowa[j-1]=value and icola[j-1]=value. Maximum column index in this row given by the block structure defined by blksizea is value.
Constraint: all elements of Ai must respect the block structure given by blksizea.
An error occurred in matrix Ai, i=value.
On entry, more than one element of Ai has row index value and column index value.
Constraint: each element of Ai must have a unique row and column index.
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.
The problem cannot be modified right now, the solver is running.
On entry, idblk=value.
Constraint: idblk=0.
On entry, nvar=value, expected value=value.
Constraint: nvar must match the current number of variables of the model in the handle.

7 Accuracy

Not applicable.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
e04rnc is not threaded in any implementation.

9 Further Comments

The following example demonstrates how the elements of the A i k matrices are organized within the input arrays. Let us assume that there are two blocks defined (nblk=2). The first has dimension 3×3 (blksizea[0]=3) and the second 2×2 (blksizea[1]=2). For simplicity, the number of variables is 2. Please note that the values were chosen to ease orientation rather than to define a valid problem.
A 0 1 = ( 0.1 0 0.3 0 0.2 0.4 0.3 0.4 0 ) , A 1 1 ​ empty ​ A 2 1 = ( 2.1 0 0 0 2.2 0 0 0 2.3 ) , A 0 2 = ( 0 -0.1 -0.1 0 ) , A 1 2 = ( -1.1 0 0 -1.2 ) , A 2 2 = ( -2.1 -2.2 -2.2 -2.3 ) .  
Both inequalities will be passed in a single call to e04rnc, therefore, the matrices are merged into the following block diagonal form:
A0 = ( 0.1 0 0.3 0 0.2 0.4 0.3 0.4 0 0 -0.1 -0.1 0 ) ,  
A1 = ( 0 0 0 0 0 0 0 0 0 -1.1 0 0 -1.2 ) ,  
A2 = ( 2.1 0 0 0 2.2 0 0 0 2.3 -2.1 -2.2 -2.2 -2.3 ) .  
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 0.2 0.2 -0.4 0.1 0.1 -0.4 -0.5 0.1 0.2 0.3 -0.4 -0.4 -0.5
icola 0.2 0.3 -0.5 0.1 0.3 -0.4 -0.5 0.1 0.2 0.3 -0.4 -0.5 -0.5
a 0.2 0.4 -0.1 0.1 0.3 -1.1 -1.2 2.1 2.2 2.3 -2.1 -2.2 -2.3
A0 A1 A2
nnza 5 2 6

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 e04rac.
Given a series of M vectors of length p, {vi:i=1,2,,M} this example solves the SDP problem:
maximize λ1,,λM,t t subject to   i=1 M λi vi viT tI i=1 M λi =1 λi0 ,  k=1,,M .  
This formulation comes from an area of statistics called experimental design and corresponds to finding an approximate E optimal design for a linear regression.
A linear regression model has the form:
where y is a vector of observed values, X is a design matrix of (known) independent variables and ε is a vector of errors. In experimental design it is assumed that each row of X is chosen from a set of M possible vectors, {vi:i=1,2,,M} . The goal of experimental design is to choose the rows of X so that the error covariance is ‘small’. For an E optimal design this is defined as the X that maximizes the minimum eigenvalue of XTX.
In this example we construct the E optimal design for a polynomial regression model of the form:
y = β0+ β1 x+ β2 x2+ β3 x3+ β4 x4+ε  
where x {1-j×0.05:j=0,1,,40} .

10.1 Program Text

Program Text (e04rnce.c)

10.2 Program Data

Program Data (e04rnce.d)

10.3 Program Results

Program Results (e04rnce.r)