The third part of this manual deals with Routing Problems: we have a graph[1] and seek to find a set of routes covering some or all nodes and/or edges/arcs while optimizing an objective function along the routes[2] (time, vehicle costs, etc.) and respecting certain constraints (number of vehicles, goods to pickup and deliver, fixed depots, capacities, clients to serve, time windows, etc.).
[1] | A graph is a set of vertices (the set ) connected by edges (the set ). A directed edge is called an arc. When we have capacities on the edges, we talk about a network. |
[2] | The transportation metaphor is helpful to visualize the problems but the class of Routing Problems is much broader. The Transportation Problem for instance is really an Assignment Problem. Networks can be of any type: telephone networks (circuit switching), electronic data networks (such as the internet), VLSI (the design of chips), etc. |
To solve these problems, the or-tools offers a dedicated Constraint Programming sub-library: the Routing Library (RL).
The next two chapters each deal with one of two broad categories of Routing Problems:
These three categories of problems share common properties but they all have their own paradigms and scientific communities.
In this chapter, we’ll discover the RL with what is probably the most studied problem in Operations Research: the Travelling Salesman Problem (TSP)[3].
[3] | We use the Canadian (and British, and South African, and...) spelling of the verb travelling but you’ll find much more scientific articles under the American spelling: traveling. |
We use the excellent C++ ePiX library[4] to visualize TSP solutions in TSPLIB format and TSPTW solutions in López-Ibáñez-Blum and da Silva-Urrutia formats.
[4] | The ePiX library uses the engine to create beautiful graphics. |
Overview:
We start this chapter by presenting in broad terms the different categories of Routing Problems and describe the Routing Library (RL) in a nutshell. Next, we introduce the Travelling Salesman Problem (TSP) and the TSPLIB instances. To better understand the RL, we say a few words about its inner working and the CP model we use. Because most of the Routing Problems are intractable, we use Local Search. We explain our two phases approach in details and show how to model the TSP in a few lines. Finally, we model and solve the TSP with Time Windows.
Prerequisites:
Files:
You can find the code in the directory documentation/tutorials/cplusplus/chap9.
The files inside this directory are:
Content: