e05 Chapter Contents
e05 Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_glopt_opt_set (e05zkc)

## 1  Purpose

nag_glopt_opt_set (e05zkc) either initializes or resets the optional argument arrays or sets a single optional argument for supported problem solving functions in Chapter e05. The following functions are supported:

## 2  Specification

 #include #include
 void nag_glopt_opt_set (const char *optstr, Integer iopts[], Integer liopts, double opts[], Integer lopts, NagError *fail)

## 3  Description

nag_glopt_opt_set (e05zkc) has three purposes: to initialize optional argument arrays; to reset all optional arguments to their default values; or to set a single optional argument to a user-supplied value.
Optional arguments and their values are, in general, presented as a character string, optstr, of the form ‘option $\text{}=\mathit{optval}$’; alphabetic characters can be supplied in either upper or lower case. Both 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 argument. In addition all optional arguments can take an $\mathit{optval}$ DEFAULT which resets the optional argument to its default value.
It is imperative that optional argument arrays are initialized before any options are set, before the relevant problem solving function is called and before any options are queried using nag_glopt_opt_get (e05zlc). To initialize the optional argument arrays iopts and opts for a specific problem solving function, the option Initialize is used with optval identifying the problem solving function to be called, via its short name. For example, to initialize optional argument arrays to be passed to nag_glopt_bnd_pso (e05sac), nag_glopt_opt_set (e05zkc) is called as follows:
```nag_glopt_opt_set("Initialize = e05sac", iopts, liopts, opts, lopts, &fail)
```
Information relating to available option names and their corresponding valid values is given in Section 11 in nag_glopt_bnd_pso (e05sac), nag_glopt_nlp_pso (e05sbc) and nag_glopt_nlp_multistart_sqp (e05ucc).

None.

## 5  Arguments

1:     optstrconst char *Input
On entry: a string identifying the option to be set.
$\mathbf{Initialize}=\mathit{function name}$
Initialize the optional argument arrays iopts and opts for use with function $\mathit{function name}$, where $\mathit{function name}$ is the short name associated with the function of interest.
$\mathbf{Defaults}$
Resets all options to their default values.
$\mathbf{Option}=\mathit{optval}$
See Section 11 in nag_glopt_bnd_pso (e05sac), nag_glopt_nlp_pso (e05sbc) and nag_glopt_nlp_multistart_sqp (e05ucc) for details of valid values for option and optval. The equals sign ($=$) delimiter must be used to separate the option from its optval value.
optstr is case insensitive. Each token in the option and optval component must be separated by at least one space.
2:     iopts[liopts]IntegerCommunication Array
On entry: optional argument array.
If optstr has the form ${\mathbf{Initialize}}=\mathit{function name}$, the contents of iopts need not be set.
Otherwise, iopts MUST NOT have been altered since the last call to nag_glopt_opt_set (e05zkc), nag_glopt_opt_get (e05zlc) or the selected problem solving function.
On exit: dependent on the contents of optstr, either an initialized, reset or updated version of the optional argument array.
3:     lioptsIntegerInput
On entry: the length of the array iopts.
Constraint: unless otherwise stated in the documentation for a specific, supported, problem solving function, ${\mathbf{liopts}}\ge 100$.
4:     opts[lopts]doubleCommunication Array
On entry: optional argument array.
If optstr has the form ${\mathbf{Initialize}}=\mathit{function name}$, the contents of opts need not be set.
Otherwise, opts MUST NOT have been altered since the last call to nag_glopt_opt_set (e05zkc), nag_glopt_opt_get (e05zlc) or the selected problem solving function.
On exit: dependent on the contents of optstr, either an initialized, reset or updated version of the optional argument array.
5:     loptsIntegerInput
On entry: the length of the array opts.
Constraint: Unless otherwise stated in the documentation for a specific, supported, problem solving function, ${\mathbf{lopts}}\ge 100$.
6:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INT
On entry, ${\mathbf{liopts}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{lopts}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{liopts}}\ge ⟨\mathit{\text{value}}⟩$ and ${\mathbf{lopts}}\ge ⟨\mathit{\text{value}}⟩$.
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.
NE_INVALID_FORMAT
On entry, optstr did not contain the delimiter ‘$=$’.
On entry, the optval, $"⟨\mathit{\text{value}}⟩"$, associated with optstr was partially recognized as a numerical value. However, it could not be fully interpreted.
The option in optstr is associated with a numerical value. However, the optval, $"⟨\mathit{\text{value}}⟩"$, present in optstr is non-numerical.
NE_INVALID_OPTION
Either the option arrays have become corrupted, or they were not initialized together.
Either the option arrays have not been initialized, have been corrupted, or are not compatible with this option setting function.
On entry, optstr has not been recognized.
The $\mathbf{option}=\mathit{optval}$ pairing present in optstr is not compatible with the function for which the option arrays were initialized.
NE_INVALID_VALUE
On entry, the absolute value of the integer present in optstr is above the maximum allowable value.
$\left|\mathit{ivalue}\right|=⟨\mathit{\text{value}}⟩$, $\left|\mathit{ivalue}\right|\le ⟨\mathit{\text{value}}⟩$ required.
On entry, the absolute value of the integer present in optstr is below the minimum required value.
$\left|\mathit{ivalue}\right|=⟨\mathit{\text{value}}⟩$, $\left|\mathit{ivalue}\right|\ge ⟨\mathit{\text{value}}⟩$ required.
On entry, the integer value present in optstr is above the maximum allowable value.
$\mathit{ivalue}=⟨\mathit{\text{value}}⟩$, $\mathit{ivalue}\le ⟨\mathit{\text{value}}⟩$ required.
On entry, the integer value present in optstr is below the minimum allowable value.
$\mathit{ivalue}=⟨\mathit{\text{value}}⟩$, $\mathit{ivalue}\ge ⟨\mathit{\text{value}}⟩$ required.
On entry, the integer value present in optstr is outside of allowable bounds.
$\mathit{ivalue}=⟨\mathit{\text{value}}⟩$, $⟨\mathit{\text{value}}⟩\le \mathit{ivalue}\le ⟨\mathit{\text{value}}⟩$ required.
On entry, the integer value present in optstr is outside the allowable set.
$\mathit{ivalue}=⟨\mathit{\text{value}}⟩$.
On entry, the magnitude of the real value present in optstr is above the maximum allowable value.
$\left|\mathit{rvalue}\right|=⟨\mathit{\text{value}}⟩$, $\left|\mathit{rvalue}\right|\le ⟨\mathit{\text{value}}⟩$ required.
On entry, the magnitude of the real value present in optstr is below the minimum required.
$\left|\mathit{rvalue}\right|=⟨\mathit{\text{value}}⟩$, $\left|\mathit{rvalue}\right|\ge ⟨\mathit{\text{value}}⟩$ required.
On entry, the optval in optstr is not compatible with the option in optstr.
On entry, the real value present in optstr is above the maximum allowable value.
$\mathit{rvalue}=⟨\mathit{\text{value}}⟩$ and $\mathit{rvalue}<⟨\mathit{\text{value}}⟩$ required.
On entry, the real value present in optstr is below the minimum required value.
$\mathit{rvalue}=⟨\mathit{\text{value}}⟩$, $\mathit{rvalue}>⟨\mathit{\text{value}}⟩$ required.
On entry, the real value present in optstr is outside allowable bounds.
$\mathit{rvalue}=⟨\mathit{\text{value}}⟩$, $⟨\mathit{\text{value}}⟩\le \mathit{rvalue}\le ⟨\mathit{\text{value}}⟩$ required.
On entry, the real value present in optstr is outside the allowable set.
$\mathit{rvalue}=⟨\mathit{\text{value}}⟩$.
NE_NOT_FUN_NAME
On entry, the option in optstr has been detected as Initialize, however the optval, $"⟨\mathit{\text{value}}⟩"$, associated with optstr has not been recognized as a valid function name.

## 7  Accuracy

Not applicable.

Some options have default values which are problem dependent. For example the option ${\mathbf{Maximum Iterations Completed}}$ for nag_glopt_bnd_pso (e05sac) has the default value $1000×{\mathbf{ndim}}$. If options such as this are set, they may only be set to constant values. If such an option is reset to its DEFAULT value its dependence on the specific problem will be restored.