Building an Optimization Model: Exploring Your Options

When building an optimization model, one must choose from among two alternatives: Using Gurobi with a proprietary modeling language such as AMPL or GAMS, or using Gurobi with a full programming language such as C, C++, C#, Java, Python, VB, MATLAB or R. Using a modeling language can be an attractive choice, especially for non-programmers, given the perceived ease with which a model can be formulated. Using a programming language can be a much more powerful and flexible choice if you are interested in formulating a model and then deploying that model and/or integrating it into an application for others to use. This perceived trade-off led us to wonder, why should someone have to choose between easy or powerful? Is there a way to combine the ease of the modeling language with the power and flexibility of a programming language, without requiring significant programming skills on the part of the modeler?

 

Introducing the Gurobi Python Environment

The Gurobi Python Environment combines the benefits a modeling language with the strengths a programming language. By embedding our set of high-level optimization modeling constructs in the very popular Python programming language, we’ve eliminated the need to choose between working in just a modeling language or just a programming language. The Gurobi Python environment allows you to tap into the vast ecosystem of Python, a mature, full-featured and easy-to-use language. With Python, you can take advantage of numerous available pre-written and tested packages (over 50,000 at last count) that can save you significant development time when creating new capabilities for your program. And based on our experience, since Python is a very readable and easy programming language to get started with, we think you’ll be most productive in the Gurobi Python environment—even if you are already familiar with another programming language. By using Python, we’ve created an environment that is:

  • Flexible and powerful – Use it just for prototyping, or to create full-featured optimization applications.
  • Easy to use – Create simple models, requiring a very basic understanding of the language. Create more complex models that are still concise, efficient and easy to express with just a bit more knowledge.
  • Robust – Take advantage of Python’s full range of pre-built packages to support full application development, including exceptional data access capabilities. These capabilities are in part the result of a very large and rapidly growing user community.

“…the decision to focus on a really slick Python API instead of a one-off language took real vision. It’s 100% the right call…” — Peter Cacioppi, Opalytics

 

Build Better Optimization Applications in Less Time

To help you get started quickly, the Gurobi distribution includes a Python interpreter and a basic set of Python packages. While these are sufficient for building and running simple optimization models, they provide just a glimpse of the wealth of tools and packages that are available for Python. You can further enhance your development experience with the addition of Anaconda, a free and widely used Python distribution that includes an Integrated Development Environment (Spyder), a notebook-style interface (Jupyter), and a broad set of 270 of the most useful Python packages. These tools can significantly increase the interactivity and productivity of your Python model and application building experience. Here are just a few examples of the types of things you can do with the Python packages included with Anaconda:

  • Extract data stored in a database
  • Analyze your data using powerful data analysis tools
  • Build a GUI to capture user input and display results

In addition, there are over 50,000 more Python packages available, above and beyond what’s included with Anaconda.

 

Try It Now

To get started using The Gurobi Python Environment, follow these steps:

Guidance for Your Journey

30 Day Free Trial for Commercial Users

Start solving your most complex challenges, with the world's fastest, most feature-rich solver.

Always Free for Academics

We make it easy for students, faculty, and researchers to work with mathematical optimization.

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search

Gurobi Optimization