Minimizing Travel Time and Latency in Multi-Capacity Ride-Sharing Problems

: Motivated by applications in ride-sharing and truck-delivery, we study the problem of matching a number of requests and assigning them to cars. A number of cars are given, each of which consists of a location and a speed, and a number of requests are given, each of which consists of a pick-up location and a drop-off location. Serving a request means that a car must ﬁrst visit the pick-up location of the request and then visit the drop-off location. Each car can only serve at most c requests. Each assignment can yield multiple different serving routes and corresponding serving times, and our goal was to serve the maximum number of requests with the minimum travel time (called CS sum ) and to serve the maximum number of requests with the minimum total latency (called CS lat ). In addition, we studied the special case where the pick-up and drop-off locations of a request coincide. Both problems CS sum and CS lat are APX-hard when c ≥ 2. We propose an algorithm, called the transportation algorithm (TA), which is a ( 2 c − 1 ) -approximation (resp. c -approximation) algorithm for CS sum (resp. CS lat ); these bounds are shown to be tight. We also considered the special case where each car serves exactly two requests, i.e., c = 2. In addition to the TA, we investigated another algorithm, called the match-and-assign algorithm (MA). Moreover, we call the algorithm that outputs the best of the two solutions found by the TA and MA the CA. We show that the CA is a two-approximation (resp. 5/3) for CS sum (resp. CS lat ), and these ratios are better than the ratios of the individual algorithms, the TA and MA.


Introduction
In the multi-capacity ride-sharing problem, we are given a set of cars (or trucks) D, each car k ∈ D located at location d k , and a set of requests R, each request r ∈ R consisting of a source s r (pick-up location) and a destination t r (drop-off location). Travel times are given between each pair of locations. Each car k ∈ D has capacity c. Serving a request means that a car first visits the pick-up location of the request (customer or parcel) and then the drop-off location. Each car can serve multiple requests at the same time. This offers the opportunity to share rides, which may reduce the travel time or traffic congestion. This paper is concerned with two objectives when assigning the maximum number of requests (min{|R|, c · |D|} requests): one is to assign requests to the cars such that each car serves at most c requests while minimizing the total travel time, and the other problem is to assign requests to the cars such that each car serves at most c requests while minimizing the total waiting time (called total latency) incurred by customers that have submitted the requests. We now provide more insight into these two objectives: • Minimize total travel time: In this problem, we considered assigning the maximum number of requests to cars, each with no more than c requests, to minimize the total travel time, which is the sum of the travel times a car drives to serve its requests. Viewed from the ride-sharing company or drivers, minimizing the total travel time is the most important, since it results in minimizing the costs while serving the maximum number of requests. Furthermore, it also results in the minimum pollution or emissions. A solution for a given instance is a collection of trips with the minimum total travel time where a car visits all locations of the requests assigned to that car, while visiting the pick-up location of a request before the corresponding drop-off location. We call the ride-sharing problem with the objective of minimizing the total travel time CS sum and the special case of CS sum where the pick-up and drop-off locations are identical for each request CS sum,s=t ; • Minimize total latency: In this problem, we considered assigning the maximum number of requests to cars, each with no more than c requests, to minimize the total waiting time, which is the sum of the travel times needed for each individual request (customer or parcel) to arrive at the destination. Passengers or clients care about reaching their destinations as soon as possible. Here, the goal is to obtain a solution that is a collection of trips where the travel time summed over the individual requests is minimum. We call the ride-sharing problem with the objective of minimizing the total latency CS lat and the special case of CS lat where the pick-up and drop-off locations are identical for each request CS lat,s=t .

Motivation
Many ride-sharing companies (see [1]) provide a service (carpooling, ride-sharing, etc.) where customers submit their requests and then wait for the company to assign them a car. Consider a large number of requests in a working day morning, each consisting of a pick-up and a drop-off location. The company has a number of available cars whose locations and capacity c are known. The value of capacity c can be seen as the capacity of each car over time, i.e., the number of requests a car can accommodate in a relevant period of time. This value may well differ from the instantaneous capacity of a car (say the number of seats), as a pair of requests served by the same car may not be served simultaneously as one request is dropped off before the other request is picked up. In order to achieve a balanced allocation of requests to cars, each car receives no more than c requests. The task then is to assign the maximum number requests to available cars with respect to the capacity constraint.
It is a fact, however, that in many practical situations, "each request is allowed to occupy at most two seats in a car" (see Uber [1]). A regular vehicle has 4-8 seats; thus, only a limited number of requests can be combined in a single vehicle; this can be modeled by taking c ≤ 4.
Consider the application of our problem in the area of collective transport. For instance, the company TransVision [2] provides transport service for specific groups of people (patients, commuters, etc.), and they organize collective transport by collecting requests in a particular region of The Netherlands in advance, combine these requests, and assign them to some regular transport companies. To access their service, customers must make their request the evening before the day of the actual transport; the number of requests for a day often exceeds 5000. In this application, each server (car, bus, etc.) may pick up more than four requests during its working period; hence, a value of c > 4 can be appropriate.
We can capture the above scenarios by the following problem: There is a set of customers who have specified their pick-up locations and drop-off locations to the vehicle provider, and the provider has a set of cars (also with drivers) that have a specified location and capacity c. The task, in this paper, is to assign customers to vehicles without exceeding the vehicles' capacities and plan a service route for each of the vehicles based on optimization criteria, either minimizing the total travel time in CS sum or minimizing the total latency in CS lat .
The problems CS sum,s=t and CS lat,s=t are natural special cases of CS sum and CS lat , respectively, and can be used to model situations where parcels have to be delivered to clients (whose location is known and fixed). For instance, one can imagine a retailer sending out trucks to satisfy clients' demands where each truck is used to satisfy multiple clients.

Related Work
There is a growing amount of literature related to ride-sharing (see [3] for a survey). In a ride-sharing system, a number of cars are provided to serve requests from customers in a fixed period of time. Typically, there are four types of ride-sharing models: one-to-one, meaning that each car serves a single request at a time (see [4][5][6][7]); one-to-many, meaning that each car can serve multiple requests at the same time (see [8,9]); many-to-one, meaning that one request can be served consecutively by multiple cars ( [10]); many-to-many, which is a combination of the previous two models ( [11]). The ride-sharing problem is to match requests and cars while either minimizing the cost (see [8,9]) or maximizing the profit (see [5][6][7]10]). In this paper, we study a ride-sharing problem of the one-to-many type with the objective of minimizing the cost.
Different versions of ride-sharing problems have been studied. Alonso-Mora et al. [12] and Pavone et al. [13] estimated what fleet size is appropriate for a city considering the cost of cars, a maximum waiting time for a customer, and the extra expense of moving cars. Agatz et al. [14] studied the problem of assigning cars to customers in real-time to minimize the expected total delivery cost. For a dynamic ride-sharing problem, Stiglic et al. [15] analyzed and showed that a small increase in the flexibility of either the cars or the customers can significantly increase performance. Furthermore, Wang et al. [16] introduced the notion of the stability of a ride-sharing system, and they presented methods to establish stable or nearly stable solutions. Considering the online ride-sharing model, Ashlagi et al. [17] studied the problem of matching requests while they arrive one by one and each of them must be either matched to another request within a prespecified period of time or discarded. Each request can be matched at most once and yields a positive profit. To maximize the total profit while requests arrive in an adversarial model, they provided a randomized four-competitive algorithm. Lowalekar et al. [18] studied a special case of the online version of the ride-sharing problem, such that the vehicles have to return to their depot after serving a number of requests. Guo and Luo [19] designed algorithms for the online ride-sharing problem under both the adversarial model and the random arrival model.
Mori and Samaranayake [20] studied the ride-sharing problem with arbitrary capacity while relaxing the assumption of serving all requests. They used an LP-based randomized rounding algorithm to obtain a solution, such that the expected fraction of unassigned requests was at most 1/e, while the total cost of serving assigned requests was no more than the optimal solution. This paper deals with a setting where the maximum number of requests needs to be assigned to the cars such that each car serves no more than c requests while minimizing the total travel time (CS sum ) or minimizing the total waiting time (CS lat ). As far as we are aware, this particular ride-sharing problem has not been extensively studied, especially for the latency criterion, i.e., CS lat . Notice that when c = 1, the ride-sharing problems CS sum and CS lat become minimum weight assignment problems, and an optimal solution can be found in O(|D| 3 ) (see, e.g., [21]). Bei and Zhang [9] considered CS sum with c = 2 and gave a 2.5-approximation algorithm for it. Luo and Spieksma [22] proposed approximation algorithms for four versions of the problem, while still assuming c = 2. Here, we generalize the ride-sharing problem to a problem involving any arbitrary constant c ≥ 2.
In fact, both CS sum and CS lat with c = 2 are a special case of the so-called two-to-one assignment problem (2-1-AP) investigated by Goossens et al. [23]. Given a set G of n green elements and a set R of 2n red elements, we call a triple a set of three elements that consists of a single green element and two red elements. Each triple has a non-negative cost-efficient, and the goal of the 2-1-AP problem is to find a collection of triples such that each element is covered exactly once while minimizing the sum of the corresponding cost coefficients. In the context of our ride-sharing problem with c = 2, the green elements represent the cars, and the red elements represent the requests. The arguments presented in [23] allowed us to conclude that both CS sum and CS lat are APX-hard, already for c = 2.
For the special case of 2-1-AP where the cost of each triple (i, j, k) is defined as the sum of the three corresponding distances, i.e., cost(i, j, k) = d ij + d jk + d ki , where the distances d satisfy the triangle inequality, Goossens et al. [23] gave an algorithm with the approximation ratio of 4/3. The definition of the cost coefficients in CS sum , as well as in CS lat differs from the above expression for cost(i, j, k); we refer to Section 4 for a precise definition.

Our Results
We formulated and analyzed an algorithm, called the transportation algorithm (TA), that outputs a feasible solution to each of the four problems described above. This transportation algorithm belongs to a type of heuristics, called hub heuristics, which have been analyzed in the context of the multi-index assignment and multi-index transportation problems (see [24,25]). We identified the worst-case ratios of the TA for the four problems and show them to be tight (see [26] for the appropriate terminology). An overview of these results is shown in Table 1, where " * " means that the corresponding worst-case ratio is tight. For the case c = 2, we propose a so-called match-and-assign algorithm, the MA. We also define an algorithm, the CA, that consists of outputting the better of the solutions found by the TA and MA. An overview of the results for c = 2 is shown in Table 2 (see also [22]). Notice that for CS sum,s=t , CS lat , and CS lat,s=t , the worst-case ratio of the combined algorithm (CA) is strictly better than each of the two worst-case ratios of the individual algorithms f which CA is composed. The paper is organized as follows. In Section 2, we give a precise problem description. In Section 3, we present the transportation algorithm (TA) and analyze its performance for both CS sum and CS lat . In Section 4, we consider the special case where each car serves exactly two requests. We propose the match-and-assign algorithm (MA) and analyze the performance of the MA and CA (the better solution of the MA and TA) for both CS sum and CS lat . Section 5 concludes the paper.

Preliminaries
Notation. Given a metric space on vertices V, where the travel time between vertices x 1 ∈ V and x 2 ∈ V is denoted by w(x 1 , x 2 ), note that the travel times w(x 1 , x 2 ) for all x 1 , x 2 ∈ V are non-negative, symmetric, and satisfy the triangle inequality. Furthermore, we extended the notation of travel time between two locations to the travel time of a path: w(x 1 , x 2 , . . . , ). In the ride-sharing problem, we are given n cars, denoted by D = {1, 2, . . . , n}, each car k consisting of its location d k ∈ V and m requests R = {r 1 , r 2 , . . . , r m }, each r i consisting of a source (pick-up location) and destination (drop-off location) pair (s i , t i ) ∈ V × V. Each car can serve at most c requests. We want to find an allocation: serving the maximum number of requests while minimizing the total travel time or minimizing the total latency. In the basic setting, we suppose m = c · n (see Section 3.3 for the case m < c · n and m > c · n); thus, |R k | = c holds for all k ∈ D of any feasible solution. We now elaborate on these two objectives.
Minimizing total travel time: where R k contains c requests, i.e., |R k | = c, we denote the minimum travel time of serving all requests in R k by cost(k, R k ), i.e., the minimum time (or distance) of visiting all locations {s i , t i | i ∈ R k } starting from d k where s i is visited before t i . The length of the shortest Hamiltonian path of visiting all locations {s i , t i | i ∈ R k } starting from s r (r ∈ R k ) with s i visited before t i is denoted by SHP(s r , R k ). We view cost(k, R k ) as consisting of two parts: one term w(d k , s r ) expressing the travel time between d k and the first pick-up location s r and another term SHP(s r , R k ) (r ∈ R k ) capturing the minimum travel time of visiting all requests starting from s r . (It is true that, in general, the SHP is NP-hard; however, in our case, the parameter c is a small constant leading to instances of a SHP of bounded size.) The travel time needed to serve requests in R k (k ∈ D) is then given by: (1) We denote the travel time of an allocation M by: In CS sum and CS sum,s=t , the goal is to find an allocation M that minimizes cost(M). Minimizing total latency: Here, we focus on the waiting time as perceived by an individual customer, from the moment the car leaves his/her location until the moment the customer reaches his/her drop-off location. For each (k, R k ) ∈ M (k ∈ D) where R k contains c requests, i.e., |R k | = c, we denote the minimum total waiting time of all requests in R k by wait(k, R k ), i.e., the sum of the times to reach all drop-off locations t r (r ∈ R k ) following a path that visits all locations {s i , t i | i ∈ R k } starting from d k while s i is visited before t i . We view wait(k, R k ) as consisting of two parts: one term c · w(d k , s r ) expressing the waiting time between d k and the first pick-up location s r ; another term SHWP(s r , R k ) capturing the sum of waiting times from the first pick-up location s r to every other drop-off location, minimized over all feasible ways of traveling through the locations in R k . The latency needed to serve requests in R k (k ∈ D) is then given by: We denote the latency of an allocation M by: Thus, in CS lat and CS lat,s=t , the goal is to find an allocation M that minimizes wait(M). Another variant of the ride-sharing problem considering the latency objective is counted with respect to the pick-up location rather than the drop-off location in CS lat . In this setting, the drop-off location clearly becomes irrelevant to the objective, and our approximation results for CS lat,s=t become valid for this variant.

The Transportation Algorithm and Its Analysis
We describe the transportation algorithm in Section 3.1 and analyze its performance for CS sum , CS sum,s=t , CS lat , and CS lat,s=t in Section 3.2.

The Transportation Algorithm
In this section, we present the transportation algorithm. The idea of the algorithm is to assign to each car k ∈ D c requests based only on the travel times between the car locations d k and the request locations s r , t r , thereby ignoring travel times between different request locations.
We implemented this idea by replacing each car k ∈ D by c virtual cars Next, we assigned c · n requests to the c · n cars using a particular definition of the cost v 1 (γ i (k), r) (or v 2 (γ i (k), r)) between a request r ∈ R and a car γ i (k) ∈ Γ: Next, we introduce how to assign c · n requests to the c · n cars. As is showed in Algorithm 1.
bipartite graph with left vertex-set Γ, right vertex-set R, and edge weights v 1 (γ i (k), r) (resp. v 2 (γ i (k), r)) for γ i (k) ∈ Γ and r ∈ R. 2: Find a min-weight assignment: Find a minimum weight assignment M 1 (resp, M 2 ) in A solution is then found by letting car k ∈ D serve the requests assigned to virtual cars {γ 1 (k), . . . , γ c (k)}. Let R k = {r 1 , r 2 , . . . , r c } (k ∈ D) denote the requests assigned to a car k, where request r i ∈ R k is assigned to γ i (k).
In our algorithm, two minimum weight assignments based on these costs are found: M 1 with weight v 1 (M 1 ) and M 2 with weight v 2 (M 2 ). We use M 1 to construct a solution for CS sum and M 2 to construct a solution for CS lat . Observe . This amounts to a solution where each car k ∈ D travels according to the following path: Notice that, due to the triangle inequality, the cost of such a path will not increase by "short-cutting" the path, i.e., by traveling from each t r i directly to s r i+1 : In fact, we use TA(v 1 ) to denote this resulting solution found by the TA for CS sum , with cost(TA(v 1 )) denoting its cost.
We conclude: A similar observation can be made with respect to M 2 . The quantity v 2 (M 2 ) collects the waiting time of all requests by following, for each car k ∈ D, the path: As argued above, shortcutting gives us then a feasible solution for an instance of CS lat we denote by TA(v 2 ) with cost wait(TA(v 2 )). We have: Recall that our problem does not force the driver to return to the original position. This implies that the cost of a driver when serving a set of request R k does not include the time from the last drop-off location to the driver's original location. This explains why in the expression for v 1 (M 1 ) (also, v 2 (M 2 )), we can subtract the corresponding travel time from the total travel time. We now give two lemmas concerning v 1 (M 1 ) (which we need to prove Theorem 1) and two more lemmas concerning v 2 (M 2 ) (which we need to prove Theorem 2).
Lemma 1. For any c ≥ 2, we have: It remains to prove the claim. Consider any R k = {r 1 , r 2 , . . . , r c } for car k ∈ D. We Necessary condition: From the above lemma and the fact that M 1 is a minimum weight assignment in G 1 ≡ (Γ ∪ R, v 1 ), we have the following lemma: Lemma 2. For c ≥ 2 and for each allocation M, we have: We now provide two lemmas concerning v 2 (M 2 ). In the statement of these lemmas, we index the requests such that, for each k ∈ D, R k = {r 1 , r 2 , . . . , r c }.

Lemma 3.
For any c ≥ 2, for each car k ∈ D and ∀r x , r y ∈ R k with x < y, w(d k , s r x , t r x ) + w(d k , t r x ) ≤ w(d k , s r y , t r y ) + w(d k , t r y ).
Proof. We claim that v 2 (M 2 ) is minimized if and only if for each car k ∈ D and ∀r x , r y ∈ R k = {r 1 , r 2 , . . . , r c } with x < y, w(d k , s r x , t r x ) + w(d k , t r x ) ≤ w(d k , s r y , t r y ) + w(d k , t r y ). Consider ∀r x , r y ∈ R k = {r 1 , r 2 , . . . , r c } with x < y for car k ∈ D. We prove that v 2 (M 2 ) is minimized if and only if w(d k , s r x , t r x ) + w(d k , t r x ) ≤ w(d k , s r y , t r y ) + w(d k , t r y ).
Necessary condition: Since v 2 (M 2 ) is minimized, based on definition of cost v 2 (·, ·), we have: Sufficient condition: According to the above statement, the condition w(d k , s r x , t r Since M 2 is a minimum weight assignment in G 2 ≡ (Γ ∪ R, v 2 ), we have the following lemma: Lemma 4. For c ≥ 2 and for each allocation M, we have:

Let us denote an optimal allocation in CS
the collection of c-tuples of requests in an optimal solution M * . We now establish the worst-case ratios of the TA(v 1 ) for CS sum and CS sum,s=t . Theorem 1. The TA(v 1 ) is a (2c − 1)-approximation algorithm for CS sum . Moreover, there exists an instance I of CS sum,s=t for which cost(TA(v 1 )(I)) = (2c − 1) · cost(M * (I)). Proof.
We now comment on the validity of the inequalities above. Inequality (9) follows from applying Inequality (7), and Inequality (10) follows from Lemma 2. The final Inequality (12) follows from the fact that for any r ∈ R * k , w(d k , t r ) ≤ w(d k , s r , t r ) ≤ cost(k, R * k ). To see that the bound 2c − 1 is tight even for CS sum,s=t , consider the instance I depicted in Figure 1 Let us now analyze the performance of TA(v 1 ) on instance I. Notice that TA(v 1 ) may assign requests {i, c + i, . . . , (c − 1)c + i} to car k i . In that case, the total cost of TA(v 1 ) is c(2(c − 1) + 1)) = c(2c − 1), showing tightness.  We proceed by establishing the worst-case ratios of the TA(v 2 ) for CS lat and CS lat,s=t . Again, we assume that an optimal solution to CS lat is denoted by M * , and the collection of c-tuples of requests in M * is denoted by M * R = {R * k : (k, R * k ) ∈ M * }. In the following theorem, we index the requests such that, for each k ∈ D, R * k = {r 1 , r 2 , . . . , r c }.
Theorem 2. The TA(v 2 ) is a c-approximation algorithm for CS lat . Moreover, there exists an instance I of CS lat,s=t for which wait(TA(v 2 )(I)) = c · wait(M * (I)). Proof.

Discussion
Clearly, the TA is a polynomial-time algorithm, and it is easy to implement; moreover, it can be generalized to handle a variety of situations. We now list three situations and briefly comment on the corresponding worst-case behavior: • Ride-sharing with car-dependent speeds or related ride-sharing. In this situation, the cars have speed p 1 , p 2 , . . . , p n . The travel time of serving requests in R k is denoted by cost(k, R k )/p k , and the total travel time of an allocation M is denoted by ∑ (k,R k )∈M cost(k, R k )/p k . Analogously, the total latency of an allocation M is denoted by ∑ (k,R k )∈M wait(k, R k )/p k . Without going into the details, we point out that the TA can be modified by appropriately redefining v 1 (k, r) and v 2 (k, r) in terms of the cost above; we claim that the corresponding worst-case ratios of TA as shown in Table 1 remain unchanged; • Ride-sharing with car-dependent speeds or related ride-sharing. In this situation, the cars have speed p 1 , p 2 , . . . , p n . The travel time of serving requests in R k is denoted by cost(k, R k )/p k , and the total travel time of an allocation M is denoted by ∑ (k,R k )∈M cost(k, R k )/p k . Analogously, the total latency of an allocation M is denoted by ∑ (k,R k )∈M wait(k, R k )/p k . Without going into the details, we point out that the TA can be modified by appropriately redefining v 1 (k, r) and v 2 (k, r) in terms of the cost above; we claim that the corresponding worst-case ratios of TA as shown in Table 1 remain unchanged; • Car redundancy: c · n > m. In this situation, our problem is to find an allocation that serves all requests with the minimum total cost (total travel time or total latency). Clearly, some cars may serve less than c requests, or even do not serve a request. To apply TA for this situation, we need to add a number of requests to fill the shortage of requests, without affecting the total travel time or latency. We created an instance of our problem by adding a number of dummy requests R d with |R d | = c · n − m, where the travel time between a request in R d and a car in D is zero, i.e., v 1 (γ i (k), r) = 0 and v 2 (γ i (k), r) = 0 for all i ∈ [c], k ∈ D, r ∈ R d . Since the cost of assigning dummy requests is zero in any feasible solution, removing dummy requests of a solution for the newly created instance with c · n = |R| will give us a solution to the original instance; • Car deficiency: c · n < m. In this situation, our problem is to find an allocation that serves the maximum number of requests (c · n requests) with the minimum total cost (total travel time or total latency). It follows that some requests will not be served. To apply the TA for this situation, we created an instance of our problem by adding a number of dummy cars D d with |D d | = m − n · c, where the travel time between a car in D d and a request in R is H (H is a sufficiently large number), i.e., v 1 (k, r) = H and v 2 (k, r) = H for all k ∈ D d , r ∈ R. Removing dummy cars (and their corresponding requests) gives us a solution to the original instance. Since we found an assignment with the minimum total weight and we removed the set of requests assigned to the dummy cars, we claim that the TA selected c · n requests with the minimum total weight. In fact, the proofs in Section 3.1 imply that the TA(v 1 ) is a (2c − 1)-approximation algorithm for CS sum and the TA(v 2 ) is a c-approximation algorithm for CS lat .

The Case c = 2: Algorithms and Their Analysis
In this section, we consider the ride-sharing problems CS sum , CS sum,s=t , CS lat , and CS lat,s=t with capacity c = 2 and each car serving exactly two requests, i.e., m = 2n (see [22]). In Section 4.1, we propose and analyze the match-and-assign algorithm (MA). Next, in Section 4.2, we analyze the combined algorithm (CA), i.e., the better of the two algorithms, the MA and TA.
For convenience, we explicitly write the quantity SHP(s i , {i, j}) in CS sum by a parameter u ij as follows: Notice that the u ij 's are not necessarily symmetric. Obviously, u ij ≥ w(s i , s j ) and u ji ≥ w(s i , s j ). For CS sum,s=t , we have u ij = u ji ≡ w(s i , s j ).
The travel time needed to serve requests in R k = {i, j} (k ∈ D) is then given by: For convenience, we also explicitly write the quantity SHWP(s i , {i, j}) in CS sum by a parameter µ ij as follows: Notice that the µ ij 's are not necessarily symmetric. For CS lat,s=t , we have µ ij = µ ji ≡ w(s i , s j ).
The latency needed to serve requests in R k = {i, j} (k ∈ D) is then given by:

The Match-and-Assign Algorithm and Its Analysis
We came up with a match-and-assign algorithm, the MA(α, v), the idea being that, first, requests are matched into request pairs, after which the request pairs are assigned to the cars. Finding request pairs is performed by using a carefully chosen time v 3 ({i, j}) between a pair of requests {i, j}, as well as a travel time v 4 (k, {i, j}) between each request pair {i, j} and a car k ∈ D: Now, we introduce the match-and-assign Algorithm 2. The resulting quantity is v 3 (M 3 ) + v 4 (M 4 ); we now prove two lemmas concerning this quantity, which will be of use in the approximation analysis.

1: Matching step:
• Construct a graph: Let G 3 ≡ (R, v 3 ) be the complete weighted graph where an edge between vertex i ∈ R and vertex j ∈ R has weight v 3 ({i, j}); • Find a min-weight matching: Find a minimum weight perfect matching M 3 in .

Lemma 6.
For α ∈ {1, 2}, v ∈ {u, µ}, and for each allocation M, we have: Proof. For an allocation M, let M R = {R k : (k, R k ) ∈ M}. Observe that: since M 3 is a minimum weight perfect matching in G 3 ≡ (R, v 3 ). We claim that: When summing (26) and (27) . Note that every vertex in graph G has degree two. Thus, we can partition G into a set of disjoint cycles called C; each cycle c ∈ C can be written as c = (i 1 , j 1 , k 1 , i 2 , j 2 , k 2 , . . . , k h , i 1 ), where {i s , j s } ∈ M 3 , (k s , {j s , i s+1 }) ∈ M for 1 ≤ s < h and (k h , {j h , i 1 }) ∈ M. Consider now, for each cycle c ∈ C, the following two assignments called M c and M c r : . Given the definition of v 4 (k, {i, j}) (see Equation (25)), we derive for each pair of requests {i, j} and two cars a, b: v 4 (a, {i, j}) Note that M 4 is a minimum weight assignment in G 4 = (D ∪ M 3 , v 4 ), and both M and M r are a feasible assignment in The last inequality follows from (28), and hence, (27) is proven.

Lemma 7.
For any two requests i and j, we have: and: u ij ≤ 2u ji .
Without loss of generality, suppose u ij ≥ u ji , u ij ≤ w(s i , s j ) + u ji . Since w(s i , s j ) ≤ min{u ij , u ji }, we have u ij ≤ 2u ji for any two requests i and j. Theorem 3. The MA(1, u) is a two-approximation algorithm for CS sum . Moreover, there exists an instance I for which cost(MA(I)) = 2cost(M * (I)).
To see that the equality may hold in wait(MA(I)) ≤ 2wait(M * (I)), consider the instance I depicted in Based on the µ values as defined in (22), the MA(2, µ) can find, in the first step, Then, no matter how the second step assigns the request pairs to cars, the total waiting time of the MA(2, µ) will be eight.

The Combined Algorithm and Its Analysis
The CA sum runs the MA(1, u) and TA(v 1 ) and then outputs the better of the two solutions. We now state the main result for CS sum . Theorem 6. The CA sum is a two-approximation algorithm for CS sum . Moreover, there exists an instance I for which cost(CA sum (I)) = 2cost(M * (I)).
Proof. It is obvious that, as cost(CA sum ) = min{cost(MA(1, u)), cost(TA(v 1 ))}, Theorems 1 and 3 imply that the CA sum is a two-approximation algorithm for CS sum . We now provide an instance for which this ratio is achieved.
Consider the instance I depicted in Figure 2. This instance has two cars D = {k 1 , k 2 } with car locations {d 1 , d 2 } and four requests R = {1, 2, 3, 4}. Locations corresponding to distinct vertices in Figure 2 (20), the MA(1, u) can find, in the first step, Then, no matter how the second step assigns the request pairs to cars (since two cars stay at the same location), the total cost of MA(1, u) will be four.
The TA(v 1 ) may assign Requests 1 and 2 to Car 1 and Requests 3 and 4 to Car 2 since: Thus, the total cost of the TA(v 1 ) is four.
To summarize, the instance in Figure 2 is a worst-case instance for the CA sum .

Theorem 7.
The CA sum is a 7/5-approximation algorithm for CS sum,s=t . Moreover, there exists an instance I for which cost(CA sum (I)) = 7/5 cost(M * (I)).
We now provide an instance for which this ratio is achieved. Consider the instance I depicted in Figure 3. This instance has four cars {k 1 , k 2 , k 3 , k 4 } with car locations {d 1 , d 2 , d 3 , Based on the u ij values as defined in (20), the MA(1, u) can find, in the first step, Then, no matter how the second step assigns the request pairs to cars (since two cars stay at the same location), the total cost of MA(1, u) will be 14.
TA(v 1 ) may assign Requests 1 and 3 to Car 1 and Requests 2 and 4 to Car 2 and, similarly, Requests 5 and 7 to Car 3 and Requests 6 and 8 to Car 4 because: Thus, the total cost of the TA(v 1 ) is 14.
To summarize, the instance in Figure 3 is a worst-case instance for the CA sum .
The CA lat runs the MA(2, µ) and TA(v 2 ) and then outputs the better of the two solutions. We now state the main result for CS lat . The following lemma is useful to analyze the performance of the CA for CS lat .
According to the triangle inequality, we know that: Based on the definition of µ, we know: Using the above inequalities, we have: The other two cases (2) and (3) are obtained similarly.
Theorem 8. The CA lat is a 5/3-approximation algorithm for CS lat .

Theorem 9.
The CA lat is a 3/2-approximation algorithm for CS lat,s=t . Moreover, there exists an instance I for which wait(CA lat (I)) = 3/2 wait(M * (I)).
We now provide an instance for which this ratio is achieved. This instance has four cars {k 1 , k 2 , k 3 , k 4 } with car locations {d 1 , d 2 , d 3 , d 4 } and eight requests R = {1, 2, . . . , 8}. Consider the instance I depicted in Figure 5. If two points are not connected by an edge, their travel time equals five. Observe that an optimal solution is: Then, no matter how the second step matches the pairs to cars, the total waiting time of the MA(2, µ) will be 12.
The TA(v 2 ) may assign Requests 1 and 3 to Car 1 and assign Requests 4 and 2 to Car 2 and, similarly, assign Requests 5 and 7 to Car 3 and assign Requests 6 and 8 to Car 4 because: Thus, the total waiting time of the TA(v 2 ) is 12.
To summarize, the instance in Figure 5 is a worst-case instance for the combined algorithm CA lat .

Conclusions
We analyzed a polynomial-time algorithm, called the transportation algorithm (TA), for four different versions of a ride-sharing problem where each car serves at most c requests. We proved that the TA is a (2c − 1)-approximation (resp. c-approximation) algorithm for CS sum and CS sum,s=t (resp. CS lat and CS lat,s=t ). Furthermore, for the special case where capacity c = 2 and m = c · n, we proposed another algorithm, called match-and-assign (MA), which firstly matches the requests into pairs and then assigns the request pairs to the cars. We proved that (for most problem variants) the worst-case ratio of the algorithm defined by the better of the two corresponding solutions is strictly better than the worst-case ratios of the individual algorithms.
For future directions, it would be interesting to extend the MA for the ride-sharing problem for any constant capacity c. It would also be interesting to obtain meaningful lower bounds on the approximability of the ride-sharing problem. Other possible directions include studying the problem under different objectives such as minimizing the makespan or considering the release times and/or deadlines of the requests.