handle_set_linconstr is a part of the NAG optimization modelling suite and adds a new block of linear constraints to the problem or modifies an individual linear constraint.
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, OptionalE04RJopt)
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)
3Description
After the handle has been initialized (e.g., handle_init has been called),
handle_set_linconstr may be used to add to the problem a new block of linear constraints
where is a general rectangular matrix, is the current number of decision variables in the model and and are -dimensional vectors defining the lower and upper bounds, respectively. The call can be repeated to add multiple blocks to the model.
Note that the bounds are specified for all the constraints of this block. This form allows full generality in specifying various types of constraint. In particular, the th constraint may be defined as an equality by setting . If certain bounds are not present, the associated elements of or 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 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.
The linear constraints can be edited. To identify the individual constraints, they are numbered starting with , see idlc. A single constraint (i.e., a single row of the matrix ) can be modified (replaced) by handle_set_linconstr by referring to its idlc. An individual coefficient of the matrix can be set or modified by e04tjf (no CPP interface) and bounds of a single constraint can be set or modified by e04tdf (no CPP interface). Note that it is also possible to temporarily disable and enable individual constraints in the model by e04tcf (no CPP interface) and e04tbf (no CPP interface), respectively.
Linear constraints may be present in many different types of problems, for simplicity of the notation, only one block of linear constraints is presented. For example,
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: – double arrayInput
On entry: bl and bu define lower and upper bounds of the linear constraints, and , respectively. To define the th constraint as equality, set , where . To specify a nonexistent lower bound (i.e., ), set ; to specify a nonexistent upper bound, set .
Constraints:
, for ;
, for ;
, for ;
if , , for .
3: – double arrayInput
On entry: bl and bu define lower and upper bounds of the linear constraints, and , respectively. To define the th constraint as equality, set , where . To specify a nonexistent lower bound (i.e., ), set ; to specify a nonexistent upper bound, set .
On entry: arrays irowb, icolb and b store nnzb nonzeros of the sparse matrix in coordinate storage (CS) format (see Section 2.1.1 in the F11 Chapter Introduction). The matrix has dimensions , where is the current number of decision variables in the model. 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 where and
, for . No particular order of elements is expected, but elements should not repeat.
On entry: arrays irowb, icolb and b store nnzb nonzeros of the sparse matrix in coordinate storage (CS) format (see Section 2.1.1 in the F11 Chapter Introduction). The matrix has dimensions , where is the current number of decision variables in the model. 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 where and
, for . No particular order of elements is expected, but elements should not repeat.
Constraint:
, , for .
6: – double arrayInput
On entry: arrays irowb, icolb and b store nnzb nonzeros of the sparse matrix in coordinate storage (CS) format (see Section 2.1.1 in the F11 Chapter Introduction). The matrix has dimensions , where is the current number of decision variables in the model. 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 where and
, for . No particular order of elements is expected, but elements should not repeat.
Constraint:
, , for .
7: – OptionalE04RJInput/Output
Optional parameter container, derived from Optional.
Container for:
idlc – types::f77_integer
This optional parameter
may be set using the method
OptionalE04RJ::idlc
and accessed via
OptionalE04RJ::get_idlc.
Default:
On entry: if , a new block of linear constraints is added to the model; otherwise, refers to the number of an existing linear constraint which will be replaced and nclin must be set to one.
Constraint:
.
On exit: if , the number of the last linear constraint added. By definition, it is the number of linear constraints already defined plus nclin. Otherwise, stays unchanged.
5.1Additional Quantities
1:
, the number of linear constraints (number of rows of the matrix ) in this block.
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).