.NET Interface (C#)
This section assumes that you are already familiar with the C# programming language. If not, 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 recently released an open-source, cross-platform .NET
implementation (.NET Core) that allows you to run C# programs on
Linux and Mac OS as well. You will find the Gurobi library that
supports .NET Core 2 in
information on how to obtain and use .NET Core, please refer to the
We will work through a simple C# example in order to illustrate the use of the Gurobi .NET interface. The example builds a model, optimizes it, and outputs the optimal objective value.
Our example optimizes the following model:
|subject to||x||+||2 y||+||3 z||4|
|x, y, z binary|