# NAG CPP Interfacenagcpp::opt::handle_init (e04ra)

## 1Purpose

handle_init 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 "e04/nagcpp_e04ra.hpp"
#include "e04/nagcpp_class_CommE04RA.hpp"
```
```template <typename COMM>

void function handle_init(COMM &comm, const types::f77_integer nvar, OptionalE04RA opt)```
```template <typename COMM>

void function handle_init(COMM &comm, const types::f77_integer nvar)```

## 3Description

handle_init initializes an empty problem with $n$ decision variables, $x$, and returns a handle to the data structure. This handle may then be passed to some of the functions handle_​set_​group, handle_​set_​linobj, handle_​set_​quadobj, handle_​set_​nlnobj, handle_​set_​simplebounds, handle_​set_​linconstr, handle_​set_​nlnconstr, handle_​set_​nlnhess, handle_​set_​nlnls, e04rnf (no CPP interface) and e04rpf (no CPP interface) to formulate the problem (define the objective function and constraints) and to a compatible solver, e04fff (no CPP interface), handle_​solve_​dfls_​rcomm, e04jdf (no CPP interface), e04jef (no CPP interface), handle_​solve_​bounds_​foas, handle_​solve_​lp_​ipm, handle_​solve_​socp_​ipm, handle_​solve_​ipopt and e04svf (no CPP interface), to solve it. The handle must not be changed between calls. When the handle is no longer needed, handle_​free 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{comm}$CommE04RA Output
Communication structure.
2: $\mathbf{nvar}$types::f77_integer Input
On entry: $n$, the number of decision variables in the problem.
Constraint: ${\mathbf{nvar}}>0$.
3: $\mathbf{opt}$OptionalE04RA Input/Output
Optional parameter container, derived from Optional.

## 6Exceptions and Warnings

Errors or warnings detected by the function:
All errors and warnings have an associated numeric error code field, errorid, stored either as a member of the thrown exception object (see errorid), or as a member of opt.ifail, depending on how errors and warnings are being handled (see Error Handling for more details).
Raises: ErrorException
$\mathbf{errorid}=6$
On entry, ${\mathbf{nvar}}=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{nvar}}>0$.
$\mathbf{errorid}=10605$
On entry, the communication class $⟨\mathit{\text{value}}⟩$ has not been initialized correctly.
$\mathbf{errorid}=-99$
An unexpected error has been triggered by this routine.
$\mathbf{errorid}=-399$
Your licence key may have expired or may not have been installed correctly.
$\mathbf{errorid}=-999$
Dynamic memory allocation failed.

Not applicable.

## 8Parallelism and Performance

Please see the description for the underlying computational routine in this section of the FL Interface documentation.