I am trying to read a mps file using the following code:
m_internal = MathProgBase.LinearQuadraticModel(GurobiSolver())
c = MathProgBase.getobj(m_internal)
A = MathProgBase.getconstrmatrix(m_internal)
This code was working a while ago, however now when I call the function readLP() I have the following error
" UndefVarError: GurobiSolver not defined"
I have gurobi installed and its working properly since I am using it in some other part of the code without any problem…
I’m guessing that your version of Gurobi.jl no longer supports MathProgBase, but uses MathOptInterface instead.
The most recent releases of Gurobi.jl no longer support MathProgBase (which was discontinued some time ago in favor of MathOptInterface).
You have a few options:
If you want to stick to your old code (and use MathProgBase), you must use an older version of Gurobi.jl: see these instructions.
If you just need to read an MPS file and extract the corresponding data, you can use the QPSReader package. It can read MPS and QPS files, in fixed and free format.
You can update to the newest Gurobi.jl release (which requires Gurobi v9.0 or later), and use MathOptInterface instead of MathProfBase.
MOI has a number of built-in parsers you can use, see the docs here.
For some reason, I missed adding
GurobiSolver to the list of deprecated functions: https://github.com/jump-dev/Gurobi.jl/pull/368
I suggest you update to the latest version.