Notebooks and code in Julia for COMM 612.
- Download Gurobi. It's best to stick with the default settings and do a "standard installation".
- To use Gurobi, you will need a free academic license. For this step, you will need to be on an academic network; it's easiest if you are physically at your school and on the university WiFi. Register for a Gurobi account, log in to the User Portal, and generate a Named-User Academic license. When you run the
grbgetkeycommand, you will be asked "In which directory would you like to store the Gurobi license file?" I use the default, which is/Users/my-username. - Download Julia.
- Open Julia. In Julia, you will first need to set the
GUROBI_HOMEenvironment variable to wherever Gurobi was installed, as described in this README:
# On Windows, this might be
ENV["GUROBI_HOME"] = "C:\\Program Files\\gurobi1100\\win64"
# ... or perhaps ...
ENV["GUROBI_HOME"] = "C:\\gurobi1100\\win64"
# On Mac, this might be
ENV["GUROBI_HOME"] = "/Library/gurobi1100/mac64"
# ... or perhaps ...
ENV["GUROBI_HOME"] = "/Library/gurobi1100/macos_universal2"- Then, install the Gurobi package in Julia by running the following:
import Pkg
Pkg.add("Gurobi")- Install the JuMP package in Julia by running
Pkg.add("JuMP"). - Run the following code in Julia to test whether Gurobi is working properly.
using JuMP, Gurobi
model = JuMP.Model(Gurobi.Optimizer)
@variable(model, x >= 0)
@objective(model, Min, x)
optimize!(model)- You will need IJulia to open and run my notebooks. To install the IJulia package, run
Pkg.add("IJulia"). (Each notebook also includes package dependences in the header, which need to be installed before running the notebook.) - Either download or clone this repository and navigate to the directory containing the notebook that you want to run. Run the following in Julia:
using IJulia
notebook(dir = ".")Please report any issues so that I can expand this list.
- If you switched the order of the Gurobi instructions and tried to run
Pkg.add("Gurobi")before settingENV["GUROBI_HOME"]or before downloading the Gurobi Optimizer...- First, remove the
Gurobi.jlpackage by runningPkg.rm("Gurobi"). Then, close Julia and start over, using the order of instructions as written in this README. - Alternatively, you could try to run
Pkg.build("Gurobi"). - See this thread for discussion.
- First, remove the
- If you can use Gurobi in the Julia REPL but not in IJulia, try restarting Julia and IJulia.