# Data Loader for MPS format files

Mathematical Programming System (MPS) is one of the file formats used in linear programming (LP) and mixed-integer programming (MIP) problems. JijModeling can read mathematical models and their instances defined in MPS files. We describe a brief use of a function for MPS files.

## Getting MIPLIB Dataset​

We can get MIPLIB benchmark set as follows:

import jijmodeling.datasetmiplib = jijmodeling.dataset.Miplib()

We can also use instance_statistics to obtain statistics on MIPLIB benchmark set. We check information such as the number of constraints, the number of binary variables, and the number of integer variables. Here, only data with zero number of continuous variables and less than 500 constraints are displayed.

import pandas as pddf = pd.DataFrame(miplib.instance_statistics).Tdf[(df["continuous"]==0)&(df["constraint"]<500)]

We load "gen-ip002" from MIPLIB dataset.

problem, instance_data = miplib.load("gen-ip002")

load returns JijModeling Problem and the corresponding instance data.
With Jupyter Notebook, we can check the mathematical model loaded.

problem

$\begin{array}{cccc}\text{Problem:} & \text{gen-ip002} & & \\& & \min \quad \displaystyle \sum_{i^I = 0}^{N^I - 1} c^I_{i^I} \cdot x^I_{i^I} & \\\text{{s.t.}} & & & \\ & \text{Inequality constraint (<=)} & \displaystyle \sum_{i^I = 0}^{N^I - 1} a^{I\le}_{j^\le, i^I} \cdot x^I_{i^I} \leq b^\le_{j^\le} & \forall j^\le \in \left\{0,\ldots,M^\le - 1\right\} \\\text{{where}} & & & \\& x^I & 1\text{-dim integer variable}& \text{Integer variables}\\ & & \text{lower bound: }l^I & \\ & & \text{upper bound: }u^I & \\\end{array}$

We solve this problem using JijZept.

import jijzept as jz# set samplersampler = jz.JijSASampler(config='../config.toml')# solve problemresults = sampler.sample_model(problem, instance_data, search=True, num_reads=100)

We select feasible solutions from the output results.

# get feasible solutionsfeasibles = results.feasible()if feasibles.evaluation.objective.size == 0:    print("No feasibles solution")else:    feas_objs = feasibles.evaluation.objective    print(min(feas_objs))    

0.0

Using JijModeling function, it is possible to read in MIPLIB data set and MPS files.

## References​

[1][MPS file format](https://www.ibm.com/docs/en/icos/22.1.1?topic=cplex-mps-file-format-industry-standard)
[2][MIPLIB 2017](https://miplib.zib.de/index.html)