Disclaimer: What I did here might work on Windows or OSX, but I give no
Request by Clóvis Gonzaga.
First, create an account here and login.
Secondly, download the appropriate Gurobi version clicking on Gurobi
In my case, it is Linux 64 bits. Where to download this is optional, but you
have to remember, as we’ll use later. I use a folder
packages on my home
Third, unpack the file. For linux, you might have a file-roller that allows
clicking and unpacking trivially, but I’ll use the command line.
Open a terminal and navigate to the folder where you downloaded the file.
tar -zxf gurobi7.0.2_linux64.tar.gz
This creates folder
gurobi702. Inside is folder
Inside are many folders, one being
docs which include the quick start guide
you might want to read (or not).
Fourth, your system needs to see this installation. On
bash (the usual
terminal on Ubuntu), you have to open file
.bashrc on your home folder, to
input some variables.
input the following at the end of the file:
/FULL/PATH part. This is where you downloaded the package, but it
has to be the full path there. You can use
$HOME to reference your home
folder. For instance, your
Desktop is in
$HOME/Desktop. My packages folder
Also notice the
GRB_LICENSE_FILE variable. If you intend to put your license
somewhere else, you’ll need to change that part.
After that is done you need to either (a) close and reopen the terminal or (b)
To know that it’s working enter
grbgetkey on the terminal. If it’s working,
a message like
Gurobi license key client (version 7.0.2)
Copyright (c) 2017, Gurobi Optimization, Inc.
Enter the Key Code for the license you are activating
(format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx):
will appear. Press “CTRL+C” or close the terminal, because you need to get the
Getting the LICENSE
If you already applied for a license before installing Gurobi, you can go to
this page to see your
available licenses. Otherwise, you need to (a) buy a license; (b) apply for
an academic license or (c) ask for a trial license.
I’m gonna focus on the academic license.
Get your academic license clicking on “Academic
Accept the conditions and agreements and click “Request License”.
Notice that you need to fulfill some requirement to ask for an academic
license, like being a student or professor.
After requesting your license, you will get to a page showing your license
information and a line saying
Copy all that line and paste on your terminal.
The software will connect to Gurobi and check that it’s a valid serial number,
and then will download a file
gurobi.lic. (Press ENTER or choose a different
folder). If you choose a different folder, remember to change
To check that it’s working, enter
on a terminal. It will a “Gurobi Interactive Shell” message and a prompt
“gurobi> “. It if gives any error, check the Quick User Guide.
Gurobi with JuMP in Julia
For the advanced students, if you know the Julia
Language, and the JuMP Modelling
Language, you should be able to install
Gurobi with the julia command
Pkg.add("Gurobi") now. Make sure you’re in a
terminal with all variables set.
The following examples solves a simple problem with JuMP and Gurobi:
using JuMP, Gurobi
m = Model(solver=GurobiSolver(Presolve=0)) # Presolve=0 otherwise it will be trivial
@variable(m, x[1:2] >= 0, Int)
@objective(m, Max, x + 2*x)
@constraint(m, x + 10*x <= 30)
@constraint(m, 10*x + x <= 29)