NAG CL Interface
e04sbc (handle_​write_​file)

Settings help

CL Name Style:


1 Purpose

e04sbc 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

#include <nag.h>
void  e04sbc (void *handle, const char *filename, const char *ftype, NagError *fail)
The function may be called by the names: e04sbc or nag_opt_handle_write_file.

3 Description

e04sbc 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 e04sac 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 4.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 void * Input
On entry: holds a handle to the internal data structure.
2: filename const char * 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 const char * 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: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
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 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 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_NOT_CLOSE_FILE
Cannot close file.
NE_READ_ERROR
Cannot open file value for reading.
NE_STR_UNKNOWN
On entry, ftype=value.
Constraint: ftype=NAGBIN or NB.
NE_WRITE_ERROR
An error occurred when writing to file.

7 Accuracy

Not applicable.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
e04sbc 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 e04mtc.
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 (e04sbce.c)

10.2 Program Data

Program Data (e04sbce.d)

10.3 Program Results

Program Results (e04sbce.r)