MATH 441 Gurobi Files and Links, Fall 2018

This page concerns some examples that we will use in Gurobi for MATH 441, Fall 2018. The lab LSK 310 will soon be running Gurobi.

In class I will call the "Gurobi shell," which on a Mac can be done (1) by running the Gurobi app (i.e., clicking on the icon), or (2) opening a terminal window any typing "gurobi.sh".

News No news is good news.
Installation I recommend that you use the Gurobi Optimizer for projects and homework; it is ranks among the best commercial products (such as CPLEX, Mosek), and Gurobi offers convenient, free academic versions. Visit Gurobi's Academic Center to get a license for University Users.

Gurobi offers support regarding installation issues for academic users. One student had a Gurobi installation issue involving Xcode (on a Mac). [One fix for Xcode issues is to download the latest version from the App Store (it's a large download) and to open the app once (you may also have to tell Xcode to install the Command Line Tools under the Locations tab of the Preferences).]
Running Gurobi There are a number of ways of running Gurobi.
You can click on the Gurobi icon, which will bring up a terminal window running the Gurobi shell. You may want to use the commands (really Python commads): "import os", "os.getcwd()", "os.chdir(".."), "help(os)", etc. to navigate to the directory you like.
You can run python (or python3 or another variant of Python) from a terminal window, and then use "from gurobipy import *" to get all the Gurobi commands.
You can run a "python script" in a manner that we will show in class. Many of Gurobi's examples are written as python scripts (note that they begin with "#!/usr/bin/python").
There are a number of popular variants of python that you can install (which come with standard libraries). You will then need to make sure that your variant loads the gurobipy library. Gurobi provides instructions, such as how to install the Anaconda version of python on a Mac and the commands needed to set up Gurobi there, or their more general webpage on getting Anaconda.
Gurobi's Documentation Gurobi's documentation homepage
Gurobi's Example Tour
Gurobi shell "quickstart" intro (for a Mac)
Sample Gurobi *.lp Files Gurobi provides a number of sample *.lp files. Here are some used in class (these are *.txt files for the sake of your web browser, but save them as *.lp files for use with Gurobi):
The toy LP based on a toy problem of which TV programs to watch; there is only one constraint (on the total number of hours of TV watched)
A variant of the above LP, where certain TV programs have a limit of hours per day
A variant of the last LP, where certain TV programs have non-integer limits of hours per day
A variant of the last LP, where certain decision variables must be integers.

An IP for the easy Sudoku puzzle solved on Sept 21.
Sudoku Here is an IP (integer program) to solve the easy Sudoku puzzle solved on Sept 21.
Gurobi actually has its own Sudoku examples on this webpage of Gurobi examples, built in the following languages: C, C++, C#, Java, MATLAB, Python (which is also the language of the Gurobi shell), R, and VB.
Basic Gurobi shell commands Here is a list of some basic Gurobi shell commands. If you haven't used Unix before, you may consult this webpage on Unix and Gurobi Fundamentals.
Working in Python or the Gurobi shell In October we will describe how to set up models in the Gurobi shell or--what is almost the same--in Python where you import the gurobipy library. Review Unix and Gurobi Fundamentals, see some simple Python covered in class.

UBC Math Home| Joel Friedman Home| Course Materials