1 Introduction

In major cities, people enjoy a wide range of transportation modes: buses, urban railways, trams, taxis, and their own private cars. Besides, different ride-sharing providers started in recent years, although the dial-a-ride concept is already known since around 1970 (Oxley 1980). An important difference to the first concepts is that nowadays providers usually use apps to connect drivers and passengers. The biggest company, Uber, which connects private drivers to potential customers, started 2009 and operates worldwide (Uber Technologies, Inc. 2020). In contrast to Uber, most providers have employed drivers. Among others even companies with competing business models push into the ride-sharing market. MOIA—a subsidiary company of the automobile manufacturer Volkswagen AG—operates in Hanover (since 2018), and Hamburg (since 2019) (MOIA GmbH 2020). ioki—a subsidiary company of the main German railway company, Deutsche Bahn AG—was founded in 2017 and operates among others in Hamburg (ioki GmbH 2020).

Although the dial-a-ride problem is well investigated (Ho et al. 2018), to the best of our knowledge no paper considers the problem these competitors of taxis and private cars in large cities have. For them customer satisfaction is much more important than a minimal driven distance. On the one hand, they compete directly with other modes of transportation and need a high service level to reach a sufficient market share. Thus, they have to be fast enough from the perspective of many customers in order to become a viable alternative for the end user. On the other hand, these companies want to improve the quality of life by less traffic and reduced pollution. Beside the traffic reduction due to the pooling effect, they use electric vehicles to reach this aim. However, electric vehicles are cheaper to recharge and, perspectively [MOIA plans to use autonomous vehicles in Hamburg from 2025 on (MOIA GmbH 2020)], driver costs can be omitted if autonomous vehicles are available. Because of that pure distance minimization is not an appropriate objective. Instead, these ride-sharing providers aim at the minimization of the time between request and arrival at the delivery location for each customer.

In this paper, we minimize the sum of relative detours over all customers in a static setting, i.e. the arrival time at the destination minus the request time minus the direct travel time between pickup and delivery location divided by the latter. The maximum relative detour is penalized additionally to prevent prohibitively long ride or waiting times. We assume a number of vehicles with a maximum passenger capacity as given. Due to our objective, we can omit time windows and maximum waiting and ride time constraints (Psaraftis 1980; compare Cordeau 2006; Ropke et al. 2007). Therefore, we do not need feasibility tests (see Hunsaker and Savelsbergh 2002; Tang et al. 2010; Gschwind and Drexl 2019) since picking up a customer and driving directly to their destination before the next customer gets into the vehicle is always feasible even if only one vehicle with a sufficient capacity is used (all customers must be picked up after their request time). Our objective might lead to empty trips, which are detrimental relating to other objectives such as cost minimization, but they are necessary to compete against taxis and private cars. Taxis have significant empty trips as well (Bischoff and Maciejewski 2016), which are even increased to reduce passenger waiting times (Lees-Miller and Wilson 2012).

We present a literature review in Sect. 2. Afterwards, we introduce the problem in detail in Sect. 3. In Sect. 4, we put forward a general heuristic solution approach based on adaptive large neighbourhood search and in Sect. 5 we introduce a dynamic programming approach for single-tour instances. Both approaches are evaluated in a computational study (Sect. 6) afterwards. The paper closes with a conclusion (Sect. 7).

2 Literature review

The static dial-a-ride problem (DARP) has been subject to an extensive amount of research. Originally, it was formulated by Psaraftis (1980). The exact definition of the DARP differs, but generally the DARP features customer satisfaction (Parragh et al. 2008) to distinguish it from a standard pickup and delivery problem. However, the way customer satisfaction is measured differs a lot. Most commonly used are maximum ride time constraints (Lehuédé et al. 2014) and time windows. Some authors consider hard time windows, which are never allowed to be violated (Cubillos et al. 2014), while others allow violations and penalize them in the objective function (Chevrier et al. 2012; Atahran et al. 2014).

The objective function of a DARP formulation often aims to minimize operating costs like the number of needed vehicles (Baugh et al. 1998) or the total travelled distance (Diana and Dessouky 2004). Mostly, they are combined in a multi-criteria objective function (Baugh et al. 1998). Other approaches search for pareto-optimal frontiers of solutions instead (Atahran et al. 2014).

However, there are also works which consider customer satisfaction in the objective function. Parragh et al. (2009) propose a multi-objective DARP where both the routing cost and the mean user ride times are minimized. The same objective function is evaluated in Molenbruch et al. (2017b). Sexton and Bodin (1985) consider a problem where the customers can specify a desired delivery time and the objective function then minimizes the sum of excess ride times and the deviation to the desired delivery time. Diana and Dessouky (2004) present a DARP where the customer can specify a pickup or a delivery time. The objective function is a weighted sum of the total distance, the excess ride time, and the total idle time. A lexicographic objective is considered by Schilde et al. (2011): Primarily, the total tardiness is minimized, then the number of vehicles and finally the total duration of the routes. To the best of our knowledge, no other work has presented an objective function that minimizes the weighted relative detour as described in Sect. 3. Instead, if the ride or waiting time is considered at all in the objective, it is generally summed up nominally and not relative to the minimum travel time.

Exact solution methods for the DARP have been studied in the form of branch-and-cut algorithms (Cordeau 2006; Ropke et al. 2007) and branch-and-cut-and-price algorithms (Wilson et al. 1999; Baldacci et al. 2011; Gschwind and Irnich 2015). Heuristic solution methods include metaheuristics such as variable neighbourhood search (Parragh et al. 2010; Muelas et al. 2013), Tabu Search (Cordeau and Laporte 2003), simulated annealing (Baugh et al. 1998; Reinhardt et al. 2013), and adaptive large neighbourhood search (Gschwind and Drexl 2019).

A lot of research has been influenced by real-life problems in the transportation of elderly, handicapped or ill passengers (Jorgensen et al. 2007; Heilporn et al. 2011; Detti et al. 2017). Nevertheless, especially for urban areas dial-a-ride problems have also been studied in the context of commercial ride-sharing and demand responsive transport systems (Jaw et al. 1986; Parragh et al. 2015). Muelas et al. (2013) consider a dial-a-ride problem for on-demand transportation in large cities, but they use routing cost minimization as their objective.

3 Problem description

Our problem differs from the standard DARP formulation (Cordeau and Laporte 2007) in the objective function as well as some constraints. As in the standard formulation we consider

  • a number of requests with a given demand, i.e. the number of people who want to travel in common,

  • k homogeneous vehicles with fixed capacity starting from the same depot,

  • a pickup and a delivery location for each request which have to be visited by the same vehicle and in the sequence pickup before delivery, and

  • travel times between each pair of locations.

Ride-sharing providers compete in large cities with different modes of transportation like public transport, taxis or private cars. Hence, a customer-oriented objective is necessary to be attractive for customers. On the other side, it is not that important to minimize the total travel distance, as ride-sharing providers typically use electric vehicles, which are cheaper to recharge, to reduce pollution in cities (we do not consider recharging in this paper, as the vehicles are typically recharged during upfront scheduled breaks in practice). In the medium or long term they further target to use autonomous vehicles (no costs for drivers).

Thus, as distinguished from the standard DARP formulation, we do not minimize the travel distance or travel time. Instead, we minimize the customer inconvenience by minimizing the sum of relative detours over all customers. By detour we mean the difference between arrival time at the delivery location and the sum of request time and direct travel time between pickup and delivery location, i.e. the detour includes the waiting time. Afterwards, the detour is divided by the direct travel time between pickup and delivery location to get the relative detour. In order to prevent a single customer from having a prohibitively long detour, the maximum detour over all customers is additionally penalized.

The objective value is given by

$$\begin{aligned} \sum _{i\in P}q_i\frac{B_{i+n}-r_{i} - t_{i,i+n}}{t_{i,i+n}} + w \cdot \max _{i\in P}\left( \frac{B_{i+n}-r_{i} - t_{i,i+n}}{t_{i,i+n}}\right) , \end{aligned}$$

where \(q_i\) is the number of passengers in request i, \(r_i\) is the request time (i.e. earliest possible pickup time) of request i, \(t_{i,i+n}\) is the direct travel time from the pickup to the delivery location of request i, \(B_{i+n}\) is the arrival time at the delivery location of request i, and w is the penalty factor for the maximum detour. Hence, the first part of the objective value measures the sum of relative detours, i.e. the sum of waiting time and riding time for each customer relative to the direct travel time, weighted with the number of passengers. The second part of the objective function penalizes the maximum relative detour. A higher value for the penalty factor w increases the importance of minimizing the maximum relative detour compared to minimizing the sum of all weighted relative detours. Note that the number of passengers \(q_i\) is not present in the second term, as the maximum relative detour should be measured independently of the number of passengers in the request. If \(q_i\) would be part of the maximum in (1), the maximum could be determined by a request with a smaller relative detour but a larger number of passengers.

The direct travel time between pickup and delivery location can be understood as the minimum required time for the request. It acts as a benchmark since we assume that customers could use their own private car or a taxi to leave at their earliest pickup time and travel straight to their destination. Any delay caused by waiting or by making a detour for another customer will increase the customer’s inconvenience and also increase the objective value. Since the objective value is measured relative to the direct travel time, a request with a small direct travel time can lead to a large increase in the objective value for a moderate detour. We believe that this captures actual customer behaviour, as customers will often put their experienced delay in relation to their expected travel time (Nie 2000).

Fig. 1
figure 1

Example for the first part of the objective function. Continuous lines represent journey times. Dotted lines represent waiting times

Figure 1 gives an example for the first part of the objective function. It shows the vehicle’s tour on top, the customer’s waiting and driving times in the middle, and a time axis as well as the request times (\(r_1\)\(r_3\)) in the lower part. First, the vehicle drives from the depot to the pickup location of customer 1 (\(P_1\)). As the tour between depot and the first location is not relevant for the objective (we assume that each pickup location is reachable directly from depot until the corresponding request time, i.e. vehicle and driver are available early enough), it is not included in the figure. The vehicle reaches the first pickup location at time \(r_1\). From there it drives to the delivery location of customer 1 (\(D_1\)). Thus, the first customer has an objective value of zero. They had no waiting time and travelled directly from the pickup to the delivery location. Afterwards, the vehicle drives to \(P_2\). Until it reaches \(P_2\), customer 2 has to wait from \(r_2\) on. After driving to \(P_3\), the vehicle, with customer 2 in it, has to wait because it reaches \(P_3\) before \(r_3\). However, this waiting time counts as journey time for customer 2 since they sit in the vehicle. Then, customers 2 and 3 drive to \(D_3\), where customer 3 leaves the vehicle, before the vehicle finally reaches the destination of customer 2. The tour between the last delivery location and the depot is not relevant for the objective and, therefore, not included in the figure. Like customer 1 customer 3 has an objective value of zero while customer 2 has a positive objective value. It sums up the waiting time between \(r_2\) and their entrance in the vehicle and the tour \(P_2 \rightarrow P_3 \rightarrow D_3 \rightarrow D_2\) (including waiting at \(P_3\)). Afterwards, the direct tour \(P_2 \rightarrow D_2\) is subtracted before the resulting objective value is obtained by dividing the result by the direct travel time \(P_2 \rightarrow D_2\).

Although we do not minimize the travel time directly, our objective minimizes it indirectly if customers are waiting to be fetched or sitting in the vehicle. Solution approaches will try to be as fast as possible at a customer location to reduce the waiting time of later customers. Thus, the algorithm tries to bundle rides, i.e. increase the pooling rate, to reduce travel distance.

Our objective leads further to adjustments of the constraints in comparison with the standard DARP formulation. Because we minimize customer inconvenience, we do not need constraints which ensure a certain degree of customer satisfaction. Therefore, we abstain from a maximum ride time restriction and time windows. This is also the reason why there is a feasible solution in our problem setting. If the vehicle’s capacity is at least as high as the highest customer demand, all solutions which sequence the delivery location of a customer directly after their pickup location are feasible. Although such a solution is minimal according to the journey time of each customer, it might be bad according to the waiting times. Therefore, the proposed objective solves the trade-off between minimal journey time and waiting time by combining the rides of earlier customers, and, thus, increase their journey time, to reduce the waiting time of later customers. The maximum relative ride time is further controlled by the second part of the objective function. By this, we ensure that a single customer is not disadvantaged excessively in favour of the other customers.

In the following, we present a mixed-integer programming formulation for our problem setting. The notation used in the remainder of the paper is:

\(\underline{\hbox {sets and indices:}}\)

\(P=\{1,\ldots , n\} \)

pickup locations

\(D=\{n+1,\ldots , 2n\} \)

delivery locations

\(i,j\in I\)

locations, \(I= \{ 0, 2n+1 \}\cup P\cup D\)

\(\underline{\hbox {parameters:}}\)


number of tours


number of requests


capacity of each vehicle


demand at location \(i \in P \cup D\): \(q_i>0\) and \(q_{i+n} = -q_i\quad \forall i\in P\)


request time (= earliest possible pickup time) of request \(i\in P\)

with \(r_{i}=r_ {i-n}+t_{i-n,i} \quad \forall i\in D\)


travel time between locations i and \(j \in I\)


Penalty factor for the maximum relative detour of all customers


sufficiently large value

\(\underline{\hbox {variables:}}\)


departure time of location \(i \in P \cup D\)


number of passengers in the vehicle after leaving location \(i \in P\cup D\)


\(= 1\) if j is direct successor of i, 0 otherwise; \(i,j\in I\)

We always consider a travel speed of one distance unit per time unit and, thus, use distances and travel times synonymously. We assume that we have a fleet of k vehicles with passenger capacity Q that each drive a single tour starting at a common depot (\(i=0\)). Each tour ends at the end depot (\(i=2n+1\)). Since the return to the end depot does not influence the objective value, the formulation can also be used to model situations where the tours are open-ended. There are n customer requests that all need to be served. Each request i has an earliest pickup time \(r_i\) which acts as a hard lower bound for the pickup time. There is no upper limit to the pickup time of a customer, however, large deviations are unlikely since they increase the objective value and are additionally punished by the penalty factor w. All travel times are assumed to fulfil the triangle inequality.

Beside objective function (1), which is minimized, the model is the standard 2-index dial-a-ride formulation by Ropke et al. (2007) without time windows and maximum ride time constraints. We need to define the sets \(S\subseteq I\) and \({\mathcal {S}}\). \({\mathcal {S}}\) is the set of all sets S for which \(0 \in S\) and there is at least one request i that has its delivery node in S but not the pickup node, i.e. \({\mathcal {S}} = \{ S: 0 \in S \wedge \exists i: (i\notin S \wedge n+i\in S) \}\). Then, the constraints are:

$$\begin{aligned} \sum _{i\in I}X_{ij}&=1\quad&\forall j\in P\cup D \end{aligned}$$
$$\begin{aligned} \sum _{j\in I}X_{ij}&=1\quad&\forall i\in P\cup D \end{aligned}$$
$$\begin{aligned} \sum _{j\in P \cup D}X_{0j}&= k&\end{aligned}$$
$$\begin{aligned} \sum _{i,j\in S}X_{ij}&\le |S|-2\quad&\forall S\in {\mathcal {S}} \end{aligned}$$
$$\begin{aligned} B_i+t_{ij}-M_{ij}(1-X_{ij})&\le B_j&\forall i, j\in P\cup D \end{aligned}$$
$$\begin{aligned} Q_i+q_j-Q(1-X_{ij})&\le Q_j&\forall i, j\in P\cup D \end{aligned}$$
$$\begin{aligned} B_i&\ge r_i&\forall i\in P \cup D \end{aligned}$$
$$\begin{aligned} \max \{0,q_i\}&\le Q_i\le \min \{Q,Q+q_i\}&\forall i\in P\cup D \end{aligned}$$
$$\begin{aligned} X_{ij}&\in \{0,1\}&\forall i, j\in I \end{aligned}$$

Constraints (2) and (3) enforce that every pickup and every delivery location is entered and left exactly once. Constraint (4) forces the model to leave the depot k times to form tours. Constraints (5) serve both as a subtour elimination constraint as well as to ensure that pickup and delivery location of each customer are always visited in the same tour and in the correct order. Constraints (6) and (7) enforce the correct setting of time and capacity variables. Finally, the Constraints (8), (9), and (10) restrict the variable domains.

In order to generate the sets S for Constraints (5), we adopt the procedure by Ropke et al. (2007): At every integer feasible solution, a maximum flow problem is run for each customer to verify whether the customer’s pickup node and delivery node are visited in the same tour and correct order. If not, a new set S is added to cut off the current solution.

4 Adaptive large neighbourhood search

Adaptive large neighbourhood search (ALNS) is a metaheuristic developed by Ropke and Pisinger (2006a). In each iteration, a new solution is created based on the current solution: first, a removal heuristic removes certain customers, i.e. their pickup as well as their delivery locations, from the solution. Then, an insertion heuristic reinserts the removed customers back into the solution. Both the removal and the insertion heuristic are chosen based on their past performance in the algorithm. If a specific heuristic can consistently create new, high-quality solutions, it is used more often. The new solution is accepted based on the simulated annealing acceptance criterion. In the following, we describe our implementation in detail.

Our algorithm’s initial solution is randomly generated. Unless otherwise mentioned, the removal heuristics will always remove q (determined similarly to Ropke and Pisinger (2006a)) customers and the insertion heuristics will insert all of the removed customers back into the solution. The parameter q is dependent on the number of customers n and is drawn from the interval \([1,\xi \cdot n]\) with \(0<\xi <1\) in each iteration.

The heuristics marked with an * are run with an additional random component that perturbs the selection process so that we do not always choose the q “best” customers but only give a higher probability to better customers to be chosen. It works by drawing a random number \(x\in [0,1)\) and then raising it to the power of a parameter \(\rho >1\). \(x^\rho \) is a random number that is weighted towards 0 and if multiplied with the number of options and rounded down, will give the index of the option that should be chosen. If the options are sorted according to a quality criterion beforehand, higher quality options will be chosen more often. The procedure is explained in more detail in Ropke and Pisinger (2006a) and was originally proposed by Shaw (1997). The higher the controlling parameter \(\rho \), the higher the influence of the underlying ordering and the lower the randomization.

The heuristics marked with an \(^{+}\) are also run with an additional random component but instead of the aforementioned rank based selection by Shaw (1997) we run a roulette wheel selection where the quality criteria of all the options are summed up and each criterion is then divided by the sum to generate the probability of the option to be selected.

4.1 Removal neighbourhoods

We implemented the following removal neighbourhoods:

  1. 1.

    Random removal: q customers are selected randomly and removed from their tour [diversification; Pisinger and Ropke 2007].

  2. 2.

    Worst removal (tour)\(^{+}\): the q customers with the worst contribution to their tour are removed, i.e. the q customers for which the difference between the objective value of the corresponding tour with and without the customer is maximized (Pisinger and Ropke 2007).

  3. 3.

    Worst removal (individual)\(^{+}\): the q customers with the worst contribution to the objective value are removed, i.e. the q customers with the highest individual objective value. The request with the current maximum relative detour is additionally penalized by adding the product of w and its contribution as well.

  4. 4.

    Related removal distance*: choose a random customer \(i \in P\) and remove it as well as their \(q-1\) most related customers, i.e. those customers for which

    $$\begin{aligned} s_{ij} = t_{ij} + t_{ji} + t_{i,j+n} + t_{j+n,i} + t_{j,i+n} + t_{i+n,j} + t_{i+n,j+n} +t_{j+n,i+n} \end{aligned}$$

    with \(j \in P\) is minimal (Shaw 1998; Pisinger and Ropke 2007).

  5. 5.

    Related removal request time*: referred to as time-oriented removal in (Pisinger and Ropke 2007), this heuristic works the same as in 4. with

    $$\begin{aligned} s_{ij} = |r_i - r_j|. \end{aligned}$$
  6. 6.

    Proximity removal\(^{+}\): Compute

    $$\begin{aligned} s_{ij} = {\left\{ \begin{array}{ll} \frac{1}{t_{ij} + t_{ji} + t_{i,j+n} + t_{j+n,i} + t_{j,i+n} + t_{i+n,j} + t_{i+n,j+n} +t_{j+n,i+n} + |r_i - r_j|}&{} \text {if } q_i + q_j \le Q, \\ 0 &{}\text {else} \end{array}\right. } \end{aligned}$$

    and take for each customer \(i \in P\) the highest \(s_{ij}\) value over all customers \(j \in P\) which are assigned to different tours. Then, choose q customers according to a roulette-wheel selection where the weight of customer i is the highest \(s_{ij}\) value. In contrast to related removal, the removed customers are not similar amongst each other but have a similar request in a different route in which they might be inserted (Molenbruch et al. 2017a). As Proximity removal does not work in instances with only a single tour (i.e. \(k=1\)), it is automatically turned off in such cases.

  7. 7.

    Cluster removal distance: select a random tour. Apply Kruskal’s algorithm (Kruskal 1956) on all customers of the tour until two clusters are left. The edge costs for the algorithm are given by

    $$\begin{aligned} {\bar{t}}_{ij} = t_{ij} + t_{i+n,j+n} \end{aligned}$$

    for all ij in the considered tour. Choose one of the two clusters randomly and remove all its customers (Ropke and Pisinger 2006b).

4.2 Insertion neighbourhoods

  1. 1.

    Basic greedy insertion: all customers are sorted according to the costs of their best insertion. The customer with the best insertion (smallest increase in the objective value) is inserted first. Afterwards, the next best customer is chosen. This is repeated until all customers are inserted (Pisinger and Ropke 2007).

  2. 2.

    Greedy roulette insertion\(^{+}\): each feasible insertion for every customer is evaluated. Then, a roulette wheel selection is run where each insertion is weighted with the inverse of its objective value, i.e. insertions with lower costs have a higher chance to be chosen and the selection probability depends on the quality of all other options. This increases diversification compared to the normal greedy insertion.

  3. 3.

    Randomized greedy insertion*: all customers are sorted according to the costs of their best insertion. In contrast to insertion neighbourhood 1., we do not simply choose the best customers first but run a weighted random selection with the randomization from Shaw (1997) instead (described above in the second to last paragraph before Sect. 4.1). Compared to insertion neighbourhood 2., the randomized greedy insertion only takes the ordering, i.e. the ranking, of the insertions into account, not the actual differences between their costs.

  4. 4.

    Regret g insertion: the customer with the highest regret value is inserted, that is, the customer that has the biggest difference between the cost of the insertion into the best tour and the insertions into the g best tours (Pisinger and Ropke 2007). If \(g>2\), the differences between the best and the other tours are added up to compute the regret value. In instances with fewer tours than the specified regret level, the level is automatically adjusted to the number of tours.

  5. 5.

    Greedy insertion perturbation: the same as insertion neighbourhood 1., but each objective value is multiplied with a random factor in \([1-\gamma , 1+\gamma ]\) with \(0<\gamma <1\). Afterwards, the best solution is chosen (Hemmelmayr et al. 2012). This operator allows us to observe the effect of noise perturbation for a single heuristic.

4.3 Choice of removal and insertion heuristic

We follow the original implementation of Ropke and Pisinger (2006a) where heuristics are chosen by roulette wheel selection and each heuristic is given a score whenever a new solution is found: \(\sigma _1\) is assigned to a heuristic whenever a new best solution is found, \(\sigma _2\) when a better solution is found that has not been accepted before and \(\sigma _3\) when a worse but accepted solution is found which has not been accepted before. After a segment of 100 iterations, the weights for the roulette wheel selection are updated with the scores and the scores are reset. A reaction factor \(\phi \in [0,1]\) determines how quickly the heuristics change their weights. A higher \(\phi \) will increase the influence of the performance in the current segment and decrease the influence of the previous weight. The determination of parameters is explained in Sect. 6.2.

4.4 Temperature

Our algorithm is run for 25,000 iterations or until an objective value of 0 is found. At the end of each iteration, we set the temperature T to \(T{:}{=}\alpha T\) with \(0<\alpha <1\). The starting temperature is generated similarly to Ropke and Pisinger (2006a): We use the objective value of the initial solution and set the starting temperature such that a hypothetical move that worsens the initial solution by a factor of \(\omega \) (with \(\omega \ge 0\)) is accepted with a probability of 50%. As an example, for \(\omega =0.2\) a solution that is 20% worse than the initial solution is accepted with a probability of 50%. The temperature is used in the simulated annealing acceptance criterion (Kirkpatrick et al. 1983): Whenever a new solution is found that is better than the old one, it is accepted. If it is worse, it is accepted with a probability given by \(e^{-\varDelta /T}\) where \(\varDelta \) is the difference between the new and the old objective value and T is the current temperature.

5 Dynamic programming algorithm

Dynamic programming algorithms have been studied for dial-a-ride problems for decades. Early approaches were given by Psaraftis (1980, 1983). Our approach is based on the dynamic programming algorithm for the travelling salesman problem by Bellman (1962) and Held and Karp (1962). In a recent paper, Ritzinger et al. (2016) developed a dynamic programming algorithm for the standard dial-a-ride formulation with time windows and maximum ride time constraints. Due to these further constraints, they need a larger state space than we do. The following algorithm finds an optimal solution for any single tour instance (i.e. \(k=1\)) in our problem setting. Although the DP can also be expanded to multiple tours, we refrain from doing so because of the memory requirements and computation times the single-tour DP already needs (compare Table 4).

  • Stages number of locations without the depot \(I\backslash \{ 0 \}\).

  • States states are described by the quadruple \((S,v,t,d_{max})\), where v is the current last location, S is the set of all already scheduled locations without v, t the point of time, and \(d_{max}\) the maximum relative detour over all customers so far. The number of customers in the vehicle is not part of the state, as it can be calculated with v and S as \(\sum _{i \in S \cup \{ v \}} q_i\). The initial state is \((\{ \}, 0, 0, 0)\), i.e. no customer has been visited so far (\(S = \{ \}\)), the current location is the depot (0), the current point in time is 0 (\(t = 0\)), and the maximum relative detour is 0.

  • Transitions the tour is expanded by one location \(v'\) from the set \(\{ i \in P: i \notin S \cup \{ v \} \wedge q_i + \sum _{j \in S \cup \{ v \}} q_j \le Q \} \cup \{ i \in D: i \notin S \cup \{ v \} \wedge i-n \in S \cup \{ v \} \}\), i.e. all pickup locations are allowed to be scheduled which have not been scheduled so far as long as \(q_i\) does not exceed the remaining capacity \(Q - \sum _{j \in S \cup \{ v \}} q_j\) as well as all delivery locations for which the corresponding pickup location has already been scheduled and which have not been scheduled themselves. The time t increases by the travelled time \(t_{vv'}\) between locations v and \(v'\) or up to \(r_{v'}\) if \(v' \in P\) and \(t + t_{vv'} < r_{v'}\), i.e. \(t' = \max (t + t_{vv'}, {\mathbbm {1}}_{\{ v' \in P, t + t_{vv'} < r_{v'} \}} \cdot r_{v'})\), where \({\mathbbm {1}}_{\{ v' \in P, t + t_{vv'} < r_{v'} \}}\) is 1 if \(v' \in P\) and \(t + t_{vv'} < r_{v'}\) and 0 else. Thereby, \(d'_{max} = \max \left( d_{max}, \max _{i \in P: i + n \notin S} \frac{t' - r_i - t_{i,i+n}}{t_{i,i+n}} \right) \). While the first part of the maximum covers the case that the maximum relative detour does not change, the second part covers the case where a not yet delivered customer leads to a new maximal relative detour. Hence, the new state is \((S\cup \{ v \},v',t',d'_{max})\).

  • Recursion costs of a state \((S,v,t, d_{max})\) are

    $$\begin{aligned}&C(S,v,t, d_{max}) \nonumber \\&\quad = \min _{{\bar{v}} \in S} \left\{ C(S \backslash \{ {\bar{v}} \}, {\bar{v}}, {\bar{t}}, {\bar{d}}_{max}) \right. \nonumber \\&\qquad \left. + \sum _{i \in P: i+n \notin S} {\mathbbm {1}}_{\{ t > r_{i} + t_{i,i+n} \}} \cdot q_i \cdot \frac{\min (t - {\bar{t}}, t - r_{i} - t_{i,i+n})}{t_{i,i+n}} \right. \nonumber \\&\qquad \left. + w \cdot \max (0, d_{max} - {\bar{d}}_{max}) \right\} \end{aligned}$$

    with \({\mathbbm {1}}_{\{ t> r_{i} + t_{i,i+n} \}} = {\left\{ \begin{array}{ll} 1 &{} \text {if } t > r_{i} + t_{i,i+n}, \\ 0 &{} \text {else} \end{array}\right. }\) and \(t = {\left\{ \begin{array}{ll} {\bar{t}} + t_{{\bar{v}}v} &{} \text {if } v \in D, \\ \max \{ {\bar{t}} + t_{{\bar{v}}v}, r_v \} &{} \text {if } v \in P. \end{array}\right. }\)

The time in the state description leads to a potentially high number of states. Nevertheless, it is necessary, as the tour \({\tilde{v}} \rightarrow i+n \rightarrow j \rightarrow v\) might be longer (let t be the time the vehicle reaches location v) than \({\tilde{v}} \rightarrow j \rightarrow i+n \rightarrow v\) but leads to a smaller objective value, as customer i is taken away earlier. In contrast, the longer tour increases the relative detour of all other customers \(j \in P\) with \(r_j < t\) which have not been taken away so far. Hence, it is possible that \(C(S,v,t, d_{max}) < C(S,v,t', d'_{max})\) although \(t > t'\). However, we get a dominance rule for the case \(t' \ge t\).

Theorem 1


$$\begin{aligned} \begin{aligned}&C(S,v,t,d_{max}) + \sum _{i\in P: i+n \notin S \cup \{ v \}} q_i \cdot \frac{\max (t' - \max (t, r_i + t_{i,i+n}),0)}{t_{i,i+n}} \\&\qquad + w \cdot \max (0, d'_{max} - d_{max}) \\&\quad < C(S,v,t', d'_{max}). \end{aligned} \end{aligned}$$

Then, \((S,v,t,d_{max})\) dominates \((S,v,t',d'_{max})\) if \(t \le t'\).


Both states \((S,v,t,d_{max})\) and \((S,v,t',d'_{max})\) coincide in the already visited customer locations. Let \(\Pi = \pi _{|S|+2}, ... \pi _{2n}\) be any sequence of the not yet visited customers. Let \(t \le t'\). Let \(B_i\) (\(B'_i\)) be the departure time of location \(i \in I\), if we merge state \((S,v,t,d_{max})\) (\((S,v,t',d'_{max})\)) and \(\Pi \) to a complete solution and wait during the tour only if necessary. Then, \(B_i \le B'_i\) for all customer locations in \(\Pi \). Costs for customers with \(i+n \in S \cup \{ v \}\) do not change anymore. Costs can occur for customers with \(i+n \notin S \cup \{ v \}\) if the vehicle has to wait longer if starting at t than if starting at \(t'\). These costs are included in \(\sum _{i\in P: i+n \notin S \cup \{ v \}} q_i \cdot \frac{\max (t' - \max (t, r_i + t_{i,i+n}),0)}{t_{i,i+n}}\). Costs for driving the partial tour \(\Pi \) occur for both states. Thus, the relative detour costs starting in \((S,v,t,d_{max})\) are at most the relative detour costs starting in \((S,v,t',d'_{max})\) plus \(\sum _{i\in P: i+n \notin S \cup \{ v \}} q_i \cdot \frac{\max (t' - \max (t, r_i + t_{i,i+n}),0)}{t_{i,i+n}}\).

Because of \(C(S,v,t,d_{max}) + w \cdot \max (0, d'_{max} - d_{max}) < C(S,v,t',d'_{\max })\), it holds

$$\begin{aligned} C(S,v,t, \max (d_{\max }, d'_{\max })) < C(S,v,t',d'_{\max }). \end{aligned}$$

Since \(B_i \le B'_i\) for all customer locations in \(\Pi \), costs for the maximum relative detour do not increase more strongly at any point of the tour if we start in state \((S,v,t,\max(d_{\max }, d'_{\max }))\) than in state \((S,v,t',d'_{\max })\). In total, completing the tour from v at t leads to no higher costs than starting in v at \(t'\).

Theorem 2 views a variant of Theorem 1 where \(t' \ge t \ge \max _{i \in P} (r_i + t_{i,i+n})\).

Theorem 2

Let \(C(S,v,t,d_{\max }) + w \cdot \max (0, d'_{max} - d_{max}) < C(S,v,t', d'_{max})\). Then, \((S,v,t,d_{max})\) dominates \((S,v,t',d'_{max})\) if \(t' \ge t \ge \max _{i \in P} (r_i + t_{i,i+n})\).


Let \(\Pi \) again be any feasible sequence of the remaining locations \(i \in (P \cup D) \backslash (S \cup \{ v \})\). \(t' \ge t \ge \max _{i \in P} (r_i + t_{i,i+n})\) implies that \(\frac{t-r_i-t_{i,i+n}}{t_{i,i+n}} > 0\) for all \(i \in P: i+n \notin S \cup \{ v \}\) immediately when the car leaves v. Thus, the car does not wait during the partial tour \(\Pi \) and \(B'_i = B_i + (t'-t)\) for all customer locations in \(\Pi \). Hence, completing the tour from v at t leads to no higher costs than starting in v at \(t'\) with the same argumentation as in the proof of Theorem 1 if \(t \le t'\) and

$$\begin{aligned} C(S,v,t,d_{max}) + w \cdot \max (0, d'_{max} - d_{max}) < C(S,v,t', d'_{max}). \end{aligned}$$

Theorem 3 considers also the case, where all customers have a positive relative detour immediately when the car moves (\(\min (t,t') \ge \max _{i \in P} (r_i + t_{i,i+n})\)). Thus, it generalizes Theorem 2.

Theorem 3


$$\begin{aligned}&C(S,v,t,d_{max}) + w \cdot \left( \max (0,d'_{max} - d_{max}) \right. \\&\qquad \left. + \max \left( 0, \max _{i \in P: i+n \notin S \cup \{ v \}}\frac{t-t'}{t_{i,i+n}} \right) \right) \\&\quad < C(S,v,t', d'_{max}). \end{aligned}$$

Then, \((S,v,t,d_{max})\) dominates \((S,v,t',d'_{max})\) if \(\min (t,t') \ge \max _{i \in P} (r_i + t_{i,i+n})\).


We assume \(t > t'\). Otherwise, we have the situation of Theorem 2. Let \(\Pi \) again be any feasible sequence of the remaining locations \(i \in (P \cup D) \backslash (S \cup \{ v \})\). Then, \(B_i = B'_i + (t-t')\) for all of them. \(t > t' \ge \max _{i \in P} (r_i + t_{i,i+n})\) implies that \(\frac{t'-r_i-t_{i,i+n}}{t_{i,i+n}} > 0\) for all \(i \in P: i+n \notin S \cup \{ v \}\) immediately when the car leaves v. However, \(t > t' \ge \max _{i \in P} (r_i + t_{i,i+n})\) implies also that \(\frac{t-r_i-t_{i,i+n}}{t_{i,i+n}} = \frac{t'-r_i-t_{i,i+n}}{t_{i,i+n}} + \frac{t-t'}{t_{i,i+n}}\). Hence, the costs for the longer relative detours in \((S,v,t,d_{max})\) in comparison to \((S,v,t',d'_{max})\) are already included in \(C(S,v,t,d_{max})\). Thus, \(C(S,v,t,d_{max}) + \sum _{i \in P: i+n \notin S \cup \{ v \}} \frac{B_{i+n} - t}{t_{i,i+n}} < C(S,v,t', d'_{max}) + \sum _{i \in P: i+n \notin S \cup \{ v \}} \frac{B'_{i+n} - t'}{t_{i,i+n}}\).

The so far maximum relative detours \(d_{max}\) and \(d'_{max}\) are also priced in in \(C(S,v,t,d_{max})\) and \(C(S,v,t',d'_{max})\), respectively. Because of \(d_{max} + \max (0,d'_{max}-d_{max}) = \max (d_{max},d'_{max})\), we get

$$\begin{aligned} C(S,v,t,d_{max}) + w \cdot \max (0,d'_{max} - d_{max})&= C(S,v,t,\max (d_{max},d'_{max})) \\& < C(S,v,t',d'_{max}). \end{aligned}$$

Since \(B_i = B'_i + (t-t')\) for all \(i \notin S \cup \{ v \}\),

$$\begin{aligned} \max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}} > \max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B'_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}}. \end{aligned}$$

If \(\max (d_{max},d'_{max}) \ge \max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}}\), we are finished, as the larger maximal relative detour is already priced in at location v (\(C(S,v,t,\max (d_{max},d'_{max})) < C(S,v,t',d'_{max})\)). So, let \(\max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}} > \max (d_{max},d'_{max})\). We distinguish two cases:

  1. 1.

    \(\max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}} > \max (d_{max},d'_{max}) \ge \max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B'_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}}\)

  2. 2.

    \(\max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}}> \max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B'_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}} > \max (d_{max},d'_{max})\).

It holds

$$\begin{aligned} \begin{aligned}&\max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}} \\&\quad =\max _{i \in P: i+n \notin S \cup \{ v \}} \left( \frac{B'_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}} + \frac{t-t'}{t_{i,i+n}} \right) \\&\quad \le \max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B'_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}} + \max _{i \in P: i+n \notin S \cup \{ v \}} \frac{t-t'}{t_{i,i+n}}. \end{aligned} \end{aligned}$$

In the first case, this leads immediately to

$$\begin{aligned}&C \left( S,v,t,\max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}} \right) \nonumber \\&\quad = C \left( S,v,t,\max _{i \in P: i+n \notin S \cup \{ v \}} \left( \frac{B'_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}} + \frac{t-t'}{t_{i,i+n}} \right) \right) \nonumber \\&\quad \le C \left( S,v,t,\max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B'_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}} \right) \nonumber \\&\qquad + w \cdot \max \left( 0, \max _{i \in P: i+n \notin S \cup \{ v \}}\frac{t-t'}{t_{i,i+n}} \right) \nonumber \\&\quad \le C \left( S,v,t,\max (d_{max},d'_{max}) \right) + w \cdot \max \left( 0, \max _{i \in P: i+n \notin S \cup \{ v \}}\frac{t-t'}{t_{i,i+n}} \right) \nonumber \\&\quad = C(S,v,t,d_{max}) \nonumber + w \cdot \left( \max (0,d'_{max} - d_{max}) + \max \left( 0, \max _{i \in P: i+n \notin S \cup \{ v \}}\frac{t-t'}{t_{i,i+n}} \right) \right) \end{aligned}$$
$$ < C(S,v,t', d'_{max}).$$

In the second case,

$$\begin{aligned}&C \left( S,v,t,d_{max} \right) + w \cdot \max \left( 0, \max _{i \in P: i+n \notin S \cup \{ v \}}\frac{t-t'}{t_{i,i+n}} \right) \nonumber \\&\quad \le C \left( S,v,t,\max (d_{max},d'_{max}) \right) + w \cdot \max \left( 0, \max _{i \in P: i+n \notin S \cup \{ v \}}\frac{t-t'}{t_{i,i+n}} \right) \nonumber \\&\quad {\mathop {<}\limits ^{(13),(14)}} \; C(S,v,t', d'_{max}) \end{aligned}$$


$$\begin{aligned} \begin{aligned}&C \left( S,v,t,\max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}} \right) \\&\quad {=} C \left( S,v,t,\max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B'_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}} + \frac{t-t'}{t_{i,i+n}} \right) \\&\quad {\le } C \left( S,v,t,\max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B'_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}} \right) \\&\qquad + w \cdot \max \left( 0, \max _{i \in P: i+n \notin S \cup \{ v \}}\frac{t-t'}{t_{i,i+n}} \right) \\&\quad {\mathop {<}\limits ^{(15)}} C \left( S,v,t',\max _{i \in P: i+n \notin S \cup \{ v \}} \frac{B'_{i+n} - r_i - t_{i,i+n}}{t_{i,i+n}} \right) . \end{aligned} \end{aligned}$$

Thus, we can add the costs for the relative detour of each customer \(i \in P: i+n \notin S \cup \{ v \}\) as well as the maximal detour costs for any sequence \(\Pi \) of the remaining customers to \(C(S,v,t,d_{max})\) (and \(C(S,v,t',d'_{max})\)) such that state \((S,v,t,d_{max})\) leads to no higher cost at the end of the tour than state \((S,v,t',d'_{max})\).

Theorem 4 dominates states at pickup locations v where the car has to wait if it is possible to use the waiting time to bring a customer who is in the car to the delivery location or pick up another customer and drive to their delivery location while still reaching v at time \(r_v\).

Theorem 4

Let \((S\backslash \{ {\bar{v}} \}, {\bar{v}}, {\bar{t}}, {\bar{d}}_{max})\) be the predecessor of \((S,v,t,d_{max})\) with \(v \in P\) and \(t = r_v\), i.e. \((S\backslash \{ {\bar{v}} \}, {\bar{v}}, {\bar{t}}, {\bar{d}}_{max})\) determines the costs of \((S,v,t,d_{max})\) in (12). Then, \((S,v,t,d_{max})\) is dominated if one of the sets \(\{ i \in P \cap S: i+n \notin S \wedge {\bar{t}} + t_{{\bar{v}},i+n} + t_{i+n,v} \le t \}\) and \(\{ i \in P \backslash (S \cap P): \max (r_i, {\bar{t}} + t_{{\bar{v}},i}) + t_{i,i+n} + t_{i+n,v} \le t \wedge \sum _{j \in S} q_j + q_i \le Q \}\) is not empty, i.e. if it is possible to take away a customer in the vehicle or pick up and take away another customer and still reach location v not later than \(r_v\).


First, we compare the two transitions \((S \backslash \{ {\bar{v}} \},{\bar{v}},{\bar{t}},{\bar{d}}_{max}) \rightarrow (S,v,t,d_{max})\) and \((S \backslash \{ {\bar{v}} \},{\bar{v}},{\bar{t}},{\bar{d}}_{max}) \rightarrow (S,i+n,t',d'_{max}) \rightarrow (S \cup \{ i \},v,t,{\tilde{d}}_{max})\) with \(i \in \{ i \in P \cap S: i+n \notin S \wedge {\bar{t}} + t_{{\bar{v}},i+n} + t_{i+n,v} \le t \}\). In both transitions \(q_j \cdot \frac{\min (t - r_j - t_{j,j+n})}{t_{j,j+n}}\) is the same for all \(i \ne j \in P\). But customer i reaches the delivery location at no later point in time in the second transition, as \(t' \le t\), i.e. \(q_i \cdot \frac{\min (t' - r_i - t_{i,i+n})}{t_{i,i+n}} \le q_i \cdot \frac{\min (t - r_i - t_{i,i+n})}{t_{i,i+n}}\). As \(q_j \cdot \frac{\min (t - r_j - t_{j,j+n})}{t_{j,j+n}}\) is for no customer \(j \in P\) larger in the second transition than in the first, \({\tilde{d}}_{max} \le d_{max}\). So, the first transition is dominated.

By the same argumentation \((S \backslash \{ {\bar{v}} \},{\bar{v}},{\bar{t}},{\bar{d}}_{max}) \rightarrow (S,i,t^1,d^1_{max}) \rightarrow (S \cup \{i\},i+n,t^2,d^2_{max}) \rightarrow (S \cup \{ i, i+n \},v,t,{\hat{d}}_{max})\) dominates \((S \backslash \{ {\bar{v}} \},{\bar{v}},{\bar{t}},{\bar{d}}_{max}) \rightarrow (S,v,t,d_{max})\) for a customer \(i \in \{ i \in P \backslash (S \cap P): \max (r_i, {\bar{t}} + t_{{\bar{v}},i}) + t_{i,i+n} + t_{i+n,v} \le t \wedge \sum _{j \in S} q_j + q_i \le Q \}\).

Especially the last dominance criterion (Theorem 4) leads to a reduction of states in early stages because customers with high request times are dominated.

The above formulation can solve smaller instances but for larger numbers of customers the time and memory requirements make this exact procedure unsuitable. Therefore, we change the DP to a restricted DP similar to Malandraki and Dial (1996) and Ritzinger et al. (2016). At each stage we only branch on the B states with the lowest costs. If B is sufficiently large, this restricted DP still maintains the guarantee of optimality but if there are more than B states in a stage, it devolves into a heuristic.

6 Computational study

The algorithms were implemented in C++ and compiled with Visual Studio 2017. The tests were run on an AMD Ryzen Threadripper 3990X with 2.9GHz (single-threaded) and 256GB of RAM. The mixed integer program (MIP) was solved with CPLEX version 12.9 with dynamic search enabled.

6.1 Instances

The instances in the computational study are synthetic test instances which are based on a practical application in a district of Hamburg, Germany. For each instance, the pickup and delivery locations are determined randomly out of a set of possible stops of a ride-sharing provider. Since the city layout needs to be taken into account, the resulting distance matrix is not symmetrical but fulfils the triangle inequality. Distances are rounded to the second decimal place and are measured in units of time. The largest possible travel time between two locations is roughly 28 minutes. The smallest possible request time is determined by the maximum distance of the depot to any pickup location maxT, i.e. \(maxT=\max _{i\in P} t_{0,i}\). This ensures that every request can be reached on time if it is the first location in a tour. The request times are uniformly distributed in the interval \([maxT, maxT+\beta \cdot n]\) with \(\beta \ge 0\). For our instances we set \(\beta =100\) which resulted in instances of adequate difficulty as preliminary tests showed. Larger values for \(\beta \) tend to spread out the requests too much so that the instances become too easy while smaller values lead to an unrealistically high concentration of requests in a tight time window. The vehicle capacity is set to six passengers which is common in practice.

The number of tours is varied between 1, 2, 5, and 8. The number of requests is set such that the ratio of requests to tours (i.e. n/k) equals 5, 10, 15, and 20 for each tour configuration. This leads to 16 parameter configurations ranging from 5 to 160 requests. For each configuration we generated 100 instances. Half of the instances had their \(q_i\) set to 1 for every customer. In the other half we drew each \(q_i\) according to an exponential distribution with \(\lambda =0.9\) and rounded the result to the next highest integer. We redrew if the result was greater than our passenger capacity of six. The 400 instances with one tour were also used for the evaluation of the DP. All utilized instances can be found under the following link: https://doi.org/10.25592/uhhfdm.9610.

6.2 Parametrization

The instance generator described above was also used for the parametrization but we took care not to reuse any instances. Furthermore, the instances for the parametrization had passenger demands of one per request and no single-tour instances as the latter makes some of the heuristics unsuitable. Additionally, we varied the penalty factor w in the used instances between 0, n, 2n,  and 5n such that the tuning is not biased towards one specific value of w.

The parameter values for ALNS were determined with the help of the irace package which can automatize the parameter tuning (López-Ibáñez et al. 2016). irace is given a set of parameters and their respective ranges as well as a training set of instances. Then, it performs a certain amount of experiments where the algorithm is tried out with different parameter configurations. The distributions that irace uses for determining the parameters are changed throughout the search to focus on the more promising areas in the parameter search space. In the end, irace gives out a set of elite configurations that have performed best. We chose the best of these elite configurations which resulted in the use of the parameter values in Table 1. The third column additionally gives the range for the distributions that irace used.

Table 1 Parameter values for ALNS

In a next step, we are interested in finding a suitable value for the penalty factor w. Preliminary results showed that a value of \(w=n\) results in a reasonable trade-off between the reduction of the maximum relative detour and the reduction of the sum of all weighted relative detours. More details about this preliminary study can be found in Appendix A. As a result, all instances in the following use the penalty factor \(w=n\).

While the adaptive procedure in the ALNS is in theory capable of identifying poorly performing heuristics during the search, in practice a preselection of heuristics can improve performance significantly (François et al. 2016). For this reason, we performed a series of tests to identify a good heuristic configuration. A more detailed description of the tests for the heuristic configurations can be found in Appendix B.

The evaluation of the heuristic configurations has shown that there are two competitive configurations which are displayed in Table 2. Both of these configurations were utilized in the following calculations. The instances we used for the parameter tuning are different from the ones in the computational study to avoid any kind of bias.

Table 2 Used heuristics of the two best configurations found in the preliminary tests

6.3 Discussion of results

For the ALNS we solved each of the 1,600 instances of our test bed with the two configurations of Table 2. For the 400 instances with one vehicle (\(k=1\)) we turned off the proximity removal heuristic from the first ALNS configuration, as it does not work if only a single tour is examined. Furthermore, these 400 instances were solved by the restricted DP where we varied the amount of states. As an additional benchmark, we also ran the MIP for the smaller instances with a computational time of one hour. In any of the following tables, z refers to the (average) objective value and Time refers to the (average) computational time in seconds.

6.3.1 Results of ALNS

In Fig. 2, the average relative difference to the best found configuration for both configurations is displayed. This means that we computed the relative difference of the worse to the better configuration for all 100 tested instances and averaged them afterwards. The results for the single tour instances are not shown because of the aforementioned changes to the configuration and the separate evaluation in the next subsection. In general, both configurations are fairly close to each other with no clear apparent winner. Comparing the mean over all instances (again excluding the instances with \(k=1\)), configuration 2 is on average 0.23% better. Since the results between the two configuration are so close, we only report the values for the second configuration in the following.

Fig. 2
figure 2

A comparison between the two different heuristic configurations for ALNS. Each square shows the average relative deviation from the best found solution of 100 instances

Table 3 Overview of the performance of the second ALNS configuration on all instances and the MIP solved by CPLEX

A summary of the results of the second configuration can be found in Table 3. The table also states the results of the MIP for comparison. We did not attempt to solve the larger instances with the MIP for \(k=\{2,5,8\}\) as the largest ones we did run could only be solved to feasibility in rare cases (compare \((k,n) = (2,20), (5,25) \text{ and } (8,40)\)). Computation times for ALNS increase with a higher amount of customers, specifically if there are few vehicles, as longer tours prolong the search for a good insertion position in an iteration. Nevertheless, the computation times for ALNS are still acceptable in a static setting. The mixed integer model performs very poorly and can only reliably solve very small instances (\(n=5\)) to optimality in the time limit of one hour. Additionally, the lower bounds for slightly larger instances are very close to 0 which is likely due to a weak LP relaxation of the model formulation. In summary, the basic MIP formulation does not seem suitable to solve the problem which further emphasizes the need for a heuristic like ALNS.

The first part of the objective value for the ALNS results is further visualized in a histogram in Fig. 3 where the first part of the objective value is divided by the number of passengers. The resulting value is the average relative detour per passenger. For the instances where we set \(q_i=1\) for all requests, the first part of the objective value is simply divided by n, but for the other half of the instances, the total number of passengers varies due to the random generation. It is apparent in Fig. 3 that the detour per passenger is especially high for instances with only one vehicle (\(k = 1\)). If there is only one tour, the assignment of customers to tours is already fixed. Hence, the number of possible solutions is lower. As the customer to tour assignment is fixed, the algorithm has no influence on the compatibility of the customers, i.e. whether they fit well together or not. In contrast, for instances with eight vehicles the relative detour per passenger is even for 20 requests per vehicle (on average, i.e. 160 requests in total) close to 0, indicating reasonable detours that would likely be accepted by consumers in practice.

In a second analysis, we present the maximum relative detour per instance of the second configuration in Fig. 4. A similar effect to Fig. 3 can be observed. In instances with few vehicles, the maximum relative detour is rather large, particularly if the number of customers is also high. On the other hand, for a larger number of vehicles (\(k=8\)), the maximum detour is not only lower but also increases more slowly for increasing n (compare the bottom right square to the top right one). Hence, in competition with taxis and private cars, a few further vehicles can make the ride-sharing provider significantly more attractive.

Fig. 3
figure 3

A histogram of the first part of the objective value per passenger for ALNS split into the 16 instance categories, i.e. the average relative detour in each instance. Each square contains 100 instances

Fig. 4
figure 4

A histogram of the second part of the objective value for ALNS split into the 16 instance categories, i.e. the maximum relative detour in each instance. Each square contains 100 instances

The average relative detour per passenger can further be split into the waiting time \(\left( \frac{B_i-r_i}{t_{i,i+n}}\right) \) and the ride time detour \(\left( \frac{B_{i+n} - B_i -t_{i,i+n}}{t_{i,i+n}}\right) \). This is visualized in Fig. 5. Particularly for instances with few vehicles, the majority of the objective value is determined by the customers’ waiting time. As we increase k, the ratio of waiting to ride time decreases. In a static setting, the pickup time \(B_i\) can be communicated to the customer in advance. This can mitigate the negative effect of the high waiting time, as the customers might be able to use the waiting time more effectively than the ride time if they know exactly when they will be picked up.

Fig. 5
figure 5

The first part of the objective value per passenger split into waiting and ride time. Each bar is the average of 100 instances

In Fig. 6, we visualize the development of the ride-sharing effect over different ratios of customers to vehicles. For the instances with a passenger demand of one on the left in Fig. 6, there is little actual ride-sharing when the number of customers per vehicle is low. For \(n/k=5\), for example, almost 80% of the ride time is spent with at most one customer. So the intended effect of reducing the amount of traffic by pooling trips is not actually present. However, the higher pooling rates with a larger number of customers per vehicle justify the choice of the objective function. The objective function considers exclusively the customer’s detour. The results show that a high pooling rate and, hence, a high degree of capacity utilization is accomplished. This means that our objective leads further to good results for the provider on the economic base. In the instances with the exponentially distributed passenger numbers on the right in Fig. 6, the vehicles are more filled on average since even a single request can potentially contain six passengers.

Fig. 6
figure 6

Development of the occupancy rate for all instances with one passenger per request (left) and all instances with exponentially distributed passenger demand (right). The bars for each instance group add up to 1, each individual bar is the relative share of ride time with that amount of customers. For example, in the single passenger instances with \(n/k=5\), 47% of the total ride time a vehicle has a single passenger

In order to better evaluate the impact of the ride sharing, we ran another test in which we simulated a more traditional taxi environment in which no rides are shared. For this we changed the capacity Q to one for all 800 instances where \(q_i=1\). The results of these instances (when solved with configuration 2 of ALNS) compared to the same instances with the original vehicle capacity of six are shown in Fig. 7. Both the detour per customer as well as the maximum detour (and therefore the objective value) increase when the vehicle capacity is reduced. This effect is more pronounced in the instances with more customers per vehicle which coincides with the findings of Fig. 6 that ride sharing has a larger impact when more customers are present per vehicle.

Fig. 7
figure 7

Comparison of the average detour per customer and the average maximum detour between the instances with \(Q=6\) (Sharing) and \(Q=1\) (Taxi)

6.3.2 Results of DP

The restricted DP was run for the 400 instances with \(k=1\). We varied the maximum number of states B for different DP runs to evaluate how many states we need to produce good results in a reasonable time. For the instances with 5, 10, and 15 customers we also provide the optimal solution gained by running the DP without any state restrictions. For the instances with 20 customers this was not possible due to the exponential increase in both time and memory requirements. The results are summarized in Table 4. We also state the result of the second ALNS configuration for comparison. Expectedly, a higher number of states leads to a higher solution quality but also to a higher computational effort. For 5 and 10 customers small state sizes like 5,000 can already find optimal solutions in almost every instance. For 15 and 20 customers the solution quality of the smaller numbers of states in relation to the optimal solution quickly deteriorates. ALNS’s solutions for these instances in regard to the objective value are comparable to the restricted DP with 10,000 to 20,000 states for \(n=15\) and 50,000 to 1,000,000 states for \(n=20\). In both cases, ALNS’s computation times are similar. These results lead us to believe that there is little benefit to run the DP within the ALNS algorithm as a local optimization procedure since any meaningful improvements to the solution quality of ALNS would require a number of states with too much computational effort. In contrast, the results show that the ALNS finds optimal or near optimal solutions within seconds. Compared to the MIP results of Table 3, the DP can clearly beat the MIP for the single tour instances, as the MIP struggles to find optimal solutions for 10 customers or more. In Fig. 8, the average relative difference to the best found solution is given for every state setting (excluding ALNS and the exact DP runs). This further shows that running a restricted DP can still lead to a high solution quality if the number of states is sufficiently high. This is especially beneficial for larger instances where running the exact DP becomes intractable.

Table 4 Summary of objective values and computational times of the DP with different states and ALNS on the instances with one tour
Fig. 8
figure 8

Relative differences for the restricted DP depending on the maximal number of states to the best known solution for the single tour instances. For \(n\in \{5, 10, 15\}\) the best known solution is optimal. The x-axis is scaled logarithmically

7 Conclusion

The paper presents an ALNS and a dynamic programming algorithm for the static dial-a-ride problem with ride and waiting time minimization. Although the dynamic program is restricted to small instances, it can be used with a restricted number of states and shows that for one vehicle the ALNS approach finds near optimal solutions. The results of our computational study relating to the ALNS indicate further that ride-sharing proposals can help to solve the trade-off between individual transport, profitability of the provider, and traffic and pollution reduction. Our results show that the presented approaches lead to solutions with only small detours while generating a significant pooling effect if the number of used vehicles as well as the number of participating people is not too small. This is a promising result for practical tests and further research.

We studied the static problem setting. Further research is necessary to develop policies for the dynamic setting since customers get an immediate feedback on their request in real applications. Besides, stochastic travel times should be included, as travel times, especially in large cities, are highly dependent on the current traffic situation. Furthermore, the first part of the objective function weights all customers equally while the second part focusses on the maximum relative detour. Our results show that the second part of the objective is important to punish large relative detours. Further research can adapt the second part of the objective to reach more levelled relative detours in the comparison of two customers, e.g. by summing up the pairwise absolute differences of customers’ relative detours [compare (Schulz 2021)].