MPS

titanq.tools.from_mps(path: str | PathLike, model: Model, *, skip_empty_lines: bool = False) None

Configure a model with an .mps file. It currently supports these following sections.

  • NAME: The name of the problem.

  • ROWS: The definition of constraints.

  • COLUMNS: The coefficients for the variables.

  • RHS: The right-hand side values for the constraints.

  • BOUNDS: The bounds on the variables.

  • QUADOBJ or QMATRIX: The quadratic objective matrix

  • ENDATA: Marks the end of the data.

Integer variables in .mps files are supported both by the markers in the COLUMNS section and from the types in the BOUNDS section.

Parameters

path

The path to the .mps file

model

The instance of the model to configure

options

Additional options applied when parsing the .mps file

Example

>>> from titanq.tools import from_mps
>>> from titanq import Model
>>> model = Model()
>>> from_mps("path/to/file.mps", model)
>>> model.optimize()
titanq.tools.configure_model_from_mps_file(model: Model, file_path: Path) None

Deprecated since version 0.26.0: Use from_mps() instead.

Configure a model with an MPS file. Set the variable vector, the objective matrices and the constraints.

Parameters

model

The instance of the model to configure.

file_path

The path to the MPS file.

exception titanq.tools._mps.errors.MpsConfiguredModelError

Passed model is pre-configured

exception titanq.tools._mps.errors.MpsMalformedFileError

The file is malformed

exception titanq.tools._mps.errors.MpsMissingSectionError

A required section is missing

exception titanq.tools._mps.errors.MpsMissingValueError

A required value is missing

exception titanq.tools._mps.errors.MpsParsingError

Base class for any error related to the MPS files parsing module

exception titanq.tools._mps.errors.MpsUnexpectedValueError

Found an unexpected value

exception titanq.tools._mps.errors.MpsUnsupportedError

Found an unsupported value