NAG Library Function Document

nag_opt_handle_opt_set_file (e04zpc)


    1  Purpose
    7  Accuracy
    10  Example


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.


#include <nag.h>
#include <nage04.h>
void  nag_opt_handle_opt_set_file (void *handle, Nag_FileID fileid, NagError *fail)


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




1:     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:     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 mode=0.
3:     fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

Error Indicators and Warnings

Dynamic memory allocation failed.
See Section in How to Use the NAG Library and its Documentation for further information.
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.
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.
The expected delimiter ‘=’ was not found on line value.
The optval provided on line value could not be converted to the expected numerical type.
The option provided on line value was not recognized.
The optval provided on line value for the character optional parameter is not valid.
The optval provided on line value for the integer optional parameter is out of bounds.
The optval provided on line value for the real optional parameter is out of bounds.
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.
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.
The options cannot be modified in this phase.


Not applicable.

Parallelism and Performance

nag_opt_handle_opt_set_file (e04zpc) is not threaded in any implementation.

Further Comments



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