NAG FL Interface
e04rbf (handle_​set_​group)

1 Purpose

e04rbf is a part of the NAG optimization modelling suite and modifies a model by either adding a new, or replacing or deleting an existing, quadratic or rotated quadratic cone constraint.

2 Specification

Fortran Interface
Subroutine e04rbf ( handle, gtype, lgroup, group, idgroup, ifail)
Integer, Intent (In) :: lgroup, group(lgroup)
Integer, Intent (Inout) :: idgroup, ifail
Character (*), Intent (In) :: gtype
Type (c_ptr), Intent (In) :: handle
C Header Interface
#include <nag.h>
void  e04rbf_ (void **handle, const char *gtype, const Integer *lgroup, const Integer group[], Integer *idgroup, Integer *ifail, const Charlen length_gtype)
The routine may be called by the names e04rbf or nagf_opt_handle_set_group.

3 Description

After the initialization routine e04raf has been called, e04rbf may be used to edit a model by adding, replacing, or deleting a cone constraint i of dimension mi. The supported cones are quadratic cone and rotated quadratic cone, also known as second-order cones, which are defined as follows:
The cone constraint is defined by its type and a subset (group) of variables. Let index set Gi1,2,,n denote variable indices, then xGi will denote the subvector of variables xn.
For example, if mi=3 and Gi=4,1,2, then a quadratic cone constraint
xGi = x4,x1,x2 Kq3  
implies the inequality constraints
x42 x12 + x22 ,   x4 0 .  
Typically, this routine will be used to build second-order cone programming (SOCP) problems which might be formulated in the following way:
minimize xn cTx   (a) subject to lBBxuB,   (b) lxxux ,   (c) xGiKmi,i=1,,r,   (d) (3)
where Kmi is either quadratic cone or rotated quadratic cone of dimension mi.
e04rbf can be called repeatedly to add, replace or delete one cone constraint at a time. See Section 3.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite.

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 before the call to e04rbf.
2: gtype Character(*) Input
On entry: the type of the cone constraint, case insensitive.
gtype='QUAD' or 'Q'
The group defines a quadratic cone.
gtype='RQUAD' or 'R'
The group defines a rotated quadratic cone.
Constraint: gtype='QUAD', 'Q', 'RQUAD' or 'R'.
3: lgroup Integer Input
On entry: mi, the number of the variables in the group.
If lgroup=0, gtype and group will not be referenced, and the constraint with ID number idgroup will be deleted from the model.
Constraints:
  • if gtype='QUAD' or 'Q', lgroup=0 or lgroup2;
  • if gtype='RQUAD' or 'R', lgroup=0 or lgroup3.
4: grouplgroup Integer array Input
On entry: Gi, the indices of the variables in the constraint. If lgroup=0, group is not referenced.
Constraint: 1groupkn, for k=1,2,,lgroup , where n is the number of decision variables in the problem. The elements must not repeat and each variable can appear in one cone at most, see Section 9.
5: idgroup Integer Input/Output
On entry:
idgroup=0
A new cone constraint is created.
idgroup>0
i, the ID number of the existing constraint to be deleted or replaced.
Constraint: idgroup0.
On exit: if idgroup=0 on entry, the ID number of the new cone constraint is returned. By definition, this is the number of the cone constraints already defined plus one. Otherwise, idgroup stays unchanged.
6: ifail Integer Input/Output
On entry: ifail must be set to 0, -1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of -1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value -1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value -1 is recommended since useful values can be provided in some output arguments even when ifail0 on exit. 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
On entry, variable with index i=value has been defined in a cone in a previous call to this routine.
Constraint: each variable may be defined in one cone constraint at most.
ifail=4
On entry, idgroup=value.
The given idgroup does not match with any cone constraint already defined.
ifail=5
On entry, gtype=value and lgroup=value.
Constraint: if gtype='QUAD' or 'Q', lgroup=0 or lgroup2.
On entry, gtype=value and lgroup=value.
Constraint: if gtype='RQUAD' or 'R', lgroup=0 or lgroup3.
On entry, lgroup=value.
Constraint: lgroup0.
ifail=6
On entry, gtype=value.
Constraint: gtype='QUAD', 'Q', 'RQUAD' or 'R'.
ifail=7
On entry, idgroup=value.
Constraint: idgroup0.
ifail=8
On entry, k=value, groupk=value and n=value.
Constraint: 1groupkn.
ifail=9
On entry, groupi=groupj=value for i=value and j=value.
Constraint: elements in group cannot repeat.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

e04rbf is not threaded in any implementation.

9 Further Comments

Overlapping of cones is not supported, which means each variable may be defined in one cone at most. However by adding auxiliary variables, you can achieve the same effect. For example, if xaKm1 and xaKm2, you can add one more variable xb=xa and set xaKm1, xbKm2.

10 Example

This example solves the following SOCP problem
minimize 10.0x1 + 20.0x2 + x3  
subject to the bounds
-2.0 x1 2.0 -2.0 x2 2.0  
the general linear constraints
-0.1x1 - 0.1x2 + x3 1.5 1.0 -0.06x1 + x2 + x3  
and the cone constraint
x3,x1,x2 K q 3 .  
The optimal solution (to five significant figures) is
x*=-1.2682,-4.0843,1.3323T,  
and the objective function value is -19.518.

10.1 Program Text

Program Text (e04rbfe.f90)

10.2 Program Data

Program Data (e04rbfe.d)

10.3 Program Results

Program Results (e04rbfe.r)