JAMP  Vol.5 No.9 , September 2017
A Dynamic Programming Algorithm for the Ridersharing Problem Restricted with Unique Destination and Zero Detour on Trees
ABSTRACT
We deal with the problem of sharing vehicles by individuals with similar itineraries which is to find the minimum number of drivers, each of which has a vehicle capacity and a detour to realize all trips. Recently, Gu et al. showed that the problem is NP-hard even for star graphs restricted with unique destination, and gave a polynomial-time algorithm to solve the problem for paths restricted with unique destination and zero detour. In this paper we will give a dynamic programming algorithm to solve the problem in polynomial time for trees restricted with unique destination and zero detour. In our best knowledge it is a first polynomial-time algorithm for trees.

1. Introduction

There are many previous researches for assigning passengers to drivers [1]-[7]. In this paper we deal with a more general ridesharing problem, introduced by Gu et al. [8], in which each individual is a driver or passenger. Let G be a connected and edge-weighted graph with vertex set V ( G ) and edge set E ( G ) . Let k be a positive integer, and let a ridesharing infomation R be a set of k trips ( i , s i , t i , c i , d i , P i ) , 1 i k , where

s i and t i are the source (start location) and the destination, respectively, of the i-th trip;

c i is the number of seats (capacity) of the i-th driver available for passengers including the driver;

d i is the detour distance limit which the i-th driver can tolerate for offering ridesharing services; and

P i is the preferred path of the i-th trip from s i to t i in G.

Let I ( R ) be the set of the indices of all trips in R which should be served, that is, I ( R ) = { i | ( i , s i , t i , c i , d i , P i ) R } . A ridesharing of a graph G with R is a mapping f : I ( R ) I ( R ) such that, for each i I ( R ) , if f 1 ( i ) = then i f 1 ( i ) , | f 1 ( i ) | c i and there is a trip (walk) P satisfying P j P for each j f 1 ( i ) and the distance of P is at most d i plus the distance of P i , where f 1 ( i ) = { j | f ( j ) = i } , that is, f 1 ( i ) is the set of the indices of trips served by the i-th driver. Let d r i v e r ( f ) be the number of drivers of a ridesharing f, that is,

d r i v e r ( f ) = | ) + c a p ( T e j , v , α 2 ) } .

Furthermore, all c a p ( T v j , v , α ) , 0 α k , can be computed from all c a p ( T v j 1 , v , α 1 ) and c a p ( T v j , v j , α 2 ) in time O ( k 2 ) .

Proof. We first prove

c a p ( T v j , v , α ) m a x 0 α 1 , α 2 α , α 1 + α 2 = α { c a p ( T v j 1 , v , α 1 ) + c a p ( T e j , v , α 2 ) } . (6)

If c a p ( T v j , v , α ) = , then Equation (6) trivially holds. We thus assume that c a p ( T v j , v , α ) = , that is, there is a ridesharing f with the instance ( T v j , R ( T v j , v ) , v ) such that d r i v e r ( f ) α and c a p ( T v j , v , α ) = c a p ( f ) . Let f 1 be a mapping from I ( R ( T v j 1 , v ) ) to I ( R ( T v j 1 , v ) ) such that f 1 ( i ) = f ( i ) for each i I ( R ( T v j 1 , v ) ) . Then clearly f 1 is a ridesharing of T v j 1 with the instance ( T v j 1 , R ( T v j 1 , v ) , v ) . Let α 1 = d r i v e r ( f 1 ) . By the definition of c a p ( T v j 1 , v , α 1 ) we have c a p ( f 1 ) c a p ( T v j 1 , v , α 1 ) . Similarly, let f 2 be a mapping from I ( R ( T e j , v ) ) to I ( R ( T e j , v ) ) such that f 2 ( i ) = f ( i ) for each i I ( R ( T e j , v ) ) . Then clearly f 2 is a ridesharing of T e j with the instance ( T e j , R ( T e j , v ) , v ) . Let α 2 = d r i v e r ( f 2 ) . By the definition of c a p ( T e j , v , α 2 ) we have c a p ( f 2 ) c a p ( T e j , v , α 2 ) . Furthermore, c a p ( f ) = c a p ( f 1 ) + c a p ( f 2 ) and d r i v e r ( f ) = d r i v e r ( f 1 ) + d r i v e r ( f 2 ) , and hence α = α 1 + α 2 . We thus have

c a p ( T v j , v , α ) = c a p ( f ) = c a p ( f 1 ) + c a p ( f 2 ) c a p ( T v j 1 , v , α 1 ) + c a p ( T e j , v , α 2 ) ,

verified Equation (6).

We next prove

c a p ( T v j , v , α ) m a x 0 α 1 , α 2 α , α 1 + α 2 = α { c a p ( T v j 1 , v , α 1 ) + c a p ( T e j , v , α 2 ) } . (7)

Choose α 1 and α 2 such that 0 α 1 , α 2 α , α 1 + α 2 = α and

c a p ( T v j 1 , v , α 1 ) + c a p ( T e j , v , α 2 ) = max 0 α 1 , α 2 α , α 1 + α 2 = α { c a p ( T v j 1 , v , α 1 ) + c a p ( T e j , v , α 2 ) } .

We may assume c a p ( T v j 1 , v , α 1 ) = and c a p ( T e j , v , α 2 ) = ; otherwise Equation (7) trivially holds.

Since c a p ( T v j 1 , v , α 1 ) = , there is a ridesharing f 1 with the instance ( T v j 1 , R ( T v j 1 , v ) , v ) such that c a p ( f 1 ) = c a p ( T v j 1 , v , α 1 ) . Similarly, since c a p ( T e j , v , α 2 ) = , there is a ridesharing f 2 with the instance ( T e j , R ( T e j , v ) , v ) such that c a p ( f 2 ) = c a p ( T e j , v , α 2 ) . Let f be a mapping such that for each i I ( R ( T v j , v ) )

f ( i ) = { f 1 ( i ) i f i I ( R ( T v j 1 , v ) ) , f 2 ( i ) o t h e r w i s e , t h a t i s , i I ( R ( T e j , v ) ) .

Then clearly f is a ridesharing of T v j with the instance ( T v j , R ( T v j , v ) , v ) such that c a p ( f ) = c a p ( f 1 ) + c a p ( f 2 ) and d r i v e r ( f ) = d r i v e r ( f 1 ) + d r i v e r ( f 2 ) . By the definition of c a p ( T v j , v , α ) , we have

c a p ( T v j , v , α ) c a p ( f ) = c a p ( f 1 ) + c a p ( f 2 ) = c a p ( T v j 1 , v , α 1 ) + c a p ( T e j , v , α 2 ) = max 0 α 1 , α 2 α , α 1 + α 2 = α { c a p ( T v j 1 , v , α 1 ) + c a p ( T e j , v , α 2 ) } ,

verified Equation (7).

Furthermore, clearly c a p ( T v j , v , α ) for all α and j , 0 α k , can be computed in time O ( k 2 ) from all c a p ( T v j 1 , v , α 1 ) and c a p ( T e j , v , α 2 ) . ,

2.3. Algorithm

From Lemmas 2.1―1 one can obtain the following algorithm to compute all c a p ( T v , v , α ) , v V ( T ) and 0 α k .

Algorithm Alg( T v , R , v , c a p ) begin if v is a leaf in T , then c a p ( T v , v , α ) = 0 for all α , 0 α k , by Lemm 2.1; else if v is an internal vertex in T , then begin let v 1 , v 2 , , v l be the children of v ordered arbitrarily, and let e j , 1 j l , be the edge joining v to v j ; for each j , 1 j l , compute all c a p ( T e j , v , α ) , 0 α k , from all c a p ( T v j , v j , α 1 ) m 0 α 1 k , by Lemma 1; for each j , 1 j l , compute all c a p ( T v j , v , α ) , 0 α k , from all c a p ( T v j 1 , v , α 1 ) , 0 α 1 k , and all c a p ( T e j , v , α 2 ) , 0 α 2 k , by Lemma 1; let c a p ( T v , v , α ) = c a p ( T v l , v , α ) for all α , 0 α k ; end end

Clearly it runs in time O ( k 2 n ) since T has the n vertices. This completes to prove Theorem 2.

3. Conclusion

In this paper we gave a dynamic programming algorithm to solve the ridesharing problem for trees restricted with unique destination and zero detour. Our algorithm runs in polynomial time. However, it is still open whether or not there is a polynomial-time algorithm to solve the problem restricted with unique destination and zero detour for series-parallel graphs and graphs with bounded treewidth.

Funding

This work is partially supported by JSPS KAKENHI Grant Number JP16K00003 (X. Zhou).

Cite this paper
Li, Y. , Lu, H. , Ye, Z. and Zhou, X. (2017) A Dynamic Programming Algorithm for the Ridersharing Problem Restricted with Unique Destination and Zero Detour on Trees. Journal of Applied Mathematics and Physics, 5, 1678-1685. doi: 10.4236/jamp.2017.59140.
References
[1]   Agatz, N., Erera, A., Savelsbergh, M. and Wang, X. (2011) Dynamic Ride-Sharing: A Simulation Study in Metro Atlanta. Transp. Res. Part B, 45, 1540-1564. https://doi.org/10.1016/j.trb.2011.05.017

[2]   Agatz, N., Erera, A., Savelsbergh, M. and Wang, X. (2012) Optimization for Dynamic Ride-Sharing: A Review. European Journal of Operational Research, 223, 295-303. https://doi.org/10.1016/j.ejor.2012.05.028

[3]   Baldacci, R., Maniezzo, V. and Mingozzi, A. (2004) An Exact Method for the Car Pooling Problem Based on La-grangean Column Generation. Oper. Res., 52, 422-439. https://doi.org/10.1287/opre.1030.0106

[4]   Brucker, P. and Nordmann, L. (1994) The k-Track Assignment Problem. Computing, 54, 97-122. https://doi.org/10.1007/BF02238071

[5]   Chan, N.D. and Shaheen, S.A. (2012) Ridesharing in North America: Past, Present, and Future. Transp. Rev., 32, 93-112. https://doi.org/10.1080/01441647.2011.621557

[6]   Cordeau, J.-F. and Laporte, G. (2007) The Dial-a-Ride Problem: Models and Algorithms. Annals of Operations Re-search, 153, 29-46. https://doi.org/10.1007/s10479-007-0170-8

[7]   Ghoseiri, K., Haghani, A. and Hamedi, M. (1979) Real-Time Ridesharing Matching Problem. Final Report of UMD-2009-05. U.S. Department of Transportation.

[8]   Gu, Q.-P., Liang, L. and Zhang, G. (2016) Algorithmic Analysis for Ridesharing of Personal Vehicles. Proc. of COCOA 2016, LNCS 10043, 438-452. https://doi.org/10.1007/978-3-319-48749-6_32

 
 
Top