Keywords

1 Introduction

Humanity is increasingly using e-commerce. In modern cities, especially smart cities of the future, there is an increasing need for optimized package delivery. The motivation is both to maximize profit and to reduce our impact on the environment. In this paper we study package delivery with delivery site selection.

Schittekat et al. present an interesting problem and analysis in [1]. They tackle a problem of school bus routing (SBR) with bus stop selection. In this problem, students need to be assigned to a station from a list of potential stations and then routes need to be constructed so that all students are transported to school while covering a distance as small as possible. By jointly optimizing student station assignment and station route assignment, they produce significantly shorter routes then if they divided the process into two steps: assigning students to stations, and defining routes for the stations with assigned students. We noticed several things:

  • This problem is equivalent to the problem of package delivery where the package can be delivered to multiple delivery sites. Since providing multiple delivery sites can produce shorter routes, such user behavior should be incentivized.

  • The running time of the joint optimization approach seems quite large for the dynamic world of package delivery. We decided to investigate how time performance improves when using a stepwise approach.

  • The benchmark stepwise approach presented in the above paper seems very simple, thus artificially increasing the benefit of the presented approach. We decided to investigate how a smarter stepwise approach compares to the joint approach.

The rest of the paper is organized as follows. Section 2 defines the problem in precise terms. Section 3 presents the work related to this paper. In Sect. 4, a detailed description of the proposed algorithm is given. Section 5 presents the evaluation results. Section 6 gives final comments about our work and future research possibilities.

2 Problem Definition

In this paper the problem of defining vehicle routes for delivery trucks with an addition of delivery place selection is considered. The problem can be described as follows:

  • there is a single production factory,

  • there are N delivery stations,

  • there are M customers who will pick up their delivery at the delivery station.

Furthermore,

  • each customer will visit only one delivery station, which needs to be in his or her walking range,

  • each customer will pick up only one delivery package,

  • all delivery trucks have the same capacity which indicates the number of packages they can carry (all packages are assumed to have the same size),

  • any delivery station can be visited by only one delivery truck.

The goal is to minimize the total route length travelled by all trucks.

A mathematical description of the problem is shown in Table 1 and Eqs. 1, 2, 3, 4 and 5.

Table 1. Mathematical problem description

The aim is to minimize expression (1):

$$\begin{aligned} \sum _{i=1}^N\sum _{j=1}^Nc_{ij}\sum _{k=1}^T x_{ijk} + \sum _{i=1}^Ncp_{i}\sum _{k=1}^T xp_{ik} \end{aligned}$$
(1)

While respecting the following restrictions:

$$\begin{aligned} \sum _{i=1}^N z_{il} s_{il} = 1\quad \forall l\in \{1, ..., M\} \end{aligned}$$
(2)
$$\begin{aligned} pn_{l}=1 \quad \forall l\in \{1, ..., M\} \end{aligned}$$
(3)
$$\begin{aligned} K_{i}=K_{j} \quad \forall i, j\in \{1,...,T\} \end{aligned}$$
(4)
$$\begin{aligned} \sum _{k=1}^T y_{ik} = 1\quad \forall i\in \{1, ..., N\} \end{aligned}$$
(5)

In this paper we present a fast greedy randomized adaptive search procedure (GRASP) heuristic algorithm for solving the described problem. The algorithm consists of two parts:

  1. 1.

    assigning customers to delivery stations,

  2. 2.

    defining routes for visiting delivery stations.

The first part is done using a greedy heuristic, while the second one is done using a specialized local search. These two steps are repeated R times and the best solution is kept.

In order to evaluate the proposed approach, we conducted extensive laboratory experiments. During the experiments we compared various approachpresented in [1]. Our results show that although a stepwise approach does, on average, produce longer routes the difference gap can be minimized from \(23\%\) to \(4\%\) while improving execution time by three orders of magnitude. In the end we give guidelines for future work on this topic.

3 Related Work

Vehicle routing is a very active field of research. An overview of research in this field is given by Vigo and Toth in [2]. A large body of work in this field is concerned with incorporating as many real world constraint as possible. This is easily seen by the amount of variation of the vehicle routing problem (VRP). There is VRP with time windows (VRPTW), inventory routing problem (IRP), production routing problem (PRP), location routing problem (LRP), inventory location routing problem (ILRP), capacitated vehicle routing problem (CVRP), split delivery routing problem (SDVRP) and many others, all of them described in [3].

However, to the best of our knowledge there does not seem to be a large body of work which studies the effect of multiple delivery site availability. Most of the work on this topic seems to be done by dealing with the school bus routing (SBR) problem since station selection is a common part of this problem. [4] describe two stepwise approaches for such problems. Location-Allocation-Routing (LAR) first selects the delivery sites and then performs routing on the selected sites. Allocation-Routing-Location (ARL) first performs routing and then performs delivery site selection.

In our paper we have decided to use the LAR strategy and implement it using a GRASP metaheuristic [5], noting that Park and Kim observed in [6] that only a few metaheuristic approaches have been tried for this problem.

4 Proposed Algorithm

As introduced before, the algorithm can be divided into two parts:

  1. 1.

    assigning customers to delivery stations,

  2. 2.

    defining routes to delivery stations.

The following sections describe each of the steps.

4.1 Assigning Customers to Delivery Stations

The main idea behind the assignment algorithm is to reduce the number of delivery stations which need to be visited while preferring delivery stations which are closer to the production factory. The algorithm (shown formally in Algorithm 1) goes as follows:

  • The fitness of each station is calculated. The fitness indicates how fit a station is to be assigned to customers. It is generated in the following way:

    • For each station it is initialized to zero.

    • A constant C (controlling the relevance of the distance to the factory) is randomly generated uniformly from [0, 10]. For each station, the fitness is increased by C divided by the distance of the station to the production factory.

    • Then, for each customer, the fitness of each reachable station is increased by a reciprocal of the number of reachable stations. In this way the fitness of stations which can be reached by a lot of customers or which are the only option for some customers are increased.

  • The stations are then sorted in descending order by fitness. If the fitness difference is less then \(fitness\_d\_min\), precedence is given to stations closer to the production factory. \(fitness\_d\_min\) is a hyper-parameter which we usually set to 0.01.

  • The stations are then iterated in the sorted order. For each station, customers which can reach it are considered.

    • If the station can be reached by a number of customers less or equal to the capacity of the truck, then all the customers are assigned to that station.

    • If more customers can reach the station, they are sorted by the number of stations they can reach in ascending order. If two customers can reach the same number of stations, precedence is given to the customer which is farther from the production factory. Customers are then assigned to the current station in the sorted order until the capacity on the truck is filled.

After all of this is done, all customers are assigned to a station. Those stations which have at least one customer assigned to them are active stations and only they are considered in the rest of the algorithm.

figure a

4.2 Defining Routes to Delivery Stations

The goal of this step is to define truck routes for active stations which are as short as possible while respecting the truck capacity constraint. This problem can be divided into two subproblems:

  • determining which stations are grouped to the same route,

  • determining the best possible order of visiting the stations in the route.

The developed algorithm can be divided into three separate steps:

  1. 1.

    preprocessing,

  2. 2.

    initial solution generation,

  3. 3.

    solution optimization.

Preprocessing involves iterating over all stations and defining routes for stations which cannot be combined with any other station due to the capacity constraint. These stations and routes are no longer taken into consideration in further optimization.

Initial solution generation is done using a greedy heuristic which does the following:

  1. 1.

    it selects a station which is not yet assigned to any route and creates a route for it,

  2. 2.

    then it iterates over the rest of the unassigned stations and calculates which of the satisfiable stations is closest to the set of stations currently in the route. A station is satisfiable if the distance between the station and the route is smaller than between the station and the factory.

  3. 3.

    If the closest station is found, it is added to the current route; otherwise that is the end of the current route creation.

  4. 4.

    The previous steps are repeated as long as there are active unassigned stations.

The described algorithm is shown in Algorithm 2. Each of the defined routes is optimized using a greedy heuristic TSP (travelling salesman problem) solver which will be described later.

figure b

Solution optimization is done using local search. The search is defined by the following properties.

  • An incomplete neighborhood consists of one element which is generated by doing one of the following:

    • switching a station from one route to another,

    • selecting two stations from different routes and swapping the stations between the two routes,

    • joining two routes into one,

    • breaking a route into two routes at a random point.

    There is a small probability (a parameter called repetitionChance) that another modification occurs after each modification.

  • Routes are re-optimized using a TSP solver in each iteration as soon as they are manipulated.

  • The objective function is the sum of lengths of all routes.

  • The stopping condition is reaching a maximum number of iterations or a maximum number of stagnant iterations. These are defined using hyperparameters maxIterationCount and maxStagnationCount.

The defined algorithm is shown in Algorithm 3.

figure c

The result produced by this step are the final routes. We are left to describe the TSP solver used in our problem.

A TSP solver is used to optimize the generated routes. This TSP solver uses the following greedy heuristic.

  • If it is given three or less nodes, a list of the given nodes is returned as the solution.

  • Otherwise, three random nodes are taken and declared the current optimal route. Then the following is iteratively done:

    • select a random node,

    • iterate over each edge of the current optimal route and calculate the distance change if that edge is removed and two new ones are added connecting the previously randomly selected node,

    • remove the edge which produced the minimal change in distance.

    This is repeated as long as there are nodes which are not in the route.

  • Finally it returns the created route.

The described algorithm is shown in Algorithm 4.

figure d

5 Results

For our experiments, we use the dataset presented in [1] and give our results relative to the results presented in that paper. The dataset contains 112 problem instances, with the number of customers ranging from 25 to 800, the number of stations ranging from 5 to 80, and the maximum allowed walking distance ranging from 5 to 40. For each value of the repetition parameter, we solve each instance 100 times and take the average solution route length and calculation time as the results for that instance.

Figure 1 shows the average solution route length increase produced by our algorithm when compared to the results of the joint presented in [1]. At a 100 repetitions our algorithm produces, on average, \(4\%\) longer routes. This is clearly superior compared to the \(23\%\) longer routes produced by the stepwise method reported in [1].

Figure 2 shows the solution route length increase in relation to the instance maximum walking distance constraing. As the maximum walking distance varies from 5 to 40, the increase in the route length for our solutions varies from \(-0.54\%\) to \(4.5\%\) at 100 repetitions. Our results again outperform results in [1] which reports that, when varying the maximum walking distance from 5 to 40, the route length increases from \(1.4\%\) to \(63.4\%\).

In addition, Figs. 3 and 4 present the relation between station/customer count and route length increase. As the amount of stations varies from 5 to 80, the increase in the route length for our solutions varies from \(0\%\) to \(8.31\%\) at 100 repetitions. As the amount of customers varies from 25 to 800, the increase in the route length for our solutions varies from \(0\%\) to \(6.98\%\) at 100 repetitions.

Fig. 1.
figure 1

Average solution route length increase

Fig. 2.
figure 2

Solution quality in relation to walking distance

Fig. 3.
figure 3

Solution quality in relation to station count

Fig. 4.
figure 4

Solution quality in relation to customer count

The time performance results depict the logarithm of time decrease in order to improve readability. Figure 5 shows the time decrease of our algorithm when compared to [1]. Our algorithm (on average) takes \(e^{7.02} \approx 1100\times \) less time at 100 repetitions, which is clearly a superior result. The time decrease is due to the problem simplification which occurs as a consequence of the stepwise approach.

Figures 6, 7 and 8, show how the running time depends on the maximum walking distance, the number of stations, and the number of customers. As the maximum walking distance varies from 5 to 40, the time decrease for our algorithm varies from \(e^{7.07} \approx 1171.13\times \) to \(e^{6.82} \approx 913.75\times \) at 100 repetitions. As the number of stations varies from 5 to 80, the time decrease for our algorithm varies from \(e^{2.01} \approx 7.47\times \) to \(e^{8.53} \approx 5036\times \) at 100 repetitions. As the number of customers varies from 25 to 800, the time decrease for our algorithm varies from \(e^{5.11} \approx 165\times \) to \(e^{7.8} \approx 2436\times \) at 100 repetitions.

Fig. 5.
figure 5

Average time decrease

Fig. 6.
figure 6

Solution time decrease in relation to station count

Fig. 7.
figure 7

Solution time decrease in relation to customer count

Fig. 8.
figure 8

Solution time decrease in relation to maximum walking distance

6 Conclusion

In this paper, a fast GRASP-based heuristic algorithm for vehicle routing with delivery place selection is presented. The evaluation results have shown that the proposed algorithm is, on average, three orders of magnitude faster than benchmark, thus showing that stepwise optimization can be much faster than joint optimization for this problem. We have also shown that using a smart stepwise approach can significantly reduce the performance gap with respect to the joint approach. Namely, with the proposed algorithm the gap has been reduced from \(23\%\) to \(4\%\). In future work, our aim will be to increase the solution quality while maintaining or only slightly sacrificing the speed of the algorithm.