Optimal traversal path algorithm based on improved PSO

By improving the PSO algorithm and optimizing the cleaning path of urban sanitation roads, the problem of resource waste caused by traditional manual arrangements has been solved, more efficient sanitation work and environmental optimization have been achieved, and public expenditure has been reduced.

CN119005474APending Publication Date: 2024-11-22JILIN UNIVERSITY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411189517.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

Traditional sanitation road cleaning relies on manual arrangements, resulting in waste of travel routes and personnel arrangements, and it is difficult to efficiently complete urban sanitation cleaning while ensuring road safety.

Method used

Using the optimal traversal path algorithm based on improved particle swarm optimization (PSO) algorithm, we use the optimal traversal path optimization algorithm to import actual maps, generate digital raster maps, mark obstacles and non-obstructions positions, use particle swarm optimization algorithm to optimize paths, and make preliminary results The path is compressed to remove duplicate routes and obtain the optimal path.

Benefits of technology

It has improved the efficiency of sanitation work, optimized staffing, reduced costs, realized the efficient use of human and material resources, saved public fiscal expenditures, and promoted the sanitation status of the urban environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119005474A_ABST
    Figure CN119005474A_ABST
Patent Text Reader

Abstract

The invention relates to an optimal traversal path algorithm based on improved PSO (Particle Swarm Optimization), which is suitable for selecting an optimal traversal path under a given map condition. Comprising the following steps of: 1, importing an actual map, and processing the actual map by using a grid method to obtain a digital grid map; and step 2, generating a map matrix An * m according to the digital grid map, wherein the map matrix An * m is used for marking obstacle positions and non-obstacle positions. And step 3, according to the map matrix, generating a counting matrix Bn * m, bij, and recording the number of times that aij is walked by. And step 4, performing path optimization by using a particle swarm optimization algorithm. And step 5, outputting the initial path, compressing the initial path, and deleting repeated paths. And step 6, outputting the compressed optimal path, and obtaining a specific route and the length of the optimal path.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of path planning and logistics optimization, and specifically relates to an optimal traversal path algorithm based on improved PSO, which is a traversal algorithm with path optimal planning as the core. The present invention can improve the efficiency of daily urban sanitation work, save public resources, promote urban civilization construction, ensure the sanitary condition of the urban environment, and provide decision-making departments with safer and more efficient sanitation work solutions. Background Art

[0002] Road cleaning is one of the core tasks of urban sanitation work. With the continuous development of society, the urban road network is becoming increasingly complex, with crisscrossing streets and increasing traffic volume. People's requirements for travel are also getting higher and higher, but traditional sanitation road cleaning is still in the primary stage of manual arrangement based on past experience, which will cause a certain degree of waste in terms of travel routes and personnel arrangements. At present, there is an urgent need for an intelligent optimization solution that can complete urban sanitation cleaning with high quality and efficiency while ensuring road safety. Summary of the invention

[0003] 1. Technical issues to be solved

[0004] In view of the deficiencies of existing research, the present invention proposes an optimal traversal path algorithm based on improved PSO, which solves the problems raised in the background technology.

[0005] (II) Technical solution

[0006] In order to achieve the above object, the present invention adopts the following technical solution to achieve it: based on the improved PSO optimal traversal path algorithm, the steps include the following:

[0007] Step 1: Import the actual map and process it using the raster method to obtain a digital raster map.

[0008] Step 2: Generate map matrix A based on digital grid map n×m , used to mark obstacle locations and non-obstacle locations.

[0009] Step 3: Generate count matrix B based on the map matrix n×m ,b ij Record a ij The number of times it has been walked.

[0010] Step 4: Use particle swarm optimization algorithm to find the optimal path.

[0011] Step 5: Output the preliminary path, compress it, and delete duplicate routes.

[0012] Step 6: Output the compressed optimal path and obtain the specific route and the length of the optimal path.

[0013] Preferably, in step 1, after field investigation, the actual road map is obtained in combination with the electronic map, and the traffic conditions and traffic requirements of different trunk roads and auxiliary roads are collected and marked accordingly. The correspondence between the width of the grid in the grid map and the actual road is as follows: the unit grid is a square with the same length and width; the side length of the grid is the width of the one-way road. A single lane is a row or column of unit grids, a double lane is two rows or two columns of unit grids, and a multi-lane is multiple rows or columns of unit grids.

[0014] Preferably, in step 2, according to the map grid division result obtained in step 1, the number of rows and columns obtained by division are respectively set as the map matrix A n×m The row values ​​(n) and column values ​​(m) of the map matrix A. n×m Each element in a ij ,

[0015]

[0016] Preferably, in step 3, according to the map matrix A in step 2 n×m Generate count matrix B n×m B n×m Each element in b ij , in the initial state,

[0017]

[0018] When iterating, if you pass a in the map matrix ij , then b ij =b ij +1, and only b ij When ≤15×max{n,m}, the position is allowed to pass.

[0019] Preferably, in step 4, a function is called to obtain a reference point calculated using the PSO algorithm, the legal points of the current point in four directions are calculated, the angle between the current point and the reference point obtained by PSO is compared, the point with the smallest angle is selected to join the path, and the corresponding b is updated. ij , until all b ij All satisfy 1≤b ij ≤15×max{n,m}, end the traversal and get the shortest path of this time; after N iterations, compare the length of each iterative path and select the shortest path.

[0020] Preferably, in step 5, a compression function is used to compress the paths and delete duplicate paths.

[0021] (III) Beneficial effects

[0022] The present invention provides an optimal traversal path algorithm based on improved PSO. It has the following beneficial effects: The present invention proposes a traversal algorithm with optimal path planning as the core, which can provide solid theoretical support for the intelligentization of urban cleaning routes and has broad application prospects and scalability. It can improve the efficiency of sanitation work, help optimize personnel allocation, reduce costs, and achieve efficient utilization of human and material resources. At the same time, it optimizes the environment, saves public financial expenditure, and achieves a win-win situation in terms of economic benefits and environmental protection. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0024] Figure 1 The map matrix after marking obstacles;

[0025] Figure 2 This is a schematic diagram of the initialization result;

[0026] Figure 3 is the optimal path obtained by PSO, corresponding to B 8×6 result;

[0027] Figure 4 B after compression 8×6 ;

[0028] Figure 5 This is the optimal path diagram output at the end. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the technical solution of the present invention, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. 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 creative work should fall within the scope of protection of the present invention.

[0030] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the present invention is further explained below in conjunction with specific implementation methods.

[0031] The optimal traversal path algorithm based on improved PSO includes the following steps:

[0032] Step 1: Import the actual map and process it using the raster method to obtain a digital raster map.

[0033] Step 2: Generate map matrix A based on digital grid map n×m , used to mark obstacle locations and non-obstacle locations.

[0034] Step 3: Generate count matrix B based on the map matrix n×m ,b ij Record a ij The number of times it has been walked.

[0035] Step 4: Use particle swarm optimization algorithm to find the optimal path.

[0036] Step 5: Output the preliminary path, compress it, and delete duplicate routes.

[0037] Step 6: Output the compressed optimal path and obtain the specific route and the length of the optimal path.

[0038] Preferably, in step 1, after field investigation, the actual road map is obtained in combination with the electronic map, and the traffic conditions and traffic requirements of different trunk roads and auxiliary roads are collected and marked accordingly. The correspondence between the width of the grid in the grid map and the actual road is as follows: the unit grid is a square with the same length and width; the side length of the grid is the width of the one-way road. A single lane is a row or column of unit grids, a double lane is two rows or two columns of unit grids, and a multi-lane is multiple rows or columns of unit grids.

[0039] Preferably, in step 2, according to the map grid division result obtained in step 1, the number of rows and columns obtained by division are respectively set as the map matrix A n×m The row values ​​(n) and column values ​​(m) of the map matrix A. n×m Each element in a ij ,

[0040]

[0041] Preferably, in step 3, according to the map matrix A in step 2 n×m Generate count matrix B n×m B n×m Each element in b ij , in the initial state,

[0042]

[0043] When iterating, if you pass a in the map matrix ij , then b ij =b ij +1, and only b ijWhen ≤15×max{n,m}, the position is allowed to pass.

[0044] Preferably, in step 4, a function is called to obtain a reference point calculated using the PSO algorithm, the legal points of the current point in four directions are calculated, the angle between the current point and the reference point obtained by PSO is compared, the point with the smallest angle is selected to join the path, and the corresponding b is updated. ij , until all b ij All satisfy 1≤b ij ≤15×max{n,m}, end the traversal and get the shortest path of this time; after N iterations, compare the length of each iterative path and select the shortest path.

[0045] Preferably, in step 5, a compression function is used to compress the paths and delete duplicate paths.

[0046] Implementation examples:

[0047] Taking an 8*6 map of a certain area in a city as an example, the specific implementation steps are as follows:

[0048] Step 1: Import the actual map and process it using the raster method to obtain a raster digital map.

[0049] Step 2: Set up the map matrix A n×m , mark the corresponding position of the obstacle as a ij =1, the non-obstacle position is a ij =0:

[0050] Map matrix row value: n = 8;

[0051] Map matrix column value: m = 6;

[0052] Map Matrix:A 8×6 ; Initialize to all zero array A = zeros(n,m);

[0053] Obstacle position array: zhangai_point = [7:919:2131:3343:45612182430364248];

[0054] Traverse the obstacle positions, calculate the coordinates of the obstacles and set the corresponding values ​​of the map matrix to 1, indicating that there is an obstacle at this position. 8×6 See Figure 1 .

[0055] Step 3: Set the count matrix B n×m , where b ij The corresponding value is a ij The number of times it has been walked.

[0056] Count matrix: B 8×6 =A8×6 ;

[0057] Traverse B 8×6 So that the corresponding b ij = 1 is the maximum number of times that can be walked, that is, b ij =15×max{n,m}=120, and the obtained B 8×6 See Figure 2 .

[0058] Step 4: Use the particle swarm optimization algorithm (PSO) to optimize the path.

[0059] Iteration number: item_i=200;

[0060] Shortest path length: route_length = inf;

[0061] Shortest path array: route_last = [];

[0062] Flag indicating whether the traversal is completed: flag = isYes(visited);

[0063] Call the PSO_inter function to get the reference point calculated by the PSO algorithm, calculate the legal points of the current point in four directions, compare the angle between the current point and the reference point obtained by PSO, select the point with the smallest angle to add to the path, and update the corresponding b ij , until all b ij All of them are greater than or equal to 1 and less than or equal to 120, the traversal ends and the shortest path is obtained; compare the length of each iterative path and select the shortest path. 8×6 like Figure 3 .

[0064] Step 5: Output the preliminary path, compress it, and delete duplicate routes.

[0065] Flag indicating whether to end the loop compression path: flag_pn = 0;

[0066] Call the zip_route function, zip_route2 function, and zip_route3 function to compress the path and delete unnecessary duplicate paths until the path length no longer decreases. 8×6 See Figure 4 .

[0067] Step 6: Initialize the drawing window and draw obstacles;

[0068] Mark the map coordinates and set the drawing boundaries and grid lines, set the starting point to red; dynamically draw the path, and finally output the path length. The final result is as follows Figure 5 .

[0069] The above shows and describes the basic principles and main features of the present invention and the advantages of the present invention. It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary examples, and the present invention can be implemented in other specific forms without departing from the spirit or basic features of the present invention. Therefore, no matter from which point of view, the embodiments should be regarded as exemplary and non-restrictive. The scope of the present invention is defined by the attached claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any figure mark in the claims should not be regarded as limiting the claims involved.

[0070] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.

Claims

1. The optimal traversal path algorithm based on improved PSO is characterized by: The following steps are involved: Step 1: Import the actual map and process it using the raster method to obtain a digital raster map. Step 2: Generate map matrix A based on digital grid map n×m , used to mark obstacle locations and non-obstacle locations. Step 3: Generate count matrix B based on the map matrix n×m ,b ij Record a ij The number of times it has been walked. Step 4: Use particle swarm optimization algorithm to find the optimal path. Step 5: Output the preliminary path, compress it, and delete duplicate routes. Step 6: Output the compressed optimal path and obtain the specific route and the length of the optimal path.

2. The optimal traversal path algorithm based on improved PSO is characterized by: In step 1, after field investigation, the actual road map is obtained in combination with the electronic map, and the traffic conditions and traffic requirements of different main roads and auxiliary roads are collected and marked accordingly. The correspondence between the width of the grid in the grid map and the actual road is as follows: the unit grid is a square with the same length and width; the side length of the grid is the width of the one-way road. A single lane is a row or column of unit grids, a double lane is two rows or two columns of unit grids, and a multi-lane is multiple rows or columns of unit grids.

3. The optimal traversal path algorithm based on improved PSO is characterized by: In step 2, according to the map grid division result obtained in step 1, the number of rows and columns obtained by division are respectively set as the map matrix A n×m The row values ​​(n) and column values ​​(m) of the map matrix A. n×m Each element in a ij , 4. The optimal traversal path algorithm based on improved PSO is characterized by: In step 3, according to the map matrix A in step 2 n×m Generate count matrix B n×m . B n×m Each element in b ij , in the initial state, When iterating, if you pass a in the map matrix ij , then b ij =b ij +1, and only b ij When ≤15×max{n,m}, the position is allowed to pass.

5. The optimal traversal path algorithm based on improved PSO is characterized by: In step 4, the function is called to obtain the reference point calculated using the PSO algorithm, calculate the legal points of the current point in four directions, compare the angle between the current point and the reference point obtained by PSO, select the point with the smallest angle to add to the path, and update the corresponding b ij , until all b ij All satisfy 1≤b ij ≤15×max{n,m}, end the traversal and get the shortest path of this time; after N iterations, compare the length of each iterative path and select the shortest path.

6. The optimal traversal path algorithm based on improved PSO is characterized by: In step 5, a compression function is used to compress the paths and delete duplicate paths.

Citation Information

Cited By

  • Method and device for polling photovoltaic panel by unmanned aerial vehicle

    CN120406504A