Python API Reference#

This section documents the Gurobi Python interface. It begins with an overview of the global functions, which can be called without referencing any Python objects. It then discusses the different types of objects that are available in the interface, and the most important methods on those objects. Finally, it gives a comprehensive presentation of all of the available classes and methods.

If you are new to the Gurobi Optimizer, we suggest that you start with the Getting Started Knowledge Base article for general information. This also includes Tutorials for the different Gurobi APIs. Additionally, our Example Tour provides concrete examples of how to use the classes and methods described here. We will point to sections or examples of this tour whenever it fits in this overview.

In the Python examples in this documentation, we assume that your code starts with an import statement import gurobipy as gp so that global functions and types can be accessed through the gp. prefix. We also assume that the import statement from gurobipy import GRB is used so that all constants in the GRB class are directly accessible (e.g. as GRB.MINIMIZE).

Important

Due to limited Python support on AIX, our AIX port does not include the Python interface.

Contents