MPS2GMS

Translates an MPS or LP file into an equivalent short generic GAMS program using a GDX file to store data. A number of solver specific extensions are recognized.

The MPS file is first attempted to be read in free format (no spaces in names). If it seems that row or column names have spaces but have at most 8 characters, parsing in fixed format is attempted. The MPS and LP readers of the HiGHS solver are utilized. GAMS Data Exchange (GDX) files and matching GAMS source is written.

Notes:

  • Row, column, SOS (special ordered sets), and cone names can have up to 63 characters and are tested for case sensitivity and uniqueness because these names become GAMS set members. If the test fails, the tool attempts to modify the names.
  • MPS files may contain multiple N rows. The first one will be used as objective function and remaining ones will be ignored.
  • If no optimization direction is given in a MPS file, minimization will be assumed.
  • Variables in SOS must be continuous.
  • SOS must not overlap. A variable cannot appear multiple times in the same SOS.

The MPS and LP formats have been extended in different forms by several solver vendors. Not all extensions are supported by MPS2GMS.

The following MPS sections are recognized by the free format parser:

  • NAME
  • OBJSENSE, MAX, MIN
  • ROWS
  • COLUMNS
  • RHS
  • BOUNDS
  • RANGES
  • QUADOBJ, QMATRIX
  • QSECTION, QCMATRIX
  • CSECTION with cone types QUAD and RQUAD
  • SETS, SOS
  • ENDATA

The fixed format parser also recognizes these sections except for QMATRIX, QSECTION, QCMATRIX, CSECTION, SETS, and SOS.

For a description of the MPS format, see also

The following LP format features are recognized:

  • Comments
  • Single objective function: linear or quadratic only
  • Constraints (Subject To section): linear or quadratic only
  • Variable bounds and types (Bounds, Binaries, Generals, Semis section); to specify semi-integer variables, they need to appear in sections Generals and Semis
  • Special ordered sets (SOS section)

For a description of the LP format, see also

Usage

mps2gms mpsfile | lpfile [ gdxfile [ gmsfile ] ] { key=value }

If the first parameter is not of the form key=value and ends with .lp or .lp.gz, it is assumed to be the name of an LP file, otherwise it is assumed to be the name of an MPS file. If no GDX filename is given, the name of the MPS or LP file is used, with .mps/.lp (or .mps.gz/.lp.gz) extension replaced by .gdx, or .gdx appended. If no GMS filename is given, the name of the GDX file is used, with .gdx extension replaced by .gms, or .gms appended.

Guide to parameters:

Key Description
MPS Name of MPS input file, can be compressed with GZIP
LP Name of LP input file, can be compressed with GZIP
GDX Name of GDX output file
GMS Name of GAMS program output file
CEQUATIONS Whether to write quadratic cones from CSECTION sections into deprecated =C= equations.
Possible values: 0, N, 1, Y.
Default: 0
COLUMNINTVARSAREBINARY Whether integer variables that appear first in COLUMNS section should be assumed to be binary variables.
Possible values: 0, N, 1, Y.
Default: 0.
Note that modern solvers assume binary variables, but for backward compatibility the default is set to the original IBM interpretation.
DUPLICATES Whether to check and how to handle multiple coefficients for the same variable or product in LP files.
If set to NOCHECK, then no checks for multiple coefficients are done. In this case, writing the GDX file may fail. For performance reasons, this is the default.
If set to ADD, then coefficient are added up.
If set to IGNORE, then additional coefficients are ignored and a warning is printed to the log.
If set to ERROR, then warnings are printed to the log and MPS2GMS terminates with a nonzero return code.