MPS (.mps)

Background & Context

    • MPS mathematical file format.
    • De facto standard for specifying linear programming (LP) problems.
    • Commonly used as input format by LP solvers.
    • MPS is an acronym for Mathematical Programming System.
    • Plain text ASCII format, sometimes compressed as binary.
    • Stores data in a fixed-width tabular form.
    • Developed in the 1970s at IBM.

Import

  • Import["file.mps"] imports an MPS file, returning an expression representing an optimization problem.
  • Import["file.mps"] returns a list of objective functions and constraints in a form suitable as input for NMinimize.
  • Import["file.mps",elem] imports the specified element from an MPS file.
  • Import["file.mps",{elem,suba,subb,}] imports a subelement.
  • Import["file.mps",{{elem1,elem2,}}] imports multiple elements.
  • The import format can be specified with Import["file", "MPS"] or Import["file",{"MPS",elem,}].
  • See the following reference pages for full general information:
  • Importimport from a file
    CloudImportimport from a cloud object
    ImportStringimport from a string
    ImportByteArrayimport from a byte array

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary"summary of the file
    "Rules"list of rules for all available elements
  • Data representation elements:
  • "Equations"list of objective functions and constraints
    "LinearOptimizationData"vectors and matrices representing a linear program
    "ConstraintMatrix"matrix describing the constraints of a linear optimization problem
  • Import uses the "Equations" element by default.

Options

  • Import options:
  • "FreeFormat"Falsewhether data fields are loosely or strictly aligned in the file
    "EMPS"Falsewhether the file is compressed

Examples

Basic Examples  (3)

Get a list of Import elements from an MPS file:

Read an MPS file as a list of objective functions and constraints that is an expression suitable for LinearOptimization or NMinimize:

Use it as input for LinearOptimization:

Use it as input for NMinimize:

Read MPS data in a form suitable as input for LinearOptimization:

Use it as input for LinearOptimization:

Import and plot the constraint matrix of the previous example: