2

Imagine you have a fleet consisting of various vehicles, including electronic cars. Each vehicle has a tracking device to record its trips. The goal is to analyze these trips (after a month/year) whether all of the historic trips would have been possible if a fleet size was reduced. Can you point me to an algorithm, research paper, or a library that can do that? Heuristics for simplification are also possible and welcomed.

Unlike in typical vehicle routing problems, we are not trying to find the optimal route. The routes are already given, and cannot be changed. Re-Planning of future trips is not in the scope of this analysis. Unfortunately, I only found algorithms and libraries for minimizing trips that also optimize the routes.

As an example, let's assume that there are three locations A, B, and C. Each location is the home base for a set of vehicles V1, V2, …, VN from where the initial trip can be made. A recorded trip T has a starting and destination location and timestamps for when the trip started and ended. Let's say we are analyzing trips of just one day and the following trips are made:

7:00 - 9:00 Vehicle V1 made a trip from location A to B.

8:00 - 9:00 Vehicle V2 made a trip from location B to C.

10:00 - 11:00 Vehicle V3 made a trip from location B to C.

12:00 - 13:00 Vehicle V3 returned from location C to B.

14:00 - 15:00 Vehicle V1 returned from location B to A.

14:00 - 15:00 Vehicle V2 returned from location C to B.

15:00 - 16:00 Vehicle V4 made a trip from location C to A.

16:00 - 17:00 Vehicle V4 returned from location A to C.

In this example, vehicle V1 was idle at location B and could have replaced trips of vehicle V3. Vehicle V4 was also idle at that time but could not replace these trips because it was in another location.

In reality, we would also need to check whether electronic cars doing additional trips had enough time to recharge.

Zorec
  • 23
  • 3
  • An example would be extremely helpful. Do the routes also include time information? Why can’t you just check for when the most vehicles are all on the road at the same time, and return that number as the minimum? – kcsquared Mar 14 '22 at 11:50
  • Thank you for the hint. I've added an example, including time information. – Zorec Mar 14 '22 at 12:56
  • If we are only concerned about the time dimension, then the approach you suggested would work but we need to consider other dimensions like the location of vehicles. – Zorec Mar 14 '22 at 12:58
  • I'm confused by your example. What exactly counts as 'replacing a trip'? V2 and V3 had the same overall route, B -> C -> B. However, V2 was at C when V3 made its trip from B to C. For V2 to replace V3, would it need to travel B -> C -> B -> C -> B? Do you mean that any edge X -> Y (possibly repeated) from your original graph needs to occur at most once in the new graph? Can you share what the new, reduced routes are for your example? – kcsquared Mar 14 '22 at 13:42
  • Sorry, there was a mistake, I wrote V2 instead of V1 in the result. – Zorec Mar 14 '22 at 15:25
  • What counts as replacing a trip? If a trip can be covered by another vehicle that is idle at that time in a given location (starting point of that trip) and it doesn't affect the possibility of any other trip that follows. – Zorec Mar 14 '22 at 15:32
  • We need to be able to replace all vehicle trips. If one trip of a vehicle cannot be covered by other idle vehicles, the vehicle must remain in the fleet. The example after removing vehicle V3 would change in the following way: wherever there was V3 written, it is replaced with V1. – Zorec Mar 14 '22 at 15:39
  • Do the vehicles (and their drivers) always return to their starting points by the end of the day? – phatfingers Mar 14 '22 at 15:50
  • I think you have a typo in V4. Its trip and return are in the same direction. – phatfingers Mar 14 '22 at 16:00
  • In most cases, vehicles return to their starting point which is reflected in the recorded trips. So, it should be ensured if all trips get covered by fewer vehicles. A driver might just have returned in a different vehicle from a pool. Corrected, thanks for pointing that out. – Zorec Mar 14 '22 at 16:13
  • The problem statement can you rephrased as follows: Given a set of trips made by vehicles 1, ..., N, find the smallest number of vehicles M, where M <= N and all trips can still be performed. Naturally, a vehicle cannot be used simultaneously for multiple trips. I hope this clarifies it. – Zorec Mar 16 '22 at 14:53

1 Answers1

1

Here’s an algorithm that assumes instantaneous recharging. Gather the list of arrivals and departures and sort them by time.

Time Location Δ
0700 A −1
0800 B −1
0900 B +1
0900 C +1
1000 B −1
1100 C +1
1200 C −1
1300 B +1
1400 B −1
1400 C −1
1500 A +1
1500 B +1
1500 C −1
1600 A +1
1600 A −1
1700 C +1

Now compute the running sums for each location.

Time A B C
0 0 0
0700 −1 0 0
0800 −1 −1 0
0900 −1 0 1
1000 −1 −1 1
1100 −1 −1 2
1200 −1 −1 1
1300 −1 0 1
1400 −1 −1 0
1500 0 0 −1
1600 0 0 −1
1700 0 0 0

Track the minimum value attained in each location. This is minus the number of vehicles required in that location at the start (one in each location here).

Charging does seem make this problem harder. You could get a guaranteed overestimate by pushing out each vehicle arrival by the amount of time it would have taken to fully recharge. Maybe that’s good enough for forecasting purposes?

David Eisenstat
  • 64,237
  • 7
  • 60
  • 120