# NAG FL Interfacee04ref (handle_​set_​linobj)

## 1Purpose

e04ref is a part of the NAG optimization modelling suite and defines the linear objective function of the problem.

## 2Specification

Fortran Interface
 Subroutine e04ref ( nvar, cvec,
 Integer, Intent (In) :: nvar Integer, Intent (Inout) :: ifail Real (Kind=nag_wp), Intent (In) :: cvec(nvar) Type (c_ptr), Intent (In) :: handle
#include <nag.h>
 void e04ref_ (void **handle, const Integer *nvar, const double cvec[], Integer *ifail)
The routine may be called by the names e04ref or nagf_opt_handle_set_linobj.

## 3Description

After the initialization routine e04raf has been called, e04ref may be used to define the objective function of the problem as a linear function ${c}^{\mathrm{T}}x$ using a dense vector $c$ unless the objective function has already been defined by another routine in the suite. This will typically be used for linear programming (LP)
 $minimize x∈ℝn cTx (a) subject to lB≤Bx≤uB, (b) lx≤x≤ux , (c)$ (1)
second-order cone programming (SOCP)
 $minimize x∈ℝn cTx (a) subject to lB≤Bx≤uB, (b) lx≤x≤ux , (c) xGi∈Kmi,i=1,…,r, (d)$ (2)
linear semidefinite programming problems (SDP)
 $minimize x∈ℝn cTx (a) subject to ∑ i=1 n xi Aik - A0k ⪰ 0 , k=1,…,mA , (b) lB≤Bx≤uB , (c) lx≤x≤ux , (d)$ (3)
or SDP with bilinear matrix inequalities (BMI-SDP) where the objective function has only linear terms. It is recommended to use e04rff if the vector $c$ is sparse. See Section 3.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite.

None.

## 5Arguments

1: $\mathbf{handle}$Type (c_ptr) Input
On entry: the handle to the problem. It needs to be initialized by e04raf and must not be changed before the call to e04ref.
2: $\mathbf{nvar}$Integer Input
On entry: $n$, the number of decision variables $x$ in the problem. It must be unchanged from the value set during the initialization of the handle by e04raf.
3: $\mathbf{cvec}\left({\mathbf{nvar}}\right)$Real (Kind=nag_wp) array Input
On entry: the dense vector $c$ of the objective function.
4: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $-1$ is recommended since useful values can be provided in some output arguments even when ${\mathbf{ifail}}\ne {\mathbf{0}}$ on exit. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{ifail}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
${\mathbf{ifail}}=1$
The supplied handle does not define a valid handle to the data structure for the NAG optimization modelling suite. It has not been initialized by e04raf or it has been corrupted.
${\mathbf{ifail}}=2$
The problem cannot be modified in this phase any more, the solver has already been called.
${\mathbf{ifail}}=3$
The objective function has already been defined.
${\mathbf{ifail}}=4$
On entry, ${\mathbf{nvar}}=〈\mathit{\text{value}}〉$, expected $\mathrm{value}=〈\mathit{\text{value}}〉$.
Constraint: nvar must match the value given during initialization of handle.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

Not applicable.

## 8Parallelism and Performance

e04ref is not threaded in any implementation.