NAG CPP Interface
nagcpp::opt::handle_set_group (e04rb)

1 Purpose

handle_set_group 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

#include "e04/nagcpp_e04rb.hpp"
#include "e04/nagcpp_class_CommE04RA.hpp"
template <typename COMM, typename GROUP>

void function handle_set_group(COMM &comm, const string gtype, const GROUP &group, types::f77_integer &idgroup, OptionalE04RB opt)
template <typename COMM, typename GROUP>

void function handle_set_group(COMM &comm, const string gtype, const GROUP &group, types::f77_integer &idgroup)

3 Description

After the initialization function handle_​init has been called, handle_set_group 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 Gi{1,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 function 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.
handle_set_group 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: comm CommE04RA Input/Output
Communication structure. An object of either the derived class CommE04RA or its base class NoneCopyableComm can be supplied. It is recommended that the derived class is used. If the base class is supplied it must first be initialized via a call to opt::handle_init (e04ra).
2: gtype string 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: group(lgroup) types::f77_integer array Input
On entry: Gi, the indices of the variables in the constraint. If lgroup=0, group is not referenced.
Constraint: 1group(k)n, for k=0,1,,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.
4: idgroup types::f77_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.
5: opt OptionalE04RB Input/Output
Optional parameter container, derived from Optional.

5.1Additional Quantities

1: lgroup
mi, the number of the variables in the group.

6 Exceptions and Warnings

Errors or warnings detected by the function:
All errors and warnings have an associated numeric error code field, errorid, stored either as a member of the thrown exception object (see errorid), or as a member of opt.ifail, depending on how errors and warnings are being handled (see Error Handling for more details).
Raises: ErrorException
errorid=1
comm::handle has not been initialized.
errorid=1
comm::handle does not belong to the NAG optimization modelling suite,
has not been initialized properly or is corrupted.
errorid=1
comm::handle has not been initialized properly or is corrupted.
errorid=2
The problem cannot be modified in this phase any more, the solver
has already been called.
errorid=3
On entry, variable with index i=value has been defined
in a cone in a previous call to this function.
Constraint: each variable may be defined in one cone constraint at most.
errorid=4
On entry, idgroup = value.
The given idgroup does not match with any cone constraint already defined.
errorid=5
On entry, lgroup = value.
Constraint: lgroup 0.
errorid=5
On entry, gtype=value and lgroup = value.
Constraint: if gtype = "QUAD"​ or ​"Q", lgroup = 0 or lgroup 2.
errorid=5
On entry, gtype=value and lgroup = value.
Constraint: if gtype = "RQUAD"​ or ​"R", lgroup = 0 or lgroup 3.
errorid=6
On entry, gtype=value.
Constraint: gtype = "QUAD","Q","RQUAD"​ or ​"R".
errorid=7
On entry, idgroup = value.
Constraint: idgroup 0.
errorid=8
On entry, k=value, group[k-1] = value and
n=value.
Constraint: 1group[k-1]n.
errorid=9
On entry, group[i-1]=group[j-1]=value
for i=value and j=value.
Constraint: elements in group cannot repeat.
errorid=10601
On entry, argument value must be a vector of size value array.
Supplied argument has value dimensions.
errorid=10601
On entry, argument value must be a vector of size value array.
Supplied argument was a vector of size value.
errorid=10601
On entry, argument value must be a vector of size value array.
The size for the supplied array could not be ascertained.
errorid=10602
On entry, the raw data component of value is null.
errorid=10603
On entry, unable to ascertain a value for value.
errorid=10605
On entry, the communication class value has not been initialized correctly.
errorid=-99
An unexpected error has been triggered by this routine.
errorid=-399
Your licence key may have expired or may not have been installed correctly.
errorid=-999
Dynamic memory allocation failed.

7 Accuracy

Not applicable.

8 Parallelism and Performance

Please see the description for the underlying computational routine in this section of the FL Interface documentation.

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.3323)T,  
and the objective function value is -19.518.
Source FileDataResults
ex_e04rb.cppNoneex_e04rb.r