1. Introduction
The transportation industry is currently the second-largest source of global carbon emissions [
1]. Most regions are falling behind in achieving the target of net-zero carbon emissions by 2050 [
2]. Electric vehicles (EVs) remain the most cost-effective and commercially viable route to fully decarbonized transportation [
3].
Figure 1 shows the EV sales in selected countries and regions from 2017 to 2023. Due to the high frequency and large-scale usage of public transportation, it has become a priority to reduce urban carbon emissions [
4]. The Chinese government gives priority to promoting the electrification of vehicles in the field of public transportation, including urban buses, taxis, ride-hailing, and logistics fleets. In this context, electric taxis have gradually become an important part of the urban transportation system [
5]. Cities such as Taiyuan, Shenzhen, and Hangzhou have successfully implemented the large-scale adoption of electric taxis [
6].
Efficiency and revenue are key priorities for taxi drivers. Unlike conventional charging, the battery swapping model enables replenishment in just 3–5 min, making it more suitable for high-frequency operations [
7]. Effective battery swapping station (BSS) allocation is therefore essential to support uninterrupted taxi operations. However, its efficiency is constrained by limited battery availability and dynamic driver demand. In practice, drivers often rely on personal judgment when selecting a BSS, which can lead to congestion and long wait times [
8]. Meanwhile, operators managing multiple stations must ensure balanced utilization across all stations to maximize overall efficiency. Thus, it is critical to design a guidance system for BSSs.
Despite the failure of projects such as Battery Place and Tesla in the early development of the battery swap mode, they have been actively promoted in recent years with the continuous expansion of China’s new energy market. By January 2024, China had deployed 3624 swapping stations. Current research on the operation of battery swapping stations primarily focuses on station location optimization [
9], battery inventory planning [
10], and battery charging schedules [
11,
12,
13]. However, relatively little attention has been given to battery swapping guidance. Existing studies on swapping guidance focus on two main areas: route optimization and multi-factor guidance strategies. In route optimization, early work concentrated on homogeneous fleet optimization [
14]. Later studies expanded to heterogeneous fleets, considering factors such as battery life, energy consumption, and degradation costs [
15]. Some researchers also explored the impact of drivers’ choices between fast charging and battery swapping on route planning [
16,
17,
18]. But these studies often assume BSSs have unlimited service capacity, overlooking practical constraints such as limited facility capacity and demand-driven queue fluctuations [
19].
In multi-factor guidance strategies, research prioritizes factors like the distance between vehicles and stations, congestion levels, and battery availability [
20,
21]. Sun et al. [
22] optimized service probabilities and waiting times using a hybrid queuing network model. However, these methods are often based on offline analysis and fail to capture real-time demand. To tackle this, online recommendation algorithms have been introduced to capture real-time information on vehicle destinations and station queue lengths, thereby optimizing route and station selection [
23]. Ni et al. [
24] did not directly assign BSSs to customers but instead provided a list of prices for customers to choose from. But the temporal coupling between vehicles and stations creates challenges in dynamic environments and increases computational complexity. So, some studies introduced game theory models to align vehicle distribution with dynamic pricing signals [
25]. To improve vehicle–station matching efficiency, Li et al. [
26] proposed an online allocation method based on bipartite graph matching. While these methods offer insights for vehicle arrival scheduling, they impose a large computational burden on short time scales. Wang and Hou [
8] addressed this issue by proposing a multi-time-scale optimization strategy, allocating overall demand every 15 min and updating recommendations every 10 s to better adapt to dynamic demand.
Current research on vehicle battery swapping station (BSS) recommendations faces several limitations. First, existing studies on BSS selection have primarily focused on logistics distribution scenarios where the main objective is to minimize travel distance. In contrast, research on more general electric taxi swapping scenarios and the analysis of multiple influencing factors remains limited. Second, many studies overlook the constraints of BSS service capacity, with some assuming that batteries are always available. Finally, existing research lacks sufficient consideration of randomness factors. The operational randomness of taxis and the stochastic nature of traffic conditions make it difficult to predict the sequence of vehicle arrivals at swapping stations. This often results in arrival conflicts, where actual driver waiting times exceed initial estimates.
Given these theoretical and practical considerations, this paper proposes an optimization framework for electric vehicle battery swapping guidance within an online decision-making context. The main contributions are as follows:
- (1)
This paper proposes two optimization methods, real-time optimization and delayed optimization, to provide different guidance strategies for battery swapping station operators. Each method recommends an optimal BSS based on driver preferences and station conditions and plans the best route through path optimization.
- (2)
To address dynamic vehicle demand, the proposed framework integrates the A* algorithm and K-nearest neighbor search into both strategies to improve solution speed.
- (3)
From a practical perspective, the framework enables personalized station and route recommendations based on driver requests. This alleviates BSS congestion while enhancing system efficiency and user satisfaction.
The remainder of this paper is organized as follows:
Section 2 presents the model formulation.
Section 3 introduces two optimization approaches and solution methods for the problem. In
Section 4, case studies are presented for performance analysis. Finally,
Section 5 summarizes the key insights from this study and offers suggestions for future research.
2. Problem Description and Formulations
2.1. Problem Definition
The core problem addressed in this paper is how to guide vehicles under dynamic demand while considering the resource limitations of swapping stations. Initially, vehicle swapping requests are unknown. The dispatching center receives a request for information for vehicles at different locations and time periods. Once a dynamic request appears, details such as request time, vehicle location, and remaining battery level become available. For the initial set of known requests, swapping station allocation can be performed in the planning phase. However, as vehicles travel, new emerging dynamic requests may necessitate adjustments to the original decisions. This randomness in time and location affects station status, rendering initial decisions suboptimal and requiring real-time adjustments.
As shown in
Figure 2, this problem is defined on a directed graph
, where
represents the set of nodes, including demand points
and swapping stations
, and
represents the set of arcs between nodes. Suppose the day is divided into
time periods. At time
,
makes a swapping request at
, and
makes a swapping request at
. In the initial stage, the swapping route for
might be
. At time
,
and
are located at nodes
and
, respectively. When
makes a swap request,
is still traveling between nodes 1 and 3, and
swap route becomes
. At this point, a situation arises where the
actual wait time upon arrival is longer than initially estimated, resulting in a conflict in reaching the destination.
Arrival conflicts primarily arise due to the system’s inability to accurately predict future battery swap requests. The limited capacity of swapping stations creates a coupling effect between vehicles and stations. As dynamic demand increases, unresolved arrival conflicts accumulate, further increasing queue lengths and reducing station service efficiency. In light of this, this paper examines the guidance problem for battery swapping stations under dynamic vehicle demand, with the goal of enhancing the immediate service capacity of swapping stations.
2.2. The Vehicle Guidance Model for BSS
This chapter introduces a realistic road network model. According to the China Urban Road Engineering Design Code (CJJ 37-2012), roads are classified into four categories: expressways, arterial roads, secondary roads, and branch roads. Considering actual traffic capacity, this study selects expressways, arterial roads, and secondary roads to construct the road network model. The sets used in the model are defined in
Table 1.
The objective function minimizes the total battery swapping cost for vehicles, including travel time to the BSS, waiting cost at the BSS, and the battery swapping fee. Constraint (2) ensures that each vehicle selects only one swapping station. Constraint (3) ensures the consistency of the movement between nodes and swapping station selection. Constraint (4) represents the vehicle’s battery level upon arrival at a node, describing the battery consumption under different times and road types. Constraint (5) represents the per-unit distance battery consumption between nodes and at time . Constrain (6) ensures that nodes and belong to only one type of road. Constraint (7) indicates that upon arrival at a swapping station, the battery level of vehicle must be greater than 10% of the battery’s capacity. Constraint (8) calculates the arrival time of vehicle at node . Constraint (9) denotes the time required for each battery at the swapping station to reach full charge. This value continuously changes as vehicles arrive and depart from the station. Constraint (10) defines the waiting time for vehicle at swapping station . Whether a vehicle can begin swapping depends on two conditions. First, whether there is an available queue position for the vehicle, and second, whether there is a sufficiently charged battery. The availability of swapping service is determined by the departure time of the preceding vehicle. The availability time of a battery depends on its charging duration, and each vehicle upon arrival will obtain a set of fully charged battery times . Thus, the vehicle’s waiting time is the difference between the earliest available service time and its arrival time at the swapping station. Constraint (11) indicates that each vehicle can only select one battery to swap at the station. Constraint (12) represents the swapping cost for vehicle at the swapping station. Since the charging process generally spans multiple time periods, the battery will be recharged over several intervals until it reaches the vehicle’s requirements, as shown in Constraint (13). Constraint (14) represents battery consumption during vehicle travel.
3. Solution Method
Drivers have different expectations for the response time of battery swapping services. Some prefer immediate recommendations, while others can accept short delays for better results. Peak-hour demand often leads to station congestion and uneven resource use. To address this, we propose two guidance strategies: real-time optimization and delayed optimization. The real-time strategy provides instant recommendations and periodic updates. The delayed strategy collects requests over fixed intervals and processes them in batches, which is more effective during high-demand periods.
3.1. Real-Time Optimization for Vehicle Guidance
This section introduces a real-time optimization framework to guide vehicles to battery swapping stations under dynamic demand conditions, as shown in
Figure 3. The framework integrates real-time allocation and rolling optimization to adapt to continuously changing station statuses and vehicle requests.
In the initial phase, vehicle requests are addressed immediately upon generation using a greedy algorithm. This approach minimizes the total battery swapping costs, encompassing travel time, waiting time, and swapping fees. After assigning a swapping station, the shortest path from the vehicle’s current location to the selected station is determined based on real-time traffic conditions.
To account for changes in station states and newly generated requests, rolling optimization is performed at fixed intervals. During each interval , the system combines pending requests from the previous period with newly generated requests. All requests are then reassigned to their optimal stations, and travel paths are recalculated based on the latest system information.
Figure 4 provides an example of real-time optimization. At time
, vehicle
sends a battery swap request. Based on the road segment speeds
at time
and the current status of swapping stations,
is initially assigned to station
with the shortest path
. At time
, the position of
is updated to node
. Considering the updated station status and road conditions, a new swapping station assignment is made. Simultaneously, vehicle
generates a new swap request at node
. Taking into account the updated road speeds, the request from
, and the latest station status, the final path for
is adjusted to
.
Additionally, when reallocating a swapping station and recalculating a vehicle’s route after
, it is crucial to determine the vehicle’s starting node. As shown in
Figure 5a, if the vehicle reaches node 2 exactly at time
, node 2 is set as the starting node. However, if the vehicle is still on the road segment and has traveled a distance
, as show in
Figure 5b, the end node of that segment, node 4, is set as the starting node for the updated route.
3.2. Delayed Optimization for Vehicle Guidance
To meet different user preferences in vehicle guidance, this study proposes a delayed optimization strategy. Unlike real-time optimization, which processes each vehicle request immediately, delayed optimization aggregates requests within a short decision window (e.g., 5 min) to achieve a more efficient and globally optimized solution. For example, in the online retail industry, more orders may be received during the delay period, which provides more information for the e-commerce provider to make better decisions [
27,
28]. The delayed optimization strategy addresses dynamic vehicle demand by dividing the continuous optimization problem into sequential static decision cycles. This framework consists of two key stages: global optimization for vehicle allocation and dynamic demand insertion.
3.2.1. Genetic Algorithm Optimization
Figure 6 presents the framework of the delayed optimization strategy. At the start of each decision interval, all battery swapping requests within the interval are processed together. These requests are globally optimized using the genetic algorithm. The goal is to minimize the vehicle travel distance, battery swapping costs, and waiting time while considering station capacity constraints. Each solution is encoded as a chromosome, where vehicle assignments to battery swapping stations (BSSs) are represented as integers corresponding to station nodes in the network. After optimization, the assignment results of vehicles to swapping stations are obtained, forming an expected arrival queue. As shown in
Figure 6, during the
time period, 11 vehicle requests are optimized. Based on the expected arrival time of the vehicles, arrival queues are formed at two swapping stations, and battery swapping is conducted on a first-come, first-served basis.
3.2.2. Dynamic Demand Insertion Using KD-Tree
In subsequent decision intervals, as new vehicle requests are dynamically generated, they need to be inserted into the previously optimized solution. As shown in
Figure 6, during the time interval
, vehicles
have arrived at the BSS, while vehicles
have been scheduled but have not yet arrived. These arrived and expected-to-arrive vehicles form queues at each BSS. Newly generated vehicle demands
are dynamically inserted into these queues based on the distance of the vehicles from the BSS.
To address this challenge, this study proposes a KD-tree nearest-neighbor search method, adopting a “station-to-vehicle” approach instead of the traditional “vehicle-to-station” strategy. The traditional approach, where vehicles select the nearest BSS, has two significant limitations. First, from the perspective of accessibility and distance cost, drivers do not need to perform a global search across all BSSs, as this results in significant, unnecessary computational overhead. Second, this method does not fully consider the positions of other vehicles, potentially leading to station selection conflicts. Therefore, the “station-to-vehicle” approach is employed, where each BSS proactively identifies and allocates the nearest vehicle to itself. The key steps are as follows:
Step 1: Constructing the KD-Tree. Vehicle demand points are split into dimensions (e.g., latitude and longitude). The median value of the data is selected as the root node, with lower and higher values assigned to the left and right subtrees, respectively. This recursive process forms a balanced KD-tree structure.
Step 2: Nearest-Neighbor Search. Starting from the root node, the search traverses the tree to identify the nearest vehicle demand point to the BSS. The Haversine formula or other distance metrics are applied to calculate the spherical distance between the BSS and vehicle points.
Step 3: Updating the KD-Tree. Once a vehicle is assigned to a BSS, it is removed from the KD-tree. This prevents duplication and ensures subsequent searches reflect only unallocated vehicles.
Step 4: Generating a New Solution. The updated vehicle assignments are integrated into the optimization framework. The newly inserted demands form an optimized queue for each BSS, which is further refined through the global optimization process using the genetic algorithm.
5. Conclusions and Future Work
Addressing the operational practices of battery swapping stations and incorporating the uncertainty in electric taxi movements, this paper constructs a comprehensive optimization framework for vehicle-to-station assignment under dynamic demand. The framework effectively mitigates station congestion caused by resource limitations and conflicting vehicle demands. The main conclusions are as follows:
- (1)
This study introduces two optimization methods: real-time optimization and delayed optimization. Real-time optimization uses a greedy algorithm to rapidly generate decisions based on real-time vehicle locations and BSS statuses. This strategy is suitable for drivers who prioritize immediate battery swapping. In contrast, delayed optimization emphasizes cooperative effects, combining genetic algorithms and KD-tree-based rapid insertion techniques to achieve global optimization within fixed time windows. This method is more suited to scenarios requiring coordinated scheduling.
- (2)
Case study analysis demonstrates that considering travel distance, waiting time, and swapping cost can significantly enhance swapping service efficiency. Further analysis reveals differences in station selection between the two methods, reflecting the impact of real-time information and shared data on decision-making.
- (3)
From a management standpoint, a centralized dispatch system is essential for efficient station scheduling. Additionally, developing a user-friendly driver application can effectively improve user experience, thereby facilitating resource allocation and service quality improvements.
This study has several limitations. First, it assumes that replaced batteries are immediately recharged after swapping. However, this setting ignores electricity pricing, an important factor for station operators when managing charging costs. Second, the model assumes that drivers fully comply with the recommended assignments. In future work, electricity pricing and driver behavior can be incorporated to support more flexible decision-making. Additionally, this study does not address emergency demands, such as those from ambulances and emergency vehicles. The suddenness of emergency demands may disrupt regular queuing processes. Future research can focus on resource allocation and priority management under emergency conditions.