The SMPS command generates the underlying algebraic formulation for the current model and then writes it to a disk file in MPS format. MPS format is a common format for representing linear programming models. MPS files can be ported to any solver that reads MPS files—this includes most commercial linear programming packages.

The syntax for the SMPS command is:

SMPS filename

where filename is the name of the file you wish to save the MPS representation of the model under.

In the following example, we input a small model and then save it as an MPS file:

: !Enter a small model

: MODEL

? MAX = 20*X + 30*Y;

? X <= 50;

? Y <= 60;

? X + 2*Y <= 120;

? END

: !Save model to an MPS file

: SMPS MYMODEL.MPS

:

If you open the MPS file created in a text editor, you should find:

NAME    LINGO GENERATED MPS FILE( MAX)

ROWS

 N 1

 L 2

 L 3

 L 4

COLUMNS

   Y         1           30.0000000

   Y         3            1.0000000

   Y         4            2.0000000

   X         1           20.0000000

   X         2            1.0000000

   X         4            1.0000000

RHS

   RHS       2           50.0000000

   RHS       3           60.0000000

   RHS       4          120.0000000

ENDATA

Note:Your model must be entirely linear to be able to successfully export it using SMPS. If a model is nonlinear, the MPS file will contain question marks in place of numbers for coefficients of nonlinear variables.
Note:SMPS truncates all variable names to 8 characters. For instance, the two distinct LINGO names SHIP( WH1, C1) and SHIP( WH1, C2) would both be truncated to the single 8 character name SHIPWH1C under SMPS . Either choose names to avoid collisions of truncated names, or enable the RCMPSN option for converting names to RC format when doing MPS I/O. LINGO will print an error message if potential collisions exist.
Note:The MPS file format is intended primarily for exporting models to other applications or platforms. The MPS format is purely scalar in nature—all set-based information is lost upon converting a LINGO model to MPS format. Thus, when saving copies of a model on your own machine, you should always use the SAVE command instead of the SMPS command.
Note:When exporting a stochastic program to MPS format, LINGO will write a total of four SMPS format files, consisting of a header file, the core model, its stochastic declarations and its time structure.