Fence optimization method and device
Through the particle swarm algorithm, multiple iterations are carried out, and the road area ownership is automatically adjusted, which solves the problem that the optimization of dot fences in the existing technology depends on expert experience, and achieves rapid reuse and better effect dot fence optimization.
Patent Information
- Application Number
- CN202311596195.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-27
- Publication Date
- 2025-05-27
AI Technical Summary
In the prior art, the optimization of the dot fence depends on expert experience, is difficult to reuse and the effect is unstable.
The particle swarm algorithm is used to determine the optimized fence information of each outlet by initializing multiple particles and performing multiple iterations. This method can automatically adjust the ownership of the road area and meet the optimization conditions.
It realizes rapid reuse and good results of network fence optimization, can be optimized according to specific business needs, and improves the automation and accuracy of fence division.
Smart Images

Figure CN120050185A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a fence optimization method and device. Background Art
[0002] Network point fence optimization is used to collect and divide multiple road areas in a specified area so as to assign multiple adjacent road areas to the same network point. Different road areas have different coverage areas, geographical shape attributes, distribution scenarios and many other characteristics. Under certain geographical factor restrictions, focusing on multiple optimization goals, finding a network point fence division scheme that meets actual production needs is the core idea of network point fence optimization. In the existing technology, network point fence optimization is mainly based on expert experience. This method is highly dependent on the level of experts, difficult to reuse, and the results are uneven. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a fence optimization method and device, which can be quickly reused and have a good fence optimization effect.
[0004] In a first aspect, an embodiment of the present invention provides a fence optimization method, including:
[0005] Obtain fence information of each network point, where the fence information is used to characterize the network point to which each road area belongs;
[0006] Initializing a plurality of particles according to the fence information of each of the network points;
[0007] Using a particle swarm algorithm, determining position information of each particle in at least one round of iteration;
[0008] Determining whether the current iteration meets the optimization condition according to the position information of each particle in the current iteration;
[0009] In response to the current round of iteration not satisfying the optimization condition, using the particle swarm algorithm, continuing to iterate the particles until the current round of iteration satisfies the optimization condition;
[0010] According to the position information of each particle in the iteration process, the preferred position information is determined, and according to the preferred position information, the optimized fence information of each grid point is determined.
[0011] Optionally, determining whether the current round of iteration satisfies the optimization condition according to the position information of each particle in the current round of iteration includes:
[0012] Performing edge preservation processing on the position information of each particle in this round of iteration; wherein the edge preservation processing is used to preserve the position information corresponding to the edge road area, and the edge road area is the road area where adjacent network points are converted in this round of iteration of the particle;
[0013] According to the position information of the particles after the edge retention processing, it is determined whether the current iteration meets the optimization conditions.
[0014] Optionally, performing edge preservation processing on the position information of each particle in this round of iteration includes:
[0015] Determine the initial grid point of the target road area in the previous iteration of the target particle;
[0016] Determine the current grid point of the target road area in the current iteration of the target particle;
[0017] Determining whether the target road area is an edge road area according to the initial network point and the current network point corresponding to the target road area;
[0018] In response to the target road area being a non-edge road area, the current network point corresponding to the target road area is changed to an initial network point corresponding to the target road area.
[0019] Optionally, determining whether the target road area is an edge road area according to the initial network point and the current network point corresponding to the target road area includes:
[0020] Determine whether the current network point is adjacent to the initial network point;
[0021] In response to the current network point being adjacent to the initial network point, determining whether the target road area is located in an adjacent area between the current network point and the initial network point;
[0022] In response to the target road area being located in an adjacent area between the current grid point and the initial grid point, the target road area is determined to be an edge road area.
[0023] Optionally, the outlet is a logistics distribution outlet;
[0024] After continuing to iterate each of the particles using the particle swarm algorithm, the method further includes:
[0025] Determining the optimal position information of this round from the position information of each particle in this round of iteration;
[0026] Determine multiple subsidiary road areas under the network point according to the current round of optimal location information;
[0027] Determine at least one highway within the network point range of the network point;
[0028] The location information of the network point is updated according to the distance between the network point and each of the affiliated road areas, the order volume of each of the affiliated road areas, and the distance between the network point and each of the highways.
[0029] Optionally, after continuing to iterate each particle using the particle swarm algorithm, the method further includes:
[0030] Determine a first number of the particles for the previous iteration; wherein the first number is the sum of the numbers of the first connected subgraphs of the network points, and the first connected subgraphs are determined according to the position information of the particles in the previous iteration;
[0031] Determine a second number of the particles for this round of iteration; wherein the second number is the sum of the numbers of the second connected subgraphs of the network points, and the second connected subgraphs are determined according to the position information of the particles in this round of iteration;
[0032] In response to the first number being smaller than the second number, the position information of the particle in the current iteration is changed to the position information of the particle in the previous iteration.
[0033] Optionally, determining the second number of particles for this round of iterations includes:
[0034] Determine multiple subsidiary road areas under each of the network points according to the position information of the particles in this round of iteration;
[0035] Determine the number of connected subgraphs of the network point in this round of iteration according to the multiple affiliated road areas under the network point;
[0036] The sum of the numbers of connected subgraphs of the network points in this round of iteration is calculated, and the sum of the numbers of connected subgraphs is determined as the second number of the particles for this round of iteration.
[0037] In a second aspect, an embodiment of the present invention provides a fence optimization device, including:
[0038] An information acquisition module, used to acquire fence information of each network point, wherein the fence information is used to characterize the network point to which each road area belongs;
[0039] An initialization module, used for initializing a plurality of particles according to the fence information of each of the network points;
[0040] An information determination module, used to determine the position information of each particle in at least one round of iteration using a particle swarm algorithm;
[0041] A condition determination module, used to determine whether the current iteration meets the optimization condition according to the position information of each particle in the current iteration;
[0042] An iteration module, for responding to the current round of iteration not satisfying the optimization condition, using a particle swarm algorithm to continue iterating on each of the particles until the current round of iteration satisfies the optimization condition;
[0043] The fence optimization module is used to determine the preferred position information according to the position information of each particle in the iteration process, and determine the optimized fence information of each grid point according to the preferred position information.
[0044] In a third aspect, an embodiment of the present invention provides an electronic device, including:
[0045] one or more processors;
[0046] a storage device for storing one or more programs,
[0047] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the above embodiments.
[0048] In a fourth aspect, an embodiment of the present invention provides a computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method described in any of the above embodiments.
[0049] An embodiment of the above invention has the following advantages or beneficial effects: multiple particles are initialized according to the fence information of each network point. Using the particle swarm algorithm, multiple particles are iterated for multiple rounds until the optimization conditions are met. The optimization conditions can be set according to specific business needs. Finally, based on the position information of each particle during the iteration process, the preferred position information is determined, and based on the preferred position information, the optimized fence information of each network point is determined. The scheme of the embodiment of the present invention uses the particle swarm algorithm to perform multiple rounds of iterations to generate multiple fence alternatives for each network point, and determine the optimized fence information of each network point. The scheme is easy to implement, can be quickly reused, and has a good fence optimization effect.
[0050] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0052] Figure 1 is a schematic diagram of a process of a fence optimization method provided by an embodiment of the present invention;
[0053] Figure 2 is a schematic diagram of a process of a fence optimization method provided by another embodiment of the present invention;
[0054] Figure 3 is a schematic diagram of a process of a fence optimization method provided by another embodiment of the present invention;
[0055] Figure 4is a schematic diagram of a process of a fence optimization method provided by yet another embodiment of the present invention;
[0056] Figure 5 is a structural schematic diagram of a fence optimization device provided by an embodiment of the present invention;
[0057] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0058] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0059] It should be noted that the acquisition, storage, use, and processing of data in the technical solutions of the embodiments of the present invention are in compliance with the relevant provisions of national laws and regulations.
[0060] Figure 1 FIG. 1 is a schematic diagram of a process of a fence optimization method provided by an embodiment of the present invention. Figure 1 As shown, the method includes:
[0061] Step 101: Obtain fence information of each network point, where the fence information is used to characterize the network point to which each road area belongs.
[0062] A road zone is a geographical area with different coverage areas, geographical shape attributes, delivery scene attributes, or transportation scene attributes. Delivery scene attributes include: order quantity, difficulty, weight, and time. A road zone can be multiple Areas of Interest (AOIs) or work units within a specified area.
[0063] Fence optimization is used to assign multiple adjacent road areas to the same network point. For example, a logistics distribution network point is responsible for the logistics distribution of multiple road areas under the network point.
[0064] A network point identifier is assigned to each network point, and a road area identifier is assigned to each road area. Fence information is used to characterize the network points to which each road area belongs, and the road areas affiliated to each network point. Fence information can be represented by the mapping relationship between network points and road areas.
[0065] Step 102: Initialize multiple particles according to the fence information of each grid point.
[0066] According to the fence information of each network point, the initial position information of each particle is determined. The position information of the particle is an array [x1, x2, x3, x4, ..., xN], where N is the number of road areas. Among them, xi means that the i-th road area belongs to the xi-th network point.
[0067] For example, there are 3 grid points and 10 road areas, and the position information of the particle can be [1,3,3,2,1,3,3,2,2,2]. The position information of the particle indicates that the 1st and 5th road areas belong to the 1st grid point, the 4th, 8th, 9th and 10th road areas belong to the 2nd grid point, and the 2nd, 3rd, 6th and 7th road areas belong to the 3rd grid point.
[0068] The position information of each particle in each round of iteration corresponds to a set of fence division schemes. The scheme of the embodiment of the present invention uses the particle swarm algorithm to perform multiple rounds of iterations to generate multiple fence alternative schemes for each grid point, and determines the optimized fence information of each grid point from them.
[0069] The number of particles can be determined based on the number of CPU cores, number of parallel threads, qps (queries per second), etc. The more particles there are, the more solutions will be compared in each round, and the better the effect will be, but it will also consume more computing resources.
[0070] Step 103: Using the particle swarm algorithm, determine the position information of each particle in at least one round of iteration.
[0071] Step 104: Determine whether this round of iteration meets the optimization condition based on the position information of each particle in this round of iteration.
[0072] Step 105: In response to the current round of iteration not satisfying the optimization condition, using the particle swarm algorithm, continue to iterate each particle until the current round of iteration satisfies the optimization condition.
[0073] Define the basic operations between the road areas of the spatial scene, and then obtain the iterative equation of the particle swarm algorithm from the basic operations. The basic operations are as follows:
[0074] Define the spatial belonging variable x ij Attribution variable, addition x+y=random>c? x:y
[0075] Define the spatial belonging variable x ij Attributed variable, subtraction xy = x == y? -1:x
[0076] Define the spatial belonging variable x ij Attribution variable, multiplication x*c=random <c?x:-1
[0077] The motion equation of the particle swarm algorithm is v = (x_gbest-x)*c + (x_pbest-x)*c. The iteration equation of the particle swarm algorithm is x_next = x + v.
[0078] In the above basic operations, x and y are two sets of solution vectors in the particle iteration process. The meaning of addition in the basic operation is to generate a random number. If it is greater than c, it is equal to x, otherwise it is y. The meaning of subtraction in the basic operation is that if x is not equal to y, then x is returned, otherwise no operation is performed. The meaning of multiplication in the basic operation is to generate a random number. If it is less than c, then x is returned, otherwise no operation is performed. Addition, subtraction and multiplication in the basic operation stipulate the operation rules of the equation of motion and the iterative equation. The basic operation ensures that the values in the array of the particle position information in the iteration process are always the identifiers of each network point.
[0079] The motion equation and iteration equation of the particle swarm algorithm above illustrate the iteration process of particles. Among them, x_gbest is the historical optimal position of a single particle, and x_pbest is the historical optimal position found by the entire particle swarm. v is the velocity of the particle after this round of iteration, c is the cognitive coefficient, x is the position information of the particle after this round of iteration, and x_next is the position information of the particle after the next round of iteration.
[0080] In this round of iteration, multiple particles are independent of each other. Each particle calculates its own solution through the equation of motion and the corresponding loss function value. It compares all the historical loss function values and updates the historical best position (pbest) of the particle with the smallest one. After all particles in this round have updated their own historical best solutions (pbest), they compare and calculate the minimum loss and update the historical best position (gbest) of the entire particle group.
[0081] During the iteration process, each particle calculates its own solution through the equation of motion, which is the position information of the particle in this round of iteration. Using the particle swarm algorithm, multiple rounds of iterations are performed on multiple particles until the current round of iteration meets the optimization conditions.
[0082] The optimization conditions can be set according to specific business needs. The optimization conditions can be that the statistical value of the distance between each network point corresponding to the preferred location information and its affiliated road area is less than the preset distance, the statistical value of the cost of each network point corresponding to the preferred location information to its affiliated road area is less than the preset value, the number of iterations reaches the preset number, the minimum loss function value of each particle is less than the preset value, the historical optimal value of the objective function is greater than the preset value, etc.
[0083] Step 106: Determine the optimal position information according to the position information of each particle in the iteration process, and determine the optimized fence information of each network point according to the optimal position information.
[0084] The historical minimum loss function value or the historical objective function value of each particle in the iteration process can be calculated, and the particle position information having the smallest historical minimum loss function value or the best historical objective function value is determined as the preferred position information.
[0085] According to the preferred location information, the optimized fence information of each network point is determined. For example, the preferred location information is [2,3,3,3,1,1,1,2,2,2]. The optimized fence information indicates that the 5th, 6th, and 7th road areas are assigned to the first network point, the 1st, 8th, 9th, and 10th road areas are assigned to the second network point, and the 2nd, 3rd, and 4th road areas are assigned to the third network point.
[0086] In the scheme of the embodiment of the present invention, multiple particles are initialized according to the fence information of each network point. Using the particle swarm algorithm, multiple particles are iterated for multiple rounds until the optimization conditions are met. Finally, the preferred position information is determined according to the position information of each particle during the iteration process, and the optimized fence information of each network point is determined according to the preferred position information. The scheme of the embodiment of the present invention uses the particle swarm algorithm to perform multiple rounds of iterations to generate multiple fence alternatives for each network point, and determine the optimized fence information of each network point from them. This scheme is easy to implement, can be quickly reused, and has a good fence optimization effect.
[0087] Figure 2 FIG. 1 is a schematic diagram of a process of a fence optimization method provided by another embodiment of the present invention. Figure 2 As shown, the method includes:
[0088] Step 201: Obtain fence information of each network point, where the fence information is used to characterize the network point to which each road area belongs.
[0089] Step 202: Initialize multiple particles according to the fence information of each grid point.
[0090] Step 203: using the particle swarm algorithm to determine the position information of each particle in at least one round of iteration.
[0091] Step 204: Perform edge preservation processing on the position information of each particle in this round of iteration.
[0092] Fence optimization must ensure the connectivity of each network point and avoid the problem of network point islands. That is, the road areas under a network point are adjacent to each other and form a connected area. A road area cannot be divided into a network point that is not connected to it.
[0093] The edge preservation process is used to retain only the position information corresponding to the edge road area, which is the road area where the adjacent dot conversion has occurred in the current iteration of the particle. For the road area where the adjacent dot conversion has not occurred, that is, the non-edge road area, the initial information of the previous round is restored.
[0094] The situation of non-edge road area can be: the road area is not at the edge of the network point, that is, the road area is inside the network point, the road area is converted to a non-adjacent network point, etc. The initial network point information of the non-edge road area in the previous iteration process is maintained and no iteration processing is performed.
[0095] The initial grid point information of the non-edge road area in the previous iteration process can be maintained in the following manner: determine the initial grid points of the target road area in the previous iteration of the target particle; determine the current grid points of the target road area in the current iteration of the target particle; determine whether the target road area is an edge road area based on the initial grid points and current grid points corresponding to the target road area; in response to the target road area being a non-edge road area, change the current grid points corresponding to the target road area to the initial grid points corresponding to the target road area.
[0096] If the target road area is a non-edge road area, the current network point corresponding to the target road area is changed to the initial network point corresponding to the target road area. If the target road area is an edge road area, the current position information of the edge road area in this round of iteration is retained.
[0097] The situation of the marginal road area is that the road area is located in the adjacent area of two adjacent network points, and the road area is transferred from one of the adjacent network points to the other adjacent network point. Whether the target road area is a marginal road area can be determined in the following ways: determining whether the current network point is adjacent to the initial network point; in response to the current network point being adjacent to the initial network point, determining whether the target road area is located in the adjacent area between the current network point and the initial network point; in response to the target road area being located in the adjacent area between the current network point and the initial network point, determining that the target road area is a marginal road area.
[0098] If two road areas intersect in space and the perimeter of the intersection exceeds the preset length, the two road areas are adjacent. If a road area is adjacent to the attached road areas of two network points respectively, the road area is located in the adjacent area between the two network points. If the current network point of the target road area is adjacent to the initial network point, and the target road area is located in the adjacent area between the current network point and the initial network point, the target road area is determined to be an edge road area.
[0099] Step 205: Determine whether this round of iteration meets the optimization condition based on the position information of the particles after the edge retention processing.
[0100] Step 206: In response to the current round of iteration not satisfying the optimization condition, using the particle swarm algorithm, continue to iterate each particle until the current round of iteration satisfies the optimization condition.
[0101] Step 207: Determine the optimal position information according to the position information of each particle in the iteration process, and determine the optimized fence information of each network point according to the optimal position information.
[0102] The solution of the embodiment of the present invention uses a particle swarm algorithm to randomly convert each road area at the edge of the network point to different adjacent network points to optimize the fence information of the website. Through edge preservation processing, only the road area where the adjacent network point conversion occurs, that is, the edge road area conversion, is considered to maintain the connectivity of each network point.
[0103] A neighboring search strategy is adopted and a heuristic strategy is introduced. Each round of iteration randomly selects the road areas adjacent to the fence. This can not only ensure the connectivity of the network points as much as possible and reduce invalid searches, but also reduce the size of the particle solution space and improve the speed.
[0104] Figure 3 FIG. 1 is a schematic diagram of a process of a fence optimization method provided by another embodiment of the present invention. Figure 3 As shown, the method includes:
[0105] Step 301: Obtain fence information of each network point. The fence information is used to characterize the network points to which each road area belongs. The network points are logistics distribution network points.
[0106] Step 302: Initialize multiple particles according to the fence information of each grid point.
[0107] Step 303: using the particle swarm algorithm to determine the position information of each particle in at least one round of iteration; and determining the optimal position information of this round according to the position information of each particle in this round of iteration.
[0108] The minimum loss function value or the objective function value of each particle in this round of iteration can be calculated, and the particle position information with the smallest minimum loss function value or the best objective function value is determined as the preferred position information of this round.
[0109] Step 304: Determine the fence information and multiple affiliated road areas of each network point according to the current round of optimal location information; and determine at least one highway within the network point range of each network point.
[0110] Step 305: For each network point, the location information of the network point is updated according to the distance between the network point and each affiliated road area of the network point, the order volume of each affiliated road area, and the distance between the network point and each highway.
[0111] The basic framework of the site selection strategy is similar to the K-means algorithm, that is, after each road area is assigned to a network point, the recommended network location for the network point that needs to be selected is updated. When the network point is a logistics distribution network point, the key to the site selection strategy is to consider the following factors: first, close to the user to reduce the terminal delivery distance; second, consider future user changes; third, close to the main traffic road to reduce upstream transportation costs.
[0112] Assume that the order of road zone i is o i , the navigation distance of the potential site (lng, lat) from road area i is di (lng,lat), input the link set of roads above the village level, which is {r} i , then the shortest distance from the site (lng, lat) to the main road is Then the optimal location strategy is:
[0113] Step 306: Determine whether this round of iteration meets the optimization conditions based on the location information and fence information of each network point.
[0114] The optimization conditions may be that the statistical value of the distance between each network point corresponding to the preferred location information and its affiliated road area is less than a preset distance, the statistical value of the cost from each network point corresponding to the preferred location information to its affiliated road area is less than a preset value, the minimum loss function value corresponding to the preferred location information is less than a preset value, the objective function value corresponding to the preferred location information is greater than a preset value, etc.
[0115] According to the location information and fence information of each network point, it is determined whether the current iteration meets the optimization condition. If the current iteration does not meet the optimization condition, step 307 is executed to continue the iteration. If the current iteration meets the optimization condition, step 308 is executed to output the optimized fence information.
[0116] Step 307: In response to the current round of iteration not satisfying the optimization condition, the particle swarm algorithm is used to continue iterating on each particle until the current round of iteration satisfies the optimization condition.
[0117] Step 308: Determine the optimal position information according to the position information of each particle in the iteration process, and determine the optimized fence information of each network point according to the optimal position information.
[0118] In the solution of the embodiment of the present invention, after each round of particle iteration, the site selection of each network point is updated according to the affiliated road area under each network point to evaluate the effect of this round of iteration. The site selection problem is embedded in the network point coverage problem, so that the site selection and coverage are considered at the same time, which is closer to the actual application scenario and has a higher solution adoption rate.
[0119] In one embodiment of the present invention, after continuing to iterate each particle using the particle swarm algorithm, it also includes: determining a first number of particles for the previous round of iteration; wherein the first number is the sum of the number of first connected subgraphs of each network point, and the first connected subgraph is determined based on the position information of the particle in the previous round of iteration; determining a second number of particles for the current round of iteration; wherein the second number is the sum of the number of second connected subgraphs of each network point, and the second connected subgraph is determined based on the position information of the particle in the current round of iteration; in response to the first number being less than the second number, changing the position information of the particle in the current round of iteration to the position information of the particle in the previous round of iteration.
[0120] If two road areas intersect in space and the perimeter of the intersection exceeds the preset length, then the two road areas are adjacent. If two road areas can be connected through several adjacent road areas, then the two road areas are called connected. If any two of a subgraph are connected, then the subgraph is called a connected subgraph.
[0121] The sum of the numbers of connected subgraphs corresponding to the particles can be determined in the following manner: according to the position information of the particles in this round of iteration, multiple subsidiary road areas under each network point are determined; according to the multiple subsidiary road areas under the network point, the number of connected subgraphs of the network point in this round of iteration is determined, and the sum of the numbers of connected subgraphs of each network point in the current round of iteration of the particle is calculated.
[0122] In the process of fence optimization, the connection of a certain network point may cause the island problem of another network point. The solution of the embodiment of the present invention further ensures the connectivity of the result through connectivity constraints. By establishing a spatial index, a spatial relationship network diagram is established for the road area during the initialization process. In the subsequent iteration step, the spatial connectivity of the road area is ensured through depth-first search, as follows:
[0123] Assume that the relationship between the road area and the network point is x ij , when x ij When it is 1, it means that road area i belongs to network point j, otherwise it is 0. The spatial relationship is expressed as R ij , when R ij When it is 1, it means that the spatial intersection of road area i and road area j exceeds the preset length. Then the dfs function can be obtained:
[0124]
[0125] N represents the number of road areas, and the dfs function indicates that there are d connected subgraphs of node j. It is required that during the iteration process, each particle needs to satisfy the following spatial constraints in each round of iteration:
[0126]
[0127] Where t represents the number of iterations. The meaning of the above spatial constraint is: the sum of the number of connected subgraphs after the t+1th iteration < the sum of the number of connected subgraphs after the tth iteration. The initial solution may have multiple connected subgraphs. Through each round of iteration, the number of connected subgraphs of each node is reduced to ensure that the number of connected subgraphs is getting smaller and smaller. It should be noted that during the iteration process, the number of connected subgraphs is allowed to remain unchanged.
[0128] Figure 4 FIG. 1 is a schematic diagram of a process of a fence optimization method provided by another embodiment of the present invention. Figure 4As shown, first obtain the road area information of the AIO or road area, as well as the order details of each AIO or road area. Perform data preprocessing on the above information to remove dirty data and digitize the information. Obtain information such as business scenario classification, business requirements and constraints, and determine the optimization conditions or objective functions based on the above information. Business scenario classification may include: splitting, merging, coverage adjustment, whether to select a site, etc. Among them, the split representation splits a network point into multiple networks, and the merge representation merges multiple networks into one network point. Initialize the evolutionary algorithm, including the strategy of initializing the evolutionary algorithm. Use the discrete particle swarm algorithm and the neighborhood search mechanism to control the iteration process to ensure the connectivity of the network points. Update the location information of each network point based on the preferred location information of this round. Determine whether this round of iteration meets the optimization conditions. If not, iterate again until this round of iteration meets the optimization conditions.
[0129] The solution of the embodiment of the present invention is used to solve the problem of network fence division, how to establish a set of universal fence generation framework, so that the division goals, constraints, initialization strategies, iteration strategies, and site selection strategies can be configured. The iterative strategy defines a spatial offline particle swarm algorithm, which is combined with a neighborhood search strategy to speed up the search process. The site selection strategy is embedded in the initialization method and the iteration method, so that each site selection generates fence information that meets the constraints. The site selection and coverage are organically combined, which can improve the solution recommendation rate.
[0130] Different from the existing network point fencing solutions, the solution of the embodiment of the present invention establishes a spatial index, adopts depth-first search to determine spatial connectivity, improves the efficiency of connectivity judgment, establishes floor efficiency constraints, determines the maximum coverage order quantity of different network points, and improves the rationality of the coverage adjustment solution, which can be adapted to a variety of application scenarios.
[0131] The solution of the embodiment of the present invention establishes a general search framework and decouples it from the business scenario, so that it can be suitable for multi-objective problems in various business scenarios. The search process is accelerated by designing the logic of the neighborhood search. A set of spatial constraints based on the number of connected subgraphs is also provided, which can greatly improve the efficiency of fence optimization.
[0132] Figure 5 FIG. 1 is a schematic diagram of a fence optimization device provided by an embodiment of the present invention. Figure 5 As shown, the device comprises:
[0133] The information acquisition module 501 is used to acquire the fence information of each network point, and the fence information is used to characterize the network point to which each road area belongs;
[0134] Initialization module 502, used to initialize multiple particles according to the fence information of each network point;
[0135] An information determination module 503 is used to determine the position information of each particle in at least one round of iteration using a particle swarm algorithm;
[0136] A condition determination module 504 is used to determine whether the current iteration meets the optimization condition according to the position information of each particle in the current iteration;
[0137] Iteration module 505, used for, in response to the current round of iteration not satisfying the optimization condition, using the particle swarm algorithm to continue iterating on each particle until the current round of iteration satisfies the optimization condition;
[0138] The fence optimization module 506 is used to determine the optimal position information according to the position information of each particle in the iteration process, and determine the optimized fence information of each network point according to the optimal position information.
[0139] Optionally, the condition determination module 504 is specifically configured to:
[0140] The position information of each particle in this round of iteration is subjected to edge preservation processing; wherein the edge preservation processing is used to preserve the position information corresponding to the edge road area, and the edge road area is the road area where the adjacent network point conversion occurs in the current round of iteration of the particle;
[0141] According to the position information of the particles after the edge retention processing, it is determined whether the current iteration meets the optimization conditions.
[0142] Optionally, the condition determination module 504 is specifically configured to:
[0143] Determine the initial grid point of the target road area in the previous iteration of the target particle;
[0144] Determine the current grid point of the target road area in the current iteration of the target particle;
[0145] Determine whether the target road area is a marginal road area according to the initial network point and the current network point corresponding to the target road area;
[0146] In response to the target road area being a non-edge road area, the current network point corresponding to the target road area is changed to an initial network point corresponding to the target road area.
[0147] Optionally, the condition determination module 504 is specifically configured to:
[0148] Determine whether the current network point is adjacent to the initial network point;
[0149] In response to the current network point being adjacent to the initial network point, determining whether the target road area is located in an adjacent area between the current network point and the initial network point;
[0150] In response to the target road area being located in an adjacent area between the current grid point and the initial grid point, the target road area is determined to be an edge road area.
[0151] Optionally, the outlet is a logistics distribution outlet;
[0152] The device also includes:
[0153] A position optimization module is used to determine the optimal position information of this round from the position information of each particle in this round of iteration;
[0154] According to the current round of optimal location information, multiple subsidiary road areas under the network point are determined;
[0155] Determine at least one highway within the network point range of the network point;
[0156] The location information of the outlets is updated based on the distance between the outlets and each affiliated road area, the order volume of each affiliated road area, and the distance between the outlets and each highway.
[0157] Optionally, the information determination module 503 is further configured to:
[0158] Determine a first number of particles for the previous iteration; wherein the first number is the sum of the numbers of first connected subgraphs of each network point, and the first connected subgraph is determined according to the position information of the particles in the previous iteration;
[0159] Determine a second number of particles for this round of iteration; wherein the second number is the sum of the numbers of second connected subgraphs of each network point, and the second connected subgraph is determined according to the position information of the particles in this round of iteration;
[0160] In response to the first number being smaller than the second number, the position information of the particle in the current iteration is changed to the position information of the particle in the previous iteration.
[0161] Optionally, the information determination module 503 is further configured to:
[0162] According to the position information of the particles in this round of iteration, multiple subsidiary road areas under each network point are determined;
[0163] According to the multiple affiliated road areas under the network point, the number of connected sub-graphs of the network point in this round of iteration is determined;
[0164] The sum of the number of connected subgraphs of each network point in this round of iteration is calculated, and the sum of the number of connected subgraphs is determined as the second number of particles for this round of iteration.
[0165] An embodiment of the present invention provides an electronic device, including:
[0166] one or more processors;
[0167] a storage device for storing one or more programs,
[0168] When one or more programs are executed by one or more processors, the one or more processors implement the method of any of the above embodiments.
[0169] Reference below Figure 6, which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0170] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0171] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0172] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.
[0173] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0174] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0175] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, they may be described as: an information acquisition module, an initialization module, an information determination module, a condition determination module, an iteration module, and a fence optimization module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the information acquisition module may also be described as a "module for acquiring fence information of each network point."
[0176] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:
[0177] Obtain fence information of each network point, where the fence information is used to characterize the network point to which each road area belongs;
[0178] Initializing a plurality of particles according to the fence information of each of the network points;
[0179] Using a particle swarm algorithm, determining position information of each particle in at least one round of iteration;
[0180] Determining whether the current iteration meets the optimization condition according to the position information of each particle in the current iteration;
[0181] In response to the current round of iteration not satisfying the optimization condition, using the particle swarm algorithm, continuing to iterate the particles until the current round of iteration satisfies the optimization condition;
[0182] According to the position information of each particle in the iteration process, the preferred position information is determined, and according to the preferred position information, the optimized fence information of each grid point is determined.
[0183] According to the technical solution of the embodiment of the present invention, multiple particles are initialized according to the fence information of each network point. Using the particle swarm algorithm, multiple particles are iterated for multiple rounds until the optimization conditions are met. The optimization conditions can be set according to specific business needs. Finally, based on the position information of each particle during the iteration process, the preferred position information is determined, and based on the preferred position information, the optimized fence information of each network point is determined. The solution of the embodiment of the present invention uses the particle swarm algorithm to perform multiple rounds of iterations to generate multiple fence alternatives for each network point, and determine the optimized fence information of each network point from them. The solution is easy to implement, can be quickly reused, and has a good fence optimization effect.
[0184] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for optimizing a fence, characterized in that, it includes: Obtaining the fence information of each network point, where the fence information is used to represent the network points to which each road area belongs; Initializing a plurality of particles according to the fence information of each of the network points; Using a particle swarm algorithm to determine the position information of each of the particles in at least one round of iteration; Determining whether the current round of iteration meets the optimization condition according to the position information of each of the particles in the current round of iteration; In response to the current round of iteration not meeting the optimization condition, using a particle swarm algorithm to continue iterating each of the particles until the current round of iteration meets the optimization condition; Determining the optimal position information according to the position information of each of the particles in the iteration process, and determining the optimized fence information of each of the network points according to the optimal position information.
2. The method according to claim 1, characterized in that, The determining whether the current round of iteration meets the optimization condition according to the position information of each of the particles in the current round of iteration includes: Performing edge-preserving processing on the position information of each of the particles in the current round of iteration; wherein, the edge-preserving processing is used to retain the position information corresponding to the edge road areas, and the edge road areas are the road areas where adjacent network point conversions occur in the current round of iteration of the particles; Determining whether the current round of iteration meets the optimization condition according to the position information of each particle after the edge-preserving processing.
3. The method according to claim 2, characterized in that, The performing edge-preserving processing on the position information of each of the particles in the current round of iteration includes: Determining the initial network point of the target road area in the previous round of iteration of the target particle; Determining the current network point of the target road area in the current round of iteration of the target particle; Determining whether the target road area is an edge road area according to the initial network point and the current network point corresponding to the target road area; In response to the target road area being a non-edge road area, changing the current network point corresponding to the target road area to the initial network point corresponding to the target road area.
4. The method according to claim 3, characterized in that, The determining whether the target road area is an edge road area according to the initial network point and the current network point corresponding to the target road area includes: Determining whether the current network point is adjacent to the initial network point; In response to the current network point being adjacent to the initial network point, determining whether the target road area is located in the adjacent area between the current network point and the initial network point; In response to the target road area being located in the adjacent area between the current network point and the initial network point, determining that the target road area is an edge road area.
5. The method according to claim 1, characterized in that, The network point is a logistics distribution network point; After using the particle swarm algorithm to continue iterating each of the particles, it further includes: Determining the optimal position information of the current round from the position information of each of the particles in the current round of iteration; Determining a plurality of affiliated road areas under the network point according to the optimal position information of the current round; Determining at least one highway within the range of the network point of the network point; Updating the position information of the network point according to the distances between the network point and each of the affiliated road areas, the order volumes of each of the affiliated road areas, and the distances between the network point and each of the highways.
6. The method according to claim 1, It is characterized in that after continuing to iterate each of the particles by using the particle swarm optimization algorithm, it further includes: determining a first number of the particle for the previous iteration; wherein, the first number is the sum of the numbers of the first connected subgraphs of each of the network nodes, and the first connected subgraph is determined according to the position information of the particle in the previous iteration; determining a second number of the particle for the current iteration; wherein, the second number is the sum of the numbers of the second connected subgraphs of each of the network nodes, and the second connected subgraph is determined according to the position information of the particle in the current iteration; in response to the first number being less than the second number, changing the position information of the particle in the current iteration to the position information of the particle in the previous iteration.
7. The method according to claim 6, It is characterized in that the determining the second number of the particle for the current iteration includes: determining a plurality of affiliated road areas under each of the network nodes according to the position information of the particle in the current iteration; determining the number of connected subgraphs of the network node in the current iteration according to the plurality of affiliated road areas under the network node; calculating the sum of the numbers of connected subgraphs of each of the network nodes in the current iteration, and determining the sum of the numbers of connected subgraphs as the second number of the particle for the current iteration.
8. A fence optimization device, It is characterized in that including: an information acquisition module, configured to acquire the fence information of each network node, where the fence information is used to represent the network node to which each road area belongs; an initialization module, configured to initialize a plurality of particles according to the fence information of each of the network nodes; an information determination module, configured to use the particle swarm optimization algorithm to determine the position information of each of the particles in at least one iteration; a condition determination module, configured to determine whether the current iteration meets the optimization condition according to the position information of each of the particles in the current iteration; an iteration module, configured to, in response to the current iteration not meeting the optimization condition, continue to iterate each of the particles by using the particle swarm optimization algorithm until the current iteration meets the optimization condition; a fence optimization module, configured to determine the optimal position information according to the position information of each of the particles in the iteration process, and determine the optimized fence information of each of the network nodes according to the optimal position information.
9. An electronic device, It is characterized in that including: one or more processors; a storage device, configured to store one or more programs, when the one or more programs are executed by the one or more processors, enabling the one or more processors to implement the method according to any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, It is characterized in that when the program is executed by a processor, it implements the method according to any one of claims 1-7.