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.dataset
miplib = 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 pd
df = pd.DataFrame(miplib.instance_statistics).T
df[(df["continuous"]==0)&(df["constraint"]<500)]
Loading MPS format files
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
We solve this problem using JijZept.
import jijzept as jz
# set sampler
sampler = jz.JijSASampler(config='../config.toml')
# solve problem
results = sampler.sample_model(problem, instance_data, search=True, num_reads=100)
We select feasible solutions from the output results.
# get feasible solutions
feasibles = 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)