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

**URL:** <https://discourse.julialang.org/t/jump-is-it-possible-to-switch-solver-version-back-and-forth-e-g-gurobi-7-5-8-0/10932>\
**Category:** Optimization (Mathematical)\
**Created:** [May 16, 2018, 4:21pm UTC](https://discourse.julialang.org/t/jump-is-it-possible-to-switch-solver-version-back-and-forth-e-g-gurobi-7-5-8-0/10932 "2018-05-16T16:21:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SingingKim](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Post date:** [May 16, 2018, 4:21pm UTC](https://discourse.julialang.org/t/jump-is-it-possible-to-switch-solver-version-back-and-forth-e-g-gurobi-7-5-8-0/10932/1 "2018-05-16T16:21:16Z")

</div>

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?

```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](https://global.discourse-cdn.com/julialang/original/3X/b/7/b7b3053a7008821637d42e4f20222d1f9b675526.png)

---

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [May 16, 2018, 5:17pm UTC](https://discourse.julialang.org/t/jump-is-it-possible-to-switch-solver-version-back-and-forth-e-g-gurobi-7-5-8-0/10932/2 "2018-05-16T17:17:41Z")

</div>

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()`.

---

<div class="post-metadata">

**Author:** ![SingingKim](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Post date:** [May 16, 2018, 6:24pm UTC](https://discourse.julialang.org/t/jump-is-it-possible-to-switch-solver-version-back-and-forth-e-g-gurobi-7-5-8-0/10932/4 "2018-05-16T18:24:12Z")

</div>

Thanks for the comment. That helps me a lot!

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [May 16, 2018, 9:16pm UTC](https://discourse.julialang.org/t/jump-is-it-possible-to-switch-solver-version-back-and-forth-e-g-gurobi-7-5-8-0/10932/5 "2018-05-16T21:16:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![NiclasMattsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niclasmattsson/32/21988_2.png) [@NiclasMattsson](https://discourse.julialang.org/u/NiclasMattsson)\
**Post date:** [November 8, 2018, 12:35pm UTC](https://discourse.julialang.org/t/jump-is-it-possible-to-switch-solver-version-back-and-forth-e-g-gurobi-7-5-8-0/10932/6 "2018-11-08T12:35:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [November 8, 2018, 2:39pm UTC](https://discourse.julialang.org/t/jump-is-it-possible-to-switch-solver-version-back-and-forth-e-g-gurobi-7-5-8-0/10932/7 "2018-11-08T14:39:00Z")

</div>

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:

> <https://github.com/jump-dev/Gurobi.jl/blob/master/deps/build.jl>
