Shared bicycle battery changing cabinet locating and sizing method and system based on bilevel planning

By optimizing the location and capacity configuration of shared bicycle battery swapping stations through a two-layer planning method, combined with dispatch vehicle route optimization, the problems of resource waste and battery shortage caused by improper battery swapping station layout were solved, achieving more efficient operation and maintenance and cost optimization.

CN121660744APending Publication Date: 2026-03-13HEFEI UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-04
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing technologies lack systematic planning in the site selection and capacity configuration of shared bicycle battery swapping stations, resulting in resource waste or insufficient battery supply in some areas, reducing operation and maintenance efficiency and user experience.

Method used

A two-level programming approach is adopted, which optimizes the location and capacity configuration of battery swapping cabinets through an upper-level genetic algorithm and optimizes the dispatch vehicle path by combining a lower-level variable neighborhood search and Monte Carlo sampling, thereby achieving coordinated optimization of battery swapping cabinet layout and dispatch vehicle path.

Benefits of technology

It improves the rationality of battery swapping station location and operation and maintenance efficiency, reduces facility investment costs, enhances the stability and robustness of the solution under different demand fluctuations, and improves the economy and feasibility of electric bicycle operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121660744A_ABST
    Figure CN121660744A_ABST
Patent Text Reader

Abstract

The invention discloses an electric bicycle battery changing cabinet locating and sizing method and system based on bilevel programming. The method comprises the following steps: firstly, acquiring required parameters, constructing each individual of an initial population in an upper-layer optimization model based on the required parameters, and coding candidate site selection schemes and capacity configuration of the power conversion cabinet; then, the initial population is transmitted to a lower-layer solving module, the lower-layer solving module generates a plurality of feasible scheduling paths of a scheduling vehicle in a random scene through the randomization requirement of an electric bicycle station, Monte Carlo sampling and a variable neighborhood search algorithm, and the comprehensive index of the individual is calculated according to the feasible scheduling paths. And then, feeding back the comprehensive index to an upper layer optimization model for correcting the initial population, and obtaining a convergent optimal solution through an iterative evolution process of the upper layer model. Through the double-layer interaction mechanism, collaborative optimization of battery changing cabinet site selection, capacity configuration and scheduling vehicle path planning is realized, and the operation efficiency and robustness of the whole system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of site selection and planning technology, and more specifically, to a method and system for site selection and capacity determination of shared bicycle battery swapping cabinets based on two-layer planning. Background Technology

[0002] In recent years, with the popularization of shared mobility and green transportation concepts, e-bikes have been widely used for short-distance urban travel and "last-mile" connections. Compared with traditional bicycles, e-bikes significantly improve travel efficiency and meet residents' diverse and immediate travel needs. However, they suffer from limited battery capacity and high usage frequency during operation. If they cannot be recharged in time, it will directly affect vehicle availability and user experience. To ensure service continuity, shared bicycle companies usually have maintenance personnel drive dispatch vehicles to replace e-bike batteries to improve maintenance efficiency. Compared with traditional charging methods, this method is faster, but it places higher demands on the battery supply system. In recent years, battery swapping cabinets have been introduced into shared mobility scenarios as infrastructure for battery storage and charging, and have gained attention due to their small footprint, high safety, and fast recharging. However, rapid market expansion has led to a lack of systematic planning in the site selection and capacity configuration of battery swapping cabinets, resulting in resource waste in some areas and insufficient battery supply in others, thereby reducing maintenance efficiency and user experience.

[0003] Battery swapping stations, as infrastructure within the e-bike operation and maintenance system, serve as centralized charging and storage points for batteries, acting as resupply nodes for dispatched vehicles during battery swapping operations. The layout and capacity of these stations directly impact overall operation and maintenance efficiency and costs. A well-chosen location can effectively shorten resupply distances for dispatched vehicles, balance regional battery supply and demand, and thus improve resource utilization. Conversely, an improperly chosen location may lead to low utilization rates or battery shortages in some areas, resulting in resource waste and increased operating costs. Due to limited urban space, significant rental differences, and uneven demand distribution, the location of battery swapping stations involves not only space optimization but also comprehensive consideration of capacity configuration and cost constraints, making it highly complex and challenging to decide.

[0004] In the operation and maintenance of e-bikes, dispatch vehicles carry batteries from the warehouse to various e-bike stations to replace batteries. When the batteries on the dispatch vehicle are insufficient, it needs to go to the battery swapping station for replenishment before continuing operation. For the dispatch vehicle, reasonable route planning should meet the battery swapping needs of the e-bike stations while minimizing the dispatch vehicle's travel distance and replenishment frequency to reduce energy consumption and time costs. However, the battery demand of e-bikes is significantly random, influenced by factors such as time, weather, and regional usage intensity, increasing the complexity of route planning. Without a scientific battery swapping station layout and dispatching strategy, battery shortages or resource waste in some areas can easily occur, reducing operation and maintenance efficiency. Existing research mostly focuses on site selection or route planning under deterministic conditions, with less consideration given to the collaborative decision-making of battery swapping station site selection (i.e., battery swapping station location), capacity configuration (i.e., battery swapping station capacity), and dispatch vehicle route optimization. Therefore, constructing a two-layer planning model that takes into account both facility construction costs and operational efficiency, and introducing an optimization mechanism under stochastic demand in the lower layer, is of great significance for improving the operation and maintenance level and system robustness of electric bicycle companies. Summary of the Invention

[0005] This application provides a method and system for site selection and capacity determination of shared bicycle battery swapping cabinets based on two-layer planning.

[0006] Firstly, this application provides a method for site selection and capacity determination of shared bicycle battery swapping cabinets based on two-layer programming. The method includes: obtaining required parameters; obtaining an initial population at the upper layer based on the required parameters and an upper-layer algorithm, wherein the initial population includes multiple individuals, each individual including the site selection and capacity of the battery swapping cabinet; inputting the initial population at the upper layer into the lower-layer algorithm; obtaining a set of dispatch vehicle paths based on bicycle station demand, a variable neighborhood search algorithm, and Monte Carlo sampling; obtaining a comprehensive result based on the set of dispatch vehicle paths, wherein the set of dispatch vehicle paths represents multiple dispatch vehicle paths planned by the dispatch vehicle based on the individuals and the bicycle stations; and inputting the comprehensive result into the upper-layer algorithm to obtain a corrected initial population; iterating the corrected initial population based on the upper-layer algorithm to obtain a final solution, wherein the final solution includes the final site selection and final capacity of the battery swapping cabinet.

[0007] In some implementations, obtaining the initial population of the upper layer includes: obtaining a candidate location set, the candidate location set including multiple candidate nodes; determining whether each candidate node is to be the initial location of the battery swapping cabinet with a preset probability; for each candidate node that is to be the initial location of the battery swapping cabinet, preset the initial capacity of each candidate node as the initial capacity of the battery swapping cabinet; and obtaining the candidate nodes that satisfy preset constraints as the individuals.

[0008] In some implementations, obtaining the set of dispatch vehicle routes includes: performing Monte Carlo sampling based on the demand for electric bicycle stations to generate multiple demand scenarios; each individual obtaining the set of dispatch vehicle routes in each demand scenario, obtaining an initial solution based on the set of dispatch vehicle routes, and using the initial solution as the current solution and the optimal solution; iteratively optimizing the current solution and updating the optimal solution based on a preset objective function and a neighborhood search optimization algorithm until the maximum number of iterations is reached; obtaining the objective function value of the optimal solution and the battery swapping capacity of the battery swapping cabinet to form the comprehensive result.

[0009] In some implementations, obtaining the initial solution includes: in each demand scenario, determining candidate stations based on the demand for electric bicycle stations, wherein the candidate stations are the electric bicycle stations that need battery swapping; obtaining the maximum number of operations for each candidate station, wherein the maximum number of operations is the smaller value between the number of available batteries of the dispatch vehicle and the number of batteries required by the candidate station; assigning the candidate stations to the dispatch vehicle based on the greedy principle of the maximum number of operations, and updating the station status of the candidate stations until the dispatch vehicle reaches the maximum working time constraint or the candidate stations are empty, and obtaining the dispatch vehicle path set; and when the number of available batteries is zero, the dispatch vehicle replenishes batteries based on the nearest battery swapping station, and continues to form the dispatch vehicle path set, and using the finally formed dispatch vehicle path set as the initial solution.

[0010] In some implementations, the step of iteratively optimizing the current solution and updating the optimal solution based on a preset objective function and a neighborhood search optimization algorithm includes: using a perturbation operator to change part of the path structure in the current solution to obtain a perturbation solution; performing a neighborhood search on the perturbation solution based on a local search operator to obtain a candidate solution optimized by the neighborhood search; if the candidate solution is better than the current solution, updating the current solution with the candidate solution; otherwise, determining whether to update the current solution based on the simulated annealing acceptance criterion; comparing the candidate solution with the optimal solution; if the candidate solution is better than the optimal solution, updating the optimal solution with the candidate solution; otherwise, keeping the optimal solution unchanged; and repeating until the maximum number of iterations is reached, and outputting the optimal solution.

[0011] In some embodiments, the set of dispatch vehicle routes includes multiple dispatch vehicle routes, and the disturbance operator includes: a node random position change operator, which is used to move the electric bicycle station to a feasible insertion position on the same dispatch vehicle route or different dispatch vehicle routes; and / or, a battery swapping cabinet focused exchange operator, which is used to exchange the electric bicycle stations on two dispatch vehicle routes; and / or, a high-demand clustering removal operator, which is used to centrally remove clusters of high-demand or high-fluctuation electric bicycle stations and redistribute them to different dispatch vehicle routes; and / or, a battery swapping cabinet replacement operator, which is used to replace the battery swapping cabinet selected on the dispatch vehicle route.

[0012] In some implementations, the set of dispatch vehicle routes includes multiple dispatch vehicle routes, and the local search operator includes: an optimal battery swapping cabinet insertion operator for inserting a battery swapping cabinet into the dispatch vehicle route; and / or a node regret insertion operator for inserting unvisited electric bicycle stations into the dispatch vehicle route according to the principle of maximizing regret value; and / or an optimal battery swapping cabinet removal operator for removing the battery swapping cabinet; and / or a node optimal change location operator for inserting electric bicycle stations into the same dispatch vehicle route or different dispatch vehicle routes.

[0013] In some implementations, the iterative process of obtaining the final solution includes: obtaining the fitness of each individual in the modified initial population based on a preset fitness function, and selecting the individual with the highest fitness as the current optimal solution; performing selection, crossover, and mutation on the modified initial population based on the fitness to obtain the next generation population; and obtaining the fitness of each individual in the next generation population based on the fitness function, comparing and retaining the individual with the highest fitness as the current optimal solution, repeating the process until the maximum number of iterations is reached, and using the current optimal solution as the final solution.

[0014] In some implementations, performing selection, crossover, and mutation on the modified initial population based on the fitness includes: adjusting the crossover probability and mutation probability based on the fitness value of the individuals, wherein...

[0015] The crossover probability satisfies:

[0016]

[0017]

[0018] The variation generally satisfies:

[0019]

[0020]

[0021] in, For the current population, For individuals fitness value, The crossover probability is... The mutation probability is... For the current population All individuals Maximum fitness value, For the current population The average fitness value of all individuals in the group. The minimum crossover probability is the preset value. This is the preset maximum crossover probability. This represents the current iteration number. This represents the maximum number of iterations for the genetic algorithm. This is the preset minimum mutation probability. This is the preset maximum mutation probability.

[0022] Secondly, this application provides a shared bicycle battery swapping cabinet location and capacity determination system based on two-layer planning, which, when executed by a processor, implements the battery swapping cabinet location and capacity determination method for electric bicycle battery swapping cabinets based on two-layer planning as described in any of the above embodiments.

[0023] This application discloses a method and system for site selection and capacity determination of electric bicycle battery swapping cabinets based on two-layer programming. The upper-layer algorithm iteratively obtains different individuals based on individuals including the location and capacity of the battery swapping cabinet to find the final solution. This approach can balance location and capacity, reduce the investment cost of battery swapping cabinets, and improve the rationality of battery swapping cabinet site selection. The lower-layer algorithm introduces a variable neighborhood search algorithm and Monte Carlo sampling to obtain a set of dispatch vehicle paths and obtain a comprehensive result. The comprehensive result obtained from the lower layer is fed back to the upper-layer algorithm, thereby realizing the coordinated optimization of location, capacity, and dispatch vehicle paths in the upper-layer algorithm. This reflects the collaborative relationship between dispatch vehicles and battery swapping cabinets, making path and capacity decisions more consistent and closer to the actual operation mode, resulting in a more reasonable and efficient selection of battery swapping cabinet site and capacity.

[0024] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0025] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:

[0026] Figure 1 This is a schematic diagram illustrating the algorithm principle of the site selection and capacity determination method for electric bicycle battery swapping cabinets based on two-layer planning in certain embodiments of this application. Detailed Implementation

[0027] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.

[0028] In the description of this application, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," and "circumferential," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are used only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application. Furthermore, features defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "a plurality of" means two or more.

[0029] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection between two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.

[0030] This application provides a site selection and capacity determination method and system for electric bicycle battery swapping cabinets based on two-layer planning. It is understood that the site selection and capacity determination system for electric bicycle battery swapping cabinets based on two-layer planning includes at least the beneficial effects of a site selection and capacity determination method for electric bicycle battery swapping cabinets based on two-layer planning.

[0031] The site selection and capacity determination method for electric bicycle battery swapping cabinets based on a two-layer planning approach proposed in this application is applicable to the following scenarios:

[0032] Within the target area, there are several warehouses, several e-bike stations, several candidate nodes, and a dispatch vehicle. Warehouses are used to store batteries. E-bike stations are used for parking e-bikes; however, some e-bikes at some stations have insufficient battery power and require battery swapping, representing the demand at these stations. Battery swapping cabinets are used to store batteries. Dispatch vehicles depart from the warehouses, carrying batteries to various e-bike stations to swap batteries for those with insufficient power. When the dispatch vehicle runs out of batteries, it can go to a battery swapping cabinet to replenish them before returning to the warehouse. In the e-bike delivery operation scenario, battery swapping cabinet nodes are deployed and used in the form of swapping cabinets. Therefore, the investment cost of a single battery swapping cabinet node mainly consists of two parts: the first part is fixed costs, including the site rental fees for e-bike stations and the construction costs of related equipment; the second part is equipment configuration costs, including the purchase cost of the swapping cabinet itself and the equipment investment resulting from the number of batteries configured for it. In actual enterprise operations, battery swapping cabinets are usually purchased as a complete set of equipment, and the number of sets purchased directly affects the enterprise's overall investment cost. Therefore, in cost calculation and planning, it is necessary to focus on the impact of the number of battery swapping cabinets on the scale of investment in order to optimize economic efficiency.

[0033] The dispatch vehicle has battery storage space and a fixed battery capacity. It needs to travel to designated e-bike stations to replace the batteries of e-bikes that require battery swapping, rendering them ready for use. Multiple dispatch vehicles can operate simultaneously within the operating area, and each e-bike station can only be accessed by a dispatch vehicle once. The maximum working time cycle for each dispatch vehicle is T. This means that after a dispatch vehicle has swapped batteries at multiple e-bike stations, it must return to the warehouse (which may be different from the departure warehouse) within one T cycle. Of course, if a dispatch vehicle's operating time exceeds T during dispatching, it must immediately return to the warehouse.

[0034] Assume the time spent by the dispatch vehicle loading and unloading electric bicycles and changing batteries is negligible. The distances between each warehouse and each electric bicycle station are known; the distances between each electric bicycle station are known; and the speed of the dispatch vehicle is known.

[0035] Please see Figure 1 The ultimate goal of this method for site selection and capacity determination of electric bicycle battery swapping stations is to minimize the fixed costs and equipment configuration costs of all battery swapping station locations, as well as the unmet demand of all electric bicycle station locations based on the total distance of the lower-level path set. Specifically, the objective function of the lower-level algorithm is to minimize the total distance of all dispatched vehicle path sets and the unmet demand of all electric bicycle station locations within those path sets.

[0036] Step 1: Obtain the required parameters, including relevant known data and algorithm parameters, and generate candidate site selection schemes for the battery swapping cabinet based on a randomization strategy. At the same time, initialize the capacity of each site selection scheme. Each candidate site selection scheme corresponds to an individual, thereby constructing the initial solution of the upper-level planning problem, i.e., the initial population.

[0037] Each individual in the initial population includes the location of the battery swapping cabinet and its corresponding initial capacity.

[0038] Step 2: Input the initial population from the upper layer into the lower layer, and optimize the dispatch vehicle path set by combining the variable neighborhood search algorithm with Monte Carlo sampling under the random demand distribution of electric bicycle stations;

[0039] Step 3: Feed the results obtained from the lower-level algorithm back to the upper-level algorithm to obtain the corrected initial population. Then, use the improved genetic algorithm to correct individuals and perform overall iterative optimization to obtain the final solution.

[0040] The final solution includes: the final location of the battery swapping cabinet and the final capacity of the battery swapping cabinet.

[0041] This application provides a site selection and capacity determination method for electric bicycle battery swapping stations based on a two-layer programming approach, belonging to the field of battery swapping station planning technology. This method, starting from practical operational considerations, combines battery swapping station construction decisions with the battery swapping scheduling process, achieving a synergistic improvement in infrastructure layout and scheduling efficiency through a nested two-layer optimization structure. The upper layer addresses the site selection and capacity configuration of battery swapping stations by employing an improved genetic algorithm to search for different construction locations and capacity combinations to reduce facility investment costs and improve layout rationality. The lower layer treats battery swapping scheduling as a path planning problem, introducing a variable neighborhood search algorithm to optimize the driving paths and replenishment strategies of scheduled vehicles, thereby reducing vehicle travel distances and meeting the battery needs of each electric bicycle station as much as possible.

[0042] To address the uncertainty of user demand, this application introduces stochastic demand scenarios into the lower-level path planning and utilizes Monte Carlo sampling to simulate and evaluate various possible scenarios, thereby improving the stability and robustness of the solution under different demand fluctuations. The scheduling costs and demand satisfaction status obtained from the lower level are fed back to the upper level to revise and improve the site selection and capacity allocation scheme, achieving iterative linkage and gradual optimization between the upper and lower levels. This method not only considers the fixed cost and capacity cost of the battery swapping cabinet but also reflects the supply coordination relationship between the dispatched vehicles and the battery swapping cabinet, making path and capacity decisions more consistent and closer to the actual operation mode of electric bicycles. It can provide an effective reference for enterprises to formulate cost-effective and feasible battery swapping cabinet layout and scheduling strategies in complex environments.

[0043] Upper-level algorithm

[0044] The process involves obtaining the necessary parameters, including relevant known data and algorithm parameters. A random algorithm is used to generate candidate site selection schemes (i.e., the initial population) for the initial battery swapping cabinets planned at the upper level. These schemes are then passed to the lower level for path optimization. The comprehensive results from the lower level are fed back to the upper level. An improved genetic algorithm is used to refine the site selection and capacity determination schemes (i.e., individuals). Overall iterative optimization is then performed to obtain the final solution. This process mainly includes the following eight steps:

[0045] Step 1: An initial population is constructed using a random generation strategy, and it is passed as the initial solution to the lower-level model to optimize the set of dispatch vehicle paths;

[0046] Step 2: Based on the comprehensive results returned by the lower-level model, update and adjust the capacity configuration of each candidate battery swapping cabinet;

[0047] Step 3: Construct a fitness function and calculate the fitness value for each individual in the initial population after the lower-level model is corrected, and regard the individual with the highest fitness as the current optimal solution;

[0048] Step 4: Determine if the maximum number of iterations has been reached and output the optimal solution; otherwise, continue into the genetic operation loop.

[0049] Step 5: Sort the current population according to its fitness value, and select some excellent individuals from the current population to enter the next generation;

[0050] Step 6: Perform crossover operation on each pair of parent individuals according to the crossover probability to generate two new offspring individuals;

[0051] Step 7: Perform mutation operation on each parent individual according to the mutation probability to generate new offspring individuals;

[0052] Step 8: Evaluate the fitness of the newly generated offspring individuals, merge the parent and offspring individuals to form a new population, update the optimal solution, and then proceed to step 4.

[0053] The specific steps are as follows:

[0054] 1. Obtain relevant known data and algorithm parameters, and derive the initial population for the upper-level planning through a random algorithm;

[0055] The relevant known data and algorithm parameters include: the addresses of warehouses, electric bicycle stations and candidate battery swapping cabinets, the distances between each warehouse, each electric bicycle station and candidate battery swapping cabinet, the initial number of electric bicycles to be swapped at each electric bicycle station, the initial capacity, fixed investment cost, investment and configuration cost of a set of battery swapping cabinet equipment at each candidate battery swapping cabinet address, and the number, capacity and maximum turnaround time of dispatch vehicles.

[0056] In the initial population, each individual includes the location of the battery swapping cabinet and its initial capacity. To ensure broad coverage of the solution space, the initial solution of the upper-level problem is constructed using a random generation strategy, and the steps are as follows:

[0057] (1) Randomly generate a site selection scheme. In the candidate location set, for each candidate node, it is randomly decided whether to build a battery swapping cabinet with a certain probability p. Each individual corresponds to a candidate node. If the gene on the individual is 1, it means that a battery swapping cabinet will be built at the candidate point. If the gene is 0, it means that a battery swapping cabinet will not be built at the candidate point.

[0058] (2) Capacity initialization: For all selected candidate nodes, a preset initial capacity value is uniformly set;

[0059] (3) Construct an initial population. By executing the deconstruction mechanism multiple times, m candidate nodes that meet the preset constraints are generated as individuals, thus forming the initial population.

[0060] 2. Based on the comprehensive results obtained by the lower-level algorithm under Monte Carlo sampling, the expected battery swapping demand for each battery swapping node is calculated. Since each battery swapping node can deploy several sets of equipment, and each set of equipment can provide a fixed battery capacity, the upper-level layer needs to ensure that the total capacity of the battery swapping stations can cover its expected battery swapping demand during the capacity configuration phase. On this basis, in order to reduce facility construction costs, the upper-level layer further minimizes the capacity configuration by reducing the number of equipment sets, thereby updating and adjusting the capacity of the battery swapping stations.

[0061] 3. Construct a fitness function and calculate the fitness value for each individual in the population, considering the individual with the highest fitness as the current optimal solution. The fitness function measures an individual's adaptability and evolutionary potential to the problem environment and is a core indicator for evaluating the quality of an individual. In this application, the fitness of individuals is determined by the objective function of the upper-level planning. Since the objective of the upper-level optimization is to minimize the fixed construction cost and capacity configuration cost of the electric vehicle station, the smaller the objective function value, the better the site selection and capacity allocation scheme of that individual. This application uses the reciprocal form of the objective function value to construct the fitness function, thereby ensuring that individuals with lower objective values ​​have higher fitness. Finally, the fitness value of each individual in the population is calculated, providing a quantitative basis for genetic operations.

[0062] 4: Determine if the maximum number of iterations has been reached. If yes, output the optimal solution; otherwise, continue into the genetic operation loop.

[0063] 5: Sort the population according to the fitness value, and select some excellent individuals from the current population to enter the next generation; the selection operation is a key mechanism in the genetic algorithm to retain high-quality individuals and eliminate inferior individuals according to the principle of survival of the fittest. In this process, each individual is genetically passed to the next generation with a certain probability according to its fitness level. Among them, individuals with higher fitness have a higher probability of survival and reproduction, while individuals with lower fitness are more likely to be eliminated, thus gradually improving the overall quality of the population.

[0064] This application adopts the tournament selection strategy, and the specific steps of the method are as follows:

[0065] (1) Set the tournament size t, which means randomly selecting t individuals from the population to participate in the competition each time;

[0066] (2) Randomly select t individuals from the population and compare their fitness values; [[ID= =10]]

[0067] (3) Determine the winner: select the best one with probability p and the second-best one with 1 - p to retain diversity;

[0068] (4) Add the winner to the next-generation population;

[0069] (5) This method uses sampling with replacement, and repeats steps 2 - 4 until the predetermined quantity is reached;

[0070] 6: For each pair of parent individuals in the population, judge whether to perform the crossover operation according to the preset crossover probability; if the condition is met, exchange part of the gene information of the parent individuals to generate two new offspring individuals, so as to combine the genetic characteristics of the parents into the next generation to increase population diversity and search potential.

[0071] This application designs several crossover operators according to the characteristics of the solution, including the two-point crossover operator and the uniform crossover operator, and the specific introduction is as follows:

[0072] (1) Two-point crossover operator

[0073] This operator realizes the structural recombination of the location selection of the battery replacement cabinet and the capacity combination of the battery replacement cabinet by selecting two crossover points in the parent individual and exchanging the segments between them. The specific steps are as follows: First, encode each individual as a sequence, the first half is the 0 - 1 vector of the location selection of the battery replacement cabinet, and the second half is the corresponding capacity of the electric bicycle station; the location selection and the capacity correspond one by one. Then, randomly select two different positions in the entire coding sequence as the crossover points p1 and p2 (p1 < p2), and exchange the segments between the two crossover points of the parents P1 and P2: The offspring C1 copies the part outside the interval of the parent P1 and replaces it with the location selection and capacity segments within the interval of the parent P2, and the offspring C2 is vice versa.

[0074] (2) Uniform Crossover Operator

[0075] This operator achieves a higher degree of structural mixing and diversity in the offspring by independently and randomly selecting parental genes for inheritance at each decision position. The specific steps are as follows: First, for each candidate position k, generate a random number r between 0 and 1. If r < p, then swap the site selection values and their corresponding capacity values of the two parents at this position; if r ≥ p, then keep the original configuration of this position in the two parents unchanged. After completing the bit-by-bit swapping of all positions, two new offspring site selection and capacity structures are obtained.

[0076] 7: For each parental individual in the population, determine whether to perform the mutation operation according to the set mutation probability; if the condition is met, randomly change some gene values in the individual to generate a new offspring individual. The mutation operation can introduce new genetic information, increase population diversity, avoid the algorithm falling into local optimality, and thus improve the global search ability. The mutation probability generally takes a small value such as 0.01.

[0077] This application designs several mutation operators according to the characteristics of the solution, including the single-point mutation operator and the random exchange mutation operator. The specific introduction is as follows:

[0078] (1) Single-point Mutation Operator

[0079] This operator perturbs the current solution by adding or deleting a single battery replacement cabinet in the upper-layer solution, thereby exploring new site selection and capacity combinations. The specific steps are as follows: First, randomly select a position i from the set of candidate positions in the current solution; if a battery replacement cabinet has been deployed at this position, perform a deletion operation to remove the battery replacement cabinet from the solution; if no battery replacement cabinet has been deployed at this position, perform an addition operation to place a new battery replacement cabinet at this position and assign it an initial default capacity.

[0080] (2) Random Exchange Mutation Operator

[0081] This operator aims to explore new facility layouts and enhance solution diversity by randomly changing the deployment status of battery replacement cabinets in the upper-layer solution. The specific operation steps are as follows: First, randomly select a deployed battery replacement cabinet electric bicycle station site (status is 1) and an undeployed candidate position electric bicycle station site (status is 0) from the current solution; then, swap the deployment status of these two electric bicycle station sites, that is, the originally deployed electric bicycle station site becomes undeployed, and the originally undeployed candidate position electric bicycle station site becomes deployed. For the newly deployed battery replacement cabinet, its capacity is initialized to a pre-set initial capacity value to ensure that the lower-layer path planning can directly perform battery replenishment at this electric bicycle station site.

[0082] In genetic algorithms, individuals with poor fitness require more crossover and mutation. Individuals with high fitness, to prevent them from being destroyed, should have their crossover and mutation probabilities reduced. Therefore, in the current population... In (i.e., the corrected initial population), according to each individual fitness value Adaptively adjust its crossover probability and mutation probability .

[0083] individual crossover probability Adaptively adjust according to the following method:

[0084]

[0085]

[0086] in, For population The maximum fitness value of all individuals in the group. For population The average fitness value of all individuals in the group. . This represents the current iteration number. This represents the maximum number of iterations for the genetic algorithm.

[0087] individual mutation probability Adaptively adjust according to the following method:

[0088]

[0089]

[0090] in, .

[0091] 8. For newly generated offspring individuals, the lower-level algorithm is invoked to calculate their fitness values. Subsequently, the parent and offspring individuals are merged to form a candidate solution set. To ensure a constant population size and maintain the quality and diversity of solutions, a tournament selection strategy is used to select m individuals from this candidate set to form a new population. Next, the optimal solution update operation is performed on the individuals in the current population to record the globally optimal solution. After completing the above steps, the algorithm proceeds to step three and continues with subsequent iterations.

[0092] Lower-level algorithm

[0093] The initial population from the upper layer is input into the lower layer, and the set of dispatch vehicle paths is optimized by combining a variable neighborhood search algorithm with Monte Carlo sampling under the random demand distribution of electric bicycle stations. Figure 1The individual in the algorithm refers to the individual. The lower-level algorithm mainly includes the following nine steps:

[0094] Step 1: Input the initial population from the upper layer into the lower layer, where each individual represents a site selection scheme;

[0095] Step 2: Initialize the relevant parameters of the lower-level algorithm, and perform Monte Carlo sampling based on the distribution of demand at electric bicycle stations to randomly generate M demand scenarios;

[0096] Step 3: For each demand scenario under each candidate location scheme, a greedy heuristic algorithm is used to determine the vehicle path and obtain the initial solution, which is then used as the current solution and the optimal solution.

[0097] Step 4: Apply a perturbation operator to the current solution to change part of the path structure in order to escape the local optimum, thereby generating a new set of dispatching vehicle paths, i.e., the perturbation solution;

[0098] Step 5: Starting with the perturbation solution, a local search operator is used to optimize its neighborhood search. The neighborhood solutions are evaluated and selected by calculating the objective function value, thereby obtaining an improved set of dispatch vehicle paths, i.e., candidate solutions.

[0099] Step 6: Compare the candidate solution of the nth iteration with the current solution; if the objective function of the candidate solution is better than that of the current solution, then update the current solution to the candidate solution of the nth iteration; otherwise, accept the candidate solution with a certain probability according to the simulated annealing acceptance criterion.

[0100] Step 7: Compare the candidate solution and the optimal solution in the nth iteration; if the objective function of the candidate solution is less than that of the optimal solution, then update the optimal solution to the candidate solution in the nth iteration; otherwise, keep the optimal solution unchanged.

[0101] Step 8: Determine if the maximum number of iterations has been reached. If it has, stop the iteration and output the optimal set of paths and the motorcycle station scheduling status. Otherwise, return to Step 4 and continue the iteration.

[0102] Step 9: Based on the solution results of multiple random demand scenarios, obtain the lower-level objective function value and the expected power exchange capacity of each battery swapping cabinet through statistical analysis methods. Use this as the comprehensive result of the lower-level model for upper-level iterative optimization.

[0103] The objective function is calculated using the following formula: In the formula, Represent the objective function; , Indicates weight; This represents the sum of the total distances traveled by all dispatch vehicles in the set of dispatch vehicle routes; This represents the unmet demand for all electric vehicle stations in the dispatch vehicle route set.

[0104] The process involves randomly sampling the future demand for electric bicycles at a station based on a pre-defined demand distribution to generate the target electric bicycle level for that station. The difference between the target level and the initial inventory of electric bicycles at a station constitutes the scheduling demand for that station. After completing the scheduling operation under given scheduling resource constraints (number of scheduling vehicles and their carrying capacity), if there are still stations with unmet demands, these remaining demands can be defined as the unmet demand for that station.

[0105] The specific details of each step are as follows:

[0106] 1. The initial population of the genetic algorithm is passed to the lower-level model. Each individual in the population encodes a complete site selection capacity configuration scheme, specifying which candidate locations will be built as battery swapping stations and the capacity of each station. Based on this, the lower-level algorithm first initializes relevant control parameters (neighborhood structure of variable neighborhood search, termination conditions, etc.), and then uses Monte Carlo sampling to sample the demand distribution, randomly generating M possible demand scenarios.

[0107] For each site i, the average demand rate is defined by estimating the historical mean. In each simulation, a Poisson distribution is used to generate the random demand for the site. (Where Di is the demand quantity for site i,) (This is the average demand rate), repeated M times to obtain M possible demand scenarios.

[0108] 2: For each demand scenario under each candidate location scheme (individual), a greedy heuristic algorithm is used to determine the vehicle path and obtain the initial solution, which is then used as the current solution and the optimal solution;

[0109] The generation of the initial solution mainly includes the following:

[0110] (1): For the kth dispatch vehicle, calculate the candidate set and the maximum number of operations for all electric bicycle stations in the candidate set based on the information of each electric bicycle station;

[0111] The candidate set is defined as: the demand for electric bicycles at electric bicycle stations is not zero and the number of electric bicycles that need to be swapped is not zero.

[0112] The maximum number of operations at a motorcycle station is calculated as follows: Maximum number of operations = min{number of batteries on the dispatch vehicle, number of motorcycles that need to be replaced at the current motorcycle station}.

[0113] (2): For each dispatched vehicle, starting from the warehouse, the next motorcycle station for the dispatched vehicle is selected sequentially from the candidate set based on the greedy principle of the maximum number of operations, and the status information of the visited motorcycle stations is updated synchronously; when the current dispatched vehicle cannot meet its time constraint or the candidate set is empty, the vehicle is sent back to the warehouse. The above process continues to be executed until all dispatched vehicles have completed their dispatching tasks.

[0114] When the available batteries of a dispatched vehicle are exhausted, the vehicle will prioritize the nearest battery swapping station based on the principle of minimum distance greed to replace the battery, so as to ensure the continuity of subsequent services.

[0115] 3. Based on the current feasible solution, a perturbation operator is introduced to modify some path structures in a controlled manner. This breaks the local structure of the original solution and enhances the ability to explore the solution space, thereby achieving escape from local optima and generating a new set of vehicle scheduling route schemes, denoted as the perturbation solution. This application designs several perturbation operators based on the characteristics of the solution, including a node random position replacement operator, a battery swapping cabinet focused exchange operator, a high-demand clustering removal operator, and a battery swapping cabinet replacement operator, which are described in detail below:

[0116] (1) Node random position change operator

[0117] This operator perturbs the current solution by randomly moving a motorcycle station from its current location to a random feasible location on the same or another route, thereby changing the access sequence and replenishment timing. The specific steps are as follows: First, a non-empty route is randomly selected from the current solution, and a motorcycle station i is randomly selected within that route. Then, a target route is randomly selected (allowing it to be the same as or different from the original route), and an insertion position is randomly chosen within the target route. Motorcycle station i is deleted from its original location and inserted into the target location. After insertion, a feasibility check is performed on the affected original and target routes. If the insertion renders either route infeasible, the move is revoked, and a new motorcycle station and insertion position are randomly selected for another attempt.

[0118] (2) Battery swapping cabinet focusing switching operator

[0119] This operator aims to optimize access patterns related to battery swapping station replenishment. It improves replenishment efficiency by swapping the locations of customers or battery swapping stations closer to each other on two routes. The specific steps are as follows: First, randomly select two non-empty routes from the current solution (allowing them to be the same or different). Identify the key locations for replenishment behavior on each route (nearby customers or e-bike stations accessed before the first replenishment) and randomly select nodes i and j on each route; these nodes represent e-bike stations. Then, directly swap the positions of nodes i and j on their respective routes, while keeping the order of the remaining nodes in both routes unchanged. After the swap, a feasibility check is performed on the affected routes, focusing on verifying vehicle loading constraints, the consistency between the battery swapping station capacity and replenishment logic, and the maximum travel time constraint. If the swap causes resource conflicts, abandon the swap and select new nodes.

[0120] (3) High-demand clustering removal operator

[0121] This operator is used to centrally perturb clusters of e-bike stations with high demand or large demand variance in demand scenarios with random or fluctuating demand, in order to improve load distribution and enhance the robustness of the solution. Specifically, the operation is as follows: First, the expected demand and fluctuation range of each e-bike station are calculated based on Monte Carlo sampling results. High-demand and high-fluctuation e-bike stations are clustered into several clusters based on spatial proximity (two adjacent high-demand e-bike stations constitute one cluster). Then, a cluster is randomly selected, and all e-bike stations within the cluster are removed from the original routes and added to the list to be re-inserted. After removal, the load capacity of the affected routes, the replenishment plan of the battery swapping stations, and the remaining capacity information are updated. Then, in the reconstruction phase, a distributed insertion strategy is prioritized, redistributing customers within the cluster to different routes or adding replenishment nodes before and after the insertion position to alleviate local load concentration and replenishment pressure.

[0122] (4) Replacement operator of the power swapping cabinet

[0123] This operator aims to modify the battery swapping cabinets relied upon by a certain dispatch route or several e-bike stations to reduce detours caused by restocking and alleviate cabinet capacity bottlenecks. The specific operation is as follows: First, randomly select a dispatch route containing at least one dispatch route and randomly identify a battery swapping cabinet j actually used by that dispatch route (each access point is located between the predecessor p and the successor q in the sequence). For each candidate existing cabinet j', calculate the total incremental distance as follows: Calculate the original distance segment for each original access j position in that dispatch route. , and the distance segment after replacement The difference The difference is summed at all affected locations on the dispatching route to obtain the cumulative incremental cost of candidate cabinet j'. Among all candidates j', the one with the smallest cumulative incremental cost is selected as the preferred replacement cabinet. After replacement, the dispatching route is simulated sequentially and its feasibility is checked. If the replacement is infeasible, a rollback or other suboptimal alternative cabinet j'' is attempted. If all alternatives are infeasible, the replacement is abandoned.

[0124] 4. Using the perturbation solution as the initial solution, a local search operator is first introduced to systematically search and optimize within its neighborhood structure. Then, a greedy criterion is used to evaluate and optimize the generated candidate solutions using the objective function, thereby obtaining a set of better-performing dispatch vehicle path schemes, denoted as candidate solutions. This application designs several local search operators based on the characteristics of the solutions, including the optimal insertion operator for the battery swapping cabinet, the node regret insertion operator, the optimal removal operator for the battery swapping cabinet, and the optimal node relocation operator, which are described in detail below:

[0125] (1) Optimal insertion operator for battery swapping cabinet

[0126] This operator addresses or optimizes replenishment rhythm by strategically inserting battery swapping cabinet visits into dispatch vehicle routes, thereby reducing unmet demand and overall operational costs. The specific steps are as follows: First, iterate through all candidate battery swapping cabinet nodes. For each candidate battery swapping cabinet j, iterate through all target dispatch vehicle routes and all feasible insertion positions for each dispatch vehicle route. Insert battery swapping cabinet j into this position and perform sequential simulation of the affected dispatch vehicle routes, calculating the incremental cost after insertion. Simultaneously, check feasibility constraints: whether the insertion satisfies vehicle load constraints, the maximum duration constraint of the dispatch vehicle route, and the shared capacity constraint of the battery swapping cabinets, and whether the replenishment order that may be changed by the insertion can still be maintained by existing cabinets or return-to-warehouse replenishment. After traversing all dispatch vehicle routes and insertion positions for candidate cabinet j, record the optimal insertion position and corresponding improvement value brought by the cabinet globally. If the optimal insertion produces a positive improvement and satisfies feasibility, execute the insertion and update the remaining capacity and dispatch vehicle route status of the corresponding cabinet, then continue traversing the next candidate cabinet. If a cabinet has no feasible or beneficial insertion at any position, skip that cabinet.

[0127] (2) Node regret insertion operator

[0128] The core idea of ​​this operator is to consider not only the minimum incremental cost of the current optimal insertion when choosing an insertion position for a node, but also the opportunity loss of not choosing that position, thus achieving a more forward-looking insertion decision. The specific steps are as follows: First, construct a set U of unvisited nodes, where each node has not yet been inserted into any dispatched vehicle path. Then, for each node i in set U, traverse all target dispatched vehicle paths and all feasible insertion positions for each dispatched vehicle path, calculate the incremental cost of the node at each insertion position, and record its minimum cost position and second-minimum cost position. Next, calculate the regret value for node i: the second-minimum insertion cost minus the optimal insertion cost. After completing the above calculations for all nodes in the unvisited node set, select the node with the maximum regret value as the node that needs the highest priority and insert it into the corresponding optimal insertion position. After insertion, the current exploration is terminated.

[0129] (3) Optimal removal operator for battery swapping cabinet

[0130] This operator is used to evaluate the necessity of each battery swapping station in the current solution during the lower-level path optimization process. It reduces fixed construction or maintenance costs by removing redundant or inefficient swapping stations, while maintaining path feasibility and customer service levels. The specific steps are as follows: First, iterate through all deployed battery swapping station nodes C in the current solution. For each swapping station ci∈C, assume it is removed from the solution. While keeping the positions of the remaining swapping stations unchanged, perform a feasibility check on the affected path, including vehicle load constraints, maximum duration / driving time constraints, and whether the battery replenishment originally provided by ci can be satisfied by other swapping stations or restocking at the warehouse. Record the change in the objective function resulting from each removal operation. After completing the traversal of all swapping stations, select the swapping station that minimizes the objective function or maximizes the improvement after removal. Then remove it from the current solution and update the solution's state. If no removal operation improves the objective function, keep the existing battery swapping cabinet deployment unchanged.

[0131] (4) Node optimal replacement operator

[0132] This operator aims to find local structural adjustments that maximally improve solution quality by re-inserting nodes within the same or across dispatch routes. The specific steps are as follows: First, traverse all non-air-conditioned dispatch routes in the current solution. Then, for each motorcycle stop i in that dispatch route, perform the following operations sequentially: temporarily remove node i from the current dispatch route and attempt insertion at all feasible target positions. For each insertion position, calculate the improvement in the solution after insertion and simultaneously check feasibility constraints. After evaluating all feasible insertion positions for node i, record its optimal insertion position and corresponding improvement value. After all nodes within the dispatch route have completed this process, select the "node that produces the greatest improvement and its optimal insertion position" and formally insert that node into that position, thereby updating the solution structure. If no insertion operation that brings improvement exists in the current dispatch route, abandon that dispatch route and continue to randomly select the next unexplored non-air-conditioned dispatch route, repeating the above process until all non-air-conditioned dispatch routes have been tried or a valid improvement has been found.

[0133] 5: Compare the candidate solution in the nth iteration with the current solution; if the objective function of the candidate solution is better than that of the current solution, then update the current solution to the candidate solution in the nth iteration; otherwise, accept the candidate solution with a certain probability according to the simulated annealing acceptance criterion.

[0134] In the design of optimization algorithms, the most direct acceptance strategy is to accept a new solution only if it is better than the current one. While this ensures monotonic improvement of the solution, it may cause the search process to converge prematurely to a local optimum. It should be noted that even better solutions may exist in the neighborhood of suboptimal or inferior solutions; therefore, a strategy that completely rejects inferior solutions will significantly weaken the algorithm's global search capability. This algorithm adopts the acceptance criterion of simulated annealing and introduces a conditional inferior solution acceptance mechanism: allowing the temporary acceptance of neighborhood solutions with degraded objective function values ​​with dynamically adjusted probabilities.

[0135] The probability formula for accepting a new feasible solution X' found from the current feasible solution X is as follows:

[0136]

[0137] Here, T represents the current temperature and T>0, used to control the acceptance probability. In the initial stage of the search, a large initial value is assigned to the temperature T. At this time, the algorithm has strong randomness and exploration ability. Even if the new solution is worse than the current solution, it may still be accepted with a high probability, thus helping to escape local extrema.

[0138] To achieve a gradual search process from exploration to convergence, the temperature is gradually reduced according to a cooling mechanism. Specifically, an exponential cooling model is adopted. ,in is the cooling coefficient, used to control the rate of temperature decay. As the algorithm iterates, the temperature T gradually decreases, the probability of accepting inferior solutions decreases significantly, and the algorithm gradually shifts towards fine-tuning local regions, achieving a smooth transition from global search to local convergence.

[0139] 6: Compare the candidate solution and the optimal solution in the nth iteration; if the objective function of the candidate solution is less than that of the optimal solution, then update the optimal solution to the candidate solution of the nth iteration; otherwise, keep the optimal solution unchanged.

[0140] 7: Determine if the maximum number of iterations has been reached. If it has, stop the iteration and output the optimal set of paths and the motorcycle station scheduling status. Otherwise, return to the genetic algorithm step and continue the iteration.

[0141] 8: Based on the solution results of multiple random demand scenarios, statistical analysis methods are used to obtain the lower-level objective function value and the expected power exchange capacity of each battery swapping cabinet. This is used as the comprehensive result of the lower-level model for upper-level iterative optimization.

[0142] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0143] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.

Claims

1. A method for site selection and capacity determination of electric bicycle battery swapping cabinets based on two-layer planning, characterized in that, include: Obtain the required parameters, and based on the required parameters and the upper-level algorithm, obtain the upper-level initial population. The initial population includes multiple individuals, and each individual includes the location of the battery swapping cabinet and the capacity of the battery swapping cabinet. The initial population from the upper layer is input into the lower layer algorithm. Based on the demand for electric bicycle stations, the variable neighborhood search algorithm, and Monte Carlo sampling, a set of dispatch vehicle paths is obtained. A comprehensive result is obtained based on the set of dispatch vehicle paths. The set of dispatch vehicle paths represents multiple dispatch vehicle paths planned by the dispatch vehicle based on the individual and the electric bicycle station. and The comprehensive results are input into the upper-level algorithm to obtain the corrected initial population. The corrected initial population is then iterated based on the upper-level algorithm to obtain the final solution, which includes the final location of the battery swapping cabinet and the final capacity of the battery swapping cabinet.

2. The site selection and volume determination method according to claim 1, characterized in that, The process of obtaining the initial population of the upper layer includes: Obtain a candidate location set, which includes multiple candidate nodes, and determine whether each candidate node should be used as the initial location of the battery swapping cabinet with a preset probability. For each candidate node serving as the initial location of the battery swapping cabinet, an initial capacity is preset for each candidate node, which serves as the initial capacity of the battery swapping cabinet; and The candidate nodes that satisfy the preset constraints are selected as the individuals.

3. The site selection and volume determination method according to claim 1, characterized in that, The set of dispatch vehicle routes for obtaining dispatch vehicles includes: Monte Carlo sampling was performed based on the demand for electric bicycle stations to generate multiple demand scenarios. Each individual, under each demand scenario, obtains the set of dispatch vehicle routes, obtains an initial solution based on the set of dispatch vehicle routes, and uses the initial solution as the current solution and the optimal solution. Based on a preset objective function and a neighborhood search optimization algorithm, the current solution is iteratively optimized and the optimal solution is updated until the maximum number of iterations is reached; The objective function value of the optimal solution and the battery swapping capacity of the battery swapping cabinet are obtained to form the comprehensive result.

4. The site selection and volume determination method according to claim 3, characterized in that, The process of obtaining the initial solution includes: In each of the aforementioned demand scenarios, candidate stations are determined based on the demand for electric bicycle stations. The candidate stations are the electric bicycle stations that require battery swapping. The maximum number of operations for each candidate station is obtained. The maximum number of operations is the smaller value between the number of available batteries in the dispatch vehicle and the number of batteries required by the candidate station. Based on the greedy principle of maximizing the number of operands, candidate stations are assigned to the dispatch vehicle, and the station status of the candidate stations is updated until the dispatch vehicle reaches the maximum working time constraint or the candidate stations are empty, at which point the dispatch vehicle's path set is obtained; and When the number of available batteries is zero, the dispatch vehicle replenishes batteries based on the nearest battery swapping station and continues to form the dispatch vehicle path set, using the final dispatch vehicle path set as the initial solution.

5. The site selection and volume determination method according to claim 3, characterized in that, Iterative optimization and updating of the optimal solution based on a preset objective function and a neighborhood search optimization algorithm for the current solution includes: By using a perturbation operator to change part of the path structure in the current solution, a perturbation solution can be obtained; Based on the local search operator, a neighborhood search is performed on the perturbation solution to obtain the candidate solution after neighborhood search optimization; If the candidate solution is better than the current solution, the current solution is updated with the candidate solution; otherwise, the current solution is updated according to the simulated annealing acceptance criterion. Compare the candidate solution with the optimal solution; if the candidate solution is better than the optimal solution, update the optimal solution with the candidate solution; otherwise, keep the optimal solution unchanged. Repeat the process until the maximum number of iterations is reached, then output the optimal solution.

6. The site selection and volume determination method according to claim 5, characterized in that, The set of dispatch vehicle routes includes multiple dispatch vehicle routes, and the disturbance operator includes: A node random position change operator is used to move the electric bicycle station to a feasible insertion position within the same dispatch route or on a different dispatch route; and / or, The battery swapping cabinet focuses the switching operator, used to swap the electric bicycle stops in the two dispatching vehicle routes; and / or, A high-demand clustering removal operator is used to centrally remove clusters of high-demand or high-fluctuation electric bicycle stations and redistribute them into different dispatch routes; and / or, The battery swapping cabinet replacement operator is used to replace the battery swapping cabinet selected for the dispatch vehicle route.

7. The site selection and volume determination method according to claim 5, characterized in that, The set of dispatch vehicle routes includes multiple dispatch vehicle routes, and the local search operator includes: A battery swapping cabinet optimal insertion operator is used to insert battery swapping cabinets into the dispatch vehicle path; and / or, A node regret insertion operator is used to insert unvisited motorcycle stops into the dispatch vehicle path according to the principle of maximizing regret value; and / or, An optimal removal operator for the battery swapping cabinet is used to remove the battery swapping cabinet; and / or, The node optimal replacement location operator is used to insert electric bicycle stops on the same or different dispatch vehicle routes.

8. The site selection and volume determination method according to claim 1, characterized in that, The iterative process for obtaining the final solution includes: Based on a preset fitness function, the fitness of each individual in the modified initial population is obtained, and the individual with the highest fitness is selected as the current optimal solution. Based on the fitness, selection, crossover, and mutation are performed on the modified initial population to obtain the next generation population; and Based on the fitness function, the fitness of each individual in the next generation population is obtained, the individual with the highest fitness is compared and retained as the current optimal solution, and the process is repeated until the maximum number of iterations is reached, and the current optimal solution is taken as the final solution.

9. The site selection and volume determination method according to claim 8, characterized in that, Based on the fitness, selection, crossover, and mutation are performed on the modified initial population, including: adjusting the crossover probability and mutation probability based on the fitness value of the individuals, wherein... The crossover probability satisfies: The variation generally satisfies: in, For the current population, For individuals fitness value, The crossover probability is... The mutation probability is... For the current population All individuals Maximum fitness value, For the current population The average fitness value of all individuals in the group. The minimum crossover probability is the preset value. This is the preset maximum crossover probability. This represents the current iteration number. This represents the maximum number of iterations for the genetic algorithm. This is the preset minimum mutation probability. This is the preset maximum mutation probability.

10. A site selection and capacity determination system for electric bicycle battery swapping cabinets based on two-layer planning, characterized in that, The electric bicycle battery swapping cabinet location and capacity determination system based on two-layer planning is implemented by the processor when executing the system, as described in any one of claims 1 to 9, using the method for location and capacity determination of the electric bicycle battery swapping cabinet based on two-layer planning.