naginterfaces.library.opt.handle_set_quadobj(handle, idxc=None, c=None, irowh=None, icolh=None, h=None)[source]

handle_set_quadobj is a part of the NAG optimization modelling suite and defines or redefines the objective function of the problem to be linear or quadratic.

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

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

idxcNone or int, array-like, shape , optional

The nonzero elements of the sparse vector . must contain the index of in the vector, for . The elements must be stored in ascending order. Note that is the current number of variables in the model.

cNone or float, array-like, shape , optional

The nonzero elements of the sparse vector . must contain the index of in the vector, for . The elements must be stored in ascending order. Note that is the current number of variables in the model.

irowhNone or int, array-like, shape , optional

Arrays , and store the nonzeros of the upper triangle 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.

icolhNone or int, array-like, shape , optional

Arrays , and store the nonzeros of the upper triangle 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.

hNone or float, array-like, shape , optional

Arrays , and store the nonzeros of the upper triangle 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.

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: (ascending order).

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, , and .

Constraint: (elements within the upper triangle).

(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_quadobj may be used to define the objective function of the problem as a quadratic function or a sparse linear function . If the objective function has already been defined, it will be overwritten. If handle_set_quadobj is called with no nonzeroes in either or , any existing objective function is removed, no new one is added and the problem will be solved as a feasible point problem. handle_set_linobj_coeff() may be used to set individual elements of the linear objective.

This objective function will typically be used for

Linear Programming (LP)

Quadratic Programming problems (QP)

or for Semidefinite Programming problems with bilinear matrix inequalities (BMI-SDP)

The matrix is a sparse symmetric matrix. It does not need to be positive definite. See the E04 Introduction for more details about the NAG optimization modelling suite.