Function: handle_set_group
NAG CPP Interface
nagcpp::opt::handle_set_group (e04rb)
Function: handle_set_group
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
of dimension
. The supported cones are quadratic cone and rotated quadratic cone, also known as second-order cones, which are defined as follows:
-
•Quadratic cone:
-
•Rotated quadratic cone:
The cone constraint is defined by its type and a subset (group) of variables. Let index set denote variable indices, then will denote the subvector of variables .
For example, if
and
, then a quadratic cone constraint
implies the inequality constraints
Typically, this function will be used to build Second-order Cone Programming (SOCP) problems which might be formulated in the following way:
where
is either a quadratic cone or a rotated quadratic cone of dimension
.
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:
– 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:
– string
Input
-
On entry: the type of the cone constraint.
gtype is case insensitive.
- or
- The group defines a quadratic cone.
- or
- The group defines a rotated quadratic cone.
Constraint:
, , or .
-
3:
– types::f77_integer array
Input
-
On entry:
, the indices of the variables in the constraint. If
,
group is not referenced.
Constraint:
, for , where is the number of decision variables in the problem. The elements must not repeat.
-
4:
– types::f77_integer
Input/Output
-
On entry:
- A new cone constraint is created.
- , the ID number of the existing constraint to be deleted or replaced.
Constraint:
.
On exit: if
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:
– OptionalE04RB
Input/Output
-
Optional parameter container, derived from
Optional.
5.1Additional Quantities
- 1:
- , 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
-
- comm::handle has not been initialized.
- comm::handle does not belong to the NAG optimization modelling suite,
has not been initialized properly or is corrupted.
- comm::handle has not been initialized properly or is corrupted.
- The problem cannot be modified right now, the solver is running.
- On entry, .
The given idgroup does not match with any cone constraint already defined.
- On entry, .
Constraint: .
- On entry, and .
Constraint: if , or .
- On entry, and .
Constraint: if , or .
- On entry, .
Constraint: .
- On entry, .
Constraint: .
- On entry, , and
.
Constraint: .
- On entry,
for and .
Constraint: elements in group cannot repeat.
- On entry, argument must be a vector of size array.
Supplied argument has dimensions.
- On entry, argument must be a vector of size array.
Supplied argument was a vector of size .
- On entry, argument must be a vector of size array.
The size for the supplied array could not be ascertained.
- On entry, the raw data component of is null.
- On entry, unable to ascertain a value for .
- On entry, the communication class has not been initialized correctly.
- An unexpected error has been triggered by this routine.
- Your licence key may have expired or may not have been installed correctly.
- 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.
10
Example
10.1
Example Program
Function: handle_set_group