# NAG Library Function Document

## 1Purpose

nag_opt_handle_opt_set_file (e04zpc) is an option setting function for all solvers from the NAG optimization modelling suite. It can set one or more optional parameters from an external file.

## 2Specification

 #include #include
 void nag_opt_handle_opt_set_file (void *handle, Nag_FileID fileid, NagError *fail)

## 3Description

nag_opt_handle_opt_set_file (e04zpc) may be used to supply values for optional parameters to the solver from an external file. It can only be called on handles which have been initialized by nag_opt_handle_init (e04rac) and before the call to the solver. nag_opt_handle_opt_set_file (e04zpc) looks in the file for a specific section containing the optional parameters. The section must start with a line Begin and must finish with a line End. Anything outside the section is ignored. If there is more than one section like this, only the first one is processed. Any line within the section is either blank or a comment which is ignored or defines a single optional parameter as if it had been set by nag_opt_handle_opt_set (e04zmc). The implied data type (character, integer or real) of each value to be set must match that expected by the corresponding optional parameter. It is only necessary to supply values for those arguments whose values are to be different from their default values. A comment begins with an asterisk (*) and all subsequent characters to the end of the line are ignored. Comments can also be placed after the optional parameter. The file is case insensitive.
Note that the optional parameters printed by the solver or by nag_opt_handle_print (e04ryc) are in the compatible format. An example of a valid options file is:
```Begin * Example options file
Print Level = 3
Monitoring Level = 5 * output all details
Monitoring File = 42 * to this file
End```

None.

## 5Arguments

1:    $\mathbf{handle}$void *Input
On entry: the handle to the problem. It needs to be initialized by nag_opt_handle_init (e04rac) and must not be changed.
2:    $\mathbf{fileid}$Nag_FileIDInput
On entry: the file identifier associated with the argument data file. Note:  that the file needs to be opened in read mode by nag_open_file (x04acc) with ${\mathbf{mode}}=0$.
3:    $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
NE_HANDLE
The supplied handle does not define a valid handle to the data structure for the NAG optimization modelling suite. It has not been initialized by nag_opt_handle_init (e04rac) or it has been corrupted.
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 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_INVALID_FORMAT
The expected delimiter ‘$=$’ was not found on line $〈\mathit{\text{value}}〉$.
The optval provided on line $〈\mathit{\text{value}}〉$ could not be converted to the expected numerical type.
NE_INVALID_OPTION
The option provided on line $〈\mathit{\text{value}}〉$ was not recognized.
NE_INVALID_VALUE
The optval provided on line $〈\mathit{\text{value}}〉$ for the character optional parameter is not valid.
The optval provided on line $〈\mathit{\text{value}}〉$ for the integer optional parameter is out of bounds.
The optval provided on line $〈\mathit{\text{value}}〉$ for the real optional parameter is out of bounds.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_NOT_READ_FILE
BEGIN found, but end-of-file found before END. All optional parameters that were set from the file before this error was encountered will remain set on exit.
End-of-file or read error detected before BEGIN was found.
NE_PHASE
The options cannot be modified in this phase.

Not applicable.

## 8Parallelism and Performance

nag_opt_handle_opt_set_file (e04zpc) is not threaded in any implementation.

None.

## 10Example

See Section 10 in nag_opt_handle_init (e04rac) for links to all the examples in the suite.
© The Numerical Algorithms Group Ltd, Oxford, UK. 2017