Nonlinear prediction and game theory algorithm-based method for determining a fall arrest point
By using nonlinear prediction and game theory algorithms, the optimal location and priority of the battery swapping cabinet can be quickly determined, solving the problem of time-consuming and labor-intensive location setting in the existing technology, and realizing efficient location selection and resource optimization.
Patent Information
- Application Number
- CN202310968398.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-03
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2043-08-03
AI Technical Summary
The current process of setting the location of battery swapping cabinets is time-consuming and labor-intensive, greatly affected by human factors, and has low accuracy, making it impossible to quickly find the best location and optimize the layout.
A method based on nonlinear prediction and game theory algorithms is adopted. Data is acquired and processed by a network robot to generate a city block model. The model is trained using a nonlinear regression mid-course basis function algorithm. The election process is simulated using game theory to determine the block priority and thus determine the optimal cabinet placement location.
Quickly identify the best locations and prioritize cabinet placement, reducing time and costs for business personnel, improving the accuracy and economic efficiency of cabinet placement, and adapting resource allocation to market changes.
Smart Images

Figure CN117010949B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of battery swap cabinet drop cabinet distribution, and particularly relates to a drop cabinet point method based on a nonlinear prediction and a game theory algorithm. BACKGROUND
[0002] In cities, the arrangement of battery swap cabinets can provide power supply for bicycle users such as delivery personnel and express delivery personnel, and the setting of the positions of the battery swap cabinets is related to the convenience of the users and the economy of the battery swap enterprises. The existing battery swap cabinet position setting is that the one-line staff carries out investigation and research on commercial districts, communities and crowd distribution, and then determines the battery swap cabinet arrangement position according to the research results. The whole process is time-consuming and laborious, the drop cabinet point selection is greatly affected by human factors, and the accuracy is low. SUMMARY
[0003] The application aims at overcoming the deficiencies in the prior art, and provides a drop cabinet point method based on a nonlinear prediction and a game theory algorithm, which can help business personnel quickly find the best point and give a drop cabinet priority, save time and cost, and improve the drop cabinet accuracy.
[0004] Technical scheme: In order to achieve the above-mentioned purpose, the drop cabinet point method based on a nonlinear prediction and a game theory algorithm of the application has the following steps:
[0005] Step S1: battery swap cabinet data acquisition
[0006] Different brand public existing site and battery swap cabinet data are acquired through a network robot, including site position and type, the data are normalized and stored in a database;
[0007] Step S2: city map data generation and drop cabinet model construction
[0008] City longitude and latitude are acquired by using a map, the city is divided into a plurality of blocks according to the longitude and latitude, each block is given a unique id and stored in a database, the generated map block is subjected to local 8 domain calculation, the local 8 domain content is acquired, the local 8 domain content is spliced and stored in the database, and a model training is carried out through a nonlinear regression midway to basis function algorithm. After the model verification is completed, a drop cabinet model is generated, and the drop cabinet number in the local 8 domain is predicted through the drop cabinet model;
[0009] Step S3: battery swap cabinet historical data acquisition
[0010] Battery swap cabinet historical data are acquired through a network robot, and battery data are extracted therefrom and stored in a database;
[0011] Step S4: delivery data acquisition
[0012] Public delivery data are acquired through a network robot, including the longitude and latitude order quantity and order density of each region, and are stored in a database;
[0013] Step S5: Data aggregation
[0014] The data obtained in steps S1 to S4 is aggregated to generate prediction block cabinet drop number, map block and cabinet drop point, and block detail data that can be displayed on the terminal, wherein:
[0015] The prediction block cabinet drop number is: based on the historical cabinet efficiency and the number of cabinets in the region, and the maximum bearing cabinet number in the region is obtained based on the take-out data order quantity, so as to determine whether the block continues to drop the cabinet;
[0016] The map block and the cabinet drop point are: the longitude and latitude of all battery swap cabinets in the city and the ratio of the distance between two points on the earth's surface and the distance between the point and the boundary point to determine whether the point is in the region, and the distance between the block center point and the battery swap cabinet is used to determine whether it is in the block., so as to obtain the block id corresponding to each battery swap cabinet and record it in the database;
[0017] Step S6: Priority judgment of block where cabinet drops
[0018] The priority of each block is calculated, and the competition between blocks is simulated based on game theory, and each block determines the priority according to the probability of successful competition.
[0019] Further, in step S2, the specific steps of generating city map data are as follows:
[0020] 1) Take the gcj02 map coordinate system to obtain the longitude and latitude of each city range in China, and take the longitude and latitude of the city government as the starting point;
[0021] 2) Take the four points above, below, left and right based on the starting point, wherein distance is the distance, radians is the calculation radian, and earth_radius is the earth radius;
[0022] Use
[0023] Distance longitude formula: distance*360 / (2*π) / cos(radians(lat)) / earth_radius
[0024] Distance latitude formula: distance*360 / (2*π) / earth_radius
[0025] Calculate the longitude and latitude of the corresponding four points, obtain the four points, calculate the four diagonal points, which are left top, right top, right bottom and left bottom, respectively. According to the distance longitude and distance latitude formula and the longitude and latitude of the four points above, below, left and right, the four diagonal points are calculated, and the four diagonal coordinates are recorded. Loop nesting until the city block coordinates are obtained;
[0026] 3) Limit block calculation range: stop the next loop calculation when the point coordinate exceeds the city range, limit the range to the longitude and latitude range of the city in the map coordinate system, and stop if it exceeds;
[0027] 4) Latitude and longitude secondary verification: take the latitude and longitude vertex coordinates, access the map inverse latitude and longitude query to verify whether the block is in the city, otherwise remove the block;
[0028] 5) Data storage and corresponding unique id.
[0029] Further, in step S2, the specific steps of the proximity domain calculation are as follows:
[0030] 1) Calculate the data coordinates of the adjacent block based on the generated map square block, obtain the center point s of each square block i, i represents the serial number of the square block; the latitude and longitude of the top vertex of the block i is (lat1i, lng1i), and the latitude and longitude of the lower right corner vertex is (lat2i, lng2i), then the latitude of the center point of the block i is (lat1i+lat2i) / 2, the longitude of the center point is (lng1i+lng2i) / 2, calculate the center point of all blocks according to the above method, and use Haversine formula to calculate the distance si between two points on a sphere:
[0031] si=2*asin(sqrt(sin((lngi2-lng1i) / 2)^2+cos(lat1i)*cos(lat2i)*sin((lat2i-lat1i) / 2)^2));
[0032] 2) According to the Pythagorean theorem, the distance of all center points of the proximity domain of each point should be less than or equal to the diagonal length of the block, but there is a certain error in the distance calculation of different maps, therefore, on the basis of the diagonal length of the block, +0.1*length distance is added as the basis for calculating the proximity domain area, that is:
[0033] si=si+0.1*sqrt(2) / 4*si
[0034] 3) Calculate the distance between the center points of all blocks, take the center points of all full-quantity data within si, which is the proximity domain content.
[0035] Further, in step S2, the specific steps of the proximity domain splicing are as follows:
[0036] 1) After calculating the center point of the proximity domain, take the center point corresponding to the city block id for splicing and sorting, and record the proximity domain corresponding to each block;
[0037] 2) In the mysql, the temporary 8 field and the block data and the block center point data are placed in the same database, and the remarks are recorded.
[0038] Further, in step S2, the construction step of the temporary 8 field cabinet model is as follows:
[0039] 1) Data collection and processing
[0040] Collect the historical data of the number of temporary 8 field cabinets, including the number of temporary 8 field cabinets and the factors affecting the number of cabinets, and collect the off-line and on-line image data of the battery swap cabinet, use the Pandas library to load these data into DataFrame, and perform preprocessing and feature engineering;
[0041] 2) Create training set and test set
[0042] The data set is divided into training set and test set by random division method;
[0043] 3) Train using nonlinear regression basis function algorithm
[0044] 3.1) Calculate the radial basis function: for each sample x_i in the training set and each sample x in the test set, calculate the value of the radial basis function; for the Gaussian kernel function, the calculation method is:
[0045] φ(xi,x)=e^(-∥xi-x∥^2 / 2σ^2)
[0046] Where: φ(xi,x) is the radial basis function value between sample x_i and sample x; ∥xi-x∥^2 is the Euclidean distance between sample x_i and sample x; σ is a control parameter of the Gaussian kernel function, used to adjust the width of the radial basis function;
[0047] 3.2) Construct design matrix: use the value of the radial basis function as a feature to construct a design matrix X, where each row corresponds to a sample and each column corresponds to a value of the radial basis function;
[0048] 3.3) Model training: perform linear regression training on the design matrix X to find the optimal parameter θ, that is, solve the following normal equation:
[0049] XTXθ=XTy
[0050] Finally, the optimal parameter θ can be obtained as:
[0051] θ=(XTX)-1XTy
[0052] 4) Verify the model
[0053] After training, the performance of the model is evaluated using the mean square error and the determination coefficient of the test set, wherein the determination coefficient is used to measure the explanatory power of the model to the target variable, and the mathematical formula is as follows:
[0054] R^2=1-\frac{SS_{res}}{SS_{tot}}
[0055] Wherein, SS_{res} represents the residual sum of squares, which is the sum of squares of the difference between the predicted value and the actual value of the model, and SS_{tot} represents the total square, which is the total variance of the target variable;
[0056] The formula of the mean square error is:
[0057] MSE=\frac{1}{m}\sum_{i=1}^{m}(h_θ(x_i)-y_i)^2
[0058] Wherein: h_θ(x_i) represents the predicted target value of the model, y_i represents the actual target value, and m represents the number of samples;
[0059] 5) Use the model to make predictions
[0060] By iterating the parameters θ, the number of fallen cabinets in the new temporary 8 domain is predicted, the model is saved, and the model is loaded when new data needs to be predicted.
[0061] Further, in step S2, the fallen cabinet temporary 8 domain block priority judgment step is as follows:
[0062] 1) Record of candidate information
[0063] Each block as a candidate needs to record the information of the candidate, including candidate ID (block ID), existing competitive product quantity c{ID}, predicted number of fallen cabinets in the temporary 8 domain n{ID}, and time stamp t{ID};
[0064] 2) Calculate the priority judgment value of the candidate
[0065] Priority judgment value{ID}=Ln(c{ID}+n{ID}) / ln(c{ID})+β*e^(-γ*t{ID})
[0066] Wherein: β and γ are parameters for adjusting the influence of the time stamp;
[0067] 3) Competition process of the candidate
[0068] 3.1) For each block, simulate the election process according to the calculated priority judgment value{ID};
[0069] 3.2) The candidates compete in turn according to the priority judgment value.
[0070] 3.3) The probability of success of each candidate is proportional to the priority judgment value, that is, the higher the priority, the greater the probability of success of the election;
[0071] 4) Election success and processing
[0072] 4.4) According to the probability of success of the election, the candidate with a high probability of success of the election obtains the opportunity to execute, that is, the block corresponding to the high probability of success of the election is processed preferentially;
[0073] 4.5) The candidate who successfully elects executes the corresponding operation or task first;
[0074] 5) Update the election environment
[0075] When a candidate successfully executes, the information of all candidates needs to be updated due to the change of the competition environment, the increase of the number of competitors, and the update of the time stamp, and the priority judgment value is recalculated;
[0076] 6) Repeat the election process
[0077] Repeat the above steps to simulate multiple election processes until all blocks obtain the opportunity to execute;
[0078] Through the above election process simulation, the priority of each block is judged according to the probability of success of the election, thereby realizing the judgment algorithm of the block priority in the game theory-based drop-off area, and the algorithm can update the priority according to the change of the competition environment to adapt to the resource allocation requirements in different scenarios.
[0079] Beneficial effects: The application finds the best point and gives the drop-off priority, which maximally reduces the time and cost of the business personnel to find the drop-off point, directly helps the business personnel to find the best drop-off point, improves the accuracy of the drop-off point in the city, can help the related enterprises to optimize the layout of the drop-off point, and can timely adjust the number of the battery swap cabinets to adapt to the market changes, and improve the economic benefits. BRIEF DESCRIPTION OF DRAWINGS
[0080] FIG. 1 is a structural block diagram of the drop-off point method of the application; Figure 1 FIG. 2 is a brief flowchart of the drop-off point method of the application;
[0081] Figure 2 FIG. 3 is a structural schematic diagram of the drop-off point priority of the application.
[0082] FIG. 4 is a specific implementation of the drop-off point method of the application. Figure 3 DETAILED DESCRIPTION
[0083] The application will be further described below in combination with the drawings.
[0084] As shown in the accompanying drawings Figure 1 and accompanying drawings Figure 2 The method for predicting the location of the battery replacement cabinet based on the nonlinear prediction and game theory algorithm is as follows:
[0085] Step S1: data collection of battery replacement cabinet
[0086] The network robot is used to obtain the data of the existing sites and battery replacement cabinets of different brands, including the site location and type. After normalization, the data is stored in the database.
[0087] In step S1, the specific steps of battery replacement cabinet data collection are as follows:
[0088] ⅰ) Use the network robot to obtain the accurate landing point of the required platform and the public battery replacement cabinet;
[0089] ⅱ) Use the map to confirm the longitude and latitude range of the city, and take the longitude and latitude at intervals of 2 kilometers, 1 kilometer, and 0.5 kilometers to divide the city into a set of fixed points;
[0090] ⅲ) According to the fixed point set map, obtain the longitude and latitude and name of all battery replacement cabinets in the city, and cyclically call the API to obtain the battery replacement cabinet data within 500-2000 meters centered on the fixed point, and unify the data structure of the obtained data;
[0091] ⅳ) Encode and decode the garbled text, format the data that does not meet the standard, and delete duplicate data and invalid information;
[0092] ⅴ) After cleaning the data, store it in the hive database for data layering, and prepare for subsequent data analysis and processing.
[0093] Step S2: city map data generation and battery replacement cabinet model construction
[0094] Use the map to obtain the longitude and latitude of the city, divide the city into several blocks according to the longitude and latitude, assign each block a unique id and store it in the database, perform local8 domain calculation on the generated map blocks, obtain the local8 domain content, store it in the database after splicing, and train the model through the nonlinear regression halfway to the basis function algorithm. After model verification is completed, generate the battery replacement cabinet model, and predict the number of battery replacement cabinets in the local8 domain through the battery replacement cabinet model.
[0095] In step S2, the specific steps of city map data generation are as follows:
[0096] 1) Take the gcj02 map coordinate system to obtain the longitude and latitude of each city in China, and take the longitude and latitude of the city government as the starting point;
[0097] 2) Take the four points of up, down, left and right based on the starting point, where distance is the distance, radians is the calculated radian, and earth_radius is the earth radius;
[0098] Using
[0099] Distance longitude formula: distance * 360 / (2 * pi) / cos(radians(lat)) / earth_radius
[0100] Distance latitude formula: distance * 360 / (2 * pi) / earth_radius
[0101] Calculate the longitude and latitude of the corresponding four points, get the four points, calculate the four diagonal points, which are left up, right up, right down and left down, according to the distance longitude and distance latitude formula and the longitude and latitude of the four points, calculate the four diagonal points, record the four diagonal coordinates, and loop until the city block coordinates are obtained;
[0102] 3) Limit the block calculation range: stop the next loop calculation when the point coordinate exceeds the city range, and the limit range is the longitude and latitude range of the city in the map coordinate system, which is stopped when it is exceeded;
[0103] 4) Latitude and longitude second verification: take the latitude and longitude vertex coordinates, access the map inverse latitude and longitude query to verify whether the block is the city, otherwise remove the block;
[0104] 5) Data storage and corresponding unique id.
[0105] In step S2, the specific steps of the neighborhood calculation are as follows:
[0106] 1) Based on the generated map square block calculation neighborhood data coordinates, get the center point s of each square block i, i represents the serial number of the square block; The latitude and longitude of the top vertex of the block i is (lat1i, lng1i), and the latitude and longitude of the right bottom vertex is (lat2i, lng2i), then the center point latitude of the block i is (lat1i+lat2i) / 2, and the center point longitude is (lng1i+lng2i) / 2, calculate the center point of all blocks according to the above method, and use Haversine formula to calculate the distance si between two points on the sphere:
[0107] si = 2 * asin(sqrt(sin((lngi2-lng1i) / 2)^2+cos(lat1i)*cos(lat2i)*sin((lat2i-lat1i) / 2)^2));
[0108] 2) According to the Pythagorean theorem, the distance between all center points in the 8-neighborhood of each point should be less than or equal to the diagonal length of the block, but there is a certain error in the distance calculation of different maps, so the distance of +0.1*edge length is added to the diagonal length of the block as the basis for calculating the 8-neighborhood region, that is:
[0109] si = si + 0.1 * sqrt(2) / 4 * si
[0110] 3) Calculate the distance between the center points of all blocks, and take all the center points of the full-amount data within si, that is, the 8-neighborhood content.
[0111] In step S2, the specific steps of 8-neighborhood splicing are as follows:
[0112] 1) After calculating the center point of the 8-neighborhood, the center point corresponding to the city block id is summarized and spliced, and the 8-neighborhood corresponding to each block is sorted out and recorded;
[0113] 2) Store the 8-neighborhood and block data, block center point data in the same database in mysql, and record the remarks.
[0114] In step S2, the construction steps of the 8-neighborhood cabinet model are as follows:
[0115] 1) Data collection and processing
[0116] Collect historical data of 8-neighborhood cabinet number, including the number of cabinets in each 8-neighborhood and the factors affecting the number of cabinets, and collect off-line and online portrait data of the battery swap cabinet, use Pandas library to load these data into DataFrame, and perform preprocessing and feature engineering;
[0117] 2) Create training set and test set
[0118] The data set is divided into training set and test set by random division, wherein the training set accounts for 80%, and the test set accounts for 20%.
[0119] 3) Use nonlinear regression radial basis function algorithm for training
[0120] 3.1) Calculate the radial basis function: for each sample x_i in the training set and each sample x in the test set, calculate the value of the radial basis function; for the Gaussian kernel function, the calculation method is:
[0121] φ(xi,x) = e^(-‖xi-x‖^2 / 2σ^2)
[0122] Where: φ(xi, x) is the radial basis function value between sample x_i and sample x; ||xi-x||^2 is the Euclidean distance between sample x_i and sample x; σ is a control parameter of the Gaussian kernel function, used to adjust the width of the radial basis function;
[0123] 3.2) Constructing the design matrix: the values of the radial basis functions are taken as features to construct a design matrix X, where each row corresponds to a sample and each column corresponds to a value of a radial basis function;
[0124] 3.3) Model training: linear regression training is performed on the design matrix X to find the optimal parameters θ, i.e., by solving the normal equation as follows:
[0125] XTXθ=XTy
[0126] Finally, the optimal parameters θ can be obtained as:
[0127] θ=(XTX)-1XTy
[0128] 4) Verify the model
[0129] After training, the mean square error and the determination coefficient of the test set are used to evaluate the performance of the model, where the determination coefficient is used to measure the explanatory power of the model for the target variable, and its mathematical formula is as follows:
[0130] R^2=1-\frac{SS_{res}}{SS_{tot}}
[0131] Where SS_{res} represents the residual sum of squares, which is the sum of the squares of the differences between the predicted values and the actual values of the model, and SS_{tot} represents the total square, which is the total variance of the target variable;
[0132] The formula of the mean square error is:
[0133] MSE=\frac{1}{m}\sum_{i=1}^{m}(h_θ(x_i)-y_i)^2
[0134] Where: h_θ(x_i) represents the predicted target value of the model, y_i represents the actual target value, and m represents the number of samples;
[0135] 5) Use the model to make predictions
[0136] Through the iterative parameters θ, the number of cabinets in the new domain is predicted, the model is saved, and the model is loaded when new data needs to be predicted.
[0137] Step S3: Obtain the historical data of the battery swap cabinet
[0138] Obtain the historical data of the battery swap cabinet through the network robot, and extract the battery data into the database.
[0139] Step S4: Take-out data collection
[0140] Public take-out data is obtained through network robots, including the longitude and latitude of merchants in each region, order volume, and order density, and is stored in a database.
[0141] In step S4, the specific steps of take-out data collection are as follows:
[0142] a) Access the corresponding take-out platform, obtain the authorized API data, and centrally obtain the orders and store area of all take-out merchants in the city, and sort the order number, merchant longitude and latitude, and store id data;
[0143] b) After data deduplication and sorting, store it in the database by city, and store it in the ODS layer data.
[0144] Step S5: Data aggregation
[0145] The data obtained in steps S1 to S4 is aggregated to generate prediction block cabinet number, map block and cabinet drop point, and block detail data that can be displayed on the terminal, wherein:
[0146] The prediction block cabinet number is: based on the historical cabinet efficiency and the number of cabinets in the region, and the maximum bearing cabinet number in the region based on the take-out data order volume, to determine whether the block continues to drop the cabinet;
[0147] The map block and cabinet drop point are: the longitude and latitude of all battery swap cabinets in the city and the ratio of the distance between two points on the surface of the earth and the distance between the point and the boundary point to determine whether the point is in the region, and the distance between the block center point and the battery swap cabinet to determine whether it is inside the block., to obtain the block id corresponding to each battery swap cabinet, and record it in the database;
[0148] Step S6: Priority judgment of cabinet drop 8-domain block
[0149] The priority of each block is calculated by competition, and the competition between blocks is simulated based on game theory, and each block determines the priority according to the probability of successful competition.
[0150] In step S6, the priority judgment of the cabinet drop 8-domain block is as follows:
[0151] 1) Record of competitor information
[0152] Each block as a competitor needs to record the information of the competitor, including competitor ID (block ID), number of existing competitors c{ID}, predicted number of dropped cabinets in 8-domain n{ID}, and timestamp t{ID};
[0153] 2) Calculate the priority judgment value of the competitor
[0154] Priority judgment value {ID} = Ln(c{ID} + n{ID}) / ln(c{ID}) + β*e^(-γ*t{ID})
[0155] Wherein: β and γ are parameters for adjusting the influence of timestamp;
[0156] 3) The competition process of the candidate
[0157] 3.1) For each block, the competition process is simulated according to the calculated priority judgment value {ID};
[0158] 3.2) The candidates compete in turn according to the priority judgment value;
[0159] 3.3) The success probability of each candidate is proportional to the priority judgment value, that is, the higher the priority, the greater the success probability;
[0160] 4) Competition success and processing
[0161] 4.4) According to the competition success probability, the candidate with high competition success probability obtains the execution opportunity, that is, the block corresponding to the high competition success probability is processed preferentially;
[0162] 4.5) The candidate who successfully competes first executes the corresponding operation or task;
[0163] 5) Update the competition environment
[0164] When a candidate successfully executes, the information of all candidates needs to be updated due to the influence of the change of the competition environment, the increase of the number of competitors and the update of the timestamp, and the priority judgment value is recalculated;
[0165] 6) Repeat the competition process
[0166] Repeat the above steps to simulate multiple competition processes until all blocks obtain the execution opportunity;
[0167] Through the above competition process simulation, the priority of each block is judged according to the competition success probability, thereby realizing the judgment algorithm of the priority of the block in the game theory, and the algorithm can continuously update the priority according to the change of the competition environment to adapt to the resource allocation demand in different scenarios.
[0168] In the attached Figure 3 , the map block A is a very strong representative: the drop-in priority is the highest; the map block E is a very weak representative: the drop-in priority is the lowest.
[0169] The application can help business personnel to quickly find the best point and give the drop-in priority, save time and cost, improve the drop-in accuracy, and the specific advantages are as follows:
[0170] (1) The application finds the best point position quickly and gives the priority of the cabinet, which reduces the time and cost of the business personnel to find the cabinet position to the maximum extent;
[0171] (2) The application directly helps the business personnel to find the best cabinet position, and improves the accuracy of the cabinet position in the city;
[0172] (3) The application can help the related enterprises to optimize the layout of the cabinet position, and can timely adjust the number of the battery replacement cabinet to adapt to the market changes, and improve the economic benefits.
[0173] The above is only the preferred embodiment of the application, and it should be pointed out that for ordinary skilled personnel in the art, without departing from the principles of the application, a number of improvements and refinements can be made, and these improvements and refinements should also be considered as the protection scope of the application.
Claims
1. A cabinet placement method based on nonlinear prediction and game theory algorithms, characterized by: The steps are as follows: Step S1: Data Acquisition from Battery Swapping Cabinet Data on publicly available sites and battery swapping cabinets from different brands are obtained through web robots, including site location and type. The data is then normalized and stored in a database. Step S2: City map data generation and cabinet model construction The city's latitude and longitude are obtained using a map. The city is divided into several blocks based on the latitude and longitude. Each block is assigned a unique ID and stored in the database. The adjacent 8 domains are calculated for the generated map blocks to obtain the adjacent 8 domain content. The adjacent 8 domain content is then stitched together and stored in the database. The model is trained using a nonlinear regression mid-path basis function algorithm. After the model is validated, a cabinet drop model is generated. The cabinet drop model is used to predict the number of cabinets in the adjacent 8 domains. Step S3: Obtain historical data of the battery swapping cabinet Historical data of the battery swapping cabinet is obtained through a network robot, and battery data is extracted and stored in a database. Step S4: Takeout Data Collection We obtain publicly available food delivery data through web robots, including the order volume and order density of merchants in each block, and store it in a database. Step S5: Data Aggregation The data obtained in steps S1 to S4 are aggregated to generate predicted block cabinet placement numbers, map blocks and cabinet placement locations, and block details that can be displayed on the terminal, including: The predicted number of cabinets to be added to a block is determined by: based on the historical cabinet efficiency, the number of cabinets in the block, and the order volume of food delivery data in the block, the maximum number of cabinets that the block can support is obtained, and then it is determined whether to continue adding cabinets to the block. The map blocks and the location of the power exchange cabinets are determined by the distance between the center point of the block and the power exchange cabinet. This determines whether the cabinet is inside the block, thereby obtaining the block ID corresponding to each power exchange cabinet and storing it in the database. Step S6: Priority determination of adjacent 8-domain blocks in the cabinet Priority election is performed for each block. The election between blocks is simulated based on game theory, and the priority of each block is determined according to the probability of successful election. In step S2, the construction steps of the adjacent 8-domain cabinet model are as follows: 1) Data collection and processing Historical data on the number of cabinets placed in each of the eight adjacent domains were collected, including the number of cabinets placed in each adjacent domain and the factors affecting the number of cabinets placed. Offline and online profile data of the battery swapping cabinets were also collected. The Pandas library was used to load these data into a DataFrame and perform preprocessing and feature engineering. 2) Create training and test sets The dataset is divided into training and test sets using a random partitioning method. 3) Training is performed using a nonlinear regression mid-course basis function algorithm. 3.1) Calculate the radial basis function: For each sample x_i in the training set and each sample x in the test set, calculate the value of the radial basis function; for the Gaussian kernel function, the calculation method is as follows: φ(xi,x)=e^(-∥xi-x∥^2 / 2σ^2) Where: φ(xi,x) is the radial basis function value between sample x_i and sample x; ∥xi-x∥^2 is the Euclidean distance between sample x_i and sample x; σ is a control parameter of the Gaussian kernel function, used to adjust the width of the radial basis function; 3.2) Constructing the design matrix: Using the values of the radial basis functions as features, construct a design matrix X, where each row corresponds to a sample and each column corresponds to a value of a radial basis function; 3.3) Model Training: Linear regression training is performed on the design matrix X. To find the optimal parameters θ, the following normal equation is solved: X T Xθ= X T y Finally, the optimal parameter θ can be obtained as: θ=(X T X) -1 X T y 4) Validate the model After training, the mean squared error and coefficient of determination on the test set are used to evaluate the model's performance. The coefficient of determination measures the model's ability to explain the target variable, and its mathematical formula is as follows: R^2=1-\frac{SS_{res}}{SS_{tot}} Where SS_{res} represents the residual sum of squares, which is the sum of squares of the differences between the model's predicted values and the actual values, and SS_{tot} represents the total squares, which is the total variance of the target variable; The formula for mean squared error is: MSE=\frac{1}{m}\sum_{i=1}^{m}(h_θ(x_i)-y_i)^2 Where: h_θ(x_i) represents the target value predicted by the model, y_i represents the actual target value, and m represents the number of samples; 5) Use models for prediction By iterating over the parameter θ, the number of cabinets in the new adjacent domain is predicted, the model is saved, and the model is loaded when new data needs to be predicted.
2. The cabinet placement method based on nonlinear prediction and game theory algorithms according to claim 1, characterized in that: In step S2, the specific steps for generating city map data are as follows: 1) Obtain the latitude and longitude of all cities in the country using the gcj02 map coordinate system, and take the latitude and longitude of the municipal government of each city as the starting point; 2) Based on the starting point, take four points: up, down, left, and right, where distance is the distance, radians is the calculated radian, and earth_radius is the Earth's radius; use Longitude formula: distance*360 / (2*π) / cos(radians(lat)) / earth_radius The formula for distance and latitude is: distance*360 / (2*π) / earth_radius Calculate the latitude and longitude of the four corresponding points. After obtaining the four points, calculate the four diagonal points, which are the upper left, upper right, lower right, and lower left. Calculate the four diagonal points based on the distance longitude and distance latitude formulas and the latitude and longitude of the four points. Record the coordinates of the four diagonal points. Repeat this process until the coordinates of the city block are obtained. 3) Limit the calculation range of the block: When the coordinates of the point exceed the city's range, stop the next cycle of calculation. The limit range is the latitude and longitude range of the city in the map coordinate system. If it is exceeded, the calculation will stop. 4) Secondary verification of latitude and longitude: Take the latitude and longitude vertex coordinates, connect to the map's inverse latitude and longitude query to check if the block belongs to the city; otherwise, remove the block. 5) Data is stored in the database and assigned a unique ID.
3. The cabinet placement method based on nonlinear prediction and game theory algorithms according to claim 2, characterized in that: In step S2, the specific steps for calculating the adjacent 8-domain are as follows: 1) Calculate the coordinates of neighboring blocks based on the generated map square blocks, and obtain the center point s of each square block i, where i represents the ordinal number of the square block; The latitude and longitude of the vertex of block i are (lat1i, lng1i), and the latitude and longitude of the bottom right vertex are (lat2i, lng2i). Therefore, the latitude of the center point of block i = (lat1i + lat2i) / 2, and the longitude of the center point = (lng1i + lng2i) / 2. Calculate the center points of all blocks using the above method, and then use the Haversine formula to calculate the distance si between two points on the sphere: si=2*arcsin(sqrt(sin((lng2i-lng1i) / 2)^2+cos(lat1i)*cos(lat2i)*sin((lat2i-lat1i) / 2)^2)); 2) According to the Pythagorean theorem, the distance between all center points of each adjacent 8-region should be less than the diagonal length of the block. However, there are certain errors in distance calculations across different maps. Therefore, 0.1 * side length is added to the diagonal length of the block as the basis for determining the adjacent 8-region, i.e.: si_n=si+0.1*√2 / 4*si 3) Calculate the distance between each pair of center points of the full block s, and take the center point of all full data within the range of si_n, which is the content of the adjacent 8 domain.
4. The cabinet placement method based on nonlinear prediction and game theory algorithms according to claim 3, characterized in that: In step S2, the specific steps for concatenating the 8 neighboring domains are as follows: 1) After calculating the center point of the adjacent 8 domains, take the city block ID corresponding to the center point, summarize and concatenate them, and sort out the adjacent 8 domains corresponding to each block, and keep the record. 2) In MySQL storage, the adjacent 8 fields, block data, and block center point data are stored in the same database, and notes are recorded.
5. The cabinet placement method based on nonlinear prediction and game theory algorithms according to claim 1, characterized in that: In step S2, the priority determination steps for the adjacent 8-domain blocks are as follows: 1) Recording of candidate information Each block acts as a candidate and needs to record the candidate's information, including the block ID, the number of existing competitors c{ID}, the predicted number of listed blocks in the adjacent domain n{ID}, and the timestamp t{ID}. 2) Calculate the priority judgment value of the candidates. Priority judgment value {ID} = Ln(c{ID} + n{ID}) / ln(c{ID}) + β*e^(-γ*t{ID}) where: β and γ are parameters used to adjust the influence of timestamps; 3) The competition process among candidates 3.1) For each block, simulate the election process based on the calculated priority judgment value {ID}; 3.2) Candidates will compete in descending order of their priority judgment values; 3.3) The probability of each candidate's election success is directly proportional to their priority value; that is, the higher the priority, the greater the probability of election success. 4) Successful election and its handling 4.4) Based on the probability of winning the election, the candidate with the higher probability of winning the election will be given the opportunity to execute, that is, the block with the higher probability of winning the election will be processed first. 4.5) Successful candidates must first perform the corresponding operations or tasks; 5) Update the campaign environment Once a candidate successfully executes, due to changes in the competitive environment, an increase in the number of competitors, and timestamp updates, it is necessary to update the information of all candidates and recalculate the priority judgment value. 6) Repeat the election process Repeat the above steps to simulate multiple election processes until all blocks have been given an execution opportunity; Through the above election process simulation, the priority of each block is determined based on the probability of successful election, thereby realizing the priority judgment algorithm of the adjacent 8-domain blocks based on game theory. Moreover, the algorithm can continuously update the priority according to the changes in the competitive environment to adapt to the resource allocation needs in different scenarios.
Citation Information
Patent Citations
Urban shared logistics pick-up point selection method based on multi-objective optimization
CN111260277A
Method, device and equipment for replacing battery for electric moped
CN112766525A