A method for generating a random map based on random weight assignment

Through the random map generation method based on random empowerment, the problem of high map repetition in the existing technology is solved, and the generated maps are more diverse and complex, meeting the needs of AI training, and improving the performance of AI.

CN115371675BActive Publication Date: 2025-06-13四川启睿克科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210956815.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-10
Publication Date
2025-06-13
Estimated Expiration
2042-08-10

AI Technical Summary

Technical Problem

When generating random maps in the prior art, the problem of high repetition is prone to occur, resulting in the performance of AI that cannot continue to improve after training.

Method used

A random map generation method based on random empowerment is adopted to generate maps and reduce their repetition through steps such as random empowerment, Manhattan distance smoothing, hole repair, isolated full acupoint elimination, and full acupoint tortuous supplementation.

Benefits of technology

It effectively reduces the repetition of the map, meets the demand of AI for training maps by navigation obstacle avoidance algorithms, and improves the performance of AI.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115371675B_ABST
    Figure CN115371675B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for generating a random map based on random weighting. A random map is generated by random weighting, and through smoothing weights, patching holes, eliminating isolated full holes, and supplementing the tortuosity of full holes, the repeatability of the map can be effectively reduced, and the requirements of the navigation and obstacle avoidance algorithm AI for the training map can be better met. The map randomly generated by the present invention can greatly enrich the maps required for the training of navigation and obstacle avoidance algorithms AI, such as in express sorting, floor-sweeping robots, and reception robots. After sufficient training, the navigation and obstacle avoidance algorithm AI can approach the optimal training result infinitely, effectively improving the performance of the navigation and obstacle avoidance algorithm AI.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computational simulation, and particularly to a method for generating a random map based on random weighting. Background Art

[0002] Maps play a crucial role in the AI training of navigation and obstacle avoidance algorithms. During the process of training and testing AI, a large number of non-repetitive maps are required to train and improve performance, so the demand for maps is very high. Most random maps are implemented in the "jigsaw puzzle" way, that is, some small pictures cut into certain fixed sizes and shapes are assembled in different ways according to a certain strategy to form different complete maps. In order to achieve a harmonious splicing effect of different small pieces, the whole map obtained in this way usually has relatively simple elements and cannot meet the requirements. Currently, ordinary map generation methods generally adopt the method of randomly combining fixed map elements to generate maps, which has the defect of high repetition rate after generating a certain number, resulting in the inability to continue improving the performance of AI after training for a period of time. Summary of the Invention

[0003] The purpose of the present invention is to provide a method for generating a random map based on random weighting to solve the above problems. The method of the present invention uses the method of first randomly weighting and then randomly walking behavior to generate a map, and then completes the map generation through smoothing weights, hole patching, eliminating isolated full holes, and supplementing the tortuosity of full holes. While generating a large number of maps, the repeatability of the maps can be effectively reduced, which can better meet the requirements of the navigation and obstacle avoidance algorithm AI training for maps.

[0004] The present invention achieves the above purpose through the following technical solutions:

[0005] A method for generating a random map based on random weighting, comprising the following steps:

[0006] Step S1: Input the required map size A (length) * B (width), and set the weight value range C, Manhattan distance D, maximum weight G, and the random weight E ranges from (0, G). The outer circle of the map is fixedly set to the maximum weight G, that is, the fixed position is a full hole;

[0007] Step S2: Randomly assign weight values E within the range for the elements (A xi , B yi ) in the two-dimensional array, E ∈ (0, G), and randomly select the weight demarcation point F, F < G;

[0008] Step S3: Perform Manhattan distance sampling smoothing on the randomly assigned weights, that is, take the average weight of the selected grid itself and the grids within the specified Manhattan distance for smoothing until all points are traversed;

[0009] Step S4: Randomly walk from the top-left point to generate a random map. During the walking process, points with weight E < F are considered as holes, and points with weight E ≥ F are considered as full holes.

[0010] Step S5: Repair holes (which can be understood as the floor). When all the surrounding grids of a hole grid are full holes, convert this grid into a full hole.

[0011] Step S6: Eliminate isolated full holes (which can be understood as walls). When the number of full hole grids around a full hole grid is less than 2, this grid is regarded as an isolated full hole. To eliminate isolated full holes, multiple iterative elimination processes are required until the map shows a stable state, that is, when all grids on the map no longer change after iterative elimination, proceed to the next step.

[0012] Step S7: Detect and connect hole areas. To ensure that there is only 1 area on the map, use the method of "random spreading erosion". For each grid in a smaller area, it is stipulated that there is a 75% probability that the surrounding walls become open spaces and spread. Stop spreading when it is detected that all holes intersect with the current hole with a different area number, and unify all hole numbers to achieve the connection of holes.

[0013] Step S8: Supplement the tortuosity of full holes, that is, increase the tortuosity of the map to avoid large areas of holes. Generate full holes by calculating the Manhattan distance. That is, when the number of walls in the grids within the specified Manhattan distance of a hole grid is 0, set this grid as a full hole.

[0014] Step S9: Complete the map generation.

[0015] The following are the explanations of some terms used in the present invention:

[0016] Manhattan distance: The distance between points a and b in the X-axis direction plus the distance in the Y-axis direction, that is, d(a,b) = |x a - x b | + |y a - y b |. The reason for using it is that floating-point operations are slower and have errors compared to addition and subtraction operations. If the Euclidean distance between points A and B (Euclidean distance: in two dimensions, the Euclidean distance between two points is the straight-line distance between them) is directly used, floating-point operations must be performed. If the Manhattan distance d(a,b) is used, only addition and subtraction operations need to be calculated. In this way, not only can the operation speed be improved, but also there will be no errors no matter how many cumulative operations are performed from the perspective of accuracy.

[0017] Random weight: That is, a method of assigning a weight value to an object by randomly generating any positive integer. The purpose of this patent is to generate a map for algorithm AI training. Using random weights can find a sufficient number of weight sets for specific mapping functions in the data for algorithm AI training.

[0018] The beneficial effects of the present invention are as follows:

[0019] Compared with the defect that the existing maps randomly generated with fixed elements are prone to repetition, the present invention generates a random map by randomly assigning weights, and through smoothing weights, hole patching, eliminating isolated full holes, and supplementing the tortuosity of full holes, the repetition of the map can be effectively reduced, and the demand of the navigation and obstacle avoidance algorithm AI for the training map can be better met.

[0020] The map randomly generated by the present invention can greatly enrich the maps required in the training of navigation and obstacle avoidance algorithms AI such as express sorting, floor cleaning robots, and reception robots, enabling the navigation and obstacle avoidance algorithm AI to infinitely approach the optimal training result after sufficient training, and effectively improving the performance of the navigation and obstacle avoidance algorithm AI. Description of the Drawings

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0022] Figure 1 It is a schematic diagram of the generation of a random weight map of the present invention;

[0023] Figure 2 It is a schematic diagram after the weights of the present invention are smoothed;

[0024] Figure 3 It is a schematic diagram after the holes of the present invention are patched;

[0025] Figure 4 It is a schematic diagram after the first elimination of full holes of the present invention;

[0026] Figure 5 It is a schematic diagram of the elimination of full holes in the stable state of the present invention;

[0027] Figure 6 It is a schematic diagram after the holes of the present invention are detected and penetrated;

[0028] Figure 7 It is a schematic diagram of the generated map of the present invention;

[0029] Figure 8 It is a flowchart of the generation of a random map of the present invention. Detailed Embodiments

[0030] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be described in detail below. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other implementation manners obtained by those of ordinary skill in the art without creative efforts shall fall within the scope protected by the present invention.

[0031] In any embodiment, as Figure 1-8 shown, a random map generation method based on random weighting of the present invention includes the following steps:

[0032] Step S1: Input the required map size A (length) * B (width), and set the weight value range C, Manhattan distance D, maximum weight G. The random weight E ranges from (0, G), and the outer circle of the map is fixedly set to the maximum weight G, that is, the fixed position is a full hole.

[0033] Step S2: Randomly assign weight values E within the range for the elements (A xi , B yi ) on the two-dimensional array, E ∈ (0, G), and randomly select the weight demarcation point F, F < G.

[0034] Step S3: Perform Manhattan distance sampling smoothing on the randomly assigned weights, that is, take the average weight of the selected grid itself and the grids within the specified Manhattan distance for smoothing until all points are traversed.

[0035] Step S4: Randomly walk from the point in the upper left corner to generate a random map. During the walking process, the points with weight E < F are empty holes, and the points with weight E ≥ F are full holes.

[0036] Step S5: Repair the empty holes (which can be understood as the floor). When all the grids around an empty hole grid are full holes, convert this grid into a full hole.

[0037] Step S6: Eliminate the isolated full holes (which can be understood as walls). When the number of full hole grids around a full hole grid is less than 2, this grid will be regarded as an isolated full hole. To eliminate the isolated full holes, multiple iterative elimination processes are required until the map shows a stable state, that is, when all the grids on the map no longer change after iterative elimination, proceed to the next step.

[0038] Step S7: Detection and penetration of the cavity area. To ensure that there is only one area on the map, the method of "random spreading and erosion" is adopted. For each grid in a smaller area, it is stipulated that there is a 75% probability that the surrounding walls become open spaces and spread. When it is detected that all cavities intersecting with the current cavity have different area numbers, the spreading stops, and all cavity numbers are unified, realizing the penetration of the cavities.

[0039] Step S8: Complementary tortuosity of the full cavity, that is, increasing the tortuosity of the map to avoid the appearance of cavities with too large an area. The full cavity is generated by calculating the Manhattan distance. That is, when the number of walls in the grids within the specified Manhattan distance of an empty cavity grid is 0, this grid is set as a full cavity.

[0040] Step S9: Complete the map generation.

[0041] In a specific embodiment, as Figure 1-8 shown, a random map generation method based on random weighting of the present invention includes the following steps:

[0042] 1. Input the size of the generated map: A*B = 30×30 grids; set the maximum weight G = 4, that is, the weight range is 5 levels of weights from 0 to 4; set the weights of the grids in the outermost circle of the map to G, and the weight is fixed at 4; therefore, in fact, the random generation part of the map is in the grids between 1 and 28. At this time, random weighting is performed on the grids on the map (excluding the surrounding areas), that is, the random numbers generated from 0 to 4 are respectively assigned to the 28×28 grids in the map. The random weighting results are shown in Figure 1 .

[0043] 2. Perform Manhattan distance sampling and smoothing on the map. The Manhattan distance is taken as 1. After smoothing the weights, a random walk within the map boundary is started from the point in the upper left corner of the map. Here, the weight range is 0 to 4, so F = 2 can be taken as the weight as the demarcation point to generate the initial map. The results are shown in Figure 2 .

[0044] 3. Repair the cavity (floor). For an open space grid, when all the grids around it are walls, this grid is converted into a wall. The results are shown in Figure 3 .

[0045] 4. Eliminate isolated full cavities (walls), which means eliminating the walls in the map that have little correlation with the walls in other positions. In this example, it is stipulated that when the number of wall grids around a wall grid is less than 2, this grid will be regarded as an "isolated full cavity". The results are shown in Figure 4 .

[0046] 7. To ensure that there are no isolated full holes on the map, multiple iterative elimination processes are required until the map presents a "stable" state, that is, when all the grids on the map no longer change, the next step can be entered. The result is shown in Figure 5 .

[0047] 8. To ensure that the training ontology can move on all the floors on the map, it is necessary to ensure that all the floors on the map are in a connected state. Each open space surrounded by walls on the map forms a set, and there may be several regions on a map. Multiple iterative connection processes are required to ensure that there is only one region on the map.

[0048] Therefore, in order to make the number of regions become one, it is necessary to penetrate the isolated regions. The "random spreading erosion" method (but not limited to) can be used for processing, that is, for each grid in the isolated region, there is a 75% probability that the surrounding walls become open spaces and spread. When an open space grid with a different region number from the current one is detected, the spreading stops, and the connection of all the floors is achieved. The result is shown in Figure 6 .

[0049] 9. Output the generated map. The result is shown in Figure 7 .

[0050] As described above, it is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claimed rights. In addition, it should be noted that in the above specific implementation manner, the various specific technical features described can be combined in any appropriate way without contradiction. To avoid unnecessary repetition, the present invention does not separately describe various possible combination methods. In addition, any arbitrary combination can be made between different embodiments of the present invention as long as it does not violate the idea of the present invention, and it should also be regarded as the content disclosed by the present invention.

Claims

1. A random map generation method based on random weighting, characterized in that, it includes the following steps: Step S1: Input the required map size A (length) * B (width), and set the weight value range C, Manhattan distance D, the maximum weight G. The random weight E takes values in the range from (0, G). The outer circle of the map is fixed to the maximum weight G, that is, the fixed positions are full holes; Step S2: For the elements (A xi , B yi ) on the two-dimensional array, randomly assign a weight value E within the range, where E ∈ (0, G), and randomly obtain a weight demarcation point F, with F < G; Step S3: Perform Manhattan distance sampling smoothing on the randomly assigned weights, that is, take the average weight of the selected grid itself and the grids within the specified Manhattan distance for smoothing until all points are traversed; Step S4: Randomly walk from the top-left point to generate a random map. During the walking process, the points with weight E < F are empty holes, and the points with weight E ≥ F are full holes; Step S5: Repair empty holes. When all the grids around an empty hole grid are full holes, convert this grid to a full hole; Step S6: Eliminate isolated full holes. When the number of full hole grids around a full hole grid is less than 2, this grid is regarded as an isolated full hole. To eliminate isolated full holes, multiple iterative elimination processes are required until the map shows a stable state, that is, when all the grids on the map no longer change after iterative elimination, enter the next step; Step S7: Detect and penetrate the empty hole area. To ensure that there is only 1 area on the map, use the method of "random spreading and erosion". For each grid in a smaller area, it is stipulated that there is a 75% probability that the surrounding walls become open spaces and spread; stop spreading when it is detected that all the empty holes that intersect with the current empty hole have different area numbers, and unify all the empty hole numbers to achieve the penetration of the empty holes; Step S8: Supplement the tortuosity of full holes, that is, increase the tortuosity of the map to avoid the appearance of too large areas of empty holes, and generate full holes by calculating the Manhattan distance; Step S9: Complete the map generation.

2. The random map generation method based on random weighting according to claim 1, characterized in that, The Manhattan distance is expressed as: the distance between two points a and b in the X-axis direction plus the distance in the Y-axis direction, that is, d(a, b) = |x a - x b | + |y a - y b |.

3. The random map generation method based on random weighting according to claim 1, characterized in that, the random weight is to assign a weight value to an object by randomly generating any positive integer.

4. The random map generation method based on random weighting according to claim 1, characterized in that, in step S8, when the number of walls in the grids within the specified Manhattan distance of an empty hole grid is 0, set this grid as a full hole.

Citation Information

Patent Citations

  • Unmanned vehicle track real-time planning method based on road structure weight fusion

    CN110081894A

  • Voltage sag monitoring point multi-objective optimization configuration method

    CN111461924A