# NAG CL Interfacee04rac (handle_​init)

Settings help

CL Name Style:

## 1Purpose

e04rac 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

 #include
 void e04rac (void **handle, Integer nvar, NagError *fail)
The function may be called by the names: e04rac or nag_opt_handle_init.

## 3Description

e04rac 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 e04tac and it is also possible to temporarily disable and enable individual variables in the model by e04tcc and e04tbc, respectively. This handle may then be passed to some of the functions 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 (e04ffc, e04fgc, e04ggc, e04jdc, e04jec, e04kfc, e04mtc, e04ptc, e04stc or e04svc). 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 functions of the suite. When the handle is no longer needed, e04rzc must be called to destroy it and deallocate all the allocated memory and data within. See Section 4.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite.

None.

## 5Arguments

1: $\mathbf{handle}$void ** 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{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INT
On entry, ${\mathbf{nvar}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nvar}}\ge 0$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

Not applicable.

## 8Parallelism and Performance

e04rac is not threaded in any implementation.

None.

## 10Example

See examples associated with other functions in the suite, such as:
• the examples in e04ffc and e04fgc present a data fitting problem solved by a DFO LSQ solver,
• the example in e04ggc solves a nonlinear regression (data fitting) problem with a trust-region based nonlinear least squares solver,
• the examples in e04jdc and e04jec demonstrate how to use a DFO NLP solver,
• the example in e04kfc solves a box-constrained nonlinear problem with a first-order solver,
• the example in e04mtc solves a small LP example using an LP IPM solver,
• the example in e04ptc solves a small Second-order Cone Programming (SOCP) problem,
• the example in e04rdc 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 e04rfc 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 e04rhc, the example also demonstrates the monitoring mode of the solver e04svc,
• the example in e04rjc solves LP/QP problems read in from an MPS file by e04mxc,
• an application for statistics, $E$ optimal design, solved as an SDP problem is shown in e04rnc,
• the example in e04rpc 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 e04rsc and e04rtc solve small convex QCQP problems which are automatically reformulated as SOCP,
• the example in e04rxc demonstrates how an approximate solution can be extracted during a monitoring step of e04mtc,
• the example in e04ryc walks through the life cycle of the handle in which a BMI-SDP problem is formulated and solved,
• the example in e04sac might serve as a template for benchmarking when a problem is loaded from a file and passed directly to the solver, in this case e04ptc,
• the example in e04stc is a small test from Hock and Schittkowski set to show how to call the NLP solver,
• the simple example in e04svc 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 e04tac and e04tcc.