handle_read_file initializes a data structure for the NAG optimization modelling suite from a data file for problems such as, Linear Programming (LP), Quadratic Programming (QP), Second-order Cone Programming (SOCP), or linear Semidefinite Programming (SDP).

For full information please refer to the NAG Library document for e04sa

https://www.nag.com/numeric/nl/nagdoc_29/flhtml/e04/e04saf.html

Parameters
filestr

The name of the file to be opened.

ftypestr

The expected file format of the input file. is case insensitive.

or

The input file is in MPS format.

or

The input file is in SDPA format.

Returns
handleHandle

Holds a handle to the internal data structure. It must not be changed between calls to the NAG optimization modelling suite.

pinfoint, ndarray, shape

Problem sizes and statistics as given in the table below:

 0 Number of variables (nvar). 1 Number of integer variables. 2 Number of binary variables. 10 Number of Lagrange multipliers (dual variables) for the bound constraints and linear constraints (nnzu). 11 Number of Lagrange multipliers (dual variables) for the cone constraints (nnzuc). 12 Number of nonzeros in all Lagrange multipliers for the matrix constraints (nnzua). 20 Flag indicating the objective function type, 0: no objective, 1: linear objective, 2: quadratic without linear term, 3: quadratic with linear term, 4: general nonlinear, 5: nonlinear least square with dense Jacobian, 6: nonlinear least square with sparse Jacobian. 21 Number of residuals defined in a nonlinear least square problem. 30 Definition of box constraints, 0: not defined, 1: defined. 31 Number of linear constraints. 32 Number of nonlinear constraints. 33 Definition of Hessian for nonlinear objective and constraints, 0: not defined, −1: defined as Lagrangian, 1: defined as individual Hessians of the objective and the constraints. 40 Number of cone constraints. 41 Number of matrix inequality constraints. 42 Number of quadratic constraints. otherwise Reserved for future use. 42–99 Reserved for future use.

, , and define the problem size and are required by other functions such as handle_solve_lp_ipm(), handle_solve_socp_ipm() and handle_solve_pennon() in the optimization suite.

Raises
NagValueError
(errno )

On entry, .

Constraint: , , or .

(errno )

(errno )

Cannot close file.

(errno )

The input file seems to be empty. No data was read.

(errno )

Reading from the file caused an unknown error on line .

(errno )

The token on line at position to was not recognized as a valid integer.

(errno )

The token on line at position to was not recognized as a valid real number.

(errno )

The token on line starting at position was too long and was not recognized.

(errno )

An invalid number of variables was given on line .

The number stated there is and needs to be at least .

(errno )

An invalid number of blocks was given on line .

The number stated there is and needs to be at least .

(errno )

An invalid size of the block number was given on line .

The number stated there is and needs to be nonzero.

(errno )

Not enough data was given on line specifying block sizes.

Expected tokens but found only .

(errno )

Not enough data was given on line specifying the objective function.

Expected tokens but found only .

(errno )

Not enough data was given on line specifying nonzero matrix elements.

Expected tokens but found only .

(errno )

Invalid structural data found on line .

The given matrix number is out of bounds. Its value must be between and (inclusive).

(errno )

Invalid structural data found on line .

The given block number is out of bounds. Its value must be between and (inclusive).

(errno )

Invalid structural data found on line .

The given row index is out of bounds, it must respect the size of the block. Its value must be between and (inclusive).

(errno )

Invalid structural data found on line .

The given column index is out of bounds, it must respect the size of the block. Its value must be between and (inclusive).

(errno )

Invalid structural data found on line .

The specified nonzero element is not in the upper triangle.

The row index is and column index is .

(errno )

Invalid structural data found on line .

The specified element belongs to a diagonal block but is not diagonal.

The row index is and column index is .

(errno )

An entry in the constraints with , , row index and column index was defined more than once. All entries need to be unique.

(errno )

A premature end of the input stream. The part defining the number of variables was not found.

(errno )

A premature end of the input stream. The part defining the number of blocks was not found.

(errno )

A premature end of the input stream. The part defining the dimensions of the blocks was not found.

(errno )

A premature end of the input stream. The part defining the objective function was not found.

(errno )

A premature end of the input stream. The part defining the nonzero entries was not found.

(errno )

Line : Incorrect ordering of indicator lines.

OBJNAME indicator line found after ROWS indicator line.

(errno )

Line : Incorrect ordering of indicator lines.

COLUMNS indicator line found before ROWS indicator line.

(errno )

Line : Incorrect ordering of indicator lines.

RHS indicator line found before COLUMNS indicator line.

(errno )

Line : Incorrect ordering of indicator lines.

RANGES indicator line found before RHS indicator line.

(errno )

Line : Incorrect ordering of indicator lines.

BOUNDS indicator line found before COLUMNS indicator line.

(errno )

Line : Incorrect ordering of indicator lines.

QUADOBJ indicator line found before BOUNDS indicator line.

(errno )

Line : Incorrect ordering of indicator lines.

QUADOBJ indicator line found before COLUMNS indicator line.

(errno )

Line : Incorrect ordering of indicator lines.

CSECTION indicator line found before COLUMNS indicator line.

(errno )

Line : Unknown indicator line .

(errno )

Line : Indicator line ‘’ has been found more than once in the MPS file.

(errno )

End of file found before ENDATA indicator line.

(errno )

(errno )

Line : An illegal line was detected in section.

This is neither a comment nor a valid data line.

(errno )

Line : Unknown inequality key in ROWS section.

Expected ‘N’, ‘G’, ‘L’ or ‘E’.

(errno )

Line : Empty ROWS section.

Neither the objective row nor the constraints were defined.

(errno )

The supplied name in OBJNAME of the objective row was not found among the free rows in the ROWS section.

(errno )

Line : Illegal row name.

Row names must consist of printable characters only.

(errno )

Line : Illegal column name.

Column names must consist of printable characters only.

(errno )

Line : Row name has been defined more than once in the ROWS section.

(errno )

Line : Column ‘’ has been defined more than once in the COLUMNS section. Column definitions must be continuous. (See COLUMNS Section).

(errno )

Line : Found 'INTORG' marker within 'INTORG' to 'INTEND' range.

(errno )

Line : Found 'INTEND' marker without previous marker being 'INTORG'.

(errno )

Line : Found 'INTORG' but not 'INTEND' before the end of the COLUMNS section.

(errno )

Line : Illegal marker type .

Should be either 'INTORG' or 'INTEND'.

(errno )

Line : Unknown row name in section.

All row names must be specified in the ROWS section.

(errno )

Line : Unknown column name in section.

All column names must be specified in the COLUMNS section.

(errno )

Inconsistent bounds for row ‘’.

(errno )

Inconsistent bounds for column ‘’.

(errno )

Line : Unknown bound type in BOUNDS section.

(errno )

More than one nonzero of has row name ‘’ and column name ‘’ in the COLUMNS section.

(errno )

Field did not contain a number (see MPS input format).

(errno )

Both quadratic objective and cone constraints found, not supported.

(errno )

Line : Second-order cone should have at least variables.

(errno )

Line : Rotated second-order cone should have at least variables.

(errno )

Line : Unknown cone type .

(errno )

Line : Illegal cone name.

Cone names must consist of printable characters only.

(errno )

Line : Cone name has been defined more than once.

(errno )

Line : Column name has been defined more than once in cone constraint.

Notes

handle_read_file reads a file in one of the supported file formats and stores the data in a new handle. The supported formats are MPS and its derivatives (for LP, QP, SOCP) and sparse SDPA for linear semidefinite programming problems. See Further Comments for more details on the supported file formats. It might be useful to refer to the file format you use to fully understand the possible error messages. Once the file is successfuly processed, the problem can be solved by a compatible solver from the suite or queried via the printing function handle_print(). Once the problem is not needed any more, handle_free() should be called to destroy the handle and deallocate the memory held within. See the E04 Introduction for more details about the NAG optimization modelling suite. Also see the E04 Introduction for more details on the standard formulations of the optimization problems (e.g., LP, QP, SOCP and SDP) for better understanding on the notations used in this document.

References

Borchers, B, 1999, SDPLIB 1.2, A Library of semidefinite programming test problems, Optimization Methods and Software (11(1)), 683–690, http://euler.nmt.edu/~brian/sdplib/

Fujisawa, K, Kojima, M and Nakata, K, 1998, SDPA (Semidefinite Programming Algorithm) User’s Manual, Technical Report B-308, Department of Mathematical and Computing Sciences, Tokyo Institute of Technology.

IBM, 1971, MPSX – Mathematical programming system, Program Number 5734 XM4, IBM Trade Corporation, New York