A point location cabinet falling method based on data algorithm
By constructing a battery swapping cabinet location selection model based on big data and artificial intelligence, the problems of time-consuming, labor-intensive, and difficult-to-accurate location selection in traditional methods have been solved, achieving efficient and accurate selection and dynamic adjustment of battery swapping cabinet locations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-03
- Publication Date
- 2026-03-31
AI Technical Summary
Finding the best location in the city to place battery swapping cabinets is a problem that not only makes it convenient for users to swap batteries but also improves utilization efficiency. Traditional methods are time-consuming, labor-intensive, and difficult to be precise.
Based on big data and artificial intelligence technologies, a battery swapping cabinet placement model is constructed. Data on battery swapping cabinets and food delivery is obtained through web crawling. The map is used to divide the area into blocks and perform adjacent domain calculations to build a battery swapping cabinet site selection model. A linear regression model is used to predict the optimal placement location.
This significantly reduces the time and cost of finding cabinet locations, improves the accuracy of cabinet locations, and allows for timely adjustments to the number of cabinets to adapt to market changes.
Smart Images

Figure CN117010948B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of urban battery swapping cabinet deployment technology, and particularly relates to a point-based cabinet placement method based on data algorithms. Background Technology
[0002] To provide a more efficient battery swapping solution for express delivery and food delivery services, battery swapping services for two-wheeled vehicles have emerged. However, finding the best locations in cities to place these lockers, thus facilitating battery swapping for users and effectively improving the utilization efficiency of the lockers, has become a crucial issue for the two-wheeled vehicle battery swapping industry. Traditionally, this problem is usually handled manually, which is time-consuming, labor-intensive, difficult to be precise, and unable to consider the optimal solution under various complex factors. Summary of the Invention
[0003] Purpose of the invention: In order to overcome the shortcomings of the existing technology, the present invention provides a method for the location of battery swapping cabinets based on data algorithms. The method constructs a cabinet placement model based on big data and artificial intelligence technology, and guides the selection of urban battery swapping cabinets according to the cabinet placement model, thereby finding the optimal cabinet placement point.
[0004] Technical solution: To achieve the above objectives, the present invention provides a point-based cabinet placement method based on data algorithms, the specific steps of which are as follows:
[0005] Step S1: Data Acquisition from Battery Swapping Cabinet
[0006] Data on publicly available sites and battery swapping cabinets from different brands are obtained through web scraping, including site location and type. The data is then normalized and stored in a database.
[0007] Step S2: City map data generation
[0008] 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 generated map blocks are subjected to adjacent 8-domain calculations to obtain adjacent 8-domain content. The adjacent 8-domain content is then stitched together and stored in the database. A cabinet model is constructed through adjacent 8-domain calculations.
[0009] Step S3: Obtain historical data of the battery swapping cabinet
[0010] Historical data of the battery swapping cabinet is obtained by crawling, and battery data is extracted and stored in the database.
[0011] Step S4: Takeout Data Collection
[0012] We obtained publicly available food delivery data through web scraping, including the order volume and order density of merchants in each block, and stored it in the database.
[0013] Step S5: Data Aggregation
[0014] The data obtained in steps S1 to S4 are aggregated to generate the predicted number of cabinets to be placed in the terminal, heat map latitude and longitude, map block and cabinet placement location data, and block detail data, which can be displayed on the terminal.
[0015] Predicted number of cabinets to be added to a block: Based on 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 the block is then used to determine whether to continue adding cabinets.
[0016] Heat map latitude and longitude: Based on food delivery data and map block data, a heat map is generated by combining food delivery merchants and their order volume within the block to determine the core business area and guide the delivery counters to move closer to the business area;
[0017] Map block and cabinet location data: The distance between the center point of the block and the battery swapping cabinet is used to determine whether it is inside the block, thereby obtaining the block ID corresponding to each battery swapping cabinet and storing it in the database.
[0018] Furthermore, in step S1, the specific steps for data acquisition from the battery swapping cabinet are as follows:
[0019] 1) Identify the battery swapping cabinets on the platform that need to be acquired, and obtain detailed locations of publicly available battery swapping cabinets using web crawlers;
[0020] 2) Confirm the latitude and longitude range of the city through the map, and then take the latitude and longitude of points at intervals of a km, b km, and c km to divide the city into a set of fixed points;
[0021] 3) Obtain the latitude, longitude and name of all battery swapping cabinets in the city based on the fixed-point map, call the API repeatedly, obtain battery swapping cabinet data within a distance of ef meters from the fixed point, and unify the data structure of the obtained data.
[0022] 4) Data cleaning: Encode and decode garbled text, format non-standard data, and delete duplicate data and invalid information for further processing and analysis;
[0023] 5) Record data uniformly, identify and clean it, and store it in the Hive database for data stratification to facilitate subsequent data analysis and processing.
[0024] Furthermore, in step S2, the specific steps for generating the city map data are as follows:
[0025] 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;
[0026] 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;
[0027] use
[0028] Longitude formula: distance * 360 / (2 * π) / cos(radians(lat)) / earth_radius
[0029] The formula for calculating latitude and distance is: distance * 360 / (2 * π) / earth_radius
[0030] 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.
[0031] 3) Limit the calculation range of the block. When the coordinates of the point exceed the city range, stop the next cycle calculation. The limit range is the latitude and longitude range of the city in the map coordinate system. If it is exceeded, stop.
[0032] 4) Secondary verification of latitude and longitude: Take the latitude and longitude vertex coordinates, connect to the map and use inverse latitude and longitude query to check if the block belongs to the city; otherwise, remove the block.
[0033] 5) Data is stored in the database and assigned a unique ID.
[0034] Furthermore, in step S2, the specific steps for calculating the adjacency domain are as follows:
[0035] 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 lower right vertex are (lat2i, lng2i). Then, 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 use the Haversine formula to calculate the distance si between two points on the sphere:
[0036] si = 2 * asin(sqrt(sin((lng2i - lng1i) / 2) ^ 2 + cos(lat1i) * cos(lat2i) * sin((lat2i - lat1i) / 2) ^ 2));
[0037] 2) According to the Pythagorean theorem, the distance between all center points of the adjacent 8-region of each point should be less than or equal to the diagonal length of that region. However, there is a certain error in distance calculation between different maps. Therefore, an additional 0.1 * side length is added to the diagonal length of the region as the basis for judging and calculating the adjacent 8-region regions, that is:
[0038] s′i = si + 0.1 * √2 / 4 * si
[0039] 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 s′i, which is the content of the adjacent domain.
[0040] 5. The point-based cabinet placement method based on data algorithms according to claim 4, characterized in that: in step S2, the specific steps of adjacent 8-domain splicing are as follows:
[0041] 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.
[0042] 2) Store adjacent 8 fields, block data, and block center point data in the same database in MySQL, and record notes.
[0043] Furthermore, in step S2, the steps for calculating the 8th domain model are as follows:
[0044] 1) Data collection and processing
[0045] Historical data on the number of cabinets installed in each of the eight adjacent domains were collected, including the number of cabinets installed in each domain and the climatic conditions and geographical factors that affected the number of cabinets installed. At the same time, offline and online profile data of the battery swapping cabinets were collected. Then, the Pandas library was used to load these data into a DataFrame and perform preprocessing and feature engineering.
[0046] 2) Create training and test sets
[0047] The dataset was divided into a training set and a test set using a random partitioning method, with 80% of the dataset used as the training set and 20% used as the test set.
[0048] 3) Model Training
[0049] The linear regression model can be represented as a prediction for the i-th sample:
[0050] h_theta(x_i)= \theta_0 + \theta_1 x_ {i1} + \theta_2 x_ {i2} + ... +\theta_n x_ {in}
[0051] Where h_theta(x_i) represents the model's prediction for the i-th sample, \theta = [\theta_0, \theta_1, \theta_2, ..., \theta_n] is the model's parameter vector, and x_{i1}, x_{i2}, ..., x_{in} are the n feature values of the i-th sample;
[0052] MSE(\theta) = \frac{1}{2m} \sum_{i=1}^{m} (h_\theta(x_i) - y_i)^2
[0053] The goal is to minimize the mean squared error, which is achieved by adjusting the parameter θ to minimize MSE(θ).
[0054] The parameter update rules for the gradient descent algorithm are as follows:
[0055] \theta_j := \theta_j - \alpha \frac{1}{m} \sum_{i=1}^{m} (h_\theta(x_i) - y_i) x_{ij}
[0056] Where α is the learning rate, which controls the step size for each update;
[0057] According to the above update rules, the parameter \theta is updated iteratively until a good fit is achieved.
[0058] 4) Validate the model
[0059] 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:
[0060] R^2 = 1 - \frac{SS_{res}}{SS_{tot}}
[0061] 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;
[0062] The formula for mean squared error is:
[0063] MSE = \frac{1}{m} \sum_{i=1}^{m} (h_\theta(x_i) - y_i)^2
[0064] Where h_theta(x_i) represents the model's predicted value for the i-th sample, y_i represents the actual target value, and m represents the number of samples;
[0065] 5) Using models for prediction
[0066] By iterating over the parameter \theta, the number of new neighboring domains is predicted, the model is saved, and the model is loaded when new data needs to be predicted.
[0067] Furthermore, in step S4, the specific steps for collecting takeout data are as follows:
[0068] 1) Connect to the corresponding food delivery platform, obtain authorized API data, centrally obtain the order and store area of all food delivery merchants in the city, and organize the order number, merchant latitude and longitude, and store ID data;
[0069] 2) After deduplication and organization, the data is stored in the database by city, and the data is stored in an ODS layer for subsequent applications.
[0070] Furthermore, in step S5, the prediction of the number of battery swapping cabinets in the block is specifically as follows: the latitude and longitude coordinates of the takeaway store, takeaway order data, battery swapping cabinet location and block data are aggregated, the order carrying capacity of the area is estimated through takeaway orders, the daily order volume of a single takeaway person is preset, the number of people required for delivery in the area is obtained, and the maximum number of battery swapping cabinets in the area is obtained based on the cabinet efficiency and the number of people served by a single cabinet, so as to determine whether the area should be included or excluded.
[0071] Furthermore, in step S5, the specific operation for generating the latitude and longitude of the heatmap is as follows: To ensure compatibility with the front-end display, the back-end processing integrates the data into heatmap data. The display method involves taking blocks with an area of 5% of the original block size and merging them into a single irregular block data to display the heatmap information. The specific steps are as follows:
[0072] i) Generate blocks that are 5% the size of the original blocks, using the same method as the city map data generation;
[0073] ii) Integrate all food delivery shops into multiple clusters using K-Means, and integrate the blocks containing these clusters into an irregular polygonal block;
[0074] iii) Use the wheel rolling method to depict the latitude and longitude of the outer vertices of the block, and arrange them in order;
[0075] iv) Record all data and enter the data.
[0076] Beneficial effects: The beneficial effects of this invention are as follows:
[0077] (1) It greatly reduces the time and cost for business personnel to find counter locations;
[0078] (2) Help business personnel find the best cabinet placement location to improve accuracy;
[0079] (3) Help relevant enterprises optimize the layout of cabinet locations and adjust the number of cabinets in a timely manner to adapt to market changes. Attached Figure Description
[0080] Appendix Figure 1 This is a structural block diagram of the point-based cabinet placement method of the present invention;
[0081] Appendix Figure 2 This is a simplified flowchart of the point-to-cabinet placement method of the present invention;
[0082] Appendix Figure 3 A schematic diagram of the structure for simulating the heat map of urban map points. Detailed Implementation
[0083] The invention will now be further described with reference to the accompanying drawings.
[0084] As attached Figure 1 Appendix Figure 2 and appendix Figure 3 As shown, a point-based cabinet placement method based on data algorithms is characterized by the following specific steps:
[0085] Step S1: Data Acquisition from Battery Swapping Cabinet
[0086] Data on publicly available sites and battery swapping cabinets from different brands are obtained through web scraping, including site location and type. The data is then normalized and stored in a database.
[0087] In step S1, the specific steps for data acquisition from the battery swapping cabinet are as follows:
[0088] 1) Identify the battery swapping cabinets on the platform that need to be acquired, and obtain detailed locations of publicly available battery swapping cabinets using web crawlers;
[0089] 2) Confirm the city's latitude and longitude range using a map, and then take the latitude and longitude of points at intervals of a km, b km, and c km to divide the city into fixed point sets; where a is 2, b is 1, and c is 0.5.
[0090] 3) Obtain the latitude, longitude, and names of all battery swapping stations in the city based on the fixed-point map, repeatedly call the API, obtain battery swapping station data within an ef-meter range centered on the fixed point, and unify the data structure of the obtained data; where e is 500 and f is 2000.
[0091] 4) Data cleaning: Encode and decode garbled text, format non-standard data, and delete duplicate data and invalid information for further processing and analysis;
[0092] 5) Record data uniformly, identify and clean it, and store it in the Hive database for data stratification to facilitate subsequent data analysis and processing.
[0093] Step S2: City map data generation
[0094] 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 generated map blocks are subjected to adjacent 8-domain calculations to obtain adjacent 8-domain content. The adjacent 8-domain content is then stitched together and stored in the database. Finally, the adjacent 8-domain calculations are used to construct the cabinet model.
[0095] In step S2, the specific steps for generating city map data are as follows:
[0096] 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;
[0097] 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;
[0098] use
[0099] Longitude formula: distance * 360 / (2 * π) / cos(radians(lat)) / earth_radius
[0100] The formula for calculating latitude and distance is: distance * 360 / (2 * π) / earth_radius
[0101] 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.
[0102] 3) Limit the calculation range of the block. When the coordinates of the point exceed the city range, stop the next cycle calculation. The limit range is the latitude and longitude range of the city in the map coordinate system. If it is exceeded, stop.
[0103] 4) Secondary verification of latitude and longitude: Take the latitude and longitude vertex coordinates, connect to the map and use inverse latitude and longitude query to check if the block belongs to the city; otherwise, remove the block.
[0104] 5) Data is stored in the database and assigned a unique ID.
[0105] In step S2, the specific steps for calculating the adjacent 8-domain are as follows:
[0106] 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 lower right vertex are (lat2i, lng2i). Then, 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 use the Haversine formula to calculate the distance si between two points on the sphere:
[0107] si = 2 * asin(sqrt(sin((lng2i - 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 of the adjacent 8-region of each point should be less than or equal to the diagonal length of that region. However, there is a certain error in distance calculation between different maps. Therefore, an additional 0.1 * side length is added to the diagonal length of the region as the basis for judging and calculating the adjacent 8-region regions, that is:
[0109] s′i = si + 0.1 * √2 / 4 * si
[0110] 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 s′i, which is the content of the adjacent domain.
[0111] In step S2, the specific steps for concatenating the 8 neighboring domains are as follows:
[0112] 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.
[0113] 2) Store adjacent 8 fields, block data, and block center point data in the same database in MySQL, and record notes.
[0114] In step S2, the calculation steps for the 8-domain model are as follows:
[0115] 1) Data collection and processing
[0116] Historical data on the number of swapping cabinets in each of the eight adjacent domains were collected, including the number of cabinets in each domain and the climatic conditions and geographical factors that affected the number of cabinets. At the same time, offline and online profile data of the swapping cabinets were collected. Then, the Pandas library was used to load these data into a DataFrame and perform preprocessing and feature engineering.
[0117] Data preprocessing is as follows:
[0118] a. Data cleaning: Fill in missing values in the offline and online data of the battery swapping cabinet;
[0119] Data transformation: Compress the data volume of a large number of competitive pairs in the adjacent domains, popular paths, and food delivery heatmaps to improve usability;
[0120] b. Data normalization: Unify the dimensions of the data and normalize all data.
[0121] Feature engineering is as follows:
[0122] a. Feature selection: Select features that affect the number of lockers in the adjacent 8 areas from the collected data, including the number of people swapping batteries, area density, food delivery density, and locker efficiency;
[0123] b. Feature construction: Based on the relationships between domain knowledge or data, intersect mutually independent vectors to obtain new features;
[0124] c. Feature encoding: Converting categorical features into numerical representations so that the model can process them.
[0125] 2) Create training and test sets
[0126] The dataset was divided into a training set and a test set using a random partitioning method, with 80% of the dataset used as the training set and 20% used as the test set.
[0127] 3) Model Training
[0128] The linear regression model can be represented as a prediction for the i-th sample:
[0129] h_theta(x_i)= \theta_0 + \theta_1 x_ {i1} + \theta_2 x_ {i2} + ... +\theta_n x_ {in}
[0130] Where h_theta(x_i) represents the model's prediction for the i-th sample, \theta = [\theta_0, \theta_1, \theta_2, ..., \theta_n] is the model's parameter vector, and x_{i1}, x_{i2}, ..., x_{in} are the n feature values of the i-th sample;
[0131] MSE(\theta) = \frac{1}{2m} \sum_{i=1}^{m} (h_\theta(x_i) - y_i)^2
[0132] The goal is to minimize the mean squared error, which is achieved by adjusting the parameter θ to minimize MSE(θ).
[0133] The parameter update rules for the gradient descent algorithm are as follows:
[0134] \theta_j := \theta_j - \alpha \frac{1}{m} \sum_{i=1}^{m} (h_\theta(x_i) - y_i) x_{ij}
[0135] Where α is the learning rate, which controls the step size for each update;
[0136] According to the above update rules, the parameter \theta is updated iteratively until a good fit is achieved.
[0137] 4) Validate the model
[0138] 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:
[0139] R^2 = 1 - \frac{SS_{res}}{SS_{tot}}
[0140] 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;
[0141] The formula for mean squared error is:
[0142] MSE = \frac{1}{m} \sum_{i=1}^{m} (h_\theta(x_i) - y_i)^2
[0143] Where h_theta(x_i) represents the model's predicted value for the i-th sample, y_i represents the actual target value, and m represents the number of samples;
[0144] 5) Using models for prediction
[0145] By iterating over the parameter \theta, the number of new neighboring domains is predicted, the model is saved, and the model is loaded when new data needs to be predicted.
[0146] Step S3: Obtain historical data of the battery swapping cabinet
[0147] Historical data of the battery swapping cabinet is obtained by crawling, and battery data is extracted and stored in the database.
[0148] Step S4: Takeout Data Collection
[0149] We obtained publicly available food delivery data through web scraping, including the order volume and order density of merchants in each block, and stored it in a database.
[0150] In step S4, the specific steps for collecting takeout data are as follows:
[0151] 1) Connect to the corresponding food delivery platform, obtain authorized API data, centrally obtain the order and store area of all food delivery merchants in the city, and organize the order number, merchant latitude and longitude, and store ID data;
[0152] 2) After deduplication and organization, the data is stored in the database by city, and the data is stored in an ODS layer for subsequent applications.
[0153] Step S5: Data Aggregation
[0154] The data obtained in steps S1 to S4 are aggregated to generate the predicted number of cabinets to be placed in the terminal, heat map latitude and longitude, map block and cabinet placement location data, and block detail data, which can be displayed on the terminal.
[0155] Predicted number of cabinets to be added to a block: Based on 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 the block is then used to determine whether to continue adding cabinets.
[0156] Heat map latitude and longitude: Based on food delivery data and map block data, a heat map is generated by combining food delivery merchants and their order volume within the block to determine the core business area and guide the delivery counters to move closer to the business area;
[0157] Map block and cabinet location data: The distance between the center point of the block and the battery swapping cabinet is used to determine whether it is inside the block, thereby obtaining the block ID corresponding to each battery swapping cabinet and storing it in the database.
[0158] In step S5, the prediction of the number of cabinets in a block is specifically as follows: the latitude and longitude of the takeaway store, takeaway order data, battery swapping cabinet location and block data are aggregated, the order carrying capacity of the area is estimated through takeaway orders, the daily order volume of a single takeaway person is preset, the number of people required for delivery in the block is obtained, and the maximum number of battery swapping cabinets in the area is obtained based on cabinet efficiency and the number of people served by a single cabinet, so as to determine whether the block is included or excluded.
[0159] In step S5, the specific operation for generating the latitude and longitude of the heatmap is as follows: To ensure compatibility with the front-end display, the back-end processing integrates the data into heatmap data. The display method involves taking blocks with an area of 5% of the original block size and merging them into a single irregular block data to display the heatmap information. The specific steps are as follows:
[0160] i) Generate blocks that are 5% the size of the original blocks, using the same method as the city map data generation;
[0161] ii) Integrate all food delivery shops into multiple clusters using K-Means, and integrate the blocks containing these clusters into an irregular polygonal block;
[0162] iii) Use the wheel rolling method to depict the latitude and longitude of the outer vertices of the block, and arrange them in order;
[0163] iv) Record all data and enter the data.
[0164] This invention constructs a cabinet placement model based on big data and artificial intelligence technologies. This model guides the site selection of urban battery swapping stations, thereby finding the optimal placement location. Its advantages are summarized as follows:
[0165] (1) It greatly reduces the time and cost for business personnel to find counter locations;
[0166] (2) Help business personnel find the best cabinet placement location to improve accuracy;
[0167] (3) Help relevant enterprises optimize the layout of cabinet locations and adjust the number of cabinets in a timely manner to adapt to market changes.
[0168] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A data algorithm-based point location cabinet-falling method, characterized in that: The specific steps are as follows: Step S1: data collection of battery swap cabinets Through the crawler, the existing site and battery swap cabinet data of different brands are obtained, including site location, type, and the data is normalized and stored in the database; Step S2: city map data generation Use the map to obtain the city longitude and latitude, divide the city into several blocks according to the longitude and latitude, assign a unique id to each block and store it in the database, perform local 8 domain calculation on the generated map blocks, obtain the local 8 domain content, splice the local 8 domain content and store it in the database, and build the cabinet model through local 8 domain calculation; In step S2, the steps of local 8 domain model calculation are as follows: 1) Data collection and processing Collect historical data of the number of battery swap cabinets in the local 8 domain, including the number of battery swap cabinets in each local 8 domain and the climate conditions and geographical location factors affecting the number of battery swap cabinets, and at the same time, collect the offline and online portrait data of the battery swap cabinet, then use the Pandas library to load these data into DataFrame and perform preprocessing and feature engineering; 2) Create training set and test set Divide the data set into training set and test set, use random division method, use 80% of the data set as training set and 20% as test set; 3) Model training The function of the linear regression model is represented as the prediction of the i-th sample: h_theta(x_i)= \theta_0 + \theta_1 x_ {i1} + \theta_2 x_ {i2} +... + \theta_n x_ {in} Where h_theta(x_i) represents the predicted value of the i-th sample, \theta = [\theta_0,\theta_1,\theta_2,…,\theta_n] is the parameter vector of the model, and x_{i1}, x_{i2},..., x_{in} are the n feature values of the i-th sample; MSE(\theta) = \frac{1}{2m} \sum_{i=1}^{m} (h_\theta(x_i) - y_i)^2 The goal is to minimize the mean square error, and by adjusting the parameters \theta, the MSE(\theta) is minimized; The parameter update rule of the gradient descent algorithm is as follows: \theta_j := \theta_j - \alpha \frac{1}{m} \sum_{i=1}^{m} (h_\theta(x_i) -y_i) x_{ij} Where \alpha is the learning rate, controlling the step size of each update; According to the above update rule, the parameters \theta are repeatedly updated until the fitting degree is reached; 4) Verify the model After training, use the mean square error and the determination coefficient of the test set to evaluate the performance of the model, where: the determination coefficient is used to measure the explanatory power of the model to the target variable, and its mathematical formula is as follows: R^2 = 1 - \frac{SS_{res}}{SS_{tot}} Wherein, SS_{res} represents residual sum of squares, the sum of squares of the difference between the model predicted value and the actual value, SS_{tot} represents total square, the total variance of the target variable; The formula of mean square error is: MSE = \frac{1}{m} \sum_{i=1}^{m} (h_\theta(x_i) - y_i)^2 Wherein, h_\theta(x_i) represents the predicted value of the model for the ith sample, y_i represents the actual target value, and m represents the number of samples; 5) Use the model to make predictions Through the iterative parameters \theta, predict the new cabinet number in the prediction area, save the model, and load the model when new data needs to be predicted; Step S3: Obtain the historical data of the battery swap cabinet Obtain the historical data of the battery swap cabinet through crawling, and store the battery data extracted therefrom into a database; Step S4: Take-out data collection Obtain public take-out data through crawling, including the longitude and latitude of each block, the order quantity of each block, and the order density, and store them into a database; Step S5: Data aggregation Aggregate the data obtained in steps S1 to S4 to generate predicted block cabinet number, heat map longitude and latitude, map block and cabinet point data, and block detail data that can be displayed on a terminal, wherein: Predicted block cabinet number: based on the historical cabinet efficiency and the number of cabinets in the block, and the take-out data order quantity in the block, obtain the maximum carrying capacity of the cabinet in the block, to determine whether the cabinet continues to fall in the block; Heat map longitude and latitude: based on the take-out data and the map block data, form a heat map of the take-out merchants and the order quantity of the merchants in the block to determine the core business district and guide the cabinet to move closer to the business district; Map block and cabinet point data: determine whether it is within the block by using the distance between the block center point and the battery swap cabinet, to obtain the block id corresponding to each battery swap cabinet, and record and store it in the database.
2. The data algorithm-based point location method of claim 1, wherein: In step S1, the specific steps of battery swap cabinet data collection are as follows: 1) Confirm the platform battery swap cabinet that needs to be obtained, and obtain the detailed drop point of the battery swap cabinet based on crawling; 2) Confirm the longitude and latitude range of the city through the map, and then take the longitude and latitude of the point at intervals of a kilometers, b kilometers and c kilometers to divide the city into a set of fixed points; 3) Obtain the longitude and latitude and name of all battery swap cabinets in the city according to the fixed point set map, cyclically call the API, obtain the battery swap cabinet data within e-f meters from the fixed point as the center, and unify the data structure of the obtained data; 4) Data cleaning: encode and decode the garbled text, format the data with non-standard format, delete duplicate data and invalid information, so as to further process and analyze; 5) Unified record storage: store the cleaned data in the hive database for data layering, so as to facilitate subsequent data analysis and processing.
3. The data algorithm-based point location binning method of claim 1, wherein: In step S2, the specific steps of generating city map data are as follows: 1) Obtain the longitude and latitude of each city range in the gcj02 map coordinate system, and take the longitude and latitude of the city government as the starting point; 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; Use Distance longitude formula: distance * 360 / (2 * π) / cos(radians(lat)) / earth_radius Distance latitude formula: distance * 360 / (2 * π) / earth_radius Calculate the longitude and latitude of the corresponding four points, get the four diagonal points, that is, the upper left, upper right, lower right and lower left, calculate the four diagonal points according to the distance longitude and distance latitude formula and the longitude and latitude of the four points, record the four diagonal coordinates, and loop until the city block coordinates are obtained; 3) Limit the calculation range of the block, 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; 4) Secondary verification of longitude and latitude, take the longitude and latitude vertex coordinates, access the map inverse longitude and latitude query to verify whether the block is the city, otherwise remove the block; 5) Data storage and corresponding unique id.
4. The data algorithm-based point location binning method of claim 3, wherein: In step S2, the specific steps of the proximity domain calculation are as follows: 1) Calculate the proximity block data coordinates based on the generated map square block, get the center point s of each square block i, i represents the serial number of the square block; The longitude and latitude of the top vertex of the block i is (lat1i, lng1i), and the longitude and latitude of the lower right 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 the Haversine formula to calculate the distance si between two points on a sphere: si = 2 * asin(sqrt(sin((lng2i - lng1i) / 2) ^ 2 + cos(lat1i) * cos(lat2i)* sin((lat2i - lat1i) / 2) ^ 2)); 2) According to the Pythagorean theorem, the distance of all center points of each point in the proximity domain 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* side length is added to the diagonal length of the block as the basis for calculating the proximity domain block, that is: s′i= si + 0.1* √2 / 4 * si 3) Calculate the distance between the center points of all blocks, take all the center points of the full amount of data within s′i, which is the proximity domain content.
5. The data algorithm-based point location binning method of claim 4, wherein: In step S2, the specific steps of the proximity domain splicing are as follows: 1) After calculating the center point of the proximity domain, take the center point corresponding to the city block id, splice and sort out the proximity domain corresponding to each block, and keep the record; 2) In the mysql, the temporary 8 fields and the block data and the block center point data are stored in the same database, and the remarks are recorded.
6. The data algorithm-based point location binning method of claim 1, wherein: In step S4, the specific steps of take-out data collection are as follows: 1) 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 arrange the order number, merchant latitude and longitude, and store id data; 2) After data deduplication and arrangement, store by city, store hierarchical ODS layer data for subsequent application.
7. The data algorithm-based point location binning method of claim 1, wherein: In step S5, the specific operation of generating the heat map latitude and longitude is as follows: In order to be compatible with the front end display, the data is integrated into the heat map data during the back end processing. The display method is to take the block size of 5% of the original block area to combine into an irregular block data, and to display the heat map information. The specific steps are as follows:
8. The data algorithm-based point location binning method of claim 1, wherein: i) Generate a block with a size of 5% of the original block according to the city map data generation method; ii) Integrate all take-out stores into multiple clusters by K-Means, and integrate the blocks where these clusters exist into an irregular polygon block; iii) Use the rolling method to describe the latitude and longitude of the outer vertices of the block, and arrange them in order; iv) Record the total data and input the data.
Citation Information
Patent Citations
Regional order analysis method and system and computer readable medium
CN112288550A
Method and system for adaptive incremental site selection of urban service facilities
CN115545758A