This section will work through a simple example in order to illustrate the use of various Gurobi APIs. The example builds a simple Mixed Integer Programming model, optimizes it, and outputs the optimal objective value. This section assumes that you are already familiar with your chosen programming language.
Python and Python matrix interface
Gurobi comes with a Python extension module called “gurobipy” that offers convenient object-oriented modeling constructs and an API to all Gurobi features. The Gurobi distribution also includes a Python interpreter and a basic set of Python modules (see the interactive shell), which are sufficient to build and run simple optimization models. You can also install
gurobipy into an existing Python installation or virtual environment (https://docs.python.org/3/library/venv.html).
A variety of books are available for learning the language (for example, The C Programming Language, by Kernighan and Ritchie).
A variety of books are available for learning the language (for example, The C++ Programming Language, by Stroustrup).
A variety of books and websites are available for learning the language (for example, the online Java tutorials).
If you are using an integrated development environment like Eclipse®, we recommend that you import the file
<installdir>/lib/gurobi-javadoc.jar, which contains Javadoc documentation for the Gurobi Java interface.
A variety of books and websites are available for learning the language (for example, the Microsoft online C# documentation).
While C# programs have historically only run on Windows machines, Microsoft has released an open-source, cross-platform .NET implementation (.NET Core) that allows you to run C# programs on Linux and macOS as well. You will find the Gurobi library that supports .NET Core 2 in <installdir>/lib/gurobi100.netstandard20.dll. For more information on how to obtain and use .NET Core, please refer to the .NET Tutorial.
We have special instructions on how to set up Gurobi for use within MATLAB.
We have special instructions on how to set up Gurobi for use with R.
Please sign in to leave a comment.