Python read from MPS not working
AnsweredI am trying to read an .mps file that is originally created by gurobi. I get the following error:
Can't import file 'debug_default.mps' into a model
I also tried to import the example .mps/.lp files that come with Gurobi installation but I get the same error. What could be the cause of this problem?
My code looks like this:
import gurobipy as gp
import os
os.chdir('.miniforge3/pkgs/gurobi-10.0.0-py310_0/share/doc/gurobi/examples/data')
model = gp.Model()
model.read('coins.mps')
0
-
Official comment
This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
You are trying to read the model file using the Model.read() method, which is used for reading data (like a MIP start or LP basis file) into an existing model. Instead, use gurobipy's read() function:
import gurobipy as gp
model = gp.read("/path/to/coins.mps")0
Post is closed for comments.
Comments
2 comments