naginterfaces.library.opt.handle_set_nlnconstr¶
- naginterfaces.library.opt.handle_set_nlnconstr(handle, bl=None, bu=None, irowgd=None, icolgd=None)[source]¶
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.For full information please refer to the NAG Library document for e04rk
https://www.nag.com/numeric/nl/nagdoc_29.2/flhtml/e04/e04rkf.html
- Parameters
- handleHandle
The handle to the problem. It needs to be initialized (e.g., by
handle_init()
) and must not be changed between calls to the NAG optimization modelling suite.- blNone or float, array-like, shape , optional
and 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 .
- buNone or float, array-like, shape , optional
and 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 .
- irowgdNone or int, array-like, shape , optional
Arrays and store the sparsity structure (pattern) of the Jacobian matrix as nonzeros in coordinate storage (CS) format (see the F11 Introduction). The matrix has dimensions . specifies one-based row indices and 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 in
handle_solve_ipopt()
, for .- icolgdNone or int, array-like, shape , optional
Arrays and store the sparsity structure (pattern) of the Jacobian matrix as nonzeros in coordinate storage (CS) format (see the F11 Introduction). The matrix has dimensions . specifies one-based row indices and 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 in
handle_solve_ipopt()
, for .
- Raises
- NagValueError
- (errno )
has not been initialized.
- (errno )
does not belong to the NAG optimization modelling suite, has not been initialized properly or is corrupted.
- (errno )
has not been initialized properly or is corrupted.
- (errno )
The problem cannot be modified right now, the solver is running.
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, , and .
Constraint: .
- (errno )
On entry, , and .
Constraint: .
- (errno )
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.
- (errno )
On entry, , and .
Constraint: .
- (errno )
On entry, , , .
Constraint: .
- (errno )
On entry, , , .
Constraint: .
- Notes
After the 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. Ifhandle_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:where is the number of the decision variables , is the number of the nonlinear constraints (in [equation](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 option ‘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., and forhandle_solve_ipopt()
).An individual set of bounds can be also modified by
handle_set_bound()
. Note that it is also possible to temporarily disable and enable individual constraints in the model by callinghandle_disable()
andhandle_enable()
, respectively.See the E04 Introduction for more details about the NAG optimization modelling suite.