Introduction

The rapid progress of urban logistics has bestowed convenience while simultaneously engendering a surge in Greenhouse Gas (GHG) emissions, posing exigent challenges for the sustainable advancement of urban distribution [1]. Presently, transport activities account for approximately 28% and 26% of GHG emissions in the United States [2] and Europe [3], respectively, necessitating the development of distribution solutions that mitigate the environmental impact of urban logistics. By ameliorating urban air quality [4], alleviating noise pollution [5], and reducing reliance on non-renewable fossil fuels [6], Electric Vehicle (EV) delivery fleets have emerged as a promising strategy to address the sustainable quandaries at hand [7]. Prominent logistics enterprises worldwide, such as UPS and DHL, are actively championing the electrification of their transport fleets [8]. Meanwhile, logistics companies must strive to curtail operating costs in today’s cutthroat market to gain a competitive edge. Joint distribution, which involves utilizing multiple depots of logistics companies, is an efficacious strategy to achieve this goal [9]. The Multi-Depot Half-open Vehicle Routing Problem (MDHOVRP) exemplifies the joint distribution concept, which allows vehicles to select the nearest depot for returning instead of retracing to their initial departure depots [10]. This approach circumvents superfluous unloaded vehicle trips, slashes distribution costs, and facilitates resource sharing among depots. Integrating EVs into multi-depot half-open vehicle distribution planning saves energy costs, lowers carbon emissions, and supports social development objectives [11]. Currently, limited studies on the Multi-Depot Half-open Electric Vehicle Routing Problem (MDHOEVRP) indicate the need for further investigation.

However, considering MDHOEVRP in the realm of urban distribution encounters numerous difficulties. One prominent obstacle pertains to the dynamic nature of urban traffic systems and the judicious replenishment of EV power [12]. The intricate urban traffic network undergoes continual fluctuations, occasionally leading to traffic congestion and resultant variations in transport vehicle speeds that directly impact battery power consumption and, consequently, vehicle mileage [13]. Therefore, the real-time estimation of remaining mileage for EVs becomes a complex task, rendering distribution route planning arduous. Furthermore, the charging operations of EVs necessitate substantially more time than the refueling process of conventional Fuel Vehicles (FV) [14]. Hence, it becomes imperative to prudently strategize the selection of charging stations for transport vehicles and align them with the corresponding charging strategy during distribution [15]. In conclusion, exploring the Multi-Depot Half-Open Time-Dependent Electric Vehicle Routing Problem (MDHOTDEVRP) within the domain of urban logistics aligns harmoniously with societal development concerns and bears immense research significance.

The MDHOTDEVRP presents multifaceted optimization challenges. First, the dynamic nature of time-dependent vehicle routing, where travel time and EV energy consumption are influenced by various temporal factors, adds complexity to the problem. Second, selecting suitable charging stations and implementing effective charging strategies are crucial, as these factors mitigate the impact of switching from FVs to EVs on transport efficiency. Lastly, the diverse array of schemes imposed by multiple depots and half-open routes further complicates the allocation of EVs, routing decisions, and the design of efficient return strategies. Effectively addressing the MDHOTDEVRP has significant implications for urban logistics transportation. By developing efficient algorithms and models tailored to this problem, it becomes feasible to optimally allocate EVs from different depots, systematically plan EV routes while considering time-dependent variables, curtail logistics distribution costs, and reduce EV energy consumption. These improvements not only foster the economic development of urban logistics but also aid in assuaging environmental impacts.

In light of the challenges posed by the MDHOTDEVRP, the study aims to propose a novel approach to tackle the problem and provide insights into its computational aspects. The proposed Two-Stage Hybrid Ant Colony Algorithm (TSHACA) integrates customer clustering using the improved K-means algorithm and distribution optimization within each cluster using the Improved Ant Colony Algorithm (IACA). Through this approach, the paper seeks to overcome the difficulties associated with EV urban distribution.

The main contributions of this study are summarized as follows: (i) The study explores the MDHOTDEVRP, thereby bridging a noteworthy research gap. (ii) A Mixed-Integer Programming (MIP) model is developed for MDHOTDEVRP, incorporating dynamic urban traffic networks, Multi-depot Half-open Joint Distribution Mode (MHJDM), and optimized charging strategies. (iii) To solve the model, a pragmatic TSHACA is designed with enhanced convergence speed, improved exploration and exploitation capabilities, and excellent robustness, enabling efficient EV allocation, route planning, and cost minimization for urban logistics. (iv) The paper meticulously scrutinizes the performance of the proposed model and algorithm through an exhaustive array of numerical experiments, thereby unearthing the economic and environmental merits inherent in the MDHOTDEVRP. The experimental findings furnish invaluable insights and recommendations to government policy-makers and logistics enterprise managers from multifarious vantage points, facilitating endeavors to champion energy conservation and emissions reduction within the logistics industry.

The remaining sections of this article are organized as follows. In the second part, a review of relevant literature is provided, and the innovative aspects of this study are elaborated. The third part presents the theoretical methodology for estimating EV power consumption and travel time in a dynamic urban traffic network. The fourth part describes the research question and develops a MIP model for the problem. The fifth part details the design of the TSHACA. In the sixth part, a series of numerical experiments are carried out to validate the efficacy and rationality of the proposed algorithm, and practical suggestions are offered. Finally, the seventh part presents the conclusion of this study.

Related literature review

As a renowned combinatorial optimization problem, the Vehicle Routing Problem (VRP) seeks to ascertain the optimal set of routes for delivering packages from the depot to customers based on various objective functions [16]. The proposed MDHOTDEVRP in this paper is a distinctive variant of VRP, which encompasses the MHJDM, time-dependent speed, and diverse charging strategies. This section provides an overview of the literature related to the factors above and artificial intelligence algorithms used to solve such problems.

Research on the multi-depot vehicle routing problem (MDVRP)

MDVRP is a variation of VRP that emerged with the growth of the transportation industry. It requires logistics enterprises to use multiple depots in the region to deliver packages to scattered customers and achieve more efficient transportation. Initially, scholars primarily focused on the closed MDVRP. Yesodha and Amudha [17] and Sadati et al. [18] developed MDVRP models with different objectives and employed an improved firefly algorithm and a variable tabu neighborhood search algorithm, respectively, to solve the problem. Soeanu et al. [19] focused on different constraints in MDVRP and proposed a risk-constrained MDVRP, developing a cost-effective learning-based heuristic technique to solve the problem. Further research in the business and academic communities has revealed that MDVRP under MHJDM offers advantages such as shorter distribution routes and reduced costs, which allow for maximum resource sharing. Subsequently, scholars began exploring the MDHOVRP, where vehicles can return to any nearby depot upon completion of a transportation task instead of solely returning to the original departure depot. Li et al. [20] comprehensively considered constraints, including time windows, route duration of the vehicle, number of depots, and MHJDM, and established an MDHOVRP model under shared resources. Wang et al. [21], while solving the optimal distribution route under MHJDM, reasonably allocated the generated profits based on the minimum costs-remaining savings method. Liu et al. [22] and Chen et al. [23] focused on MDHOVRP from the perspectives of cold chain transportation and the contactless food distribution of closed epidemic areas, respectively. The former used a Simulated Annealing Algorithm (SAA) to solve the model, while the latter designed a hybrid metaheuristic. In light of the growing importance of sustainable transportation, the MDHOEVRP is gaining attention. Lijun et al. [11] studied the MDHOEVRP based on the hybrid energy supplement strategies of charging and swapping, and used the multi-objective SAA to solve the problem. Since the price of electricity is lower than that of fuel and EVs are more environmentally friendly, MDHOEVRP offers advantages over MDHOVRP in terms of economic and environmental costs. The aforementioned literature constitutes a comprehensive theoretical framework for investigating the MDHOEVRP.

Research on the time-dependent vehicle routing problem (TDVRP)

The urban transportation system exhibits time-varying uncertain natures [24], wherein vehicular velocities may fluctuate across varying time periods. This variation significantly affects the EV energy consumption and travel time cost of urban logistics distribution. Scholars initially focused on TDVRP, which involved studying the real-time speed impact of different weather and congestion levels on vehicle routing [25], identifying ways to evade traffic congestion by analyzing urban traffic’s time-varying characteristics [26], and addressing the transport of valuable goods by proposing a secure TDVRP with time windows including pickup and delivery with uncertain demands [27]. Researchers then discovered that time-varying vehicle speeds caused various carbon emissions due to different fuel consumption, leading to the development of the Time-Dependent Green Vehicle Routing Problem (TDGVRP). Soysal et al. [28] and Çimen et al. [29] established the TDGVRP model, which considered time-varying vehicle speeds, fuel consumption, and carbon emissions. TDGVRP was later focused on cold chain transportation by Guo et al. [30], who proposed a two-stage algorithm that enabled vehicles to wait in place after service to avoid harsh traffic conditions. In recent years, with the popularity of EV fleets, the Time-Dependent Electric Vehicle Routing Problem (TDEVRP) is rising gradually. TDEVRP is, in fact, a subset of TDGVRP, which considers time-varying vehicle speeds’ impact on EVs’ energy consumption rather than FVs’ fuel consumption. Lu et al. [31] considered the impact of charging decisions and congestion conditions on the overall delivery process based on traditional constraints in TDEVRP. Bi and Tang [32] examined TDEVRP by incorporating time-varying random traffic conditions and employing the analytical battery model to determine EVs’ charging and discharging patterns. They aimed to minimize the overall service time and developed a hybrid rollout algorithm to tackle the problem. Zhang et al. [33] and Keskin et al. [34] approached TDEVRP from different viewpoints. The former incorporated charging during congestion periods into the objective function, while the latter considered the impact of queuing time at charging stations on overall distribution. The literature mentioned above offers both a theoretical framework and a solution methodology for TDEVRP.

Research on charging strategies in EVRP

Due to deviations in the energy conversion efficiency of EV batteries, the actual mileage is often lower than the displayed mileage, coupled with the time-varying vehicle speed phenomenon in urban distribution, leading to EV fleets having “range anxiety.” Moreover, charging EVs takes a longer time, which has an impact on delivery efficiency. Therefore, the formulation of a reasonable charging strategy is an important factor that cannot be ignored in the study of EVRP. Full charging, a charging strategy used in the study of Lin et al. [35], Granada-Echeverri et al. [36], and Kucukoglu et al. [37], fully charges the EV before leaving the charging station, which can alleviate range anxiety very well. However, this strategy has high charging cost and long charging time, which may easily lead to a decrease in customer satisfaction. The partial charging strategy considers charging costs and service timeliness, and offers more flexibility in charging operations. Zhou et al. [38] and Cortés-Murcia et al. [39] proposed partial charging strategies for EVs when designing EVRP charging schemes. The former allows EVs to be sent out for distribution tasks multiple times, while the latter makes the best use of partial charging time to deliver packages to some customers. In addition, there are different charging technologies in the charging process. Schiffer and Walther [40] and Dönmez et al. [41] proposed a linear charging function when designing the EVRP charging scheme. The former considers a single fast-charging mode at the charging station, while the latter considers a combination of three charging speeds: ordinary charging, fast charging, and super-fast charging. Karakatič [42] studied the nonlinear relationship between charging time and charging capacity of EVs in the EVRP. The above literature can provide theoretical references and methodological support for the charging strategy of EVs in distribution.

Research on artificial intelligence algorithms of solving VRP

Inspired by human intelligence, the social behavior of biological populations, or natural phenomena, scholars have created many intelligent optimization algorithms to solve large-scale VRPs. These include genetic algorithms that mimic the biological evolution mechanism of nature [43]; differential evolution algorithms that optimize searches through cooperation and competition among individuals within a group [44]; immune algorithms that simulate the learning and cognitive functions of the biological immune system [45]; Ant Colony Algorithms (ACA) that simulate the collective pathfinding behavior of ants [46]; particle swarm algorithms that simulate the collective behavior of bird flocks and fish schools [47]; firefly algorithms that simulate the flashing behavior of fireflies [48]; taboo search algorithms that simulate the human intelligence memory process [49]; and neural network algorithms that simulate the behavioral characteristics of animal nervous systems [50]. These algorithms have one commonality—they are developed by simulating or revealing certain natural phenomena and processes or the intelligent behavior of biological populations, and they all embody the idea of artificial intelligence.

Among these algorithms, the ACA, as a swarm intelligence algorithm, has advantages such as strong positive feedback, robustness, and distributed computing, and has received extensive research attention in academia. Su and Fan [51] aimed at the minimum penalty cost in transportation, and used ACA to solve the Green Vehicle Routing Problem (GVRP) with constraints on fuel consumption, carbon emissions, and customer satisfaction. Zhang et al. [52] also used ACA to minimize energy consumption in EVRP. However, ACA still has some shortcomings, so scholars have designed various Improved Ant Colony Algorithms (IACA). Zhang et al. [53] added three mutation operators to the traditional ACA to enhance local search capabilities and allow random global search to avoid getting stuck in local optima when solving the multi-objective VRP with flexible time windows. Li et al. [54] improved the method of updating pheromone information, while reducing the pheromone value of suboptimal solutions and increasing the pheromone value of optimal solutions, to solve the multi-objective multi-depot GVRP. Xiang et al. [55] designed a demand coverage diversity adaptation method based on the ACA to solve the dynamic VRP. Jia et al. [56] designed a bi-level ACA to solve the EVRP with capacity constraints, where the upper level does not consider electricity constraints and uses the ACA to generate routes that meet customer demands, and the lower level uses a new heuristic algorithm to determine the charging plan and uses the solution obtained by the lower level to update the pheromone of the upper level ACA. Mao et al. [57] combined insertion heuristic and local search strategies to design an IACA to solve the EVRP with time windows and multiple recharging options. They improved the elitist ant strategy by not only using the optimal solution to update pheromones but also using acceptable solutions in the ranked list. However, for some complex VRPs, a single artificial intelligence algorithm and its improvements may not be enough to find the satisfactory solution. Combining two or more algorithms effectively has become a new research hotspot. Many researchers have combined different artificial intelligence algorithms, complementing each other’s strengths, and have developed many hybrid algorithms suitable for solving complicated VRP. Xu et al. [58] designed a hybrid algorithm combining ACA and K-means clustering to solve the dynamic VRP that is closer to real-world situations, and used the 2-opt and crossover operators to further optimize the route. Pan et al. [59] also combined the K-means clustering with ACA to solve the load varying VRP with stochastic demands. Similarly, when solving the periodic VRP with time window and service choice, Wang et al. [60] employed the K-means clustering to ensure spatial clustering of customers within the same planning period, and further utilized ACA and SAA for optimization.

The research gaps

Previous studies have provided a strong foundation for investigating EV distribution-charging route planning under urban logistics. Through a review of the existing literature, several gaps in research have been identified for further exploration. (1) The MHJDM has gained attention from researchers due to its practical significance in real-world applications, such as urban logistics, last-mile delivery, and green transportation. However, there is a scarcity of literature on EV distribution route planning that comprehensively considers the time-varying dynamic nature of urban traffic networks, MHJDM, and partial charging strategies. The proposed MDHOTDEVRP not only advances the field of VRPs but also contributes to the development of sustainable transportation systems. (2) Despite many studies considering the time-varying dynamic nature of urban transportation networks, few have integrated the time-varying vehicle speed into EV distribution route planning. This issue requires consideration of the variable travel times of EVs due to factors such as traffic congestion and battery charging needs, making it more complex than traditional TDVRP. Incorporating real-time traffic and energy usage data, TDEVRP provides a more accurate and reliable solution to EV routing, addressing the unique challenges faced by EVs in urban logistics. This innovation has the potential to significantly improve the efficiency and environmental sustainability of urban transportation systems. (3) The hybrid algorithm combining ACA with the K-means clustering has been developed to solve complex optimization problems, but few studies have applied this hybrid algorithm to solve EVRP. Additionally, both ACA and K-means clustering have the drawback of easily falling into local optima. Therefore, how to balance the trade-off between global exploration and local exploitation effectively and fully leverage the strengths of the two algorithms is worth exploring. This paper fills the above research gaps by investigating MDHOTDEVRP, which comprehensively considers customer coordinates, demand, time-varying EV speeds, EV capacity, battery capacity, partial charging strategies, and MHJDM. The optimization model is constructed with the aim of minimizing the total distribution cost, and a TSHACA is designed to solve this model. The results of this study can provide decision-making references for companies and governments interested in implementing sustainable urban logistics.

Estimation of EV power consumption and travel time in a dynamic transportation network

The road network in urban areas is characterized by its time-varying nature, meaning that the speed of vehicles may fluctuate during various time periods when traveling on urban roads. The time taken to traverse the road segment \((i,j)\) depends not only on the road distance but also on the EV’s starting time, traveling speed, and real-time load. The vehicle may require several time periods to travel from node \(i\) to node \(j\). Therefore, this study adopts the method proposed by Liu et al. [26] to partition a day of 24 h into multiple equal time periods. \(H\) represents the length of a time period, and \(n\) represents the number of time periods in a day, i.e., \(n = 24/H\). \(T\) represents the set of time periods in a day, i.e., \(T = \{ [0,T_{1} ],[T_{1} ,T_{2} ],...,[T_{n - 1} ,T_{n} ]\}\), where \([0,T_{1} ]\) represents the first time period of a day, and \([T_{n - 1} ,T_{n} ]\) represents the \(n{\text{ - th}}\) time period. Additionally, \([T_{R - 1} ,T_{R} ]\) signifies the \(R{\text{ - th}}\) time period of a day, where \(R \in \{ 1,2,...,n - 1,n\}\), and \(T_{R} - T_{R - 1} = H\). The traveling speed of EV \(k\) on road segment \((i,j)\) during the \(R{\text{ - th}}\) time period is denoted as \(v_{ijk}^{R}\). By combining the EV energy consumption calculation methods proposed by Goeke and Schneider [61] and Basso et al. [12], the energy consumption \(e_{ijk}^{R}\) generated by EV \(k\) when traveling at speed \(v_{ijk}^{R}\) on road segment \((i,j)\) during the \(R{\text{ - th}}\) time period can be calculated as follows:

$$ \begin{aligned}e_{ijk}^{R} & = \phi^{d} \varphi^{d} \left(\frac{{[g\sin \theta_{ij} + C_{r} \cdot g\cos \theta_{ij} ](L + u_{ijk} )}}{3600} \right.\\ &\quad \left.+ \frac{{RA\rho (v_{ijk}^{R} )^{2} }}{76140}\right)v_{ijk}^{R} t_{ijk}^{R} , \end{aligned}$$
(1)

where \(\phi^{d}\) denotes the output efficiency parameter of the driving motor, \(\varphi^{d}\) denotes the output efficiency parameter of the battery. Other factors influencing EV energy consumption include the rolling resistance coefficient (\(C_{r}\)), air resistance coefficient (\(R\)), air density (\(\rho\)), and the windward area of the vehicle (\(A\)). \(\theta_{ij}\) is the slope of road segment \((i,j)\), and \(g\) is the gravitational acceleration. \(L\) denotes the self-weight of the EV, and \(u_{ijk}\) denotes the real-time load of EV \(k\) traveling on road \((i,j)\). \(t_{ijk}^{R}\) is the travel time of EV \(k\) on road section \((i,j)\) during the \(R{\text{ - th}}\) time period.

Let \(d_{ij}\) denote the distance between node \(i\) and node \(j\). Let \(d_{ijk}^{R}\) denote the remaining distance that EV \(k\) still needs to travel on road segment \((i,j)\) at the end of the \(R{\text{ - th}}\) time period. Under the time-varying urban road network, the following are procedures to calculate the power consumption \(E_{ijk}\) and travel time \(T_{ijk}\) that EV \(k\) requires to traverse road segment \((i,j)\):

Procedure 1: The power consumption and travel time generated by EV \(k\) during the \(R{\text{ - th}}\) time period when it leaves node \(i\). Let \(\partial_{ik}^{R}\) denote the moment when EV \(k\) departs from node \(i\) within the \(R{\text{ - th}}\) time period, i.e., \(T_{R - 1} \le \partial_{ik}^{R} \le T_{R}\). Therefore, the feasible travel time of EV \(k\) during the \(R{\text{ - th}}\) time period is \(T_{R} - \partial_{ik}^{R}\). Consequently, the distance traveled by EV \(k\) on road segment \((i,j)\) during the \(R{\text{ - th}}\) time period is \(F_{ijk}^{R} = v_{ijk}^{R} (T_{R} - \partial_{ik}^{R} )\). If \(F_{ijk}^{R} \ge d_{ij}\), it implies that EV \(k\) has covered the distance between node \(i\) and node \(j\) within the \(R{\text{ - th}}\) time period, hence \(d_{ijk}^{R} = 0\), \(T_{ijk} = t_{ijk}^{R} = d_{ij} /v_{ijk}^{R}\), and \(E_{ijk} = e_{ijk}^{R}\). The calculation process is complete. If \(F_{ijk}^{R} < d_{ij}\), it signifies that EV \(k\) cannot travel from node \(i\) to node \(j\) during the \(R{\text{ - th}}\) time period. Consequently, \(d_{ijk}^{R} = d_{ij} - F_{ijk}^{R}\), and \(t_{ijk}^{R} = T_{R} - \partial_{ik}^{R}\). Therefore, the energy consumption of EV \(k\) during the \(R{\text{ - th}}\) time period is \(e_{ijk}^{R}\). Proceed to Procedure 2.

Procedure 2: Computation of EV \(k\)’s power consumption and travel time on road segment \((i,j)\) after the \(R{\text{ - th}}\) time period. Step 1: Set \(\xi = 1\). Step 2: Calculate the possible travel distance \(F_{ijk}^{R + \xi }\) of EV \(k\) during the \((R + \xi ){\text{th}}\) time period, where \(F_{ijk}^{R + \xi } = v_{ijk}^{R + \xi } \cdot H\). If \(F_{ijk}^{R + \xi } < d_{ijk}^{R + \xi - 1}\), it means that EV \(k\) still cannot travel to node \(j\) in the \((R + \xi ){\text{th}}\) time period. Consequently, the travel time of EV \(k\) during the \((R + \xi ){\text{th}}\) time period is \(t_{ijk}^{R + \xi } = H\), and the remaining distance to node \(j\) is \(d_{ijk}^{R + \xi } = d_{ijk}^{R + \xi - 1} - F_{ijk}^{R + \xi }\). The energy consumption of EV \(k\) during this time period is \(e_{ijk}^{R + \xi }\). Let \(\xi = \xi + 1\) and proceed to Step 2. If \(F_{ijk}^{R + \xi } \ge d_{ijk}^{R + \xi - 1}\), it means that EV \(k\) can travel to node \(j\) during the \((R + \xi ){\text{th}}\) time period, then the travel time of EV \(k\) during this time period is \(t_{ijk}^{R + \xi } = d_{ijk}^{R + \xi - 1} /v_{ijk}^{R + \xi }\), and the energy consumption of EV \(k\) during this time period is \(e_{ijk}^{R + \xi }\). Proceed to Procedure 3.

Procedure 3: Computation of the total power consumption and travel time for EV \(k\) traversing road segment \((i,j)\). \(E_{ijk} = \sum\nolimits_{x = R}^{R + \xi } {e_{ijk}^{x} }\), \(T_{ijk} = \sum\nolimits_{x = R}^{R + \xi } {t_{ijk}^{x} }\). The calculation process is complete.

Problem and mathematical model

In this section, the MDHOTDEVRP is formally defined, accompanied by a presentation of the mathematical formulation that captures the key objectives and constraints of the problem. Factors such as time-dependent vehicle speed, real-time load, MHJDM, charging strategies, fixed EV dispatch costs, vehicle travel costs, customer service costs, and vehicle charging costs are considered. The aim is to minimize the aggregate of these costs by efficiently allocating EVs from multiple depots and devising optimal vehicle routes.

Problem description

The proposed MDHOTDEVRP can be described as follows:

An urban logistics company operates multiple depots, symbolized by set \(M\), which dispatches a fleet of homogeneous EVs denoted as \(K = \{ 1,2,...,k\}\) to deliver equivalent goods to customer set \(C\) in the area. The known information for this problem includes the coordinates of depots \(M\), the capacity \(W\) and battery capacity \(Q\) of EV \(k\), and the coordinates, demand \(D_{i}\), and service time \(s_{i}\) of each customer \(i\).

The EV embarks on its journey from the depot carrying a load of \(W\) kilograms, accompanied by a fully charged battery. During the distribution process, the instantaneous load of EV \(k\) upon arrival at any point \(i\) is denoted by \(\varphi_{ik}\). If the EV’s battery charge depletes to an insufficient level hindering the continuation of its task, it is obligated to recharge at a designated charging station. The set of charging stations is denoted by \(F\). Once charging is complete, the EV shall proceed with the delivery of the remaining parcels. Upon finishing all distribution tasks, the EV possesses the freedom to conclude its operations at any adjacent depot, absolving the need to return to its initial departure depot.

Figure 1 depicts an exemplification of MDHOTDEVRP, which is established on a complete directed graph \(G = (V,A)\). Here, \(V\) comprises \(M \cup C \cup F\), signifying the set of all points in the network, and \(A\) comprises all directed arcs. When each depot dispatches an EV, a fixed dispatch cost \(c_{1}\) is incurred, and the EV accrues a unit travel cost \(c_{2}\) per minute during its journey. The instance of EV \(k\) arriving and departing at point \(i\) is denoted, respectively, by \(t_{ik}^{1}\) and \(t_{ik}^{2}\). Meanwhile, \(S_{ik}^{1}\) represents the remaining battery level of EV \(k\) upon arrival at point \(i\), and \(S_{ik}^{2}\) signifies the remaining battery level when it departs from \(i\). As the EV serves a customer, it incurs a unitary service cost of \(c_{3}\) per minute, and when it visits a charging station for recharging, a unitary charging cost of \(c_{4}\) per minute arises. The charging amount for EV \(k\) at charging station \(i\) is designated as \(q_{ik}\), and \(\sigma_{ik}\) symbolizes the corresponding charging time for EV \(k\) at charging station \(i\). Since the number of recharging times at charging stations is not restricted in this study, the set \(C^{k}\) is defined as the customers that EV \(k\) must still serve after recharging.

Fig. 1
figure 1

Schematic of the MDHOTDEVRP

The ensuing assumptions are posited to streamline the MIP model in this investigation: (1) Each EV is dispatched only once, and the delivery volume of each customer falls below the EV’s capacity, with each customer being served exclusively once. (2) Due to the time-varying dynamic nature of the urban transportation network, EVs travel at varying velocities across different temporal intervals. (3) The factors influencing the power consumption of EVs encompass the vehicle’s intrinsic weight, actual payload, travel velocity, and windward area. (4) Once within the confines of the charging station, EVs are exempt from queuing and can be directly charged, adopting a partial charging strategy. Each charging station maintains a uniform and constant charging rate. The charging efficiency of the EV is denoted by \(\eta\), while the power of the charging interface is represented by \(p_{e}\). (5) The urban distribution costs encompass fixed dispatch costs, travel costs, EV charging costs, and customer service costs. The crux of the decision problem is to devise a set of optimal EV distribution–charging routes that fulfill all customer requisites while minimizing the total distribution costs incurred by the logistics company.

MDHOTDEVRP model

To build MDHOTDEVRP model, the following binary decision variables are introduced:

\(x_{ijk}\) is equal to 1 if EV \(k\) travels from node \(i\) to \(j\), 0 otherwise.

\(y_{ik}\) is equal to 1 if EV \(k\) serves customer \(i\), 0 otherwise.

\(z_{ik}\) is equal to 1 if EV \(k\) charges at charging station \(i\), 0 otherwise.

Based on the above variables and problem description, the MIP model is constructed as follows:

$$ {\text{min }}c_{1} \sum\limits_{i \in M} {\sum\limits_{j \in C} {\sum\limits_{k \in K} {x_{ijk} } } } + c_{2} \sum\limits_{i \in V} {\sum\limits_{j \in V} {\sum\limits_{k \in K} {T_{ijk} x_{ijk} } } } + c_{3} \sum\limits_{i \in C} {\sum\limits_{k \in K} {s_{i} y_{ik} } } + c_{4} \sum\limits_{i \in F} {\sum\limits_{k \in K} {\sigma_{ik} z_{ik} } } , $$
(2)

subject to

$$ \sum\limits_{i \in M} {\sum\limits_{j \in C} {x_{ijk} } \le 1,\forall k \in K,{\kern 1pt} {\kern 1pt} } i \ne j, $$
(3)
$$ \sum\limits_{i \in M} {\sum\limits_{j \in M} {x_{ijk} = 0,\forall k \in K,i \ne j} } , $$
(4)
$$ \sum\limits_{k \in K} {y_{ik} = 1,\forall i \in C} , $$
(5)
$$ \sum\limits_{i \in V} {x_{ijk} = \sum\limits_{l \in V} {x_{jlk} } ,\forall j \in C \cup F,\forall k \in K} ,i \ne j,j \ne l, $$
(6)
$$ \sum\limits_{i \in M} {\sum\limits_{j \in C} {x_{ijk} = \sum\limits_{l \in C \cup F} {\sum\limits_{i \in M} {x_{lik} } } } } ,\forall k \in K, $$
(7)
$$ \sum\limits_{i \in C} {D_{i} y_{ik} } \le W,\forall k \in K, $$
(8)
$$ u_{ijk} = (\varphi_{ik} - D_{i} )x_{ijk} ,\forall i \in C,\forall j \in V,\forall k \in K,i \ne j, $$
(9)
$$ S_{ik}^{2} = Q,\forall i \in M,\forall k \in K, $$
(10)
$$ S_{ik}^{1} = S_{ik}^{2} ,\forall i \in C,\forall k \in K, $$
(11)
$$ S_{jk}^{1} \le \left( {S_{ik}^{2} - E_{ijk} } \right)x_{ijk} + Q(1 - x_{ijk} ),\forall i,j \in V,\forall k \in K, $$
(12)
$$ S_{ik}^{2} \ge \left\{ \begin{gathered} E_{ijk} + E_{jlk} ,{\text{ if }}i \in C \cup M,j \in C,l \in F \hfill \\ E_{ijk} {\text{ , if }}i \in C,j \in F \cup M \hfill \\ \end{gathered} \right.,\forall k \in K,i \ne j, $$
(13)
$$ S_{ik}^{1} \ge 0,\forall i \in V,\forall k \in K, $$
(14)
$$ q_{ik} \le Q - S_{ik}^{1} ,\forall i \in F,\forall k \in K, $$
(15)
$$ q_{ik} = \min \left(Q - S_{ik}^{1} ,{\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} E_{ijk} x_{ijk} + \sum\limits_{{j \in C^{k} }} {\sum\limits_{{l \in C^{k} \cup M}} {E_{jlk} } } x_{jlk} \right),\forall i \in F,\forall k \in K, $$
(16)
$$ \sigma_{ik} = 60 \cdot \frac{{q_{ik} }}{{\eta \cdot p_{e} }}, $$
(17)
$$ t_{ik}^{2} = t_{ik}^{1} + s_{i} y_{ik} ,\forall i \in C,\forall k \in K, $$
(18)
$$ t_{ik}^{2} = t_{ik}^{1} + \sigma_{ik} z_{ik} ,\forall i \in F,\forall k \in K, $$
(19)
$$ t_{jk}^{1} \le \left( {t_{ik}^{2} + T_{ijk} } \right)x_{ijk} + (1 - x_{ijk} )M,\forall i,j \in V,\forall k \in K,i \ne j, $$
(20)
$$ x_{ijk} ,y_{ik} ,z_{ik} \in \left\{ {0,1} \right\}. $$
(21)

The objective function (2) minimizes the total distribution cost of the logistics fleet. Constraint (3) stipulates that each EV can only be dispatched once. Constraint (4) prohibits EVs from traveling directly between depots. Constraint (5) specifies that a single customer can only be visited once. Constraint (6) maintains flow balance between customer locations and charging stations. Constraint (7) reflects the half-open nature of the model. Constraint (8) limits the total demand of customers served by an EV to its rated carrying capacity. Constraint (9) is used to calculate the real-time load of EV \(k\) when it travels on arc \((i,j)\). Constraint (10) stipulates that the battery of any EV departing from the depot is fully charged. Constraint (11) specifies that an EV does not consume energy when serving customers. Constraint (12) indicates the change in battery level of EV \(k\) when it travels from node \(i\) to node \(j\). Constraint (13) is the remaining energy requirement for the EV to choose the next node to visit. If the next visited node \(j\) is a customer, the current remaining battery level of the EV must be able to reach customer \(j\) from the current node \(i\) and then travel to the nearest charging station \(l\). If the next visited node \(j\) is a charging station or depot, the current remaining battery level of the EV must be sufficient to reach node \(j\) from the current node \(i\). Constraint (14) guarantees that the remaining battery level of an EV at any node is not negative. Constraints (15)–(17) specify the charging amount and charging time of an EV at a charging station, respectively. Constraint (18) specifies that the departure time of EV \(k\) from customer node \(i\) equals the arrival time at node \(i\) plus the service time. Constraint (19) specifies that the departure time of EV \(k\) from charging station \(i\) equals the arrival time at station \(i\) plus the charging time. Constraint (20) indicates that the arrival time of EV \(k\) at node \(j\) equals the departure time from node \(i\) plus the travel time on arc \((i,j)\). Finally, constraint (21) restricts the values of decision variables.

Algorithm design

Large-scale VRP is a complex NP-hard problem, often making it difficult to find an optimal solution. Previous studies have shown that intelligent heuristic algorithms are more practical for obtaining satisfactory solutions for large-scale VRPs. ACA is an effective swarm intelligent algorithm with advantages such as positive feedback, parallel distributed computing, self-organization, and strong robustness. It has been successfully applied to solve complex combinatorial optimization problems, including the Job-Shop Scheduling Problem, VRP, and Graph Coloring Problem [62]. Thus, based on the characteristics of the MDHOTDEVRP model, this paper proposes a TSHACA for its solution.

The processes for each stage are as follows: (1) First stage: customer clustering. An improved K-means clustering algorithm is developed to group customers into clusters based on their spatial proximity, delivery volumes, and EV capacity. This step aims to optimize the allocation of customers to different EVs from multiple depots. (2) Second stage: distribution route planning and optimal charging decision. Once the customers are assigned to clusters, the second stage of TSHACA focuses on optimizing the distribution within each cluster. An IACA is utilized to address the specific routing challenges within each cluster. The IACA considers the time-dependent aspects of the problem, ensuring that the vehicle routes are dynamically adjusted based on varying energy consumption and other temporal factors. The algorithm aims to find near-optimal solutions while considering the half-open nature of the routes.

Improvement strategies

Based on the above analysis, the specific improvement ideas for the algorithm are as follows: (i) Traditional K-means clustering algorithms typically initialize centroids randomly, which may result in suboptimal solutions. The proposed TSHACA incorporates intelligent initialization techniques that facilitate the selection of better initial centroids, increasing the chances of finding a global optimum. (ii) Designing a probabilistic rule that combines deterministic and stochastic selections to overcome the issue of slow convergence of the ACA. At the same time, creating adaptive pheromone heuristic and expectation heuristic parameters within the probabilistic rule to expand the algorithm’s search space and ensure global search in the early iteration and fast convergence in the later iteration. (iii) Developing an improved pheromone updating mechanism to balance the global and local search capabilities of the algorithm, addressing the problem of the ACA being easily trapped in local optima.

Algorithm procedures

The implementation process of the TSHACA is shown in Fig. 2, and the specific procedures are as follows.

Fig. 2
figure 2

Flow chart of TSHACA

First stage: customer clustering

In the first stage of TSHACA, an improved K-means clustering algorithm is designed that considers both distance and EV payload factors to divide the customer set into multiple clusters. The specific implementation process includes the following steps: Step 1: Determine the number of clusters, \(r\), based on the ratio of the total demand of all customers to EV capacity. Step 2: Randomly select the coordinates of \(r\) customers as the initial cluster centers. Step 3: Set \({\text{Cap}}\) to represent the capacity of each cluster, where \(Cap\) equals the EV capacity. Then, add all unassigned customers to a set called \({\text{unallocate}}\). Step 4: Select customer \(i\) with the largest demand in the \({\text{unallocate}}\), calculate the distance between customer \(i\) and the centers of all clusters, and then determine whether the remaining capacity of the cluster \(j\) is greater than 0 after assigning customer \(i\) to the cluster \(j\) with the shortest distance. If so, add customer \(i\) to cluster \(j\), update the \({\text{Cap}}\) of cluster \(j\) and \({\text{unallocate}}\). Otherwise, assign customer \(i\) to the second-closest cluster \(l\). Repeat the above steps until customer \(i\) has been assigned. Step 5: Repeat Step 4 until all customers have been allocated to their corresponding clusters. When set \({\text{unallocate}}\) is empty, recalculate the centroids of \(r\) clusters and update the coordinates of each cluster center. Step 6: Determine whether the difference between the new and original cluster center coordinates exceeds the threshold value. If so, go to Step 2; otherwise, save the customer clustering results, re-encode the customers within each cluster, and end the algorithm.

Second stage: EV distribution route planning and optimal charging decision

This paper designs an IACA to plan the initial EV distribution route in each cluster and use a greedy strategy to allocate depots. The following are the detailed procedures:

Procedure 1: Variable initialization. Let \(N\) represent the number of ants, \({\text{maxIter}}\) represent the maximum number of iterations, \({\text{Iter}}\) represent the current iteration, \({\text{OptimalCost}}\) represent the lowest total distribution cost, and \({\text{OptimalRoute}}\) represent the optimal distribution route. Set \(N = 30\), \({\text{maxIter}} = 200\), \(Iter = 1\), \({\text{OptimalCost = + }}\infty\).

Procedure 2: Initial route construction. The following are the specific steps to plan the initial EV distribution route. Step 1: Randomly assign \(N\) ants to customer nodes and set \(n = 1\). Step 2: Dispatch ant \(n\) and let \({\text{unvisit}}_{n}\) denote the set of customer nodes that ant \(n\) has not yet visited. At this point, ant \(n\)’s tabu table \({\text{tabu}}_{n}\) only includes node \(i\) where ant \(n\) is currently located. Step 3: Calculate the transition probability for ant \(n\) to select any next node from the current node \(i\). Adopt a probabilistic rule that combines deterministic and stochastic selections to address the issue of slow convergence of the ACA, as shown in formulas (22)–(23). Step 4: Use the rule in Step 3 to select node \(j\) and update the sets of \({\text{unvisit}}_{n}\) and \({\text{tabu}}_{n}\). Step 5: If \({\text{unvisit}}_{n} \ne \emptyset\), go to Step 4; otherwise, save the initial EV distribution route planning results \({\text{InitialRoute}}_{n}\) for ant \(n\) in each cluster, proceed to Procedure 3.

$$ j = \left\{ {\begin{array}{*{20}c} {\arg {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} \max \{ [\tau_{is} ]^{{\mu_{1} }} [\vartheta_{is} ]^{{\mu_{2} }} \} ,} & {{\text{if }}{\kern 1pt} {\kern 1pt} {\text{rand}} \le {\text{rand}}_{0} } \\ {P_{ij}^{n} ,{\kern 1pt} {\kern 1pt} } & {{\text{if }}{\kern 1pt} {\kern 1pt} {\kern 1pt} {\text{rand}} > {\text{rand}}_{0} ,} \\ \end{array} } \right. $$
(22)
$$ P_{ij}^{n} = \left\{ {\begin{array}{*{20}c} {\frac{{[\tau_{ij} ]^{{\mu_{1} }} [\vartheta_{ij} ]^{{\mu_{2} }} }}{{\sum\limits_{{s \in unvisit_{n} }} {([\tau_{is} ]^{{\mu_{1} }} [\vartheta_{is} ]^{{\mu_{2} }} )} }},} & {j \in {\text{unvisit}}_{n} } \\ {0,} & {j \notin {\text{unvisit}}_{n} ,} \\ \end{array} } \right. $$
(23)

where \(\tau_{ij}\) is the pheromone heuristic parameter, and \(\vartheta_{ij}\) is the expectation heuristic parameter, \(\vartheta_{ij} = 1/d_{ij}\). \(\mu_{1}\) and \(\mu_{2}\) are the weights for pheromone and expectation heuristic factors, respectively. In this study, the work of Du et al. [63] is referenced, and adaptive heuristic factors \(\mu_{1}\) and \(\mu_{2}\) are designed. \({\text{rand}}\) is a random number such that \(0 < {\text{rand}} < 1\). \({\text{rand}}_{0}\) signifies a predefined control variable, which is set \({\text{rand}}_{0} = 0.3\) in this study. \(P_{ij}^{n}\) is the transition probability for ant \(n\) to travel from node \(i\) to node \(j\).

Procedure 3: Depot allocation and charging station insertion. The specific steps for depot allocation and charging station insertion into the distribution routes generated by ant \(n\) within each cluster are as follows: Step 1: Initialization. Input \({\text{InitialRoute}}_{n}\) and let \({\text{FinalRoute}}_{n}\) represent the distribution route after ant \(n\) adds depots and charging stations. Step 2: Depot allocation. Adopting a greedy strategy, choose depot \(M_{i}\) closest to the first customer on \({\text{InitialRoute}}_{n}\) as the departure depot for the EV, and select depot \(M_{j}\) closest to the last customer on \({\text{InitialRoute}}_{n}\) as the return depot for the EV. Thus, \({\text{FinalRoute}}_{n} = [M_{i} ,{\text{InitialRoute}}_{n} ,M_{j} ]\). Step 3: Charging station insertion. Check if the EV meets the battery limit condition (Constraint 13) from the current node \(i\) to the next node \(j\) during the distribution process. If it meets, the EV travels to node \(j\). Otherwise, the EV must select the charging station \(j\) closest to node \(i\) and insert it into \({\text{FinalRoute}}_{n}\). Step 4: Repeat Step 3 until all initial distribution routes generated by ant \(n\) are inserted with depots and charging stations. Step 5: Let \(n = n + 1\). If \(n \le N\), go to Step 2 of Procedure 2; otherwise, proceed to Procedure 4.

Procedure 4: Calculation of the total distribution cost for each ant in the current iteration. Calculate each ant’s total travel cost, fixed dispatch cost, customer service cost and charging cost based on \({\text{FinalRoute}}_{n}\). Then, obtain the set of total distribution cost \({\text{TotalCost}}_{{{\text{iter}}}}\) for all ant. Determine the lowest distribution cost \({\text{OptimalCost}}_{{{\text{iter}}}}\) and the optimal route \({\text{OptimalCost}}_{{{\text{iter}}}}\) in the current iteration. If \({\text{OptimalCost}}_{{{\text{iter}}}} < {\text{OptimalCost}}\), then update \({\text{OptimalCost}} = {\text{OptimalCost}}_{{{\text{iter}}}}\) and \({\text{OptimalRoute}} = {\text{OptimalRoute}}_{{{\text{iter}}}}\); otherwise, \({\text{OptimalCost}}_{{{\text{iter}}}} = {\text{OptimalCost}}\) and \({Optimal} {Route}_{iter} { = }OptimalRoute\).Proceed to Procedure 5.

Procedure 5: Pheromone update. Adopt an improved pheromone update strategy in this paper to balance the global and local search capabilities of ACA, addressing the problem of the ACA being easily trapped in local optima, as shown in formulas (24)–(27).

$$ \tau_{ij}^{new} { = }\tau_{ij}^{old} (1 - rho) + \sum\limits_{n = 1}^{N} {\Delta \tau_{ij}^{n} } + \varepsilon \cdot \Delta \tau_{ij}^{\psi } , $$
(24)
$$ \Delta \tau_{ij}^{n} { = }\left\{ {\begin{array}{*{20}c} {f/{\text{Cost}}_{n} ,} & {{\text{if ant }}n{\kern 1pt} {\kern 1pt} {\text{traverses arc }}{\kern 1pt} (i,j)} \\ {0,{\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} } & {\text{otherwise,}} \\ \end{array} } \right. $$
(25)
$$ \Delta \tau_{ij}^{\psi } { = }\left\{ {\begin{array}{*{20}c} {f/Cost_{\psi } ,} & {{\text{if elite ant }}\psi {\text{ traverses arc }}{\kern 1pt} (i,j)} \\ {0,{\kern 1pt} } & {\text{otherwise,}} \\ \end{array} } \right. $$
(26)
$$ \tau_{{{\text{min}}}} \le \tau_{ij}^{{{\text{new}}}} \le \tau_{{{\text{max}}}} , $$
(27)

where \(rho\) is the pheromone evaporation rate with \(0 \le rho < 1\). Set \(rho = 0.2\). \(\Delta \tau_{ij}^{n}\) denotes the pheromone increment on arc \((i,j)\) for ant \(n\). The elite ant \(\psi\) is defined as the ant with the optimal objective value in the current iteration, so \(\varepsilon\) and \(\Delta \tau_{ij}^{\psi }\) denotes the pheromone weight and the pheromone increment on arc \((i,j)\) for elite ant \(\psi\), respectively. \(f\) is a constant that represents the amount of pheromone secreted by an ant in each travel. Set \(f = 10\). \({\text{Cost}}_{n}\) is the total distribution cost of ant \(n\), and \({\text{Cost}}_{\psi }\) is the total distribution cost of the elite ant \(\psi\). \(\tau_{min}\) represents the minimum value of pheromone allowed for each arc \((i,j)\) after the update, while \(\tau_{{{\text{max}}}}\) represents the maximum value allowed. Set \(\tau_{{{\text{min}}}} = 0.05\) and \(\tau_{{{\text{max}}}} = 2\).

Procedure 6: Termination criteria for TSHACA. Let \({\text{Iter}} = {\text{Iter}} + 1\). If \({\text{Iter}} \le {\text{maxIter}}\), go to Procedure 2. Otherwise, terminate the TSHACA and output the final optimized result.

Complexity analysis

The computational complexity of the original algorithm for discovering a single ant solution (i.e., without employing the node clustering principle) is described in Eq. (28), exhibiting a quadratic relationship with the number of vertices, \(n\). This quadratic dependency arises due to the calculation of transition probabilities for all unvisited nodes during the vertex insertion phase. The variable \(m\) signifies the selection of a depot prior to the vertex transition.

$$ O(n \cdot (m + n)) = O(n^{2} + n \cdot m). $$
(28)

The incorporation of the node clustering principle substantially reduces the computational complexity of TSHACA, as demonstrated in Eq. (29). The process of selecting a node for insertion into the solution now unfolds in two distinct phases: (a) the identification of a cluster (comprising \(n_{{{\text{prim}}}}\) primary clusters for consideration), and (b) the selection of a vertex from within the chosen cluster (which contains \(n_{size}\) vertices).

$$ O(n \cdot (m + n_{{{\text{prim}}}} + n_{{{\text{size}}}} )). $$
(29)

The enhancement in optimization speed becomes evident due to the significant reduction in parameters \(n_{{{\text{prim}}}}\) and \(n_{{{\text{size}}}}\) compared to the total number of vertices (\(n_{{{\text{prim}}}} \ll n\), \(n_{{{\text{size}}}} \ll n\)). Additionally, the node clustering principle retains the essential characteristic of the original algorithm, whereby nodes are consistently chosen from the extensive set of available nodes (\(n_{{{\text{prim}}}} \cdot n_{{{\text{size}}}}\)) through the application of pheromone attraction principles, rather than being confined to a limited set of nearest vertices.

Experiments and analysis

This section provides a detailed account of the test works performed on the proposed model and algorithm. It encompasses data preparation, experimental evaluations of the difficulties inherent in MDHOTDEVRP, and a thorough analysis of the computational experiences with the TSHACA.

Data description

At present, there is no standard test set available for MDHOTDEVRP, and the delivery customers of logistics companies exhibit various types of geographic distributions. Consequently, this study refines Solomon’s VRP test sets [64], encompassing clustered distribution test sets (C-type), random distribution test sets (R-type), and randomly clustered distribution test sets (RC-type), utilizing these improved test sets as the experimental dataset. Notably, numerous scholars have generated new test instances based on Solomon’s test sets. For example, Schneider et al. [65] employed the Solomon test sets as a benchmark and incorporated 21 charging stations into each test instance to create the EVRP experimental dataset they necessitated.

Building upon the test instances created by Schneider et al., this study converts a portion of the charging station nodes into depots to construct new test sets for MDHOTDEVRP. Each test instance comprises 100 customers, 11 depots, and 10 charging stations. The data in the test instances include the coordinates of depots, charging stations, and customers, as well as customer demand quantities and service durations. To comply with the algorithm testing requirements of this study, depots commence deliveries at 7 a.m., with congestion periods occurring from 7:00 to 9:00 and 17:00 to 19:00. During these congested periods, EVs travel at a speed of \(v_{f} = 30\) km/h, while non-congested periods allow for a speed of \(v_{c} = 60\) km/h. The parameters of the numerical experiment in this paper are set as follows: \(\phi^{d}\) = 1.184692, \(\varphi^{d}\) = 1.112434, \(g\) = 9.8 m/s2, \(\theta_{ij}\) = 0°, \(C_{r}\) = 0.012, \(L\) = 3000 kg, \(R\) = 0.7, \(A\) = 3.8 m2, \(\rho\) = 1.2041 kg/m3, \(W\) = 650 kg, \(Q\) = 40 kWh, \(\eta\) = 90%, \(p_{e}\) = 60 kW, \(c_{1}\) = 0.5 yuan/min, \(c_{2}\) = 120 yuan/vehicle, \(c_{3}\) = 0.3 yuan/min, \(c_{4}\) = 0.6 yuan/min.

All the proposed procedures of the TSHACA were coded in Matlab R2020b and executed on a microcomputer equipped with a 2.40 GHz CPU and 16 GB of RAM.

Experimental evaluation of the challenges in MDHOTDEVRP

This section offers a comprehensive overview of the experimental evaluation conducted to tackle the various difficulties encountered in MDHOTDEVRP. The experiments are meticulously designed to scrutinize the algorithm’s versatility across test sets with varying geographical distributions, appraise its proficiency in seamlessly integrating charging stations into delivery routes, scrutinize the environmental advantages of MDHOTDEVRP compared to conventional fuel vehicles, showcase the supremacy of MHJDM, and evaluate the algorithm’s efficacy in diverse traffic congestion scenarios.

EV route planning for different test instances

This subsection uses a variety of experimental instances with different customer distributions to test the feasibility of the model and algorithm in the study. Table 1 shows the test results. This testing helps determine whether the TSHACA can effectively handle different spatial configurations, ensuring its viability and practicality in real-world applications across various regions and settings.

Table 1 Test results for different test instances

The test results presented in Table 1 reveal that: (1) The fixed dispatch costs, travel costs, and customer service costs of EVs account for an average of 33.20%, 34.61%, and 27.67% of the total distribution costs, respectively, totaling 95.48%. This finding suggests that vehicle fixed dispatching costs, travel costs, and customer service costs remain the primary factors affecting distribution costs in logistics distribution. In practice, transport fleets should consider using EVs with larger capacities to reduce the number of EVs dispatched. At the same time, to avoid increased travel costs due to traffic congestion, transportation tasks should be carried out considering the effect of time-varying vehicle speeds on travel time. Furthermore, training logistics drivers to reduce customer service time and improve service efficiency is recommended. These efforts can ultimately reduce the total distribution cost of the transportation fleet and enhance its overall competitiveness. (2) EV charging cost during distribution accounts for only 4.52% of the total distribution cost, and most EVs on distribution routes require only one charge to complete the transportation task. Thus, using EVs for urban distribution has a negligible effect on distribution efficiency and cost. Compared to traditional FVs, EVs have advantages such as zero emissions, low noise, and low charging costs. Using EVs for urban distribution can help logistics enterprises decrease distribution costs and increase economic benefits, while also considering the impact of logistics distribution on the environment, conserving energy, reducing emissions, and promoting the green and harmonious development of urban logistics distribution and environmental protection. (3) The TSHACA’s running time ranged from a minimum of 20.27 s to a maximum of 20.97 s, with an average of 20.64 s. This result indicates that the TSHACA proposed in this paper can provide high-quality EV distribution-charging route planning solutions that meet decision objectives in an extremely short period, demonstrating both high efficiency and feasibility.

Figure 3 illustrates the EV distribution-charging route planning solutions for the C102, C202, R102, and RC202 test instances. The solutions for each test instance involving 100 customers are shown clearly and distinctly in the figure, with few instances of route detours and intersections. Based on test cases reflecting a realistic delivery scale, proposed algorithm demonstrates its potential to consider various practical factors and offer valuable guidance for the transportation route optimization of logistics fleets.

Fig. 3
figure 3

EV distribution-charging route planning solutions for different test instances

Comparative tests of MDHOTDEVRP and MDHOTDVRP

A comparative experiment between urban distribution by EVs and FVs is conducted using different test sets, while keeping the rest of the parameters unchanged. Although FVs do not require recharging during distribution, they generate fuel consumption and carbon emissions. Following Liu et al. [26] formula for calculating fuel consumption and carbon emissions of FVs in their VRP study and taking related experimental parameters into account, the fuel consumption cost and carbon emission cost are integrated into the distribution costs of the logistics fleet. Table 2 presents the results of the comparative experiments between MDHOTDEVRP and MDHOTDVRP.

Table 2 Test results of EV urban distribution and FV urban distribution

The test results presented in Table 2 reveal that: (1) Using EVs instead of FVs for urban distribution can result in significant cost savings for logistics fleets. Specifically, substituting EVs for FVs leads to an average reduction of 31.50% in distribution costs, with the logistics fleet’s energy consumption cost dropping from an average of 35.32–4.62%. This finding highlights the advantages of using EVs for urban distribution, including saved energy and reduced operating costs. To improve competitiveness, logistics enterprises ought to adopt EV fleets for distribution, which aligns with society’s call for sustainable development within the logistics industry. Government departments should promote EV distribution by strengthening the construction and management of EV charging facilities and enhancing the convenience and safety of EV fleet use. (2) Using EVs for urban distribution results in an average increase of only 4.78% in total distance traveled compared to using FVs. Figure 4 depicts the transportation route planning solutions of test set RC203 under different vehicles, showing little difference between the transportation solutions when using EVs instead of FVs. This finding can be attributed to the well-developed charging infrastructure in urban areas, which makes it easy for EVs to locate nearby charging stations. Additionally, using FVs for urban distribution results in an average carbon emission cost of 14.20 yuan, while EVs produce no carbon emissions, improving urban air quality and promoting sustainable logistics transportation. However, it is important to note that the carbon emission cost of FV distribution accounts for only 0.89% of the total distribution cost, which is less than 1% of the proportion, indicating that logistics fleets do not prioritize reducing emissions when using FVs for urban distribution. This result suggests that China’s current carbon price is too low to encourage logistics enterprises to reduce emissions actively. Therefore, Chinese policy maker should develop more reasonable carbon trading-related policies to promote sustainable logistics transportation.

Fig. 4
figure 4

Urban distribution route planning of EVs and FVs

Comparative tests of the half-open joint distribution mode and the closed independent distribution mode

A comparative experiment is conducted to compare the distribution-charging route planning of EVs in Multi-depot Half-open Joint Distribution Mode (MHJDM) and Multi-depot Closed Independent Distribution Mode (MCIDM) using multi-type test sets, while keeping the rest of the parameters unchanged. Table 3 presents the experimental results. The purpose of this comparative test is to evaluate and demonstrate the advantages of the MHJDM. By comparing the performance of these two distribution modes, the effectiveness of the MHJDM in optimizing distribution routes and resource allocation in the context of MDHOTDEVRP can be assessed.

Table 3 Test results of MHJDM and MCIDM

The test results presented in Table 3 reveal that: (1) EVs in the MHJDM save an average of 5.14% and 5.83% in total distribution cost and time, respectively, compared to the MCIDM. This is because EVs based on the MHJDM do not need to return to the original departure depot after completing the distribution task. Instead, they can return to the nearest depot, decreasing EV empty travel time and thereby reducing the travel cost of logistics transportation. Therefore, logistics companies should consider resource sharing between various depots when building depots. (2) The EV travel distance in the MHJDM is significantly shorter than that in the MCIDM, with an average reduction of 8.88%. Figure 5 shows transportation route planning schemes of test instance R104 in the MHJDM and MCIDM, respectively. The figure clearly shows that the distribution route of EVs in the MHJDM rarely appears to be circuitous and intersecting, while the transportation route of EVs in the MCIDM has many intersecting routes. Therefore, the distribution-charging route planning of EVs has greater optimization space after adopting the MHJDM, which can effectively reduce the travel distance of EVs and should be promoted in practical logistics distribution.

Fig. 5
figure 5

The distribution route planning diagram of EVs in MHJDM and MCIDM

Sensitivity analysis of traffic conditions in the MDHOTDEVRP

While keeping other experimental parameters constant, five distinct combinations of traffic conditions (I, II, III, IV, and V) are designed. These conditions are outlined in detail in Table 4, where the values provided represent the average speeds of EVs under the respective traffic scenarios (in km/h). Employing the RC105 test set for experimentation, the test results are presented in Table 5. This analysis provides valuable insights into the algorithm’s effectiveness and reliability in real-world traffic environments, aiding decision-making in logistics planning and resource allocation.

Table 4 Average speeds of EVs in different traffic conditions
Table 5 Test results of the MDHOTDEVRP in different traffic scenarios

The test results presented in Table 5 reveal that: (1) The enhancement of traffic conditions yields a gradual reduction in the travel time of EVs during transit. Transitioning from traffic scenario I to scenario V, the en route travel time of EVs diminishes by 45.18%. This finding emphasizes the affirmative significance of ameliorated urban traffic on transport efficiency. (2) While the amelioration of traffic conditions boosts the transportation efficiency of EVs, it also leads to a notable escalation in energy consumption. Shifting from traffic scenario I to scenario V, the energy consumption of EVs rises by 195.64%. Heightened energy consumption necessitates more frequent charging requirements. Consequently, EVs fail to achieve the lowest total distribution cost in traffic transport scenario V, but instead achieve it in transportation scenario III. This is attributed to the fact that the transition from transportation scenario III to scenario V results in a 208.54% increase in charging costs, whereas the reduction in travel costs amounts to only 17.93%. The rate of increase in charging costs surpasses the decrease in travel costs. Thus, it becomes apparent that when planning the transportation route for the urban distribution fleet, fleet managers must establish a reasonable travel speed range to strike the optimal balance between efficiency and total cost. (3) In comparison to traffic scenario III, which boasts the lowest total distribution cost, the average disparity between the total distribution cost of other traffic scenarios and scenario III is 5.23%. This minor gap in distribution costs showcases the adaptability and route optimization capabilities of the TSHACA based on real-time traffic conditions and time-dependent constraints. When traffic conditions deteriorate, the proposed TSHACA prioritizes the delivery of customers in closest proximity to minimize travel time. Conversely, when traffic conditions improve, the TSHACA adeptly schedules the insertion of charging stations, effectively striking a balance between charging costs and congestion impacts.

Computational experiences

This section provides a comprehensive analysis of the computational experiences of the proposed TSHACA in addressing the MDHOTDEVRP. The primary focus lies on the computational burden of TSHACA, encompassing factors such as computational time, memory usage, and algorithmic robustness. Additionally, a comparative experiment is conducted, contrasting TSHACA against state-of-the-art methodologies.

Computational time analysis

This subsection conducts the computational time analysis of the algorithm. To gauge the computational efficiency of the TSHACA, the study measures the time required to solve instances of the MDHOTDEVRP using TSHACA, the original ACA, and the Elite Ant System (EAS) [66]. Table 6 reports the test results. Through a meticulous comparison of these three distinct ACAs, the aim is to convincingly demonstrate that TSHACA outperforms its counterparts in terms of computational time.

Table 6 Test results of the MDHOTDEVRP using different ACAs

The test results presented in Table 6 demonstrate significant advantages of TSHACA over ACA and EAS in terms of computational efficiency for solving MDHOTDEVRP. TSHACA reduces the computational time by an average of 90.14% and 89.47% compared to ACA and EAS, respectively. Moreover, the quality of solutions obtained by TSHACA surpasses those achieved by ACA and EAS. TSHACA exhibits a 4.23% reduction in distribution costs compared to ACA and a 2.70% reduction compared to EAS. The superior computational solving time of TSHACA can be attributed to several key factors. First, the TSHACA incorporates intelligent clustering techniques, enabling it to simplify large-scale problems and reduce the time required for convergence. In contrast, the absence of intelligent clustering in ACA and EAS can lead to a more extensive search space and slower convergence. Second, TSHACA’s adaptive heuristic parameters and the improved probabilistic rule augment its ability to explore the solution space efficiently, while ACA and EAS may rely on fixed parameters or less adaptive strategies, limiting their exploration and exploitation capabilities. Additionally, the TSHACA benefits from an enhanced pheromone updating mechanism, which helps balance global and local search capabilities, preventing it from getting trapped in local optima. Conversely, the ACA and EAS may use simpler or less effective pheromone updating rules, increasing the likelihood of getting stuck in local optima. These advancements make TSHACA computationally efficient, achieving faster solving than ACA and EAS.

Memory usage

This subsection offers an analysis of the algorithmic memory requirements to evaluate the performance of the TSHACA. The memory usage of the TSHACA, original ACA, and EAS is monitored and compared during their execution, with the results presented in Table 7. The objective of this analysis is to provide valuable insights into the scalability and resource demands of the proposed algorithm. By examining the memory usage situations, a deeper understanding of how TSHACA utilizes system resources and its ability to handle various problem instances is gained.

Table 7 Comparison of average memory and CPU usage for three ACAs

The test results presented in Table 7 demonstrate that TSHACA exhibits the lowest average CPU and memory usage compared to the original ACA and EAS across all test instances. TSHACA achieves an average CPU usage reduction of 18.09% and an average memory usage reduction of 4.57% compared to ACA, while compared to EAS, it achieves an average CPU usage reduction of 15.22% and an average memory usage reduction of 3.05%. This outcome can be attributed to TSHACA’s two-stage approach, which enables more efficient memory usage in contrast to ACA and EAS. The clustering step reduces the size of the problem by dividing it into smaller subproblems, decreasing the memory requirements for storing and processing the solution information. Additionally, the localized search behavior of the IACA limits the amount of pheromone information that needs to be stored, further diminishing the memory footprint. As a result, TSHACA offers improved computational efficiency and memory management compared to the original ACA and EAS.

Figure 6 depicts the temporal variation of memory usage for the three algorithms—the TSHACA, original ACA, and EAS—during the execution of the same test set, R208. The results reveal that TSHACA exhibits a minor range of oscillations in memory usage, hovering around 51% within the initial 20 s of its operation. Subsequently, it maintains a stable memory usage level, indicating the completion of all computation tasks. Conversely, both ACA and EAS have been experiencing fluctuations in memory usage at around 52% and 53%, surpassing the usage rate of TSHACA. Notably, EAS demonstrates better overall memory usage compared to ACA. These observations stem from divergent algorithmic designs and behaviors. TSHACA employs a two-stage approach, in which the second stage incorporates the IACA and conducts localized searches within each cluster. This localized search behavior facilitates focused exploration and exploitation of the search space, expediting convergence and leading to stable memory usage in later stages. The stability in memory usage indicates that TSHACA maintains a consistent amount of information and does not require significant additional memory as the algorithm progresses. In contrast, ACA and EAS typically entail frequent global pheromone updates, necessitating storage and updates of larger pheromone volumes. Consequently, over a span of 60 s, the memory usage of ACA and EAS fluctuates persistently, whereas TSHACA’s localized search behavior and clustering scheme promote efficient utilization of pheromone information, resulting in fewer memory fluctuations. Overall, TSHACA’s relatively stable and low memory usage, compared to the original ACA and EAS, contributes to better memory management and more stable memory usage patterns throughout the algorithm’s execution.

Fig. 6
figure 6

Memory usage comparison of three ACAs over time

Robustness analysis

While the proposed TSHACA is tailored for the MDHOTDEVRP under consideration, its design and underlying principles can be extended to more general situations. To further substantiate the claims regarding the robustness of the TSHACA, it is subjected to a series of examinations on diverse problem instances investigated by other scholars. Specifically, the chosen experimental setup is based on the notable work of de Oliveira et al. [67], wherein the optimal results achieved by executing TSHACA are compared against their proposed CoES algorithm. TSHACA is run 30 times under each instance to obtain optimal results. These experiments are designed to evaluate the TSHACA’s adaptability under different conditions and problem characteristics. Test results are presented in Table 8.

Table 8 Comparative results for the robustness of TSHACA

The test results presented in Table 8 unveil the excellent robustness of the TSHACA in tackling the challenges posed by MDVRPs with varying problem features. Regarding algorithm stability, the disparity between the optimal results obtained by TSHACA and the established best results achieved by CoES typically falls within a mere 1%. Meanwhile, in terms of algorithmic efficiency, TSHACA outshines CoES in all examined benchmarks, boasting an average time-saving of 35.54%. These findings demonstrate that TSHACA’s robustness enables it to capture the underlying problem structure and exploit common patterns, making it capable of delivering satisfactory results across various instances.

Algorithm comparative test

In this subsection, the algorithm comparative test is conducted to further validate the superior performance of the proposed TSHACA. To achieve this, TSHACA is compared with the widely acclaimed and state-of-the-art methodology, the Hybrid Particle Swarm Optimization (HPSO), introduced by Islam et al. [68]. The choice of HPSO as the comparison algorithm stems from its widespread popularity and effectiveness in solving diverse optimization problems, as demonstrated in extensive research and applications. By juxtaposing TSHACA with HPSO, a comprehensive evaluation of their performance and effectiveness can be obtained, shedding light on their respective strengths and weaknesses. Importantly, HPSO and TSHACA operate on different underlying principles and mechanisms. HPSO relies on particle movement and velocity update rules, while TSHACA leverages ant colony optimization techniques. This inherent contrast enables a meaningful comparison, facilitating the identification of unique advantages and limitations exhibited by different swarm intelligent algorithms. The test results are presented in Table 9, providing valuable insights into the relative performance and capabilities of TSHACA and HPSO in addressing the optimization challenges at hand.

Table 9 The results of algorithm comparative test

The test results presented in Table 9 reveal that: (1) TSHACA has a significantly shorter running time than HPSO across all benchmarks, with an average time-saving of 88.98%. The superior solving speed of TSHACA can be ascribed to its underlying principles and mechanisms. TSHACA incorporates intelligent clustering techniques, adaptive parameters, and an improved pheromone updating mechanism, which collectively enhance its computational efficiency and convergence speed. By simplifying large-scale problems through clustering, TSHACA reduces the search space and accelerates convergence. This result confirms the effectiveness of the proposed TSHACA in the distribution-charging route planning for MDHOTDEVRP. (2) Overall, the transport solutions generated by TSHACA outperform HPSO in terms of total distribution cost and distance, with average savings of 0.07% and 0.69%, respectively. However, it is noteworthy that TSHACA’s performance is comparatively weaker than HPSO under R-type test sets. The inferior solution quality of TSHACA in scenarios with randomly distributed customers may arise from the divergent solving strategies employed by the two algorithms. HPSO combines PSO and Variable Neighborhood Search (VNS), which allows it to leverage the exploration capabilities of PSO and the local search intensification of VNS. This hybridization provides HPSO with the potential to effectively explore and exploit the search space, resulting in better solutions for these instances. In contrast, the intelligent clustering approach employed in the first phase of TSHACA restricts the search space. In scenarios where customers are widely dispersed, the clustering approach may not yield optimal results. The scattered nature of customers poses challenges in forming meaningful clusters, leading to suboptimal solutions.

Nonetheless, the strengths of TSHACA lie in its ability to efficiently explore and exploit the solution space due to adaptive parameters and improved pheromone updating. On the other hand, HPSO may exhibit weaknesses stemming from its sensitivity to parameter settings. The choice of parameters, such as the inertia weight and acceleration coefficients, can significantly affect its convergence behavior and solution quality. In conclusion, while TSHACA demonstrates superior solving speed, its lower solution quality in certain instances may be attributed to the trade-off between exploration and exploitation. HPSO’s hybridization and potential for intensification through VNS contribute to its ability to find higher-quality solutions, but at the cost of slower convergence. These contrasting influences and trade-offs highlight the importance of carefully selecting the appropriate algorithm based on the specific problem characteristics and optimization objectives.

Conclusions

The paper delves into the MDHOTDEVRP. To this end, a novel approach is devised to accurately estimate the energy consumption of EVs traversing a time-varying urban road network. Subsequently, a MIP model is formulated by the unique characteristics of the problem. Building upon this model, a TSHACA is developed to tackle the problem. Comprehensive numerical experiments are conducted to address the various difficulties encountered in MDHOTDEVRP and validate the performance of the TSHACA. The study contributes to the existing body of knowledge in the field of EVRP by providing valuable theoretical advancements, which can be summarized as follows:

  1. 1.

    Problem formulation: developing an accurate MIP model that considers the dynamic nature of time-dependent vehicle routing, the complexities of MHJDM, and the constraints imposed by different charging strategies. This formulation offers a theoretical foundation for addressing the specific challenges inherent in MDHOTDEVRP.

  2. 2.

    Algorithm design: proposing optimization techniques—the TSHACA—specifically tailored to solve the MDHOTDEVRP. The algorithm efficiently allocates EVs from different depots, optimizes vehicle routes considering time-dependent factors, and minimizes logistics distribution costs while saving energy consumption.

  3. 3.

    Performance evaluation: conducting extensive numerical experiments to evaluate the performance of the proposed algorithm. This includes analyzing the superiority of the solutions obtained, comparing the algorithm with existing approaches, and assessing the economic and environmental benefits achieved through the application of the MDHOTDEVRP solution.

  4. 4.

    Practical implications: providing insights and recommendations for decision-makers in the logistics industry, transportation planners, and policy-makers to facilitate the adoption of EVs in urban logistics. This includes identifying the potential economic and environmental advantages of implementing the MDHOTDEVRP, such as reduced operating costs, lower carbon emissions, improved resource allocation, and sustainable urban development.

In conclusion, the research aims to advance the understanding and knowledge of electric vehicle routing optimization in urban logistics, propose practical solutions to tackle the challenges posed by the MDHOTDEVRP, and contribute to the development of sustainable and efficient transportation systems.