OR-Tools Examples

The following table provides links to:

  • Code examples in the supported languages: C++ Python DotNet Java
  • Tutorials that explain the examples.
  • Colabs — code demos that you can run directly in your browser.
Problem Type Interface Description Tutorials Colabs Code examples
Linear Optimization MPSolver (GLOP) Simple linear programming example
Integer Optimization MPSolver (SCIP) Simple mixed-integer programming example
Constraint Optimization CP-SAT Solver Simple constraint programming example
Constraint Optimization CP-SAT Solver Simple CP program
Routing Routing solver Simple TSP example
Routing Routing solver TSP with distance matrix
Routing Routing solver TSP with 2D locations
Routing Routing solver Simple Vehicle Routing Problem example
Routing Routing solver Vehicle Routing Problem with capacity constraints
Routing Routing solver Vehicle Routing Problem with pickup and delivery constraints
Routing Routing solver Vehicle Routing Problem with time window constraints
Routing Routing solver Vehicle Routing Problem with start and end locations