1 Introduction

In 2019–2020, an infectious disease commonly known as COVID-19 has outbroken in 49 countries and regions. As of May 10, 2020, the total number of confirmed COVID-19 infections in the world has exceeded 4.3 million [1]. In the absence of an effective vaccine, community isolation has become a workable measure to avoid virus transmission. In China, measures such as community isolation have effectively controlled the spread of COVID-19, bringing the total number of confirmed COVID-19 infections to less than 84,500.

During community isolation, most people choose to isolate and work at home, and the goods supply and distribution for the isolated personnel has become a key issue worthy of attention. In China, most communities were isolated during the COVID-19 outbreak, and the personnel going in and out of the communities were restricted. The courier could not deliver goods or parcels to customers’ homes. An effective distribution method that can ensure safe delivery and reduce delivery cost is urgently needed.

In this study, we propose a last-mile delivery problem during major infectious disease outbreak. In the problem, a vehicle departs from the depot and visits a subset of candidate parking nodes. When the vehicle arrives at a candidate parking node, the nearby customers go to the visited parking node to pick up their goods or parcels. This study focuses on delivery network optimization, and the purpose is to find a tour with minimum total cost (routing, self-pickup, and parking costs) over a subset of candidate parking nodes, in which each customer is assigned to the nearest parking node on the tour to pick up goods or parcels. We develop the node-based, flow-based, and bi-level programing formulations for the problem. We also propose a variable neighborhood search (VNS) based on the ideas from the bi-level programing formulations to solve the problem.

The rest of the paper is organized as follows. The related literature is reviewed in Sect. 2. Three models are proposed in Sect. 3 to formulate the proposed problem. VNS based on the ideas from the bi-level programing formulations is detailed in Sect. 4. Extensive computational experiments are carried out in Sect. 5 to investigate the efficiency of the proposed algorithm. Finally, conclusions are drawn in Sect. 6.

2 Literature review

Last-mile delivery during major infectious disease outbreak is a complex supply chain optimization problem [2, 3], and this problem integrates routing and allocation decisions. In an early study, Laporte et al. [4] proposed a single vehicle routing allocation problem (SVRAP) to locate a set of post boxes, in which customers are assigned to nearby post boxes. Akinc and Srikanth [5] proposed a similar SVRAP, which has an application in mobile service facility, and they developed a branch-and-bound algorithm that was tested on randomly generated problem instances with up to 100 customers to solve the problem. Beasley and Nascimento [6] surveyed SVRAP and several similar problems, such as the covering salesman problem (CSP), covering tour problem (CTP), and so on. Vogt et al. [7] proposed a unifying framework for VRAP and developed a tabu search to solve the problem. Baniasadi et al. [8] proposed a transformation technique for solving the clustered generalized traveling salesman problem (CGTSP); the objective of this problem is to find the minimal route that visits exactly one node from each subcluster to ensure that all subclusters of each cluster are visited consecutively. Moreover, Ghoniem et al. [9] proposed a vehicle routing with demand allocation problem (VRDAP) that arises in non-profit food distribution systems. In their problem, each customer is assigned to a selected delivery site to collect his/her demand. Their aim was to construct multiple tours with minimum routing and allocation costs over a set of delivery sites. They developed a column generation approach to solve the problem. Solak et al. [10] presented a Benders decomposition approach for the VRDAP, which was compared with CPLEX. Reihaneh and Ghoniem [11] proposed a branch-and-price algorithm for solving the VRDAP, and they tested the approach on 60 randomly generated instances with up to 25 delivery sites and 50 customers.

The ring star problem (RSP) pertains to minimizing routing and allocation costs of a cycle, and it has applications in telecommunication network design problem. The first version of the RSP is called median cycle problem. The problem is to construct a Hamiltonian cycle, in which the unvisited nodes are assigned to the nearest node on the cycle. Perez et al. [12], Renaud et al. [13], and Calvete et al. [14] proposed the variable neighborhood search and tabu search, random key evolutionary algorithm, and bi-level programing-based evolutionary algorithm for solving the RSP, respectively. Furthermore, Baldacci et al. [15] proposed the capacity ring star problem (CmRSP), which was to find m Hamiltonian cycles. Each customer that was not visited by the cycles was assigned to the nearest customer or Steiner node on the cycles. Naji-Azimi et al. [16, 17] introduced two heuristic procedures based on VNS to solve the CmRSP, and their method solved the instances within 200 vertices.

Current and Schilling [18] proposed a CSP in which each node that was not on the cycle had to be covered by at least one node on the cycle. Laporte and Semet [19] proposed a CTP in which the nodes were classified into three groups: nodes that must be visited, nodes that must be covered, and nodes that can be covered or visited. Furthermore, Golden et al. [20], Salari et al. [21] and Salari et al. [22] proposed local search algorithm, integer programing-based local search, and hybrid ant colony optimization to solve the CSP, respectively.

3 Problem statement

This paper focuses on the single vehicle routing and allocation optimization, and the problem can be described as: given a network \(G = (V,E \cup A)\), where \(V\) is the node set, \(E\) is the edge set and \(A\) is arc set. Node set \(V\) is defined as \(V = \{ 0\} \cup W \cup T\), where 0 is the depot, \(W\) is customer set, and \(T\) is parking spot set. Edges in \(E = \{ (i,j)\}\) refer to undirected delivery links from node \(i \in T \cup \{ 0\}\) to node \(j \in T \cup \{ 0\}\). Arcs in \(A = \{ < i,j > \}\) refer to undirected self-pickup links from customer \(i \in W\) to parking spot \(j \in T\). Edge \((i,j) \in E\) and arc \(< i,j > \in A\) are associated with a non-negative delivery cost \(c_{ij}\) and a self-pickup cost \(d_{ij}\), respectively. \(p_{i}\) is the parking cost of parking node \(i \in T\).

The problem is to construct a Hamiltonian cycle over a subset of node in \(T \cup \{ 0\}\), in which each customer in \(W\) is assigned to the nearest parking spot in \(T\) on the cycle. The goal is to minimize the total cost, including the delivery and self-pickup costs. Figure 1 illustrates an example of the proposed problem.

Fig. 1
figure 1

An example for the proposed problem

3.1 Node-based formulation

In this subsection, we develop a node-based formulation for the problem. The subtour elimination constraints are the well-known constraints for the traveling salesman problem (TSP) [23,24,25]. Other variables to formulate the problem are defined as follows:

$$ w_{i} = \left\{ {\begin{array}{*{20}l} {1,} \hfill & \quad {parking \, node \, i \, is \, visited \, by \, tour} \hfill \\ {0,} \hfill & \quad {otherwise} \hfill \\ \end{array} } \right. $$
$$ x_{ij} = \left\{ {\begin{array}{*{20}l} {1,} \hfill & \quad {edge \, (i,j) \, is \, visited \, by \, tour} \hfill \\ {0,} \hfill & \quad {otherwise} \hfill \\ \end{array} } \right. $$
$$ y_{ij} = \left\{ {\begin{array}{*{20}l} {1,} \hfill & \quad {customer \, i \, is \, assigned \, to \, parking \, node \, j} \hfill \\ {0,} \hfill & \quad {otherwise} \hfill \\ \end{array} } \right. $$

The node-based problem can be formulated as:

$$ \min \sum\limits_{(i,j) \in E} {c_{ij} x_{ij} } + \sum\limits_{ < i,j > \in A} {d_{ij} y_{ij} } + \sum\limits_{i \in T} {p_{i} w_{i} } $$
(1a)
$$ w_{0} = 1 $$
(1b)
$$ \sum\limits_{{j \in T \cup \{ 0\} }} {x_{ij} } = \sum\limits_{{j \in T \cup \{ 0\} }} {x_{ji} } = w_{i} ,\quad \forall i \in T \cup \{ 0\} $$
(1c)
$$ \sum\limits_{(i,j) \in E(S)} {x_{ij} } \le |S| - 1,\quad S \subseteq T,S \ne \phi $$
(1d)
$$ \sum\limits_{j \in T} {y_{ij} } = 1,\quad \forall i \in W $$
(1e)
$$ y_{ij} \le w_{j} ,\quad \forall i \in W,\forall j \in T $$
(1f)
$$ w_{i} = \{ 0,1\} ,\quad \forall i \in T, $$
(1g)
$$ x_{ij} = \{ 0,1\} ,\quad \forall i,j \in T \cup \{ 0\} $$
(1h)
$$ y_{ij} = \{ 0,1\} ,\quad \forall i \in W,\forall j \in T $$
(1i)

Objective function (1a) is to minimize the routing, self-pickup, and parking costs. Constraint (1b) indicates that the depot must be visited. Constraint (1c) represents the in-degree and out-degree of the parking node. If the parking node is visited, then the in-degree and out-degree of the parking node are both 1; otherwise, they are both 0. Constraint (1d) denote the subtour elimination constraints. Constraint (1e) represents that each customer can only be assigned to one parking node. Constraint (1f) indicates that if a parking node is assigned to a customer, then the parking node must be visited by the tour. Constraints (1g1i) define the variables.

3.2 Flow-based formulation

In this subsection, we develop a flow-based formulation for the problem. We define a variable \(u_{ij}\) to eliminate the subtour of the tour. \(u_{ij}\) is an integer variable, representing the tour load after leaving vertex \(i\) and just before visiting vertex \(j\). Other variables are the same as those in the node-based formulation, and the flow-based problem is formulated as:

$$ \min \sum\limits_{(i,j) \in E} {c_{ij} x_{ij} } + \sum\limits_{ < i,j > \in A} {d_{ij} y_{ij} } + \sum\limits_{i \in T} {p_{i} w_{i} } $$
(2a)
$$ w_{0} = 1 $$
(2b)
$$ \sum\limits_{{j \in T \cup \{ 0\} }} {x_{ij} } = \sum\limits_{{j \in T \cup \{ 0\} }} {x_{ji} } = w_{i} ,\quad \forall i \in T \cup \{ 0\} $$
(2c)
$$ \sum\limits_{{j \in \{ 0\} \cup T}} {u_{ij} } - \sum\limits_{{j \in \{ 0\} \cup T}} {u_{ji} } = \sum\limits_{{j \in \{ 0\} \cup T}} {x_{ji} } ,\quad \forall i \in T $$
(2d)
$$ u_{ij} \le |T|x_{ij} ,\quad \forall i,j \in T $$
(2e)
$$ \sum\limits_{j \in T} {y_{ij} } = 1,\quad \forall i \in W $$
(2f)
$$ y_{ij} \le w_{j} ,\quad \forall i \in W,\forall j \in T $$
(2g)
$$ w_{i} = \{ 0,1\} ,\quad \forall i \in T $$
(2h)
$$ x_{ij} = \{ 0,1\} ,\quad \forall i,j \in T \cup \{ 0\} $$
(2i)
$$ y_{ij} = \{ 0,1\} ,\quad \forall i \in W,\forall j \in T $$
(2j)
$$ u_{ij} \ge 0,\quad \forall i,j \in T \cup \{ 0\} $$
(2k)

Objective function (2a) is to minimize the routing, self-pickup, and parking costs. Constraints (2b2c) are the same as Constraints (1b1c). Constraints (2d2e) are the subtour elimination constraints. Constraints (2f2g) are the customer assignment constraints. Constraints (2h2k) define the variables.

3.3 Bilevel programming formulation

The bilevel programing problem consists of a upper-level optimization problem (UOP) and a lower-level optimization problem (LOP), and the UOP is determined by the LOP [26,27,28]. For the proposed problem, the UOP is a leader problem, which is to decide on the parking location. The LOP includes two follower problems, which are TSP and customer assignment problem.

$$ \min \, G(w) + H(w) + \sum\limits_{i \in T} {p_{i} w_{i} } $$
(3a)
$$ w_{0} = 1 $$
(3b)
$$ w_{i} = \{ 0,1\} ,\quad \forall i \in T $$
(3c)

The firs follower problem is a TSP, which is described as:

$$ \min \sum\limits_{(i,j) \in E} {c_{ij} x_{ij} } $$
(3d)
$$ \sum\limits_{{j \in T \cup \{ 0\} }} {x_{ij} } = \sum\limits_{{j \in T \cup \{ 0\} }} {x_{ji} } = w_{i} ,\quad \forall i \in T \cup \{ 0\} $$
(3e)
$$ \sum\limits_{{j \in \{ 0\} \cup T}} {u_{ij} } - \sum\limits_{{j \in \{ 0\} \cup T}} {u_{ji} } = \sum\limits_{{j \in \{ 0\} \cup T}} {x_{ji} } ,\quad \forall i \in T $$
(3f)
$$ u_{ij} \le |T|x_{ij} ,\quad \forall i,j \in T $$
(3g)
$$ x_{ij} = \{ 0,1\} ,\quad \forall i,j \in T \cup \{ 0\} $$
(3h)
$$ u_{ij} \ge 0,\quad \forall i,j \in T \cup \{ 0\} $$
(3i)

The second follower problem is a customer assignment problem, which is describes as:

$$ \min \sum\limits_{ < i,j > \in A} {d_{ij} y_{ij} } $$
(3j)
$$ \sum\limits_{j \in T} {y_{ij} } = 1,\quad \forall i \in W $$
(3k)
$$ y_{ij} \le w_{j} ,\quad \forall i \in W,\forall j \in T $$
(3l)
$$ y_{ij} = \{ 0,1\} ,\quad \forall i \in W,\forall j \in T $$
(3m)

Objective function (3a) is to minimize the total cost, including the routing, self-pickup, and parking costs. Objective functions (3d) and (3j) are to minimize the routing cost and self-pickup cost, respectively. Constraints (3b) indicate that the depot must be visited. Constraints (3e3i) are the TSP constraints. Constraints (3j3m) are the customer assignment problem constraints.

4 The variable neighborhood search

The variable neighborhood search (VNS), introduced by Mladenovic and Hansen [29], has effective results in solving combination problems [30,31,32,33]. In this section, we propose a VNS heuristic to solve the proposed problem, which uses the ideas from the bi-level programing formulations proposed in Sect. 3. In the VNS, the main procedure is used to explore the solution space of the leader problem, a 3-opt procedure is developed to solve the first follower problem, and a nearest neighborhood (NN) is applied to solve the second follower problem. The VNS heuristic begins from an initial solution, which is generated by the NN algorithm over the depot and all parking nodes. The initial solution is set as the current solution, and a new initial solution is obtained by shaking the current solution. Subsequently, a local search is applied to explore the space of the new initial solution to obtain a local optimal solution. If the local optimal solution is better than the incumbent, then the current solution is moved to the local optimal solution. The heuristic proposed by Lin and Kernighan (LKH) [34] is applied to improve the tour of current solution, and the search with the initial neighborhood (\(k = 1\)) is continued; otherwise, set \(k = k + 1\). Algorithm 1 details the framework of the VNS for the proposed problem.

figure a

4.1 Solution representation

A solution in the VNS consists of three sequences. The first sequence is a binary sequence (location), which represents the solution of the leader problem. The second and third sequences are both an integer sequence (tour and assignment), and they indicate the solution of the first and second follower problems, respectively. In the “location” sequence, 0 and 1 indicate that the parking node is visited or is not visited by the tour, respectively. Each integer in “tour” represents the position of each parking node on the tour. Each value in “allocation” explains which customer is assigned to which parking node. Figure 2 illustrates an example of the solution. The “location” sequence in Fig. 2a represents that parking nodes 2, 3, 4, 5, and 6 are visited by the tour, and parking nodes 1 and 7 are not visited. The “tour” sequence in Fig. 2b shows that the tour over the visited parking nodes is 0-2-3-4-5-6-0. The “allocation” sequence in Fig. 2c indicates that customers 9, 10, and 11 are allocated to parking node 2; customers 12, 13, 14, and 15 are allocated to parking node 3; and customers 16 is assigned to parking node 4, and so on.

Fig. 2
figure 2

Illustrative example for the solution

4.2 Local search

The neighborhood structures in the VNS, including inversion and exchange procedures, are used to solve the leader problem of the proposed problem. The 3-opt and NN procedures are used to solve the first and second follower problems, respectively, on the basis of the current solution obtained from the leader problem. The local search iteratively applies the inversion and exchange procedures to improve the current solution until it cannot be improved. Algorithm 2 details the framework of the local search procedure, and the following subsections provides the details of the proposed procedures.

figure b

4.2.1 Inversion procedure

The first neighborhood structure of the VNS is the inversion procedure, which is to extract a parking node \(i \in T\) and invert its “location” value. Essentially, a new solution generation process of the inversion procedure can be described as follows. First, the parking node \(i \in T\) is selected randomly, and its “location” value is inverted. If the original “location” value of the parking node \(i \in T\) is 1, it is dropped from the tour; otherwise, it is inserted to its best position on the tour. That is, the selected parking node is inserted from the first position of the tour to the last one, and the insertion position with the minimal insertion cost is selected as the best position. Second, the NN procedure is used to re-assign the customers to the parking nodes that are on the tour of the current solution. Finally, a 3-opt procedure is applied to minimize the length of the tour of the current solution. Figure 3 illustrates an example of the inversion procedure.

Fig. 3
figure 3

Illustrative example for the inversion procedure

4.2.2 Exchange procedure

The second neighborhood structure of the VNS is the exchange procedure, which is to extract two parking nodes \(i\)(\(location(i) = 1\)) and \(j\)(\(location(j) = 0\)) and exchange their “location” values. In practice, the exchange procedure generates a new solution by the following steps. First, parking nodes \(i\)(\(location(i) = 1\)) and \(j \in S\)(\(location(j) = 0\)) are selected, where \(S\) is a set of R parking nodes nearest to the node \(i\), and the “location” values of the two nodes are exchanged. The parking node \(i\) on the tour is replaced by parking node \(j\) to obtain a new tour. Second, the customers are re-assigned to the parking nodes that are on the new tour by the NN procedure. Finally, the 3-opt procedure is applied to minimize the length of the new tour to obtain a new solution. Figure 4 illustrates an example of the exchange procedure.

Fig. 4
figure 4

Illustrative example for the exchange procedure

4.3 The procedure for follower problems

4.3.1 3-opt procedure

The 3-opt procedure attempts to remove three edges of the tour and then replaces three other edges to obtain a better solution, which is then used to minimize the tour of the current solution. Figure 5 illustrates a 3-opt move. Helsgaun [35] proposed a 3-opt (forward and backward insertion) move. In the 3-opt, a node i is randomly selected from the tour, the node j is selected from the T nearest nodes to node i, and node k is selected from the T nearest nodes to node j. Then, the edges x1, x2, and x3 are selected from the edges before and after nodes i, j, and k, respectively. As shown in Fig. 5, the 3-opt replaces edges x1, x2 and x3 with edges y1, y2, and y3 to generate a new tour. The process iterates until the stop condition is met.

Fig. 5
figure 5

A 3-opt move

4.3.2 NN procedure

The (NN) algorithm is to assign each customer to the nearest parking node on the tour. Essentially, when the “location” value of each parking node is fixed, the optimal solution of the second follower problem is the solution in which each customer is assigned to the nearest parking node on the tour.

4.4 Shaking procedure

To escape from the local optimum, the VNS applies a shaking procedure to perturb the current solution. In particular, the shaking procedure is to randomly select k (an input parameter) parking nodes, and invert their “location” values. Then, each customer is re-assigned to the parking node whose “location” value is 1 by the NN procedure. Finally, the 3-opt procedure is applied to minimize the length of the new tour to obtain a new solution.

5 Computational results

To test the performance of the proposed VNS heuristic, a set of 108 instances are proposed, which are generated by using the TSP library (TSPLIB) instances proposed by [36]. The problems range from 51 to 783 nodes, which are divided into small- (\(51 \le |V| \le 100\)), medium- (\(150 \le |V| \le 200\)), and large-size (\(225 \le |V| \le 783\)) instances. For each problem, \(n\) is the number of the nodes, the first node is depot, the next \(\left\lfloor {\alpha (n - 1)} \right\rfloor\) nodes with \(\alpha \in \{ 0.25,0.5,0.75\}\) are parking spots, and the last ones are customers. For a pair of nodes \(i\) and \(j\), \(l_{ij}\) is the Euclidean distance, which is computed according to the TSPLIB standard. The routing cost \(c_{ij}\) is equal to the Euclidean distance \(l_{ij}\) (\(c_{ij} = l_{ij}\)).the self-pickup cost is \(d_{ij} = \left\lceil {\lambda l_{ij} } \right\rceil\), where \(\lambda\) is set as {0.25,0.50,0.75}.

The VNS is coded in Microsoft Visual C +  + , and the node-based and flow-based formulations are solved using the CPLEX 12.7.1 framework. The experiments are performed on a personal computer with 2.2 GHz Intel Core I5-5200U CPU and 4 GB RAM.. In addition, the termination criterion is set as 5n, and parameters R and T of the exchange and 3-opt procedures are both set as \(\left\lfloor {\alpha (n - 1)} \right\rfloor\).

5.1 Results for small- and medium-size instances

Tables 1 and 2 show the results obtained by CPLEX and the proposed VNS for the small- and medium-size instances. The running time of CPLEX for solving each instance is limited to 3600 s. In these tables, the first columns provide the names of instances, and the second and third columns contain the values of \(\alpha\) and \(\lambda\), respectively. The fourth to sixth columns are the results obtained by solving the node-based model over each instance. “Obj.” columns refer to the objective function of the optimal solution. “Gap” columns present the gaps from the lower bound. “TT” columns are the total running times. The next three columns report the same results obtained by running the flow-based model. Columns 10 to 13 are the results obtained by VNS algorithm. “Best” and “Avg.” columns refer to the best and average objective function of the solutions over five independent runs, respectively. “Dev.” columns include the deviation of the “Avg.” from the optimal objective function, which are calculated as (Avg. − Opt)/Opt × 100. “Opt” is the best objective function of the solution obtained by the VNS and CPLEX. “Time” columns contain the average running time of the VNS over five runs.

Table 1 Comparison for the small size instances
Table 2 Comparison for the medium size instances

For the 36 small size instances in Table 1, the node-based and flow-based formulations have found 34 and 35 best solutions with the average running time of 1285.95 and 849.71 s, respectively. The results in Table 1 show that the both exact methods perform well on small size instances in which most of the optimal solutions have been obtained. As shown in Table 2, for the 36 medium size instances, the node-based and flow-based formulations have only obtained 15 and 14 best solutions, respectively. Several instances have not obtained the optimal solutions, for which the time threshold of CPLEX has been reached. The results in the two tables show that all of the optimal solutions have been obtained over the small and medium size instances by the proposed VNS algorithm. In these tables, the best solutions found by each approach are represented in bold. The deviations of the average solutions obtained by the VNS algorithm from the optimal solution indicates the superiority of the proposed method, where the overall deviations are both 0 for small and medium instances.

5.2 Results for large-size instances

The results of the VNS algorithm over 36 large-size instances are presented in Table 3. In this table, the first to third columns have the same meaning as those in Tables 1 and 2. The fourth to ninth columns are the results obtained by solving the node-based and flow-based models. “Obj.” columns refer to the objective function of the optimal solution. “Gap” columns present the gaps from the lower bound. “TT.” columns are the total running times. Columns 10 to 13 are the results obtained by VNS algorithm. “Best” and “Avg.” columns refer to the best and average objective function of the solutions over five independent runs, respectively. “Dev.” columns include the deviation of the “Avg.” from the optimal objective function, and it is calculated as (Avg. − Opt)/Opt × 100. “Opt” is the best objective function of the solution obtained by the VNS and CPLEX. “TT.” columns contain the average running time of the VNS over five runs.

Table 3 The results for the large-size instances

The results of the algorithms for the large-size instances are given in Table 3. The proposed VNS obtains a large number of the best solutions as the size of the instances increases. At the same time, the performances of the exact algorithms reduce significantly. The results in Table 3 show that the proposed VNS obtains 36 best solutions out of 36 instances with a percentage of 100% for the large-size problems. By contrast, the node-based and flow-based models find only 10 and 3 best solutions within a limit running time of 3600 s, respectively. In addition, the proposed VNS solves all the large problems with an average running time of 27.16 s. The results illustrate that the proposed VNS has a good performance for solving large-size problems, and the node-based model outperforms the flow-based model.

6 Conclusion

In this work, we propose a delivery problem that arises in the last-mile delivery during major infectious disease outbreak, such as COVID-19. The problem is formulated by three mathematical models: the node-based, flow-based, and bi-level programing models. A VNS based on the ideas from the bi-level programing formulation is developed to solve the problem. This formulation divides the delivery problem into one leader and two follower subproblems. The proposed VNS is tested on 108 randomly instances, which are generated by using the TSPLIB benchmark instances. The experimental results indicate that the proposed VNS has the best performance for solving the delivery problem. Specifically, it obtains 108 best solutions out of 108 instances, and the node-based model outperforms the flow-based model as the size of the problem increases.

Future works will mainly be conducted in the directions of vehicle routing with demand allocation problem, multi vehicle routing with demand allocation problem, and so on.