Page 1 of 1

GAMS and the MPS format

Posted: Thu May 28, 2020 4:29 pm
by aileen
How do I import and export a model instance formated as a MPS file?

Re: GAMS and the MPS format

Posted: Thu May 28, 2020 4:41 pm
by aileen
GAMS can import and export model instances formated as a MPS file:
  • Export from GAMS:
    • The "solver" Convert (with option CplexMPS or fixed) writes an MPS file with trivial names (x1,x2,…,e1,e2,…), but it can also write a mapping file (use the Convert option dict) that allows you to map the trivial names to your name space.
    • Most LP/MIP solver have an option to write out an MPS file. Some of them even support to write the GAMS names to the MPS file, e.g.: CPLEX options (names yes, writemps mpsfile) or COINCBC options (names 1, writemps mpsfile).
  • Import to GAMS:
    • The command line tool mps2gms creates an almost generic gms file and a gdx file with the matrix data. mps2gms is part of any current GAMS distribution, please enter mps2gms at a command line prompt to get more information about it.
    • If you are a licensed academic user or hold a license to GAMS/SCIP you can use GAMS/SCIP to read MPS and LP files and convert them to scalar GAMS model files via the gams/interactive option in scip.opt: gams/interactive = "read somemodel.lp write genprob somemodel.gms quit".