Gurobi Modeling Examples

Explore our modeling examples for the Gurobi Python API

Traveling Salesman Problem

The Traveling Salesman Problem (TSP) is one of the most famous combinatorial optimization problems. The TSP goal is to find the shortest possible route that visits each city once and returns to the original city. It is classified as an NP-hard problem in the field of combinatorial optimization.

The continued interest in the TSP can be explained by its success as a general engine of discovery and a steady stream of new applications. Some of the general applications of the TSP are as follows:

This modeling example is at the advanced level, where we assume that you know Python and the Gurobi Python API and you have advanced knowledge of building mathematical optimization models. Typically, the objective function and/or constraints of these examples are complex or required advanced features of the Gurobi Python API.

View the notebook

Google Colab Link


For details on licensing or on running the notebooks, see the overview on Modeling Examples

© Gurobi Optimization, LLC