naginterfaces.library.opt.handle_​set_​qconstr_​fac

naginterfaces.library.opt.handle_set_qconstr_fac(handle, s, mf, idqc, idxr=None, r=None, irowf=None, icolf=None, f=None)[source]

handle_set_qconstr_fac is a part of the NAG optimization modelling suite and defines a new, or edits an existing, quadratic objective function or constraint of the problem using a factor of the quadratic coefficient matrix.

For full information please refer to the NAG Library document for e04rt

https://www.nag.com/numeric/nl/nagdoc_28.7/flhtml/e04/e04rtf.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.

sfloat

The constant term in quadratic constraint.

If , will not be referenced.

mfint

, row dimension of matrix .

idqcint

A new quadratic constraint is created.

Specifies the index of an existing constraint to be replaced. i.e., replaces the th constraint.

A new quadratic objective is created and will replace any previously defined objective function.

idxrNone or int, array-like, shape , optional

The nonzero elements of the sparse vector . must contain the index of in the vector, for . No particular order is expected, but elements should not repeat. Note that is the current number of variables in the problem.

rNone or float, array-like, shape , optional

The nonzero elements of the sparse vector . must contain the index of in the vector, for . No particular order is expected, but elements should not repeat. Note that is the current number of variables in the problem.

irowfNone or int, array-like, shape , optional

Arrays , and store the nonzeros of the matrix in coordinate storage (CS) format (see the F11 Introduction). specifies one-based row indices, specifies one-based column indices and specifies the values of the nonzero elements in such a way that where , , for . No particular order is expected, but elements should not repeat.

icolfNone or int, array-like, shape , optional

Arrays , and store the nonzeros of the matrix in coordinate storage (CS) format (see the F11 Introduction). specifies one-based row indices, specifies one-based column indices and specifies the values of the nonzero elements in such a way that where , , for . No particular order is expected, but elements should not repeat.

fNone or float, array-like, shape , optional

Arrays , and store the nonzeros of the matrix in coordinate storage (CS) format (see the F11 Introduction). specifies one-based row indices, specifies one-based column indices and specifies the values of the nonzero elements in such a way that where , , for . No particular order is expected, but elements should not repeat.

Returns
idqcint

If on entry, then is overwritten with the index of the new quadratic constraint. By definition, this is the number of quadratic constraints already defined plus one. Otherwise, stays unchanged.

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, .

The given does not match with any quadratic constraint already defined.

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

and cannot be zero at the same time.

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, more than one element of has index .

Constraint: each element of must have a unique index.

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, more than one element of has row index and column index .

Constraint: each element of must have a unique row and column index.

Notes

After the has been initialized (e.g., handle_init() has been called), handle_set_qconstr_fac may be used to edit a model by adding or replacing a quadratic objective function or constraint of the form

and

respectively.

The matrix is a sparse matrix. It can be viewed as the factor of the symmetric matrix in a general quadratic function

It is also acceptable if is a zero matrix, in which case the corresponding objective function or constraint becomes linear. If you have the full matrix as input data, please call function handle_set_qconstr() instead. Note that it is possible to temporarily disable and enable individual constraints in the model by handle_disable() and handle_enable(), respectively. See the E04 Introduction for more details about the NAG optimization modelling suite.