Reading mps file with MathProgBase

Hi,

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…

I’m guessing that your version of Gurobi.jl no longer supports MathProgBase, but uses MathOptInterface instead.

1 Like

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:

  1. If you want to stick to your old code (and use MathProgBase), you must use an older version of Gurobi.jl: see these instructions.

  2. 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.

  3. 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.

4 Likes

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.

1 Like