juliaversiongurobijulia-jump

How to determine Gurobi or solver version in JuMP


In Python, you can do:

print(gurobipy.gurobi.version())

What is the equivalent for Julia and JuMP?

I tried

using Gurobi
Gurobi.version()

Without success. I am not trying to get Gurobi.jl package version which can be obtained with ] status Gurobi.


Solution

  • @przemyslaw-szufel's answer is mostly correct, but it can be wrong with the minor version. The constants he refers to are actually the ones we copy from the gurobi.h file, not from the Gurobi library itself, so you might get v9.5.0 returned when the actual library is v9.5.1.

    You can get the exact version using:

    julia> using Gurobi
    
    julia> const MOI = Gurobi.MOI
    MathOptInterface
    
    julia> v = MOI.get(Gurobi.Optimizer(), MOI.SolverVersion())
    "9.1.0"
    
    julia> VersionNumber(v)
    v"9.1.0"
    

    this is mostly solver-independent, although not all packages support MOI.SolverVersion.