NAG CPP Interface
nagcpp::opt::handle_set_linconstr (e04rj)

1 Purpose

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

2 Specification

#include "e04/nagcpp_e04rj.hpp"
#include "e04/nagcpp_class_CommE04RA.hpp"
template <typename COMM, typename BL, typename BU, typename IROWB, typename ICOLB, typename B>

void function handle_set_linconstr(COMM &comm, const BL &bl, const BU &bu, const IROWB &irowb, const ICOLB &icolb, const B &b, OptionalE04RJ opt)
template <typename COMM, typename BL, typename BU, typename IROWB, typename ICOLB, typename B>

void function handle_set_linconstr(COMM &comm, const BL &bl, const BU &bu, const IROWB &irowb, const ICOLB &icolb, const B &b)

3 Description

After the initialization function handle_​init has been called, handle_set_linconstr 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 linear programming (LP)
minimize xn cTx   (a) subject to   lBBxuB,   (b) lxxux ,   (c) (1)
quadratic programming (QP)
minimize xn 12 xTHx + cTx   (a) subject to   lBBxuB,   (b) lxxux ,   (c) (2)
nonlinear programming (NLP)
minimize xn f(x)   (a) subject to lgg(x)ug,   (b) lBBxuB,   (c) lxxux,   (d) (3)
or 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) (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 which is common among all solvers in the suite. 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 function and any later alterations to Infinite Bound Size will not affect these constraints.
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: bl(nclin) double array Input
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 bl(j-1)=bu(j-1)=β, where |β|<bigbnd. To specify a nonexistent lower bound (i.e., lj=-), set bl(j-1)-bigbnd; to specify a nonexistent upper bound, set bu(j-1)bigbnd.
Constraints:
  • bl(j-1)bu(j-1), for j=1,2,,nclin;
  • bl(j-1)<bigbnd, for j=1,2,,nclin;
  • bu(j-1)>-bigbnd, for j=1,2,,nclin;
  • if bl(j-1)=bu(j-1), |bl(j-1)|<bigbnd, for j=1,2,,nclin.
3: bu(nclin) double array Input
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 bl(j-1)=bu(j-1)=β, where |β|<bigbnd. To specify a nonexistent lower bound (i.e., lj=-), set bl(j-1)-bigbnd; to specify a nonexistent upper bound, set bu(j-1)bigbnd.
Constraints:
  • bl(j-1)bu(j-1), for j=1,2,,nclin;
  • bl(j-1)<bigbnd, for j=1,2,,nclin;
  • bu(j-1)>-bigbnd, for j=1,2,,nclin;
  • if bl(j-1)=bu(j-1), |bl(j-1)|<bigbnd, for j=1,2,,nclin.
4: irowb(nnzb) types::f77_integer array Input
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 handle_​init. 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=b(l-1) where i=irowb(l-1) and j=icolb(l-1), for l=1,2,,nnzb. No particular order of elements is expected, but elements should not repeat.
Constraint: 1irowb(l-1)nclin, 1icolb(l-1)n, for l=1,2,,nnzb.
5: icolb(nnzb) types::f77_integer array Input
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 handle_​init. 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=b(l-1) where i=irowb(l-1) and j=icolb(l-1), for l=1,2,,nnzb. No particular order of elements is expected, but elements should not repeat.
Constraint: 1irowb(l-1)nclin, 1icolb(l-1)n, for l=1,2,,nnzb.
6: b(nnzb) double array Input
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 handle_​init. 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=b(l-1) where i=irowb(l-1) and j=icolb(l-1), for l=1,2,,nnzb. No particular order of elements is expected, but elements should not repeat.
Constraint: 1irowb(l-1)nclin, 1icolb(l-1)n, for l=1,2,,nnzb.
7: opt OptionalE04RJ Input/Output
Optional parameter container, derived from Optional.
Container for:
idlctypes::f77_integer
This optional parameter may be set using the method OptionalE04RJ::idlc and accessed via OptionalE04RJ::get_idlc.
Default: 0
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.

5.1Additional Quantities

1: nclin
mB, the number of linear constraints (number of rows of the matrix B).
2: nnzb
nnzb gives the number of nonzeros in matrix B

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
A set of linear constraints has already been defined.
errorid=4
On entry, idlc = value.
Constraint: idlc=0.
errorid=6
On entry, nnzb = value.
Constraint: nnzb>0.
errorid=6
On entry, nclin = value.
Constraint: nclin0.
errorid=8
On entry, i=value, irowb[i-1]=value and
nclin=value.
Constraint: 1irowb[i-1]nclin.
errorid=8
On entry, i=value, icolb[i-1]=value and
n=value.
Constraint: 1icolb[i-1]n.
errorid=8
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.
errorid=10
On entry, j=value, bl[j-1]=value and
bu[j-1]=value.
Constraint: bl[j-1]bu[j-1].
errorid=10
On entry, j=value, bl[j-1]=value,
bigbnd=value.
Constraint: bl[j-1]<bigbnd.
errorid=10
On entry, j=value, bu[j-1]=value,
bigbnd=value.
Constraint: bu[j-1]>-bigbnd.
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

None.

10 Example

Examples of the use of this method may be found in the examples for: handle_​solve_​lp_​ipm, handle_​set_​group and handle_​solve_​ipopt.