Example details

Let us now walk through the example, line by line, to understand how it achieves the desired result of optimizing the indicated model.

The example begins by importing the Gurobi functions and classes:

from gurobipy import *

Gurobi Python applications should always start with this line.

Note that in order for this command to succeed, the Python application needs to know how to find the Gurobi functions and classes. Recall that you have three options here. The first is to use the Python files that are included with our distribution. You would run this example by typing gurobi.bat mip1.py. The second is to install the Anaconda Python distribution. The third is to install the Gurobi functions and classes into your own Python installation.