Initializing help system before first use

# XPRSreadprob (READPROB)

Purpose
Reads an (X)MPS or LP format matrix from file.
Topic areas
File IO, Problem Creation
Synopsis
`int XPRS_CC XPRSreadprob(XPRSprob prob, const char *filename, const char *flags);`
`READPROB [-flags] [filename]`
Arguments

prob | The current problem.
filename | The path and file name from which the problem is to be read. Limited to MAXPROBNAMELENGTH characters. If omitted, the default problem_name is used with various extensions - see below.
flags | Flags to be passed:
l | only filename.lp is searched for;
v | use the provided filename verbatim, without appending the .mps, .mat or .lp extension;
z | read a compressed input file.

Related controls
Integer

EXTRACOLS | Number of extra columns to be allowed for.
EXTRAELEMS | Number of extra matrix elements to be allowed for.
EXTRAMIPENTS | Number of extra MIP entities to be allowed for.
EXTRAROWS | Number of extra rows to be allowed for.
KEEPNROWS | Status for nonbinding rows.
MPSECHO | Whether MPS comments are to be echoed.
MPSFORMAT | Specifies format of MPS files.
SCALING | Type of scaling.

Double

MATRIXTOL | Tolerance on matrix elements.
SOSREFTOL | Minimum gap between reference row entries.

String

MPSBOUNDNAME | The active bound name.
MPSOBJNAME | Name of objective function row.
MPSRANGENAME | Name of range.
MPSRHSNAME | Name of right hand side.

Example 1 (Library)

    XPRSreadprob(prob,"myprob","");

This instructs the Optimizer to read an MPS format matrix from the first file found out of myprob.mat, myprob.mps or (in LP format) myprob.lp.
See also examples addmipsol.c, fixbv.c, globjpar.c, glrhspar.c, knapsack.c, mipsolenum.c, mipsolpool.c, mostviolated.c, repair.c, roundint.c, savesol.c, solenum.c, tableau.c, trimloss.c.
Example 2 (Console)

    READPROB -l

This instructs the Optimizer to read an LP format matrix from the file problem_name .lp.
Further information
1. If the function fails and the error is anything but "Xpress has not been initialized" or "out of memory" then the problem will be reset to empty and the objective sense will be reset to "minimize". If the function returns with "out of memory" then the only safe thing to do with the problem is to call XPRSdestroyprob().
2. If no flags are given, file types are searched for in the order: .mps, .mat, .lp. Matrix files are assumed to be in XMPS or MPS format unless their file extension is .lp in which case they must be LP files. Files with compressed extensions are also searched for, e.g., .mps.gz.
3. The Optimizer can read matrix files that have been compressed using one of the following formats, as long as the command-line tool necessary to decompress the file can be located in the path: bzip2, xz, lzma, Z, zip, tar, tgz. The Optimizer has built-in support for the gz format: no external tools are necessary to read gzipped matrix files.
4. If filename has been specified, the problem name is changed to filename, ignoring any extension.
5. XPRSreadprob ( READPROB) will take as the objective function the first N type row in the matrix, unless the string parameter MPSOBJNAME has been set, in which case the objective row sought will be the one named by MPSOBJNAME. Similarly, if non-blank, the string parameters MPSRHSNAME, MPSBOUNDNAME and MPSRANGENAME specify the right hand side, bound and range sets to be taken. For example:
MPSOBJNAME="Cost"
MPSRHSNAME="RHS 1"
READPROB
The treatment of N type rows other than the objective function depends on the KEEPNROWS control. If KEEPNROWS is 1 the rows and their elements are kept in memory; if it is 0 the rows are retained, but their elements are removed; and if it is -1 the rows are deleted entirely. The performance impact of retaining such N type rows will be small unless the presolve has been disabled by setting PRESOLVE to 0 prior to optimization.
6. The Optimizer checks that the matrix file is in a legal format and displays error messages if it detects errors. When the Optimizer has read and verified the problem, it will display summary problem statistics.
7. By default, the MPSFORMAT control is set to -1 and XPRSreadprob ( READPROB) determines automatically whether the MPS files are in free or fixed format. If MPSFORMAT is set to 0, fixed format is assumed and if it is set to 1, free format is assumed. Fields in free format MPS files are delimited by one or more blank characters. The keywords NAME, ROWS, COLUMNS, QUADOBJ / QMATRIX, QCMATRIX, DELAYEDROWS, MODELCUTS, SETS, RHS, RANGES, BOUNDS and ENDATAmust start in column one and no vector name may contain blanks. If a special ordered set is specified with a reference row, its name may not be the same as that of a column. Note that numeric values which contain embedded spaces (for example after unary minus sign) will not be read correctly unless MPSFORMAT is set to 0.
8. If the problem is not to be scaled automatically, set the parameter SCALING to 0 before issuing the XPRSreadprob ( READPROB) command.
Related topics
XPRSloadmip, XPRSloadlp, XPRSloadmiqp, XPRSloadqp, XPRSwriteprob.
Parent Topic Console and Library Functions

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.