NAG FL Interface
e04sbf (handle_​write_​file)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

e04sbf creates a data file from an existing data structure from the NAG optimization modelling suite for problems such as, Linear Programming (LP), Quadratic Programming (QP), Second-order Cone Programming (SOCP), Nonlinear Programming (NLP), or Mixed Integer Linear Programming (MILP).

2 Specification

Fortran Interface
Subroutine e04sbf ( handle, file, ftype, ifail)
Integer, Intent (Inout) :: ifail
Character (*), Intent (In) :: file, ftype
Type (c_ptr), Intent (In) :: handle
C Header Interface
#include <nag.h>
void  e04sbf_ (void **handle, const char *file, const char *ftype, Integer *ifail, const Charlen length_file, const Charlen length_ftype)
The routine may be called by the names e04sbf or nagf_opt_handle_write_file.

3 Description

e04sbf creates a data file from an existing data structure. Supported problem types include any problem defined using the handle interface within the NAG optimization modelling suite. The routine e04saf can use the file created to initialize the data into the handle structure. The file has a header which contains information such as integer size, working precision size, and NAG Binary file version number (for a compatibility check). The main contents of the file is divided into sections using flags. See Section 3.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite. Also see Section 2.2 in the E04 Chapter Introduction for more details on the standard formulations of the optimization problems (e.g., LP, QP, SOCP, NLP, and MILP).
Note that semidefinite programming problems with bilinear matrix inequalities (BMI-SDP) are not supported.

4 References

None.

5 Arguments

1: handle Type (c_ptr) Input
On entry: holds a handle to the internal data structure.
2: file Character(*) Input
On entry: the name of the file to be opened.
Constraint: must contain a valid filename for the computer system being used.
3: ftype Character(*) Input
On entry: the file format of the file to be created.
ftype='NAGBIN' or 'NB'
The input file is in NAG Binary format.
Constraint: ftype='NAGBIN' or 'NB'.
4: ifail Integer Input/Output
On entry: ifail must be set to 0, −1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of −1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value −1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or −1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=1
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 e04raf or it has been corrupted.
ifail=2
On entry, ftype=value.
Constraint: ftype='NAGBIN' or 'NB'.
ifail=3
Cannot open file value for reading.
ifail=4
Cannot close file.
ifail=5
An error occurred when writing to file.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
e04sbf is not threaded in any implementation.

9 Further Comments

None.

10 Example

This example demonstrates how to load data of an LP problem from a NAG Binary file and solve it using LP solver e04mtf.
We solve the following linear programming problem:
minimize
-0.02x1 -0.2x2 -0.2x3 -0.2x4 -0.2x5 +0.04x6 +0.04x7  
subject to the bounds
-0.01x10.01 -0.10x20.15 -0.01x30.03 -0.04x40.02 -0.10x50.05 -0.01x60.00 -0.01x70.00  
and the general constraints
x1 + x2 + x3 + x4 + x5 + x6 + x7 = -0.13 0.15x1 + 0.04x2 + 0.02x3 + 0.04x4 + 0.02x5 + 0.01x6 + 0.03x7 -0.0049 0.03x1 + 0.05x2 + 0.08x3 + 0.02x4 + 0.06x5 + 0.01x6 -0.0064 00.02x1 + 0.04x2 + 0.01x3 + 0.02x4 + 0.02x5 -0.0037 0.02x1 + 0.03x2 + 0.01x5 -0.0012 -0.0992 0.70x1 + 0.75x2 + 0.80x3 + 0.75x4 + 0.80x5 + 0.97x6 -0.003 0.02x1 + 0.06x2 + 0.08x3 + 0.12x4 + 0.02x5 + 0.01x6 + 0.97x7 -0.002.  

10.1 Program Text

Program Text (e04sbfe.f90)

10.2 Program Data

Program Data (e04sbfe.d)

10.3 Program Results

Program Results (e04sbfe.r)