naginterfaces.library.opt.handle_set_linobj¶
- naginterfaces.library.opt.handle_set_linobj(handle, cvec)[source]¶
handle_set_linobj
is a part of the NAG optimization modelling suite and defines or redefines the objective function of the problem to be linear.For full information please refer to the NAG Library document for e04re
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/e04/e04ref.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.- cvecfloat, array-like, shape
The dense vector of the objective function.
- 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, , expected .
Constraint: must match the current number of variables of the model in the .
- Notes
After the has been initialized (e.g.,
handle_init()
has been called),handle_set_linobj
may be used to define the objective function of the problem as a linear function using a dense vector . If the objective function has already been defined, it will be overwritten. If , any existing objective function is removed, no new one is added and the problem will be solved as a feasible point problem. It is recommended to usehandle_set_quadobj()
if the vector is sparse.handle_set_linobj_coeff()
may be used to set individual elements of the linear objective.This will typically be used for Linear Programming (LP)
Second-order Cone Programming (SOCP)
linear Semidefinite Programming problems (SDP)
or SDP with bilinear matrix inequalities (BMI-SDP) where the objective function has only linear terms. See the E04 Introduction for more details about the NAG optimization modelling suite.