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

Settings help

CPP Name Style:



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 handle has been initialized (e.g., 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 a quadratic cone or a rotated quadratic cone of dimension mi.
handle_set_group can be called repeatedly to add, replace or delete one cone constraint at a time. Note that it is also possible to temporarily disable and enable individual cone constraints in the model by calling e04tcf (no CPP interface) and e04tbf (no CPP interface), respectively. 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. gtype is 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-1)n, for k=1,2,,lgroup , where n is the number of decision variables in the problem. The elements must not repeat.
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 cone constraints already defined plus one. Otherwise, idgroup remains unchanged.
5: opt OptionalE04RB Input/Output
Optional parameter container, derived from Optional.

5.1Additional Quantities

1: lgroup
mi, the number of 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 right now, the solver is running.
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

10 Example

See handle_​solve_​socp_​ipm.

10.1 Example Program

Source File Data Results
ex_e04rb.cpp None ex_e04rb.r