Evaluation of the size of time windows for the travelling salesman problem in delivery operations

A great challenge in operational research is to apply time-efficient algorithms to find the optimal solutions to the travelling salesman problem (TSP) and its many variations. The TSP with time windows (TSPTW) arises due to intense pressure for business to improve customer service. As online shopping becomes more popular, customer satisfaction increases if customers can decide when their orders are delivered to them. Customers may choose a time window, which is defined by an earliest delivery time and a latest delivery time, during which the package is delivered. Delivering packages to multiple customers is a typical TSPTW. One main challenge for a delivery business is to determine the size of the time window (i.e., the difference between the latest and earliest delivery times), which affects delivery cost and customer satisfaction. Although many previous studies investigated the TSPTW, none of those focused on the size of time windows. This study is the first that experiments with different time window sizes and determines their impact on tour duration, customer satisfaction, and solution time of the optimal delivery routes. The experiment results show that increasing the size of the time window decreases tour duration and customer satisfaction and increases solution time. Decreasing the size of the time window increases tour duration and customer satisfaction and decreases solution time. A small solution time is necessary for the scheduling of deliveries to many customers. A large solution time prevents a delivery business from delivering packages using optimal routes, which increases delivery cost and decreases customer satisfaction. The results of this study indicate that a general guideline for business is to allow customers to choose a time window size that is within the cost limit but is sufficiently small to maximize customer satisfaction and optimize delivery routes.


Introduction
Home delivery business such as DHL [29], FedEx [17], and UPS [33] guarantees delivery to customers on a chosen day. These industry leaders provide a delivery time window of one day. As the competition among home delivery business intensifies, companies compete in two fronts. First, companies try to deliver products to customers as fast as possible.
For example, Amazon has been providing two-day deliveries for several years and has recently started one-day deliveries for selected products. This is a dramatic improvement for customer satisfaction since some other companies are still offering 7-10 days for deliveries. Secondly, companies try to let customers choose a narrower delivery window so that customers are present when packages are delivered. This is preferred by many customers and is especially important for high-value packages, packages require signatures (e.g., alcohol products), or customers in densely populated areas.
While companies have made strides in shortening the lead time between the order time and delivery time, there is limited progress in allowing customers to choose a reasonably small delivery time window [5,26]. Due to unpredictable traffic and conditions of the delivery vehicle, driver performance, and other factors, companies are reluctant to commit to small delivery time windows. If a delivery is not completed in the specified time window, the company may incur financial loss and subject to other consequences such as lawsuits. The risk of providing customers with small delivery time windows can be factored into the delivery cost. The fundamental challenge in determining the size of the delivery time window is how to quantify the tradeoff between delivery cost and customer satisfaction when the size of time windows changes. Managers and practitioners intuitively understand that a small-time window increases delivery cost and customer satisfaction. There is a strong need to determine how the delivery cost and customer satisfaction change as the size of the delivery time window changes. This article answers this important question through mathematical modeling and case studies.
This article applies an innovative mathematical model [15] that obtains the optimal delivery route within seconds for a typical home package delivery problem with approximately 40 customers. To the best of the authors' knowledge, this research is the first study that conducts sensitivity analysis and investigates how the delivery cost and customer satisfaction vary as the size of the delivery time window changes. Results show that smaller time windows increase delivery cost but improve customer satisfaction whereas larger time windows decrease the delivery cost but negatively affect customer satisfaction. There is a range for the size of the delivery time windows that balances customer satisfaction and delivery cost.

Background
Recent development in the travelling salesman problem with time windows (TSPTW) focused on four areas: mathematical modeling, travel times, time windows, and electric or hybrid vehicles. Yuan et al. [32] proposed lifted versions of the subtour elimination constraints. Papalitsas et al. [28] formulated the TSPTW as a quadratic unconstrained binary optimization problem and used quantum computing to solve the model. These mathematical modeling tools continue to extend the applications of the TSPTW. Since the travel time between nodes is stochastic rather than deterministic in many applications, several studies expanded the TSPTW to include varying travel times. Montero et al. [25] used integer linear programming to model the time-dependent TSPTW, where the travel time depends on the travel speed, and developed an exact algorithm to solve the model. Arigliano et al. [2] also investigated and solved the time-dependent TSPTW using the branch-and-bound algorithm.
Several studies focused on time windows in the TSPTW. For example, Fachini and Armentano [11] proposed exact and heuristic dynamic programming algorithms for the TSPTW in which the size of time windows may be increased. In other words, the service of a customer may start before the earliest service time or complete after the latest service time with a penalty cost. Similarly, Avraham and Raviv [3] studied the TSPTW with soft time windows and introduced a specialized branch-and-bound algorithm and an adaptive large neighborhood search heuristic for the problem. The size of time windows in these studies varies from a few time units to a few hundred time units. These studies did not determine how delivery cost or customer satisfaction may be affected by the size of time windows. Instead, these studies assumed that the size of time windows could vary and focused on various algorithms that solved the TSPTW.
The package delivery problem studied in this article is related to the general vehicle routing problem. In both the package delivery and vehicle routing problems, the optimal route of a vehicle is identified to minimize either the total travel distance or travel time of the vehicle. The vehicle routing problem has been studied since 1960s [4,6,8,9,12,14,[18][19][20][21]27]. Haghani and Jung [13] presented a genetic algorithm to solve a pick-up or delivery vehicle routing with soft time windows. The study considered multiple vehicles with different capacities, real-time service requests, and dynamic travel times between destinations. Almoustafa et al. [1] improved a branch-and-bound method to solve the asymmetric distance-constrained vehicle routing suggested by Laporte et al. [20]. Chen et al. [7] formulated a realtime time-dependent vehicle routing with time windows as a series of mixed-integer programming models and developed a heuristic algorithm, which included route construction and improvement. Spliet and Gabor [31] proposed a formulation of a time window asymmetric vehicle routing and developed two variants of a column generation algorithm to solve the linear programming relaxation of this formulation. Kritzinger et al. [16] applied a variable neighborhood search algorithm to solve the time-dependent vehicle routing with time windows.

Mathematical model and experiments
Package delivery business face multi-facet challenges in profitability and customer satisfaction. For example, the Chinese e-commerce giant, JD.com, makes 90% of Chinese deliveries within 24 h and 57% of their deliveries arrive within 12 h [22]. JD.com has forgone most profit to build up its nationwide logistics system, including 65,000 staff couriers who deliver on bicycles and in small vans in China.
A key component determining the cost segmentation and profit margin is the total travel distance or tour duration (total delivery time) of a delivery vehicle. A shorter travel distance or tour duration decreases the cost and increases the profit margin. On the other hand, customer satisfaction in package delivery is affected by the lead time between issuing and receiving the order, choices of delivery (e.g., time windows for delivery), and other subtle and underlying factors such as packaging of the order and greetings from the delivery personnel.
The profitability and customer satisfaction are often conflicting objectives. A longer lead time helps increase profitability by reducing the inventory and order processing cost. A delivery company also prefers to deliver packages during time periods with less traffic, and group customers that are geographically close for deliveries during the same time period. All these cost-reduction practices negatively affect customer satisfaction. There are several ways to improve customer satisfaction. For example, a short lead time greatly enhances customer satisfaction and increases a company's competitiveness, but negatively impacts the company's profitability [22]. For another example, allowing customers to choose a delivery time window during which the delivery is made greatly improves customer satisfaction but unavoidably increases cost. This study investigates how the size of the time window affects the tradeoff between cost and customer satisfaction.
The cost is determined by the tour duration and solution time. The tour duration is the total delivery time. The solution time is the time it takes to solve the mathematical model and identify the optimal delivery route. The cost increases as the tour duration or solution time increases and decreases as the tour duration or solution time decreases. Customer satisfaction is determined by the size of the delivery time window. Customer satisfaction increases when the size of the delivery time window decreases and decreases when the size of the delivery time window increases.
The package delivery problem studied in this research is a TSPTW. This TSPTW is modeled as an integer linear programming model (Table 1; [15]). The model is applied to a set of benchmark instances [10], https ://homep ages.dcc. ufmg.br/~rfsil va/tsptw /) and the General Algebraic Modeling System (GAMS) is used to solve the instances and find the optimal routes that minimize the tour duration. The size of delivery time windows in the benchmark problems is systematically adjusted to determine its impact on the tradeoff between cost and customer satisfaction. The mathematical model [15] adopted in this research requires the least amount of computation time to identify the optimal routes and is readily available for adjusting delivery time windows.
Equation (1) in Table 1 is the objective function of the mathematical model and aims to minimize the tour duration of a package delivery vehicle. Equations (2)-(8) are constraints. Equation (2) initiates the arrival time of the vehicle at the first node (customer). Equations (3) and (7) Time at which the vehicle arrives at j , j ∈ N + Parameters a i The earliest time that the delivery can be made to customer The latest time that the delivery can be made to customer define a time window for each node within which the vehicle may arrive and deliver the package. Equation (4) is an innovative step-by-step sub-tour elimination constraint. When x ij = 1 , indicating that the vehicle travels from i to j , Eq. (4) becomes t ij ≤ t j − t i and ensures that the difference between the arrival times at i and j is at least the travel time from i to j , When x ij = 0 , indicating that the vehicle does not travel from i to j , Eq. (4) becomes t i − t j ≤ b i − a j . There are two possible scenarios: the vehicle arrives at i before it arrives at j , or the vehicle arrives at j before it arrives at i . If the vehicle arrives at i before it arrives at j , Eq. (4) can be rewritten as t j − t i ≥ a j − b i . Since the vehicle arrives at j after it arrives at i , a j − b i is the minimum difference between t j and t i , Eq. (4) always holds. If the vehicle arrives at j before it arrives at i , b i − a j in Eq. (4) is the maximum difference between t i and t j , and Eq. (4) always holds. Equations (5) and (6) ensure that the delivery vehicle visits each node (customer) once and only once. Equation (8) determines the tour duration.
The main purpose of this study is to investigate how the size of time windows affects tour duration, customer satisfaction, and solution time of the mathematical model. The size of delivery time windows may vary in many different ways. The experiments in this study use the problems in the TSPTW library [30] and systematically change the size of time windows. Each problem in the TSPTW library includes multiple time windows, each of which is defined by an earliest time and a latest time within which the delivery must be made to the customer. This study adjusts the size of time windows using three approaches, proportion, normalization, and stepwise. The proportion approach multiplies the size of each time window by the same coefficient. The difference between the sizes is magnified (with a coefficient greater than one) or diminished (with a coefficient less than one). The normalization approach ensures that all time windows have the same size. The difference between the sizes become zero. The stepwise approach takes a middle-of-the-road path and increases or decreases the size of each time window by two units (one unit for each side of a time window) at a time. The difference between the sizes remain the same.
In the proportion approach, the size of a time window is increased or decreased by multiplying a coefficient between "0" and "∞." The earliest and latest times of a time window are adjusted by the same amount to produce the change in the size of the time window. Figure 1 illustrates the proportion approach. S i is the size of a time window i in the TSPTW library [30]. a i is the earliest delivery time of the time window i and b i is the latest delivery time of the time window The experiments multiply six coefficients, 0, 0.5, 1, 2, 10, and ∞, and S i to produce six time windows, 0, 0.5S i , S i , 2 S i , 10 S i , and ∞, as represented by six orange bars from left to right in Fig. 1, respectively. Each time window's earliest and latest delivery times, a * i and b * i , are obtained by adjusting a i and b i , respectively, by the same amount. For example, to produce a time window with a size of 0.
The normalization approach adjusts time windows to ensure that all time windows have the same size. The experiments use two different ways to produce the same size for all time windows: equal maximum size and equal minimum size. Table 2 illustrates the normalization approach. Suppose   1  0  10  10  0  60  60  0  10  10  2  20  40  20  0  60  60  25  35  10  3  30  50  20  10  70  60  35  45  10  4  50  90  40  40  100  60  65  75  10  5  40  100  60  40  100  60  65  75  10 there are five-time windows in a benchmark problem in the TSPTW library. The maximum size of these five-time windows is 60, which is the size of time window i = 5 . The minimum size of these five-time windows is 10, which is the size of time window i = 1 . In the experiments with equal maximum size, the size of all five-time windows is adjusted and is equal to 60. As in the proportion approach, both the earliest delivery time a i and the latest delivery time b i are adjusted by the same amount in the normalization approach. One exception is for time window i = 1 . Since a 1 = 0 and cannot decrease further, b 1 increases by 50. In the experiments with equal minimum size, the size of all five-time windows is adjusted and is equal to 10, and both a i and b i are adjusted by the same amount. The stepwise approach decreases a i and increases b i by one time unit at the same time. This incremental adjustment of one unit continues until the size of the time window is sufficiently large and equivalent to infinity. The stepwise approach captures the granularity of how changes in the size of a time window affects cost and customer satisfaction.

Results and discussion
The experiments implement the mathematical model (Table 1) in GAMS and uses five benchmark problems (n20. w20.0001, n20.w20.0002, n20.w20.0003, n20.w20.0004, and n20.w20.0005) in the TSPTW library (Silva and Urrutia, 2012) to find the optimal delivery routes that minimize the tour duration. The size of time windows in the experiments is adjusted according to the three approaches outlined in Sect. 3, proportion, normalization, and stepwise. The mathematical model is solved using GAMS win64 24.0.2 on a computer with Intel i7 CPU 870 @ 2.93 GHz, 12.0 GB RAM, and Windows 10 Enterprise. To illustrate how the size of time windows is adjusted, Appendices 1, 2, and 3 show adjusted time windows for the benchmark problem n20. w20.0001 according to the proportion, normalization, and stepwise approaches, respectively. The maximum allowed solution time for GAMS is set to one hour. If it takes more than one hour to solve the mathematical model and find the optimal routes, GAMS terminates after one hour and provides the best delivery route and minimum tour duration up to that point. Table 3 shows the experiment results of the proportion approach. Table 3 depicts solution times (seconds) of finding the optimal delivery routes and tour durations (seconds) of optimal delivery routes for five benchmark problems in the TSPTW library (Silva and Urrutia, 2012). The size of time windows is adjusted proportionally. There are 17 different sizes from "0" to "∞." When the size is "∞," there is no requirement for a time window within which the delivery must be completed; packages may be delivered to a customer at any time. The tour duration with "Inf." indicates that feasible delivery routes do not exist and the model is infeasible. In other words, no delivery routes can satisfy all delivery time windows. Dumas et al. [10] prepared these five benchmark problems and their feasible solution space is relatively small. When the size of time windows S i 's is reduced, the feasible region becomes smaller and the model may become infeasible.  The highlighted (yellow) column with the size S i in Table 3 includes experiment results for the original time windows S i 's in the five benchmark problems. As the size of delivery time windows increases, both tour duration and customer satisfaction decrease, and the solution time increases. Decreasing customer satisfaction is due to the increasing size of time windows. Smaller tour duration generally incurs less delivery cost. Larger solution time increases delivery cost. Results in Table 3 show that there is a tradeoff between the delivery cost and customer satisfaction. Larger time windows decrease the delivery cost and customer satisfaction. When the size of the time window is too large, however, the delivery cost will not decrease further and may increase because the solution time is too large and the optimal delivery route is not obtained. Smaller time windows increase the delivery cost and customer satisfaction. When the size of the time window is too small, however, customer satisfaction decreases because feasible delivery routes do not exist. Table 3 reveals that the ideal size of time windows is between S i and 3S i . When the size is larger than 3S i , customer satisfaction deteriorates and the delivery cost may increase because the optimal delivery route is not obtained. When the size is smaller than S i , feasible delivery routes may not exist. When the size is between S i and 3S i , the solution time is at most a little over one second and its impact on the delivery cost is negligible. To reduce the delivery cost, larger time windows should be used for delivery operations. To increase customer satisfaction, smaller time windows should be made available to customers.
The highlighted (yellow) column with the size S i in Table 4 shows the same results as those in the highlighted (yellow) column in Table 3 for the original time windows S i 's in the five benchmark problems. When the size of all time windows is the same as the minimum size, none of the problems has any feasible solution and solution time is relatively small. When the size of all time windows is the same as the maximum size, all five problems are feasible and the minimum tour duration is identified. The solution time is larger and the largest solution time is around one second. Comparing the results for the original time windows S i 's and time windows with the same maximum size, the latter has worse customer satisfaction but does not decrease tour duration significantly. The maximum decrease in tour duration is 10 s (= 407-397) or about 2.5%. The tradeoff between delivery cost (tour duration and solution time) and customer satisfaction (size of time windows) is not clear for the normalization approach. When the size of time windows increases, the tour duration only decreases slightly.
The stepwise approach increases the size of the time windows gradually with the same amount of adjustment at each step. Table 5 shows the experiment results of the stepwise approach for problem n20.w20.0001 in the TSPTW library [30]. In the first experiment in Table 5, the original time windows S i 's in problem n20.w20.0001 are used to find the minimum tour duration and the solution time. The results for the original time windows S i 's are highlighted in yellow in Table 5. These are the same as those for S i 's in Tables 3 and  4. In each experiment that follows, the size of time windows increases by two seconds; this is achieved by decreasing a i , the earliest delivery time, and increasing b i , the latest delivery time, by one second at the same time. The tour duration and solution time of each experiment are included in Table 5. Figure 2 is a histogram that visualizes tour durations in Table 5. Figure 2 clearly shows that the minimum tour duration decreases as the size of time windows increases. This is mainly because a larger time window leads to a larger feasible region, which in turn results in a better optimal solution, i.e., a smaller tour duration. Figure 3 shows how the solution time in Table 5 changes as the size of time windows increases. The solution time remains small, around a few second or less, until the time window reaches S i +90, which requires a solution time of about 744 s. For time windows that are larger than S i +90, the solution time varies but mostly remains relatively large. Table 5 and Fig. 3 show that large solution times can occur when time windows are large enough.
The stepwise approach also reveals the tradeoff between customer satisfaction and delivery cost. As the size of time windows increases (Fig. 2), customer satisfaction decreases while the tour duration decreases and solution time remains stable, indicating reduced delivery cost. There is a caveat when the time windows become too large. Figure 3 shows that the solution time of identifying the minimum tour duration increases dramatically when the size of time windows reaches S i +90. In other words, a common and intuitive practice by many delivery companies to adopt large delivery time windows leads to both poor customer satisfaction and high cost (the optimal route is not obtained due to large solution time). While certain items may be delivered without customers being present, poor customer satisfaction resulted from large delivery time windows is exacerbated by the fact that sometimes customers are forced to wait at home for deliveries (e.g., alcohol deliveries, weather conditions, and requests by the senders).
The experiment results of the three approaches, proportion, normalization, and stepwise, provide important guidelines for determining time windows in-home delivery operations. First, customers of many delivery operations can choose the best time for a delivery to be made. A delivery   Table 5 company should provide customers with an appropriate size of the delivery time window to balance customer satisfaction and cost of delivery. This is a multi-objective optimization problem. Secondly, there is a tradeoff between customer satisfaction and delivery cost (Tables 3 and 5). Better customer satisfaction (smaller delivery time windows) require a higher delivery cost (larger tour duration). Thirdly, when the size of time windows is too small, it becomes infeasible to deliver to multiple customers and satisfy all delivery time windows (Tables 3 and 4). On the other hand, when the size of time windows is too large, the time it takes to find the minimum tour duration increases significantly (Table 3 and 5). A delivery company should avoid delivery time windows that are too small or too large.

Conclusions
This study investigates the impact of the size of delivery time windows on customer satisfaction and delivery cost. The results of this study suggest that a delivery company should not use delivery time windows that are either too small or too large. Extremely small time windows render the delivery operations infeasible; multiple deliveries cannot be completed to satisfy narrow time windows. Extremely large time windows not only lead to poor customer satisfaction but also require a significant amount of solution time to find the minimum tour duration, which is not obtained and, therefore, increases the delivery cost. Conventional wisdom suggests that large time windows reduce the delivery cost because delivery companies have more flexibility in choosing delivery routes with large delivery time windows. The results of this study show that it becomes practically infeasible (solution time exceeds one hour) to find the delivery route that minimizes the tour duration when time windows are too large. Extremely large time windows result in poor customer satisfaction and high delivery cost and require significant solution time for route planning. This study also suggests that there is a tradeoff between customer satisfaction and delivery cost. As the size of time windows increases, both customer satisfaction and delivery cost decrease. The latter is due to smaller tour duration resulted from larger time windows. Future research may determine the most appropriate size of delivery time windows for a variety of companies that deliver packages to homes and businesses. One approach is to develop multiobjective optimization models that take into consideration of multiple objectives such as customer satisfaction, tour duration, and solution time, and various constraints such as road traffic, municipality ordinances and codes, and labor standards.
This study experiments with five benchmark problems in the TSPTW library [30], which also includes other benchmark problems. There are many more TSPTW benchmark problems that are available in the public domain (e.g., [23,24]. Another important future research direction is to expand this study and conduct experiments on additional benchmark problems. These additional experiments are expected to validate the conclusions obtained in this study and may provide more insight into the tradeoff between customer satisfaction and cost when the size of time windows is adjusted in the home delivery business.  Table 5 Availability of data and material All data are included in the article.

Compliance with ethical standards
Conflict of interest The author declares that there is no competing interest.
Code availability Software code will be made available on a website after publication.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creat iveco mmons .org/licen ses/by/4.0/. Appendix 1: Adjusted time windows of the benchmark problem n20.w20.0001 using the proportion approach     19  12  41  11  42  10  43  9  44  8  45  7  46  6  47  5  48  20  1  29  0  30  0  31  0  32  0  33  0  34  0  35  0  36  21  267  308  266  309  265  310  264  311  263  312  262  313  261  314  260  315  22  0  416  0  417  0  418  0  419  0  420  0  421  0  422  0