NAG CL Interface
e04rpc (handle_​set_​quadmatineq)

Settings help

CL Name Style:


1 Purpose

e04rpc is a part of the NAG optimization modelling suite and defines bilinear matrix terms either in a new matrix constraint or adds them to an existing linear matrix inequality.

2 Specification

#include <nag.h>
void  e04rpc (void *handle, Integer nq, const Integer qi[], const Integer qj[], Integer dimq, const Integer nnzq[], Integer nnzqsum, const Integer irowq[], const Integer icolq[], const double q[], Integer *idblk, NagError *fail)
The function may be called by the names: e04rpc or nag_opt_handle_set_quadmatineq.

3 Description

After the initialization function e04rac has been called, e04rpc may be used to define bilinear matrix terms. It may be used in two ways, either to add to the problem formulation a new bilinear matrix inequality (BMI) which does not have linear terms:
i,j=1 n xi xj Q ij 0 (1)
or to extend an existing linear matrix inequality constraint by bilinear terms:
i,j=1 n xi xj Q ij k . (2)
Here Q ij k are d×d (sparse) symmetric matrices and k, if present, is the number of the existing constraint. This function will typically be used on semidefinite programming problems with bilinear matrix constraints (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)
The function can be called multiple times to define an additional matrix inequality or to extend an existing one, but it cannot be called twice to extend the same matrix inequality. The argument idblk is used to distinguish whether a new matrix constraint should be added (idblk=0) or if an existing linear matrix inequality should be extended (idblk>0). In the latter case, idblk should be set to k, the number of the existing inequality. See e04rnc for details about formulation of linear matrix constraints and their numbering and a further description of idblk. See Section 4.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite. In the further text, the index k will be omitted.

3.1 Input data organization

It is expected that only some of the matrices Qij will be nonzero, therefore, only their index pairs i,j are listed in arrays qi and qj. Note that a pair i,j should not repeat, i.e., a matrix Qij should not be defined more than once. No particular ordering of pairs i,j is expected but other input arrays irowq, icolq, q and nnzq need to respect the chosen order.
Note:  the dimension of Qij must respect the size of the linear matrix inequality if they are supposed to expand it (case idblk>0).
Matrices Qij 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. All these triplets from all Qij matrices are passed to the function in three arrays: irowq for row indices, icolq for column indices and q for the values. No particular order of nonzeros within one matrix is enforced but all nonzeros belonging to one Qij matrix need to be stored next to each other. The first nnzq[0] nonzeros belong to Qi1j1 where i1=qi[0], j1=qj[0], the following nnzq[1] nonzeros to the next one given by qi, qj and so on. The array nnzq thus splits arrays irowq, icolq and q into sections so that each section defines one Qij matrix. See Table 1 below. Functions e04rdc and e04rnc use the same data organization so further examples can be found there.
Table 1
Coordinate storage format of Qij matrices in input arrays
irowq upper triangle upper triangle upper triangle
icolq nonzeros nonzeros nonzeros
q from ​ Qi1j1 from ​ Qi2j2 from ​ Q inq jnq
nnzq[0] nnzq[1] nnzq[nq-1]
i1 = qi[0] i2 = qi[1] inq = qi[nq-1]
j1 = qj[0] j2 = qj[1] jnq = qj[nq-1]

4 References

Syrmos V L, Abdallah C T, Dorato P and Grigoriadis K (1997) Static output feedback – a survey Journal Automatica (Journal of IFAC) (Volume 33) 2 125–137

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: nq Integer Input
On entry: the number of index pairs i,j of the nonzero matrices Qij.
Constraint: nq>0.
3: qi[nq] const Integer Input
4: qj[nq] const Integer Input
On entry: the index pairs i,j of the nonzero matrices Qij in any order.
Constraint: 1i,jn where n is the number of decision variables in the problem set during the initialization of the handle by e04rac. The pairs do not repeat.
5: dimq Integer Input
On entry: d, the dimension of matrices Qij.
Constraints:
  • dimq>0;
  • if idblk>0, dimq needs to be identical to the dimension of matrices of the constraint k.
6: nnzq[nq] const Integer Input
On entry: the numbers of nonzero elements in the upper triangles of Qij matrices.
Constraint: nnzq[i-1]>0.
7: nnzqsum Integer Input
On entry: the dimension of the arrays irowq, icolq and q, at least the total number of all nonzeros in all Qij matrices.
Constraints:
  • nnzqsum>0;
  • nnzqsum k=1 nq nnzq[k-1].
8: irowq[nnzqsum] const Integer Input
9: icolq[nnzqsum] const Integer Input
10: q[nnzqsum] const double Input
On entry: the nonzero elements of the upper triangles of matrices Qij stored in coordinate storage format. The first nnzq[0] elements belong to the first Qi1j1, the following nnzq[1] to Qi2j2, etc.
Constraint: 1irowq[i-1]dimq, irowq[i-1]icolq[i-1]dimq.
11: idblk Integer * Input/Output
On entry: if idblk=0, a new matrix constraint is created; otherwise, idblk=k>0, the number of the existing linear matrix constraint to be expanded with the bilinear terms.
Constraint: idblk0.
On exit: if idblk=0 on entry, the number of the new matrix constraint is returned. By definition, it is the number of matrix inequalities already defined plus one. Otherwise, idblk>0 stays unchanged.
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

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_ALREADY_DEFINED
On entry, idblk=value.
Bilinear terms of the matrix inequality block with the given idblk have already been defined.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_DIM_MATCH
On entry, dimq=value, idblk=value.
The correct dimension of the given idblk is value.
Constraint: dimq must match the dimension of the block supplied earlier.
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 properly initialized or it has been corrupted.
NE_INDICES
On entry, index pair with qi=value and qj=value repeats.
Constraint: each index pair qi, qj must be unique.
On entry, k=value, qi[k-1]=value and n=value.
Constraint: 1qi[k-1]n.
On entry, k=value, qj[k-1]=value and n=value.
Constraint: 1qj[k-1]n.
NE_INT
On entry, dimq=value.
Constraint: dimq>0.
On entry, idblk=value.
Constraint: idblk0.
On entry, nq=value.
Constraint: nq>0.
NE_INT_2
On entry, nnzqsum=value and sum(nnzq)=value.
Constraint: nnzqsumsum(nnzq).
NE_INT_ARRAY_1
On entry, i=value and nnzq[i-1]=value.
Constraint: nnzq[i-1]>0.
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
On entry, an error occurred in matrix Qij of index k=value, qi[k-1]=value, qj[k-1]=value.
For j=value, icolq[j-1]=value and dimq=value.
Constraint: 1icolq[j-1]dimq.
On entry, an error occurred in matrix Qij of index k=value, qi[k-1]=value, qj[k-1]=value.
For j=value, irowq[j-1]=value and dimq=value.
Constraint: 1irowq[j-1]dimq.
On entry, an error occurred in matrix Qij of index k=value, qi[k-1]=value, qj[k-1]=value.
For j=value, irowq[j-1]=value and icolq[j-1]=value.
Constraint: irowq[j-1]icolq[j-1] (elements within the upper triangle).
On entry, an error occurred in matrix Qij of index k=value, qi[k-1]=value, qj[k-1]=value.
More than one element of Qij has row index value and column index value.
Constraint: each element of Qij 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 right now, the solver is running.
NE_REF_MATCH
On entry, idblk=value.
The given idblk does not match with any existing matrix inequality block.
The maximum idblk is currently value.
On entry, idblk=value.
The given idblk refers to a nonexistent matrix inequality block.
No matrix inequalities have been added yet.

7 Accuracy

Not applicable.

8 Parallelism and Performance

e04rpc is not threaded in any implementation.

9 Further Comments

None.

10 Example

This example demonstrates how semidefinite programming can be used in control theory. See also e04rac for links to further examples in the suite.
The problem, from static output feedback (SOF) control Syrmos et al. (1997), solved here is the linear time-invariant (LTI) ‘test’ system
x.=Ax+Bu y=Cx (4)
subject to static output feedback
u=Ky . (5)
Here An×n, Bn×m and Cp×n are given matrices, xn is the vector of state variables, um is the vector of control inputs, yp is the vector of system outputs, and Km×p is the unknown feedback gain matrix.
The problem is to find K such that (4) is time-stable when subject to (5), i.e., all eigenvalues of the closed-loop system matrix A+BKC belong to the left half-plane. From the Lyapunov stability theory, this holds if and only if there exists a symmetric positive definite matrix P such that
(A+BKC)T P+ P(A+BKC) 0 .  
Hence, by introducing the new variable, the Lyapunov matrix P, we can formulate the SOF problem as a feasibility BMI-SDP problem in variables K and P. As we cannot formulate the problem with sharp matrix inequalities, we can solve the following system instead (note that the objective function is added to bound matrix P):
minimize K,P trace(P) subject to (A+BKC)T P+P(A+BKC) -I , PI. (6)
For n=p=2, m=1,
A= ( -1 2 -3 -4 ) ,   B= ( -1 -1 ) ,  C=I  
and the unknown matrices expressed as
P = ( x1 x2 x2 x3 ) ,  K = ( x4 x5 ) ,  
the problem (6) can be rewritten in the form (3) as follows:
minimize x5 x1+x3 subject to ( 2x1 x4 + 2 x2 x4 x1 x5 + x2 x4 + x2 x5 + x3 x4 sym. 2x2 x5 + 2x3 x5 ) + ( 2x1 + 6x2 -2x1 + 5x2 + 3x3 sym. -4x2 + 8x3 ) - I 0 , ( x1 x2 sym. x3 ) - I 0 .  
This formulation has been stored in a generic BMI-SDP data file which is processed and solved by the example program.

10.1 Program Text

Program Text (e04rpce.c)

10.2 Program Data

Program Data (e04rpce.d)

10.3 Program Results

Program Results (e04rpce.r)