handle_set_nlnconstr is a part of the NAG optimization modelling suite and defines or overwrites nonlinear constraints in the model, their number as well as the sparsity structure of their first derivatives.
template <typename COMM, typename BL, typename BU, typename IROWGD, typename ICOLGD>
void function handle_set_nlnconstr(COMM &comm, const BL &bl, const BU &bu, const IROWGD &irowgd, const ICOLGD &icolgd, OptionalE04RKopt)
template <typename COMM, typename BL, typename BU, typename IROWGD, typename ICOLGD>
void function handle_set_nlnconstr(COMM &comm, const BL &bl, const BU &bu, const IROWGD &irowgd, const ICOLGD &icolgd)
3Description
After the handle has been initialized (e.g., handle_init has been called),
handle_set_nlnconstr may be used to define the nonlinear constraints of the problem. If the nonlinear constraints have already been defined, they will be overwritten and their Hessians (or the Hessian of the Lagrangian) will be removed. If handle_set_nlnconstr is called with , existing nonlinear constraints are removed and no new ones are added. This will typically be used for nonlinear programming problems (NLP) of the kind:
(1)
where is the number of the decision variables , is the number of the nonlinear constraints (in (1)(b)) and , and are -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 th constraint may be defined as an equality by setting . If certain bounds are not present, the associated elements 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.
Since each nonlinear constraint is most likely to involve a small subset of the decision variables, the partial derivatives of the constraint functions with respect to those variables are best expressed as a sparse Jacobian matrix of rows and columns. The row and column positions of all the nonzero derivatives must be registered with the handle through handle_set_nlnconstr. The values of the nonlinear constraint functions and their nonzero gradients at particular points in the decision variable space will be communicated to the NLP solver by user-supplied functions (e.g., confun and congrd for handle_solve_ipopt).
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 nonlinear 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 .
3: – double arrayInput
On entry: bl and bu define lower and upper bounds of the nonlinear 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 irowgd and icolgd store the sparsity structure (pattern) of the Jacobian matrix as nnzgd nonzeros in coordinate storage (CS) format (see Section 2.1.1 in the F11 Chapter Introduction). The matrix has dimensions . irowgd specifies one-based row indices and icolgd specifies one-based column indices. No particular order of elements is expected, but elements should not repeat and the same order should be used when the Jacobian is evaluated for the solver, e.g., the value of where and should be stored in
in congrd in handle_solve_ipopt, for .
On entry: arrays irowgd and icolgd store the sparsity structure (pattern) of the Jacobian matrix as nnzgd nonzeros in coordinate storage (CS) format (see Section 2.1.1 in the F11 Chapter Introduction). The matrix has dimensions . irowgd specifies one-based row indices and icolgd specifies one-based column indices. No particular order of elements is expected, but elements should not repeat and the same order should be used when the Jacobian is evaluated for the solver, e.g., the value of where and should be stored in
in congrd in handle_solve_ipopt, for .
Constraints:
, for ;
, for .
6: – OptionalE04RKInput/Output
Optional parameter container, derived from Optional.
5.1Additional Quantities
1:
, the number of nonlinear constraints (number of rows of the Jacobian matrix).
2:
nnzgd gives the number of nonzeros in the Jacobian matrix.
6Exceptions 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).
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, . Constraint: .
On entry, . Constraint: .
On entry, , and . Constraint: .
On entry, , and . Constraint: .
On entry, more than one element of structural Jacobian matrix has row index and column index . Constraint: each element of structural Jacobian matrix must have a unique row and column index.
On entry, , and . Constraint: .
On entry, , , . Constraint: .
On entry, , , . Constraint: .
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.
7Accuracy
Not applicable.
8Parallelism and Performance
Please see the description for the underlying computational routine in this section of the
FL Interface documentation.
9Further Comments
10Example
Examples of the use of this method may be found in the examples for: handle_solve_ipopt.