E04RJF (PDF version)
E04 Chapter Contents
E04 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

E04RJF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

E04RJF is a part of the NAG optimization modelling suite and defines the block of linear constraints of the problem.

2  Specification

SUBROUTINE E04RJF ( HANDLE, NCLIN, BL, BU, NNZB, IROWB, ICOLB, B, IDLC, IFAIL)
INTEGER  NCLIN, NNZB, IROWB(NNZB), ICOLB(NNZB), IDLC, IFAIL
REAL (KIND=nag_wp)  BL(NCLIN), BU(NCLIN), B(NNZB)
TYPE (C_PTR)  HANDLE

3  Description

After the initialization routine E04RAF has been called, E04RJF may be used to define the linear constraints lBBxuB of the problem unless the linear constraints have already been defined. This will typically be used for problems, such as quadratic programming (QP)
minimize xn 12 xTHx + cTx   (a) subject to   lBBxuB   (b) lxxux ,   (c) (1)
nonlinear programming (NLP)
minimize xn fx   (a) subject to lggxug   (b) lBBxuB   (c) lxxux   (d) (2)
linear semidefinite programming (SDP)
minimize xn cTx   (a) subject to   i=1 n xi Aik - A0k 0 ,  k=1,,mA   (b) lBBxuB   (c) lxxux   (d) (3)
or semidefinite programming with bilinear matrix inequalities (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) (4)
where n is the number of decision variables, B is a general mB×n rectangular matrix and lB and uB are mB-dimensional vectors. Note that upper and lower bounds are specified for all the constraints. This form allows full generality in specifying various types of constraint. In particular, the jth constraint may be defined as an equality by setting lj=uj. If certain bounds are not present, the associated elements of lB or uB may be set to special values that are treated as - or +. See the description of the optional parameter Infinite Bound Size of the solvers in the suite, E04STF and E04SVF. Its value is denoted as bigbnd further in this text. Note that the bounds are interpreted based on its value at the time of calling this routine and any later alterations to Infinite Bound Size will not affect these constraints.
See E04RAF for more details.

4  References

None.

5  Arguments

1:     HANDLE – TYPE (C_PTR)Input
On entry: the handle to the problem. It needs to be initialized by E04RAF and must not be changed.
2:     NCLIN – INTEGERInput
On entry: mB, the number of linear constraints (number of rows of the matrix B).
If NCLIN=0, no linear constraints will be defined and BL, BU, NNZB, IROWB, ICOLB and B will not be referenced.
Constraint: NCLIN0.
3:     BLNCLIN – REAL (KIND=nag_wp) arrayInput
4:     BUNCLIN – REAL (KIND=nag_wp) arrayInput
On entry: BL and BU define lower and upper bounds of the linear constraints, lB and uB, respectively. To define the jth constraint as equality, set BLj=BUj=β, where β<bigbnd. To specify a nonexistent lower bound (i.e., lj=-), set BLj-bigbnd; to specify a nonexistent upper bound, set BUjbigbnd.
Constraints:
  • BLjBUj, for j=1,2,,NCLIN;
  • BLj<bigbnd, for j=1,2,,NCLIN;
  • BUj>-bigbnd, for j=1,2,,NCLIN;
  • if BLj=BUj, BLj<bigbnd, for j=1,2,,NCLIN.
5:     NNZB – INTEGERInput
On entry: NNZB gives the number of nonzeros in matrix B.
Constraint: if NCLIN>0, NNZB>0.
6:     IROWBNNZB – INTEGER arrayInput
7:     ICOLBNNZB – INTEGER arrayInput
8:     BNNZB – REAL (KIND=nag_wp) arrayInput
On entry: arrays IROWB, ICOLB and B store NNZB nonzeros of the sparse matrix B in coordinate storage (CS) format (see Section 2.1.1 in the F11 Chapter Introduction). The matrix B has dimensions mB×n, where n, the number of variables in the problem, was set in NVAR during the initialization of the handle by E04RAF. IROWB specifies one-based row indices, ICOLB specifies one-based column indices and B specifies the values of the nonzero elements in such a way that bij=Bl where i=IROWBl and j=ICOLBl, for l=1,2,,NNZB. No particular order of elements is expected, but elements should not repeat.
Constraint: 1IROWBlNCLIN, 1ICOLBln, for l=1,2,,NNZB.
9:     IDLC – INTEGERInput/Output
Note: IDLC is reserved for future releases of the NAG Library.
On entry: if IDLC=0, new linear constraints are added to the problem definition. This is the only value allowed at the moment.
Constraint: IDLC=0.
On exit: the number of the last linear constraint added, thus NCLIN.
10:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, the recommended value is -1. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=1
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 E04RAF or it has been corrupted.
IFAIL=2
The problem cannot be modified in this phase any more, the solver has already been called.
IFAIL=3
A set of linear constraints has already been defined.
IFAIL=4
On entry, IDLC=value.
Constraint: IDLC=0.
IFAIL=6
On entry, NCLIN=value.
Constraint: NCLIN0.
On entry, NNZB=value.
Constraint: NNZB>0.
IFAIL=8
On entry, i=value, ICOLBi=value and n=value.
Constraint: 1ICOLBin.
On entry, i=value, IROWBi=value and NCLIN=value.
Constraint: 1IROWBiNCLIN.
On entry, more than one element of B has row index value and column index value.
Constraint: each element of B must have a unique row and column index.
IFAIL=10
On entry, j=value, BLj=value, bigbnd=value.
Constraint: BLj<bigbnd.
On entry, j=value, BLj=value and BUj=value.
Constraint: BLjBUj.
On entry, j=value, BUj=value, bigbnd=value.
Constraint: BUj>-bigbnd.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7  Accuracy

Not applicable.

8  Parallelism and Performance

E04RJF is not threaded in any implementation.

9  Further Comments

None.

10  Example

This example demonstrates how to use the MPS file reader E04MXF and this suite of routines to define and solve a QP problem. E04MXF uses a different output format to the one required by E04RJF, in particular, it uses the compressed column storage (CCS) (see Section 2.1.3 in the F11 Chapter Introduction) instead of the coordinate storage and the linear objective vector is included in the system matrix. Therefore a simple transformation is needed before calling E04RJF as demonstrated in the example program.
The data file stores the following problem:
minimize cT x + 12 xT H x   subject to   lB Bx uB, -2 Ax 2,  
where
c= -4.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -0.1 -0.3 ,   H= 2 1 1 1 1 0 0 0 0 1 2 1 1 1 0 0 0 0 1 1 2 1 1 0 0 0 0 1 1 1 2 1 0 0 0 0 1 1 1 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ,  
B= 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 4.0 1.0 2.0 3.0 4.0 -2.0 1.0 1.0 1.0 1.0 1.0 -1.0 1.0 -1.0 1.0 1.0 1.0 1.0 1.0 ,  
lB= -2.0 -2.0 -2.0   and   uB= 1.5 1.5 4.0 .  
The optimal solution (to five figures) is
x*=2.0,-0.23333,-0.26667,-0.3,-0.1,2.0,2.0,-1.7777,-0.45555T.  
See also Section 10 in E04RAF for links to further examples in this suite.

10.1  Program Text

Program Text (e04rjfe.f90)

10.2  Program Data

Program Options (e04rjfe.opt)

10.3  Program Results

Program Results (e04rjfe.r)


E04RJF (PDF version)
E04 Chapter Contents
E04 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2016