Closed sebastian-quintero closed 3 years ago
Duplicate of #1388 IMO.. Tell me if I am wrong.
Now, I do not think we have a good solution for that.
Two items. First, searching google for "cumulative traveling salesman problem," I found this paper (https://hal.inria.fr/hal-00648451/document) which suggests that there is an exact algorithm for solving it. Just implement that algorithm.
Second, I found the above post cross-posted to stack overflow and stack exchange, which I understood to be somewhat rude. You should at least acknowledge on each platform that you've asked the same question in multiple forums.
Hi there! The objective of the Cumulative Traveling Salesman Problem (CTSP) is to minimize the sum of arrival times at customers, instead of the total travelling time. This is different than minimizing the overall time of travel. For example, if one has unlimited vehicles (# vehicles is the same as # of locations) and the objective is to minimize the overall time to locations, one would send one vehicle per location, for it is the fastest way to satisfy said demands. One can see that the or-tools routing module focuses mainly on minimizing the overall travel time (not the time to locations). Is there a way to solve the CTSP, and, even better, have a balance (maybe using weights) between minimizing time to locations vs. minimizing travelling time?
Let me show an analytical example. Let's say we have a depot (0) and two customers (1 and 2). Let's consider the following time matrix:
Let's assume we have a number of vehicles equal to the number of locations (2 vehicles). Let's consider the following two situations:
Objective 1: if we want to minimize overall travel time The solution is
0 -> 1 -> 2 -> 0
(one vehicle is used), where:0 -> 1
: 10 +1 -> 2
: 15 +2 -> 0
: 20 =10 + 15
= 45.0 -> 1
: 10. For location 2 (note that we have to pass through location 1):0 -> 1
: 10 +1 -> 2
: 15. In summation, we have:10 + 10 + 15
= 35.Objective 2: if we want to minimize time to locations The solution is
0 -> 1 -> 0
and0 -> 2 -> 0
(two vehicles are used), where:0 -> 1
: 10 +1 -> 0
: 10. For vehicle 2:0 -> 2
: 20 +2 -> 0
: 20. In summation, we have10 + 10 + 20 + 20
= 60.0 -> 1
: 10. For location 2 (note that we do not have to pass through location 1):0 -> 2
: 20. In summation, we have:10 + 20
= 30.So... Can this be done? Can one solve the CTSP? Is it possible to have an objective function such that we could balance both of these objectives (i.e.
min alpha * overall_travel_time + beta * time_to_locations
, such thatalpha
andbeta
are weights). Python code is much appreciated. Thank you!Working code for objective 1: minimizing the overall travel time
Results for the above code