# NAG FL Interfacee04raf (handle_​init)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

e04raf initializes a data structure for the NAG optimization modelling suite for problems such as, Linear Programming (LP), Quadratic Programming (QP), Nonlinear Programming (NLP), Least Squares (LSQ) problems, Second-order Cone Programming (SOCP), linear Semidefinite Programming (SDP) and Semidefinite Programming with Bilinear Matrix Inequalities (BMI-SDP).

## 2Specification

Fortran Interface
 Subroutine e04raf ( nvar,
 Integer, Intent (In) :: nvar Integer, Intent (Inout) :: ifail Type (c_ptr), Intent (Out) :: handle
#include <nag.h>
 void e04raf_ (void **handle, const Integer *nvar, Integer *ifail)
The routine may be called by the names e04raf or nagf_opt_handle_init.

## 3Description

e04raf initializes an empty problem, adds $n\ge 0$ decision variables, $x$, and returns a handle to the data structure. Note that further variables may be added to the problem later by e04taf and it is also possible to temporarily disable and enable individual variables in the model by e04tcf and e04tbf, respectively. This handle may then be passed to some of the routines of the suite to formulate the problem (define or edit the variables, the objective function and constraints). Once the problem is fully defined, the handle may be passed to a suitable solver from the suite (e04fff, e04fgf, e04ggf, e04jdf, e04jef, e04kff, e04mtf, e04ptf, e04stf or e04svf). Afterwards, the problem may be further modified or passed to another solver of the suite. The handle must not be changed between calls to the routines of the suite. When the handle is no longer needed, e04rzf must be called to destroy it and deallocate all the allocated memory and data within. 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) Output
Note: handle does not need to be set on input.
On exit: holds a handle to the internal data structure where an empty problem with nvar variables is defined.
2: $\mathbf{nvar}$Integer Input
On entry: $n$, the initial number of decision variables defining the problem.
Constraint: ${\mathbf{nvar}}\ge 0$.
3: $\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 $0$ is recommended. 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}}=6$
On entry, ${\mathbf{nvar}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nvar}}\ge 0$.
${\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

e04raf is not threaded in any implementation.

None.

## 10Example

See examples associated with other routines in the suite, such as:
• the examples in e04fff and e04fgf present a data fitting problem solved by a DFO LSQ solver,
• the example in e04ggf solves a nonlinear regression (data fitting) problem with a trust-region based nonlinear least squares solver,
• the examples in e04jdf and e04jef demonstrate how to use a DFO NLP solver,
• the example in e04kff solves a box-constrained nonlinear problem with a first-order solver,
• the example in e04mtf solves a small LP example using an LP IPM solver,
• the example in e04ptf solves a small Second-order Cone Programming (SOCP) problem,
• the example in e04rdf demonstrates how to use the SDPA file reader and how to solve linear semidefinite programming problems, including printing of the matrix Lagrangian multipliers,
• the example in e04rff presents an alternative way to compute the nearest correlation matrix by means of nonlinear semidefinite programming,
• a matrix completion problem (minimization of a rank of a partially unknown matrix) formulated as SDP is demonstrated in e04rhf, the example also demonstrates the monitoring mode of the solver e04svf,
• the example in e04rjf solves LP/QP problems read in from an MPS file by e04mxf,
• an application for statistics, $E$ optimal design, solved as an SDP problem is shown in e04rnf,
• the example in e04rpf reads a BMI-SDP problem from a file which can be modified, in this case it solves a Static Output Feedback (SOF) problem,
• the examples in e04rsf and e04rtf solve small convex QCQP problems which are automatically reformulated as SOCP,
• the example in e04rxf demonstrates how an approximate solution can be extracted during a monitoring step of e04mtf,
• the example in e04ryf walks through the life cycle of the handle in which a BMI-SDP problem is formulated and solved,
• the example in e04saf might serve as a template for benchmarking when a problem is loaded from a file and passed directly to the solver, in this case e04ptf,
• the example in e04stf is a small test from Hock and Schittkowski set to show how to call the NLP solver,
• the simple example in e04svf demonstrates on the Lovász $\vartheta$ function eigenvalue optimization problem formulated as SDP,
• modelling capabilities of the suite (edits of an existing problem) are demonstrated in the examples in e04taf and e04tcf.