Gurobi Optimizer Example Tour#

Version 12.0

The Gurobi distribution includes an extensive set of examples that illustrate commonly used features of the Gurobi libraries. Most examples have versions for C, C++, C#, Java, Python, and Visual Basic. A few, however, illustrate features that are specific to the Python interface.

The distribution also includes examples for our MATLAB and R interfaces. Note, however, that our interfaces to these languages are built around the assumption that you will use the rich matrix-oriented capabilities of the underlying languages to build your optimization models. Thus, our examples for these languages don’t attempt to show you how to build models. We have instead chosen to provide a few simple examples that demonstrate how to pass matrices into our interface.

This document provides a brief tour of these examples. We won’t go through each example in detail. Instead, we’ll start with an Overview of the set of tasks that you are likely to want to perform with the Gurobi Optimizer. Later sections will then describe how specific examples accomplish each of these tasks. Alternatively, we provide a Structured List of all of our examples, which you can use to dive directly into an example of interest to you. In either case, we suggest that you browse the example source code (in a text editor, or in another browser window) while reading this document. This document includes Source Code for all of the examples, in all available languages. Source files are also available in the examples directory of the Gurobi distribution.

If you would like further details on any of the Gurobi routines used in these examples, please consult the Gurobi Reference Manual.