A method for public facility location selection based on simulated annealing and Monte Carlo method
Through the public facility site selection method based on simulated annealing and Monte Carlo method, the problem of low accuracy and efficiency in complex problems in the prior art site selection algorithm is solved, and efficient and accurate site selection is achieved in a controlled time. Suitable for complex geographical environments and dynamic population data.
Patent Information
- Application Number
- CN202310793369.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2043-06-30
AI Technical Summary
The existing site selection algorithms have problems such as loss of accuracy, high computational complexity, sensitivity to parameter settings and poor interpretation when dealing with complex problems, especially in large-scale problems, which are difficult to achieve efficient and accurate site selection of public facilities.
Using public facilities site selection methods based on simulated annealing and Monte Carlo methods, the geographic data is discretized, and the candidate point set is calculated using the Monte Carlo method, and the site selection points are optimized using the simulated annealing algorithm to ensure that they are controlled. Improve site selection accuracy within time complexity.
This method is applicable under complex external conditions, greatly optimizes the computing efficiency, ensures the geographical coverage and public accessibility of the site selection results, avoids local optimal solutions, reduces site selection costs, and improves the efficiency of the algorithm and applicability.
Smart Images

Figure CN116862737B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of computer technology, and in particular to a public facility site selection method based on simulated annealing and Monte Carlo methods. Background Art
[0002] In the field of computer-aided design, site selection technology refers to the ability to find the best location from a large number of data points, which requires an efficient and accurate algorithm. Currently, the commonly used site selection algorithms include algorithms based on random processes, algorithms based on exhaustive enumeration, and algorithms based on optimization, but these three algorithms have the following problems:
[0003] 1. The algorithm based on random process is a method based on probability theory analysis. It analyzes data from the perspective of importance and availability according to resource availability and performance requirements, and ultimately achieves the best location. The disadvantage of this algorithm is that the valuation process of converting deterministic problems into random problems will make the results lose precision, and it is difficult to establish accurate boundary conditions for complex problems.
[0004] 2. Based on exhaustive algorithms, the optimal solution is found by enumerating all possible solutions. The advantages of this method are that it is simple to understand and easy to implement, and it can get an exact solution for small-scale problems. However, the disadvantages of exhaustive algorithms are also obvious. As the scale of the problem increases, the search space grows exponentially, the computational complexity is very high, and it is not applicable to large-scale problems.
[0005] 3. Based on the optimization algorithm, the product can be effectively located according to its own performance characteristics. Generally, a large amount of complex data is simplified by using methods such as simulated annealing, genetic algorithms, neural networks, etc., so that the algorithm can be effectively and efficiently implemented. The disadvantage is that the algorithm is sensitive to parameter settings, has poor interpretability, and it is difficult to ensure convergence to the optimal point. Summary of the invention
[0006] The present invention provides a method for selecting a public facility site based on simulated annealing and Monte Carlo methods, a technical solution for selecting the best public resource facility address based on dynamic population data and geographic information data, and an optimization algorithm is used within a controllable time complexity to improve the accuracy of facility site selection as much as possible.
[0007] The present invention provides a method for selecting a public facility site based on simulated annealing and Monte Carlo method, comprising the following steps:
[0008] Discretize geographic data information to obtain regional grid data;
[0009] Input dynamic population data point information and perform population weighted assignment;
[0010] Determine the search scope based on the coverage of public facilities and the planning area, conduct a grid traversal search, and obtain candidate site selection points;
[0011] Calculate the best candidate point set from the candidate site selection points using the Monte Carlo method;
[0012] The best candidate point set is optimized using a simulated annealing method to obtain a population distance weighted and minimum candidate point result set.
[0013] Furthermore, the geographic data information is discretized to obtain regional grid data, specifically:
[0014] The geographic information stored as data is converted into shapefile map data of the target area through the geographic information system;
[0015] Import the map data file through geopandas, load and process the information of at least relative position, longitude and latitude, and weight of relevant data points;
[0016] Specify the coordinate reference system CRS of the map data file as the global positioning system coordinate system EPSG:4326, input the spatial reference, and perform data standardization;
[0017] Define the map boundaries, set the number of vertical and horizontal grids, and determine the map generation method, accuracy, and generation boundary conditions;
[0018] Draw to generate rasterized map.
[0019] Furthermore, the dynamic population data point information is input to perform population weighted assignment, specifically:
[0020] Import dynamic population data points and assign 1:1 weighted values to the data points according to the population size. The more people there are, the higher the weight of the data point will be. A series of population weighted centroids w1, w2, w3, w4… will be obtained on the map grid.
[0021] Furthermore, the search range is defined according to the coverage of public facilities and the planning area, and a grid traversal search is performed to obtain candidate site selection points, specifically:
[0022] Taking the population data point as the center of the circle, it represents that this point is the population gathering point. The population number represents the population heat of the gathering point. The larger the population number, the higher the weight value of the gathering point. The maximum coverage range of public facilities is specified as the radius to draw a circle, and the unavailable planning area within the circle is eliminated. This is the available planning area. A search area is generated within the available planning area and divided into data grids. The data grids are traversed to obtain a list of site selection points and the gathering points they contain, and a set of candidate site selection points is generated.
[0023] Furthermore, the Monte Carlo method is used to calculate the best candidate point set from the candidate site selection points, specifically:
[0024] In the case where the sum of the population weight values within the site selection range does not exceed the upper limit of the public facility capacity, the coordinates of the candidate points and the population data points they cover are recorded to obtain all feasible candidate point sets;
[0025] Taking all possible combinations of population points covered by the candidate point set as input, randomly select a circle that can contain each point, obtain a random sample of the corresponding circle, and obtain the distance weight value of the random sample;
[0026] Each point has a to b circle centers. Based on each random sample, an approximate area value is obtained, which is f(xi)*(ba), where f(xi) represents the area value of each sample, and a and b represent the front and back ranges of this random sample. After completing the Monte Carlo integration, the average result S of the random sample is obtained. This formula helps us understand the use of Monte Carlo integration to achieve site selection. The formula is:
[0027]
[0028] Further infer that random samples are sampled from each of the n points, and the probability distribution is obtained by sampling through uniform distribution, where θ represents the optimal result that can be obtained:
[0029]
[0030] Furthermore, the simulated annealing method is used to optimize the best candidate point set to obtain a population distance weighted and minimum candidate point result set, specifically:
[0031] Taking the optimal point set combination as input, the simulated annealing algorithm is used to further optimize the candidate point selection. Combining the probability jump characteristics, the global optimum of the objective function is randomly found in the solution space. If the new solution is better than the current solution, the new solution is accepted. Otherwise, based on the Metropolis criterion, if ΔE<0 (the new solution is better), the new solution is accepted and used as the current solution; if ΔE>0 (the new solution is worse), the new solution is accepted with probability exp(-ΔE / T). Generate a random number r between [0,1]. If r is less than or equal to exp(-ΔE / T), the new solution is accepted. Otherwise, the current solution remains unchanged. The acceptance probability formula is:
[0032]
[0033] Where P represents the iteration probability, kT is the system temperature coefficient, Et is the system energy value of the previous iteration, and Et+1 is the system energy value of this iteration.
[0034] At least one of the above technical solutions adopted in the embodiments of the present invention can achieve the following beneficial effects:
[0035] 1. Through the discretization of geographic data information and step-by-step modeling of non-deterministic problems, the ray method is used to solve the need to exclude special locations under realistic conditions, thus ensuring the applicability of the present invention under complex external conditions.
[0036] 2. The Monte Carlo method is used to calculate possible combinations of site selection points, which greatly optimizes the computational efficiency of non-deterministic problems. Compared with the traversal method, it greatly reduces the calculation time and can meet the needs of a large number of public resource site selection planning.
[0037] 3. Combine the simulated annealing algorithm to optimize the site selection points to ensure the geographical coverage and public accessibility of the site selection results, and prevent the situation where some areas have high coverage and dense facilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0039] Figure 1 The figure is a flow chart of a method according to an embodiment of the present invention.
[0040] Figure 2 The present invention uses the Monte Carlo method to calculate a schematic diagram that can cover all population data points.
[0041] Figure 3 This is a coordinate diagram of the present invention that eliminates some areas where it is not possible to select a site for public facilities. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the specific embodiments of the present invention and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0043] The technical solutions provided by various embodiments of the present invention are described in detail below in conjunction with the accompanying drawings.
[0044] like Figure 1 The present invention provides a method for selecting a public facility site based on simulated annealing and Monte Carlo method, comprising the following steps:
[0045] Discretize geographic data information to obtain regional grid data;
[0046] Input dynamic population data point information and perform population weighted assignment;
[0047] Determine the search scope based on the coverage of public facilities and the planning area, conduct a grid traversal search, and obtain candidate site selection points;
[0048] Calculate the best candidate point set from the candidate site selection points using the Monte Carlo method;
[0049] The best candidate point set is optimized using a simulated annealing method to obtain a population distance weighted and minimum candidate point result set.
[0050] The present invention aims to find the optimal site for public facilities without exceeding the maximum load limit of public facilities, which can be reduced to the following equation:
[0051]
[0052] The meanings of the three equations are as follows: the sum of the weighted population values within a single site selection circle shall not exceed the carrying capacity limit of the site selection area; while covering all population points, i site selection points with the minimum number of public facilities to be built shall be selected as much as possible; when it is determined that i site selection points are needed, the sum of the product of the weighted population value of the population data point and the distance from the population data point to the public facility shall be minimized.
[0053] First, according to the map scale information and business needs, the regional geographic information data is discretized and the available planning area is generated as a raster matrix. The operation example is as follows:
[0054] (1) Converting geographic information stored as data into shapefile map data of the target area through the geographic information system;
[0055] (2) Import the map data file through geopandas, load and process the relative position, longitude and latitude, weight and other information of relevant data points;
[0056] (3) Specify the coordinate reference system (CRS) of the map data file as the Global Positioning System coordinate system (EPSG:4326), input the spatial reference, and perform data standardization;
[0057] (4) Define the map boundary, set the number of vertical and horizontal grids, and determine the map generation method, accuracy, and generation boundary conditions;
[0058] (5) Draw and generate a raster map.
[0059] Secondly, dynamic population data points are imported and weighted according to the population size. The more people there are, the higher the weight of the data point is. A series of population weighted centroids w1, w2, w3, w4… are obtained on the map grid.
[0060] Draw a circle with the population centroid as the center and the maximum coverage of public facilities as the radius. Generate a search area with the union of the available planning areas, traverse the data grid, generate candidate points for site selection, and avoid some special areas. Use the ray method to draw a ray with the target point as the endpoint, and calculate the number of intersections between this ray and all the edges of the polygon. If the number of intersections is an odd number, the point is inside the polygon, otherwise it is outside the polygon. This method can be used to eliminate some areas where public facilities may not be able to be sited, combined with Figure 3 The specific implementation process is as follows:
[0061] 1. Determine a ray that shoots to the right from point P, calculate the intersection of the ray with each edge of the polygon, and count the number of intersections.
[0062] 2. If the number of intersection points is odd, then point P is inside the polygon; if the number of intersection points is even, then point P is outside the polygon.
[0063] 3. When calculating the intersection, it is only necessary to calculate when the ray and the edge have an intersection. At this time, it is necessary to determine whether the intersection is on the left side of point P. The cross product between vectors is used to determine whether there is any relevant overlap between the line segments. A and B represent an extended vector radiating outward from a public facility, and B represents the boundary of an area. The calculation formula for the cross product of the two vectors A and B is
[0064] A×B=|A||B|sinθ
[0065] Through the different values of the cross product results, we can confirm whether the extended vector and the boundary have a focus and determine whether they are within the specified range.
[0066] The pseudo code example is as follows:
[0067]
[0068] Next, when the sum of the population weight values within the site selection range does not exceed the upper limit of the public facility capacity, the coordinates of the candidate points and the population data points they cover are recorded to obtain all feasible candidate point sets.
[0069] The pseudo code is as follows:
[0070]
[0071]
[0072] Then, taking all the possible combinations of candidate point sets covering population points as input, the Monte Carlo method is used to calculate the candidate point set combination with the least number of candidate points in the common area that can cover all population data points. The Monte Carlo method here is to use the assumption that there is at least one circle that can contain each point, and randomly select a circle that can contain it at each point, such as Figure 2 As shown, the circle with point 1 as the center includes point 1 and point 2.
[0073] Each point has a to b circle centers. Based on each random sample, an approximate area value is obtained, which is f(xi)*(ba), where f(xi) represents the area value of each sample, and a and b represent the front and back ranges of this random sample. After completing the Monte Carlo integration, the average result S of the random sample is obtained. This formula helps us understand the use of Monte Carlo integration to achieve site selection. The formula is:
[0074]
[0075] Assume that there are currently four points that need to calculate the optimal solution, and four random samples of circles x1, x2, x3, x4 are obtained. At the same time, the distance weight values of these four samples f(x1), f(x2), f(x3), f(x4) can also be obtained. Then the Monte Carlo integral is:
[0076]
[0077] Further infer that random samples are sampled from each of the n points, and the probability distribution is obtained by sampling through uniform distribution, where θ represents the optimal result that can be obtained:
[0078]
[0079] And as the number of sampling points increases, the estimated values will become closer and closer, and closer to the optimal center solution we want to obtain.
[0080] The pseudo code is as follows:
[0081]
[0082] #Output the weighted sum of candidate point coordinates and distance and population
[0083] Finally, with the optimal point set combination as input, the simulated annealing algorithm is used to further optimize the candidate point selection, so that the sum of the population weighted value multiplied by the distance is minimized, achieving the planning goal of optimal efficiency. Combined with the probability jump characteristic, the global optimum of the objective function is randomly searched in the solution space. If the new solution is better than the current solution, the new solution is accepted. Otherwise, based on the Metropolis criterion, if ΔE<0 (the new solution is better), the new solution is accepted and used as the current solution; if ΔE>0 (the new solution is worse), the new solution is accepted with probability exp(-ΔE / T). Generate a random number r between [0,1]. If r is less than or equal to exp(-ΔE / T), the new solution is accepted. Otherwise, the current solution remains unchanged.
[0084]
[0085] In the above formula, P represents the iteration probability, kT is the system temperature coefficient, Et is the energy value of the system in the previous iteration, and Et+1 is the energy value of the system in this iteration. For example, in the iteration process, assuming that the starting state is A, as the number of iterations increases, the system updates to state B. At this time, the overall system energy is lower than A, which means that it is close to the optimal solution, so it is 100% transferred; if the state reaches B, it is found that the energy of the next step has increased, and here the probability exp(-ΔE / T) will be used to decide whether to jump out of state B to reach C, and it will continue to reach a series of subsequent states with a certain probability, and finally stabilize. Obtain the required global optimal point selection information.
[0086] The pseudo code for this process is as follows:
[0087]
[0088]
[0089] According to the test of randomly generated test sets in the actual map grid, using fifty random data points, this algorithm can obtain fewer and optimal site selection points in a shorter time, while taking into account efficiency and social cost:
[0090] Algorithm Type It takes time Number of resultant site selection points Population distance weighted sum Traversal 8312.7 seconds 21 5882.09 Greedy Algorithm 312 seconds 34 3409.12 The present invention 601.2 seconds 22 5513.85
[0091] In summary, the present invention generates a site selection scheme that is optimized as much as possible while avoiding falling into a local optimal solution as much as possible, reduces site selection costs, improves the efficiency of the algorithm facility site selection optimization algorithm, and completes all calculation processes within a controllable time; it can adapt to complex geographical environments and dynamic population data. For example, in the site selection stage, by controlling the site selection accuracy, the step size of a single site selection can be expanded or reduced to meet detailed or approximate site selection requirements; in the final site selection candidate point, the Monte Carlo method is used to control the time of the site selection output result and the result obtained is relatively good. Finally, the annealing algorithm ensures that the site selection result is the global optimal solution of the current result.
[0092] The above description is only an embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.
Claims
1. A method for selecting a public facility site based on simulated annealing and Monte Carlo method, characterized in that: The following steps are involved: Discretize the geographic data information to obtain regional grid data, specifically: convert the geographic information stored as data into shapefile map data of the target area through the geographic information system; Import the map data file through geopandas, load and process the information of at least the relative position, longitude and latitude, and weight of the relevant data points; specify the coordinate reference system CRS of the map data file as the global positioning system coordinate system EPSG:4326, input the spatial reference, and perform data standardization; define the map boundary, set the number of vertical and horizontal grids, determine the map generation method, accuracy, and generation boundary conditions; draw and generate a rasterized map; Input the location information of dynamic population data points and perform population weighted assignment; specifically: import dynamic population data points and assign 1:1 weighted values to the data points according to the population. The more people there are, the higher the weight value of the data point will be. A series of population weighted centroids will be obtained on the map grid; The search range is defined according to the coverage range of public facilities and the planning area, and a grid traversal search is performed to obtain candidate site selection points; specifically: the population data point is taken as the center of the circle, representing this point as a population gathering point, where the population number represents the population heat of the gathering point, and the larger the population number, the higher the weight value of the gathering point, and the maximum coverage range of public facilities is designated as the radius to draw a circle, and the unavailable planning area within the circle is removed, and this is used as the available planning area, and a search area is generated within the available planning area, and divided into data grids, and the data grids are traversed to obtain a list of site selection points and the gathering points contained therein, and a set of candidate site selection points is generated; The Monte Carlo method is used to calculate the best candidate point set from the candidate site selection points; when the sum of the population weight values within the site selection range does not exceed the upper limit of the public facility capacity, the candidate point coordinates and the population data points covered by them are recorded in this case, so as to obtain all feasible candidate point sets; taking all the possible combinations of covered population points of the candidate point set as input, a circle that can contain this point is randomly selected at each point to obtain a random sample of the corresponding circle, and at the same time, the distance weight value of the random sample is obtained; it is defined that each point has a to b circle centers, and an approximate area value is obtained based on each random sample, the size of which is f(xi)*(ba), where f(xi) represents the area value of each sample, and a and b represent the front and back ranges of this pile of random samples. After completing the Monte Carlo integration, the average result S of the random sample is obtained, and the data expectation is obtained, which is as follows: Further inferring that random samples are sampled from each of the n points, the probability distribution is obtained by sampling through uniform distribution, which represents the optimal result that can be obtained: ; The best candidate point set is optimized using the simulated annealing method to obtain the population distance weighted and minimum candidate point result set; the best point set combination is used as input, and the candidate point selection is further optimized using the simulated annealing algorithm. The global optimum of the objective function is randomly found in the solution space in combination with the probability jump characteristic. If the new solution is better than the current solution, the new solution is accepted. Otherwise, based on the Metropolis criterion, if ∆E < 0, it means that the new solution is better, and the new solution is accepted as the current solution; if ∆E> 0, it means that the new solution is worse, and the new solution is accepted with probability exp(-∆E / T), and a random number r between [0,1] is generated. If r is less than or equal to exp(-∆E / T), the new solution is accepted, otherwise the current solution remains unchanged. The acceptance probability formula is: Where P represents the iteration probability, kT is the system temperature coefficient, Et is the system energy value of the previous iteration, and Et+1 is the system energy value of this iteration.
