I am trying to read a mps file using the following code:
using JuMP
using MathProgBase
using Gurobi
…
function readLP(s)
m_internal = MathProgBase.LinearQuadraticModel(GurobiSolver())
MathProgBase.loadproblem!(m_internal, s)
c = MathProgBase.getobj(m_internal)
A = MathProgBase.getconstrmatrix(m_internal)
…
end
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…
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.