MPS File Reader
- titanq.tools.from_mps(path: str | PathLike, model: Model, *, skip_empty_lines: bool = False) None
Configure a model from 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.
If no RHS section is included, or any righthand side value is missing for a constraint, they will be set to 0.
Integer variables in MPS files are supported both by the markers in the COLUMNS section and from the types in the BOUNDS section. See https://www.ibm.com/docs/en/icos/22.1.1?topic=extensions-integer-variables-in-mps-files
Objective offsets in MPS files are supported in the RHS section. See https://www.ibm.com/docs/en/icos/22.1.0?topic=standard-records-in-mps-format#d184792e366
Parameters
- path
The path to the MPS file
- model
The instance of the model to configure. Must not be already configured.
- options
Additional options applied when parsing the MPS file
Raises
- OSError, FileNotFoundError
If the specified MPS file path cannot be open.
titanq.errors.MpsConfiguredModelError
If the provided model already contains data (e.g. variables).
titanq.errors.MpsParsingError
If the provided MPS file cannot be parsed.
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. Alternative form of
from_mps()
.Parameters
- model
The instance of the model to configure.
- file_path
The path to the MPS file.
Deprecated since version 0.26.0: Use
from_mps()
instead.