Route Optimization of Electric Vehicle considering Soft Time Windows and Two Ways of Power Replenishment

Under the background of severe air pollution and energy shortage, electric vehicles (EVs) are promising vehicles to support green supply chain and clean production. In the world, the renewal of EVs has become a general trend.*erefore, the concern about EVs is a hot issue at present, but EVs have the characteristics of limited driving distance and long charging time. When the EVs are used in logistics transportation, these characteristics have a significant impact on the vehicle routing problems. *erefore, based on the research experience of traditional vehicle routing optimization, combining with the characteristics of EVs, this paper presents an optimal problem of electric vehicle routes with time windows based on two charging methods and it also designs a mathematical model which was caused by early and late arrival as the objective function to minimize the transportation cost, vehicle use cost, power supply cost, and penalty cost. *e model is solved using an ant colony algorithm. Finally, the ant colony algorithm is tested and analysed with an example.


Introduction
e research on vehicle routing began in the 1950s, Dantzig and Ramser firstly proposed the concept of vehicle routing problem (VRP), which refers to the purpose of distributing or collecting goods between distribution centres and a certain number of customers with different needs through the design of vehicle routing, and finally reached the goals, such as the shortest distance, the least time, and the least cost [1]. e importance of transportation in the logistics system distribution activities is undeniable, but in recent years, the large use of fossil fuel vehicles has resulted in the rapid consumption of oil resources and excessive emissions of greenhouse gases, so considering the balance and optimization of monetary costs and the environmental problems of fossil fuel vehicles, many vehicle routing problem models for fuel or emissions have risen, such as the fuel consumption rate of the VRP was considered by Xiao et al. [2], fuel consumption and carbon emission of the VRP considered by Zhang et al. [3], a time-dependent VRP model of minimizing fuel consumption of Norouzi et al. [4], the green vehicle routing problem (GVRP) model of Poonthalir and Nadarajan [5], and the vehicle scheduling problem of minimizing carbon emission of Wang et al. [6].
Because of the environmental protection characteristics of EVs, in recent years, with the rapid growth of the market share, EVs have been introduced into the market as personal and commercial alternative energy vehicles. In 2018, the number of electric vehicles worldwide exceeded 5.1 million, an increase of 2 million from 2017, and the growth of new vehicles almost doubled (IEA, 2019). In China, electric vehicles are growing at the rate of more than 50% per year (IEA, 2018). In 2018, the number of electric vehicles in China ranked first in the world [7]. Compared with traditional fuel vehicles, the main advantages of electric vehicles are zero greenhouse gas emissions, high efficiency, and low operating noise [8], which helps logistics companies get more and more social and environmental customer support. And it gets a green image [9]. Fernandez and Casals use sustainable analysis and practical estimation methods that take into account the life cycle carbon emissions of electric vehicles to analyse the contribution of electric vehicles to reducing greenhouse gas emissions [10,11]. Wu et al. used the life cycle assessment method to estimate that the total life cycle greenhouse gas emission reduction potential of battery electric vehicles will gradually reach 13.4% in 2020 [12]. In addition to environmental benefits, EVs also have economic benefits. Compared with traditional fossil fuel powered vehicles, EVs consume 10% to 15% of the fuel cost of traditional vehicles at the same distance [13]. erefore, the focus on EVs has become a hot issue at present. However, due to the characteristics of EVs such as low endurance mileage and long charging time, it becomes a significant and challenging task to study its VRP.
Electric vehicles refer to cars that use electric engines to provide energy through their own chemical batteries. e electrical energy used by EVs can be converted into many kinds of clean energy, which is the main force of environmental protection vehicles in the future with a high energy utilization rate and being clean and pollution-free. As a distribution vehicle, electric vehicles need to be charged much time for long-distance distribution, and the power replenishment time is longer than the refueling time. erefore, it is necessary to consider the charging problems that may occur in the charging process. Based on traditional fuel vehicle route optimization, the introduction of the charging stations is the primary issue of electric vehicle upgrading combining with the characteristics of EVs. Electric distribution companies apply some coordination methods to control the charging load. at can affect the charging duration. Yang et al. studied the charging scheduling of electric vehicles on the highway [14]. Dogan and Alci optimized the charging schedule of electric vehicles considering the cost of battery degradation [15]. Dogan et al. based on a heuristic algorithm for charge and discharge coordination optimization [16]. Aravinthan and Jewell proposed a two-step method for scheduling EV charging, which limits the impact on EV charging on distribution assets [17].
At present, fast charging is the most common charging strategy. Schucking et al. proposed five charging strategies and believed that DC fast charging is essential [18]. In addition to fast charging on the issue of charging strategy, battery switching is also a relatively popular charging strategy. Adler and Mirchandani used real-time highway data to find the optimal battery exchange strategy [19]. Yang and Sun studied the location routing problem of the battery switching station of EVs with large capacity and optimized the routing plan and the selection of battery switching stations [20]. Dai et al. regarded the battery exchange strategy of EVs as the background and it provided reference for the determination of decision variables such as the number of backup batteries in AC power station and the charging selection of EVs [21]. Margaritis et al. analysed the advantages and disadvantages of battery exchange strategy to the government, users, and enterprises based on the EU [22]. is study combines the two charging strategies of fast charging and battery switching. e fast charging time is related to the remaining power, fixed battery replacement time, and the power replenishment method with less time is selected.
In the large-scale application of EVs in modern logistics, in addition to considering the plan to charge or replace batteries on the way, the delivery time is also extremely important for logistics companies, so we need to consider some important practical factors, such as customer time windows. In the actual distribution activities, more and more logistics enterprises begin to pay attention to the timeliness of package delivery. For customers, "punctuality" is one of the important factors affecting customer experience, so the vehicle routing problem with time windows (VRPTW) has also become an important part of the research. By adding time windows constraints to the basic VRP model and Solomon built VRPTW model, in which time window is a hard time window that must be observed [23]. Qureshi further expanded the concept of the hard time window, extended the problem to the category of the soft time windows, and determined the strictness of time windows by setting penalty function [24]. e soft time windows problem is widely used. Goeke considered the problem between time windows and EVs is pickup and delivery [25]. Keskin and Catay studied partial charging strategies for electric vehicles with time windows [26]. Desaulniers et al. studied the effective route optimization of battery electric commercial vehicle fleets, and they considered four variants of the route problem of electric vehicle with time windows [9]. Goeke studied the pickup and delivery of EVs with time windows (PDPTW-EV). In the PDPTW-EV, access location is limited by time windows [25]. Many scholars introduced charging stations and time windows for discussion [27,28].
is study combines the two hot charging strategies of fast charging and battery switching. e fast charging time is related to the remaining power, fixed the switching time, and the power replenishment method with less time is selected.
is paper not only considers the problem of charging stations, but also uses the broken line time windows to limit the distribution time based on the soft time windows.
In summary, compared with other similar studies, the main contributions of this paper are as follows: (1) in order to calculate the cost of logistics enterprises more accurately and save cost, this paper considers the cost of transportation as much as possible, that is to say, fixed cost, transportation cost, charging cost, and time penalty cost. And it establishes a mixed-integer linear programming model (MILP) with the goal of minimizing the total cost; (2) in order to save charging time, two commonly used charging methods are considered, and one with shorter charging time is selected; and (3) considering the customer's time tolerance, the broken line soft time windows is adopted. e rest of this paper is organized as follows: Section 2 describes the problem and identifications of the main assumptions. In Section 3, the MILP model is established and the description of the method of solving the model is provided. In Section 4, the test results of an example are given and the sensitivity analysis is carried out. Finally, the paper summarizes in Section 5.

Problem Description
is problem can be abstracted as that an enterprise uses EVs to provide distribution services for n customers with time windows after the distribution centre is fully charged.

Advances in Operations Research
Each customer's demand, service duration, good service time windows, and customer tolerance level are needed to be known. Finally, reasonable planning of the vehicle distribution route is necessary so that the total cost of distribution is small. e soft time windows can relax the constraints of time windows, optimize resource allocation, and reduce energy consumption and road congestion, so the time windows studied in this paper mainly are soft time windows. As shown in Figure 1, in the traditional soft time windows, whether the vehicle arrives before or after l, the customer is allowed to serve, but they are required to pay the corresponding penalty fee, which is generally a simple linear relationship with the degree of time deviation. However, for the deviation of the best service time windows, customers have the difference between tolerance and intolerance. erefore, based on the traditional soft time windows, considering the tolerance range of customers, this paper proposes a broken line time window.
According to the customer tolerance level (z) and service duration (tf), the tolerance time window can be obtained on the basis of the optimal time window [e′, If the vehicle provides services in the best time window [e, l], there will be no penalty cost to be paid. If the vehicle provides services in the interval [e ′ , e][e ′ , e] or [l, l ′ ], there will be only less penalty cost to be paid. If the vehicle starts service earlier than e ′ or later than l ′ , there will be more penalty cost to be paid. Compared with the traditional soft time windows, the broken line soft time windows take the actual feelings of customers into consideration, which will be conducive to better coordination between enterprises and customers, reasonable allocation, and optimization of resources.
In view of the above considerations, the problems and basic assumptions to be solved are as follows: (1) each vehicle can meet the needs of multiple customer points, and each customer point can only be served by one vehicle; after the completion of the distribution service, the vehicle must drive back to the distribution centre; (2) all vehicles are the same type, and the total transportation volume shall not exceed the capacity limit of EVs; (3) each customer's location coordinates, demand quantity, and service duration are known, and there are optimal service time windows and tolerance time windows; (4) the time window penalty coefficient of each customer node is the same; (5) EVs can only be charged or their battery can be replaced in the distribution centre or power station; (6) each customer must be visited and can only be visited once; (7) the road is smooth, without considering traffic congestion and other special situations; (8) it is assumed that the transportation cost generated by the vehicle is linearly related to the route length, and the use cost of each vehicle is fixed; and (9) the objective function of this problem is to minimize the total distribution cost.

Materials and Method
In this part, according to the electric vehicle routing problem with time windows (EVRPTW), we establish a MILP model and determine the constraints. i, j: index of nodes, i � 0, 1, 2, . . . , n. d ij : distance from the node i to the node j, i, j ∈ D. q n : demand of the customer node n, and n ∈ N. Q: rated load capacity of electric vehicles. P: battery capacity of electric vehicles. g: charge coefficient.   2, 3, 4).
x ov : if the vehicle v returns to the distribution centre after delivering a customer group, then x ov � 1, otherwise x ov � 0. y iv : the task of the customer node i is completed by the vehicle v, then y iv � 1, otherwise y iv � 0.

Model and Method.
e objective function is to minimize the comprehensive cost, including transportation cost, vehicle use cost, electricity replenishment cost, and time window penalty cost. e formula of the MILP model is as follows: Among them, subject to i∈D,k≠i n∈N y nv q n ≤ Q, (6) v∈V i∈D,i≠0 x oiv ≤ |V|, i∈N j∈D,i≠j x ijv , x ov , y iv ∈ 0, 1 In the model given above, Constraint (4) ensures that the vehicle starts from the distribution centre returns to the distribution centre and focuses on distribution centre. Constraint (5) ensures that each customer is served only once by one vehicle. Constraint (6) is a restraint on vehicle loading. Constraint (7) indicates that the number of EVs serving the customer is less than or equal to the total number of vehicles owned by the distribution centre. Constraint (8) requires that the number of customers served by each vehicle is less than or equal to the total number of customers. Constraint (9) requires that when the electric vehicle starts from the distribution centre, the time is 0. Constraint (10) indicates that the travel time of electric vehicles from the point i to the point j is the ratio of the distance between two points and the travel speed. Constraint (11) indicates that when the electric vehicle passes through the charging stations, the charge replenishment time is the minimum of the battery replacement time and fast charging time. Constraint (12) indicates that the time the electric vehicle leaves the customer node i is the sum of arriving at the customer node, waiting time at the customer node i, and servicing time. Constraint (13) shows the relationship between the starting service time and the arrival time of vehicles at the customer point. Constraint (14) indicates that the time the electric vehicle arrives at the node j is the accumulation of the previous time. Constraint (15) means that neither power consumption nor power replenishment occurs at the customer node i. Constraint (16) indicates that when the electric vehicle starts from the distribution centre, the state of charge is 100. Constraint (17) indicates that the remaining power to node j is equal to the remaining power to leave node i minus the power consumed on the way. Constraint (18) indicates that the state of charge of electric vehicles is nonnegative at any position. Constraint (19) indicates that the decision variable is constrained to 0-1.
In this paper, the ant colony algorithm is used to solve the approximate optimal solution of the NP hard problem. e ant colony algorithm has the characteristics of distributed computing, positive information feedback, and heuristic search. In essence, it is a heuristic global optimization algorithm in the evolutionary algorithm. e algorithm imitates the social behaviour of ants in order to find the shortest route from nest to food source. In the ant colony algorithm, each ant performs four basic activities in the process of route construction: (1) select the next customer based on the probable function of the distance from the current location to the customer and the route strength on the arc; (2) save the taboo list of the customers in the current route; (3) update the residual capacity of the vehicle; and (4) update the track intensity on the access arc, and use the method of local search to improve the quality of the solution. Finally, the taboo lists are deleted, and a new iteration is started. When the ant colony algorithm solves the MILP model, the specific steps are as follows: Step 1: importing data and setting basic parameters.
Step 2: calculating the distance between customer nodes and the cost and time of distance between customer points.
Step 3: initializing and iterating in order to find the best route.
Step 4: terminating the algorithm and reporting the best solution.

Calculation Experiment and Cost Analysis
In order to verify the proposed MILP model, the calculation experiments are carried out based on the known benchmark instances, and the ant colony algorithm is used to solve the model.

Test Examples.
e experimental data are from Solomon's VRPTW standard problem set, and the data number is R101 [29], which is characterized by uniform distribution of customer points and narrow time windows. In this case, a vehicle is generally only responsible for the distribution of several customer points, and the vehicle route cost is greatly affected by the time windows, so the data selection of the case is reasonable. In order to draw a clear road map, this paper only selects the first 26 data, including 1 distribution centre and 25 customer nodes.1 is the distribution centre, 2-26 is the customer node, 27-31 is the charging stations node. e specific parameters of the example are shown in Table 1, and the node information is shown in Table 2.
In this paper, according to the actual situation, we made assumptions about the required data in Table 1, and for this part of the program design, we reserved a data change area, which is malleable. e MILP model is solved by MATLAB programming. In order to reduce the influence of random factors as much as possible, this paper repeatedly tests the example 10 times to get the total cost optimal solution (C), the number of vehicles (N), route length (L), and penalty cost (P) when the optimal solution is reached.
As can be seen from Table 3, the optimal solution of this example is 7283.08, including the route length when the optimal solution is reached at 270.61, and Table 4 shows that the optimal allocation scheme includes 4 routes; the route map is shown in Figure 3.

Cost Analysis.
Based on the calculation experiment of the Solomon benchmark example, the sensitivity analysis of the cost affecting the electric vehicle route planning is carried out.

Use Cost and Transportation
Cost. First, adjust the use cost from 1000 for each vehicle to 5000 for each vehicle, keep the other parameters unchanged, repeat the test for 10 times, and see Table 5 for the results when the optimal solution is reached.
It can be seen from Table 5 that after adjusting the use cost of vehicles from 1000 to 5000, after 10 times of operation, compared with Table 3, the number of vehicles is reduced from 4 to 2, which is 50%. It can be seen that the higher the use cost of vehicles is, the smaller the number of vehicles used is. When the use cost of vehicles is much higher than other costs, the vehicle route distribution scheme with the minimum number of vehicles will be preferred. At the same time, the route length is only increased by 3% compared with the result in Table 3, while the time window penalty is increased by 52%. is is understandable, because Advances in Operations Research the proportion of vehicle use cost in the objective function increases, so the algorithm will tend to find the solution with the minimum vehicle use.
Keep the cost of using vehicles at 5000 per vehicle, and adjust the unit transportation cost from 2 to 10, while the penalty factor of time windows remains unchanged. Run the program 10 times, and see Table 6 for relevant results when the optimal solution is reached.
It can be seen from Table 6 that after adjusting vehicle use cost and unit transportation cost at the same time, the number of vehicles obtained is significantly reduced compared with Table 3. It can be seen that when vehicle transportation cost and use cost are much higher than other costs, the route distribution scheme with the least number of vehicles will be preferred. e route length in Table 6 is similar to that in Table 3, but the penalty cost of time windows is increased by 53%. By increasing the factors of vehicle use cost and unit freight in the objective function, the proportion of time window penalty cost is greatly reduced. erefore, the length of the route and the number of vehicles are given priority in the result, so the time window penalty is greatly increased. is shows the effectiveness of the algorithm again in this paper.  Figure 2: Single ant traversal process to find the best route during iterative search.

Advances in Operations Research
indicated an increase of 75%, and we can see that the number of vehicles has increased significantly. is is understandable, for the change of the penalty cost coefficient increases the penalty cost in the objective function, so the algorithm will tend to find more solutions for vehicles to serve customers. e increase in the number of vehicles will inevitably lead to a decrease in the average driving route length, which proves the effectiveness of the algorithm again. erefore, the higher the cost of fines is, the more vehicles are required. is has led logistics companies to prepare more vehicles under strict time window conditions, making the customer's total demand unchanged or even increased.

Electricity Replenishment Cost.
e battery capacity is 60 kWh, the charging time needs 60 min, and the power change time is 31 min. e shortest power supply mode is selected. erefore, when the supplementary power is not more than half, quick charging is preferred. Otherwise, choose the battery replacement strategy. e charging cost per unit time is 1 RMB/min, and the cost of single battery replacement is 30 RMB. Now, the cost of power supply is increasing. e charging cost per unit time is 50 RMB/min, and the cost of single battery replacement is 1500 RMB. e results are shown in Table 8, and the vehicle route, when the optimal solution is reached, is shown in Figure 4.
It can be seen from Table 8 that after the unit charge cost is adjusted from 1 to 50 and the single battery change cost is adjusted from 30 to 1500, after ten runs, compared with Table 3, the number of vehicles increased from 4 to 5 vehicles, indicated an increase of 25%. At the same time, it can be seen that the number of charging stations passed in Figure 3 is 3; however, the number of charging stations passed in Figure 4 is 2. Increased costs have drived companies to choose more vehicles to avoid charging. In addition, compared with Table 3, the route length is reduced by 0.6%, together with the penalty cost is reduced by 10.3%. And the increase in the number of vehicles serving customers leads to a reduction in the possibility of reducing time, penalties, and costs. is proves the effectiveness of the algorithm. erefore, when the charging facilities are not perfect, together with the power replenishment cost is high, the logistics companies tend to use more vehicles to avoid charging as much as possible.

Conclusions
At present, most of the literature studies use a charging strategy, and the customer tolerance is not considered while studying the customer time windows. In this paper, the charging strategy of combining two charging ways is adopted, the broken line soft time windows is used considering the customer tolerance, and the MILP model of the EVRPTW is finally established. And through the calculation experiment of the Solomon benchmark example, the cost of affecting the route optimization of electric vehicle is analysed, the availability as well as effectiveness of data and algorithm are proved, and the management opinions on the practical application of MILP model are put forward.
(1) e higher the use cost and freight of vehicles are, the less the number of vehicles used. When the use cost and freight of vehicles are much higher than other costs, the vehicle route distribution scheme with the least number of vehicles is preferred. (2) e higher the penalty cost of time windows is, the higher the number of vehicles used for vehicle distribution is. In the case of strict time windows, logistics companies need to prepare more vehicles than the total demand of customers.

Advances in Operations Research
(3) Logistics companies tend to use more EVs to avoid charging as much as possible when charging facilities are not perfect and the cost of power supply is high. e model can help the logistics enterprises provide some suggestions for the route optimization, help to promote the application of EVs in the field of logistics, and improve energy efficiency, energy conservation, and emission reduction. e proposed MILP model is helpful to reduce the logistics cost. However, the traditional shortcomings of VRP still exist in the EVRPTW model. For example, it is still a NP-hard, and it is difficult to solve largescale problems.
e focus of future research may be to developing more effective heuristic algorithm to solve largescale problems, consider the real-time changes of traffic conditions, and expand the direction of the dynamic vehicle route.

Data Availability
e data used to support the findings of this study are included within the article.

Conflicts of Interest
e authors declare that there are no conflicts of interest regarding the publication of this paper.