# NAG CPP Interfacenagcpp::opt::handle_opt_set (e04zm)

Settings help

CPP Name Style:

## 1Purpose

handle_opt_set is an option setting function for all solvers from the NAG optimization modelling suite. It can set a single optional parameter or reset all of them to their default.

## 2Specification

```#include "e04/nagcpp_e04zm.hpp"
#include "e04/nagcpp_class_CommE04RA.hpp"
```
```template <typename COMM>

void function handle_opt_set(COMM &comm, const string optstr, OptionalE04ZM opt)```
```template <typename COMM>

void function handle_opt_set(COMM &comm, const string optstr)```

## 3Description

handle_opt_set can only be called on handles which have been correctly initialized (e.g., by handle_​init) and not during the call to the solver. It has two purposes: to reset all optional parameters to their default values; or to set a single optional parameter to a user-supplied value.
Optional parameters and their values are, in general, presented as a character string, optstr, of the form ‘$\mathit{option}=\mathit{optval}$’; alphabetic characters can be supplied in either upper or lower case. Both $\mathit{option}$ and $\mathit{optval}$ may consist of one or more tokens separated by white space. The tokens that comprise $\mathit{optval}$ will normally be either an integer, real or character value as defined in the description of the specific optional parameter. In addition all optional parameters can take an $\mathit{optval}$ DEFAULT which resets the optional parameter to its default value.
Information relating to available option names and their corresponding valid values is given in the documentation of the particular solver. See also Section 3.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite.

None.

## 5Arguments

1: $\mathbf{comm}$CommE04RA Input/Output
Communication structure. An object of either the derived class CommE04RA or its base class NoneCopyableComm can be supplied. It is recommended that the derived class is used. If the base class is supplied it must first be initialized via a call to opt::handle_init (e04ra).
2: $\mathbf{optstr}$string Input
On entry: a string identifying the optional parameter and its value to be set.
$\mathbf{Defaults}$
Resets all options to their default values.
$\mathit{Option}=\mathit{optval}$
See the documentation of the particular solver for details of valid values for $\mathit{option}$ and $\mathit{optval}$. The equals sign ($=$) delimiter must be used to separate the $\mathit{option}$ from its $\mathit{optval}$ value.
$\mathit{Option}=\mathbf{Default}$
Resets the given optional parameter back to its default value.
optstr is case insensitive. Each token in the $\mathit{option}$ and $\mathit{optval}$ component must be separated by at least one space.
3: $\mathbf{opt}$OptionalE04ZM 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}=1$
comm::handle has not been initialized.
$\mathbf{errorid}=1$
comm::handle does not belong to the NAG optimization modelling suite,
has not been initialized properly or is corrupted.
$\mathbf{errorid}=1$
comm::handle has not been initialized properly or is corrupted.
$\mathbf{errorid}=2$
The options cannot be modified while solver is running.
$\mathbf{errorid}=11$
On entry, the $\mathit{option}$ supplied in optstr was not recognized:
${\mathbf{optstr}}=⟨\mathit{value}⟩$.
$\mathbf{errorid}=12$
On entry, the expected delimiter ‘$=$’ was not found in optstr:
${\mathbf{optstr}}=⟨\mathit{value}⟩$.
$\mathbf{errorid}=13$
On entry, could not convert the specified $\mathit{optval}$ to an integer:
$\mathit{optval}=⟨\mathit{value}⟩$.
$\mathbf{errorid}=13$
On entry, could not convert the specified $\mathit{optval}$ to a real:
$\mathit{optval}=⟨\mathit{value}⟩$.
$\mathbf{errorid}=15$
On entry, the $\mathit{optval}$ supplied for the integer option is not
valid.
$\mathit{option}=⟨\mathit{value}⟩$,
$\mathit{optval}=⟨\mathit{value}⟩$.
Constraint: $\mathit{optval}\ge ⟨\mathit{value}⟩$.
$\mathbf{errorid}=15$
On entry, the $\mathit{optval}$ supplied for the integer option is not
valid.
$\mathit{option}=⟨\mathit{value}⟩$,
$\mathit{optval}=⟨\mathit{value}⟩$.
Constraint: $\mathit{optval}>⟨\mathit{value}⟩$.
$\mathbf{errorid}=15$
On entry, the $\mathit{optval}$ supplied for the integer option is not
valid.
$\mathit{option}=⟨\mathit{value}⟩$,
$\mathit{optval}=⟨\mathit{value}⟩$.
Constraint: $\mathit{optval}\le ⟨\mathit{value}⟩$.
$\mathbf{errorid}=15$
On entry, the $\mathit{optval}$ supplied for the integer option is not
valid.
$\mathit{option}=⟨\mathit{value}⟩$,
$\mathit{optval}=⟨\mathit{value}⟩$.
Constraint: $\mathit{optval}<⟨\mathit{value}⟩$.
$\mathbf{errorid}=16$
On entry, the $\mathit{optval}$ supplied for the real option is not valid.
$\mathit{option}=⟨\mathit{value}⟩$,
$\mathit{optval}=⟨\mathit{value}⟩$.
Constraint: $\mathit{optval}\ge ⟨\mathit{value}⟩$.
$\mathbf{errorid}=16$
On entry, the $\mathit{optval}$ supplied for the real option is not valid.
$\mathit{option}=⟨\mathit{value}⟩$,
$\mathit{optval}=⟨\mathit{value}⟩$.
Constraint: $\mathit{optval}>⟨\mathit{value}⟩$.
$\mathbf{errorid}=16$
On entry, the $\mathit{optval}$ supplied for the real option is not valid.
$\mathit{option}=⟨\mathit{value}⟩$,
$\mathit{optval}=⟨\mathit{value}⟩$.
Constraint: $\mathit{optval}\le ⟨\mathit{value}⟩$.
$\mathbf{errorid}=16$
On entry, the $\mathit{optval}$ supplied for the real option is not valid.
$\mathit{option}=⟨\mathit{value}⟩$,
$\mathit{optval}=⟨\mathit{value}⟩$.
Constraint: $\mathit{optval}<⟨\mathit{value}⟩$.
$\mathbf{errorid}=17$
On entry, the $\mathit{optval}$ supplied for the character option is not
valid.
$\mathit{option}=⟨\mathit{value}⟩$,
$\mathit{optval}=⟨\mathit{value}⟩$.
$\mathbf{errorid}=10605$
On entry, the communication class $⟨\mathit{\text{value}}⟩$ has not been initialized correctly.
$\mathbf{errorid}=10703$
An exception was thrown during IO (writing).
$\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.