[JuMP] Is it possible to switch solver version back and forth? (e.g. Gurobi 7.5 <-> 8.0)

Is it possible to switch solver version back and forth? (e.g. Gurobi 7.5 ↔ 8.0)
Also, is there any command to display Solver version that I am using on Julia?

using JuMP, Gurobi
m = Model(solver = GurobiSolver())
@variable(m, x[1:3] >= 0)
@objective(m, Min, -3x[1]-x[2]-3x[3])
@constraint(m, 2x[1]+x[2]+x[3] <= 2)
@constraint(m, x[1]+2x[2]+3x[3] <= 5)
@constraint(m, 2x[1]+2x[2]+x[3] <= 6)
print(m)
status = solve(m)
getobjectivevalue(m)
getvalue(x)

image

As far as I know you would need to swap out your license files. Obviously you can write a few functions to automate this, but as far as I know that is the best you can do.

Looks like you can check your Gurobi version by doing Gurobi.getlibversion().

Thanks for the comment. That helps me a lot!

My not great way to do this is to modify the GUROBI_HOME environment variable to point to the other installation and then run Pkg.build("Gurobi") each time.

Bumping this in the hope that someone else has a better solution. Swapping license files or rebuilding the solver interface package are really ugly hacks. How would the license swap work anyway? I thought the same license file is valid for all Gurobi versions.

You just need a license for the most recent version. You need to run Pkg.build("Gurobi") because the build script writes a Julia file that tells Gurobi.jl where to find the library.

Here is the build script: