Mobile robot path optimization technology based on niche genetic algorithm
Mobile robot path planning is an important research field of robotics and a combination of artificial intelligence and robotics. Regardless of the type of mobile robot, it is required to follow an optimal (or sub-optimal) path in the workspace according to a certain criterion (such as the shortest total length of the travel route, minimum energy consumption, etc.).
The typical methods of path planning include graph search method, grid method, artificial potential field method, etc. These algorithms have certain limitations and are easy to fall into local optimal solutions. Genetic algorithms have good applicability in solving nonlinear problems. It has become a more used method in path planning. However, the standard genetic algorithm itself also has the prematureness, easy to fall into the local optimal solution and other defects, and can not guarantee the computational efficiency and reliability requirements of path planning. In order to improve the solution quality and efficiency of path planning, an improved genetic algorithm based on pre-selection mechanism niche technology is proposed and applied to the path planning of mobile robots. The complex two-dimensional coordinates are used to encode one-dimensional coordinates. The method effectively reduces the search space of genetic algorithm. According to the walking characteristics of mobile robot, adaptive crossover operator, adaptive mutation operator, insertion operator, deletion operator, disturbance operator and inversion operator are designed. The computer simulation proves that the improved genetic algorithm significantly improves the search efficiency and convergence speed, and can guarantee convergence to the global optimal solution, overcomes the shortcomings of the standard genetic algorithm, and quickly seeks an optimal path without collision.
1 Improvement and application of robot path planning algorithm based on genetic algorithm
The mobile robot path planning in this paper aims to find an optimal path on a two-dimensional map of known obstacle distributions, so that the distance to the target point is the shortest, and the distance from the obstacle is maximized as much as possible. . To simplify the discussion, the mobile machine is considered a mass point, and the boundary of the obstacle is expanded outwards, which is the maximum safe distance of the mobile robot.
1.1 Mechanism of niche genetic algorithm based on pre-selection mechanism technology
Because the simple genetic algorithm is a random method, which is designed to perform implicit parallel optimization on multiple different individuals, its running process and implementation method are still serial in nature, and the evolutionary operation process is relatively slow; The basic genetic algorithm often converges to a local best advantage before each individual reaches the optimal solution, resulting in the chromosomes tending to be consistent, that is, the phenomenon of "premature aging" occurs. In order to overcome these shortcomings, the niche genetic mechanism was introduced, and the niche method based on pre-selection mechanism technology was used to maintain the diversity of the population, avoiding the large increase of individual individuals in the population, and realizing the local optimal solution and global optimality in the solution space. Finding the solution.
Niche technology divides each generation into several categories. Each class selects a number of individuals with greater fitness as a representative of a class to form a population, and then crosses and mutates between the population and between different populations. A new generation of individual groups is generated, and a pre-selection mechanism is used to complete the selection operation. The genetic algorithm based on this niche technology can better maintain the diversity of solutions, and has high global optimization ability and convergence speed.
In the pre-selection mechanism, the substring can replace its parent string and enter the next generation group only if the substring's fitness exceeds its parent string. This approach tends to replace individuals that are similar to themselves (the trait inheritance between the father and the child), thus better maintaining the distribution characteristics of the population, even in the case of relatively small population size, Group distribution characteristics. The implementation steps of the specific algorithm are as follows:
(1) Initialization (establishing an initial population, determining genetic parameters);
(2) Calculating the fitness of the individual;
(3) genetic manipulation (selection, crossover, variation);
(4) Comparing the fitness of the substring and the parent string, if the fitness of the substring is higher than the fitness of the parent string, the parent string is replaced; otherwise, the parent string is unchanged;
(5) If the termination condition of the algorithm is not satisfied, then return to step (2); otherwise, the algorithm terminates.
1.2 path coding
The way the gene is encoded determines the representation of the problem in the genetic algorithm and also determines the genetic evolutionary operation used. Each chromosome is represented as a gene string that is composed of characters in a given symbol set. In the early genetic algorithm, the symbol set was limited to binary numbers, so the genetic genotype is a binary symbol string, which has the advantages of simple operation of encoding and decoding, and genetic manipulation of crossover, mutation, etc., which is easy to implement; Specific knowledge of the problem, as well as optimization problems for some continuous functions. Due to the random nature of the genetic algorithm, its local search ability is poor. For some continuous function optimizations that require multidimensional and high precision, the binary code has the mapping error when the continuous function is discretized. When the individual code string is short, it may not reach. Accuracy requirements; when the individual code string is long, although the accuracy can be improved, it will increase the search space of the algorithm sharply.
The real number coding is suitable for representing a large range and high precision. It can effectively overcome the shortcomings of the Hamming cliff with binary coding, and can directly use the true value coding to facilitate the heuristic knowledge related to the problem, which can improve the search efficiency of the algorithm. The path of the mobile robot can be regarded as a line segment connecting a series of coordinate points. The path planning for the mobile robot is to perform various operations on these coordinate points so that they meet the needs of the mobile robot to walk. Taking into account the characteristics of the mobile robot itself (not only need to avoid obstacles, but also to ensure the smoothness of the path), and the uncertainty of the number of turning points in the path of the mobile robot, using the real number coding of variable-length chromosomes, using real numbers The path coordinate points are directly encoded to facilitate flexible operation of the path points, thereby avoiding the cumbersome operation of converting the binary bit string and the rectangular coordinate points when using binary encoding, and facilitating the operation of the genetic operator.
1.3 Population initialization
The optimal path design for performing genetic algorithm is that the population must be initialized. Since the initial path is randomly generated, the coordinates of each turning point may be distributed throughout the planning area, including feasible and infeasible, thus increasing the search range. Here the initial turning point is limited in the feasible area to speed up the convergence of the genetic algorithm. The specific method is as follows: determine whether the turning point is within the feasible area, and if not, re-select until the coordinate point meets the condition.
According to the complexity of the planning environment, the number of turning points in the optimal path is also uncertain. Generally speaking, the more complex the environment, the more turning points. Therefore, the algorithm uses variable length coding technology to delete the chromosomes. Insertion and other operations can determine the appropriate number of turning points to optimize the path. However, the number of turning points is too large, and the resources are too large, which will make the operation slower. Therefore, during the operation, the maximum turning point is set to Nmax, and the length n of each individual in the population satisfies 2 ≤ n ≤ Nmax.
Using the niche principle, each generation of individuals is divided into several categories, and each individual is selected as a group with a large degree of fitness.
1.4 fitness function
The so-called path planning of mobile robots means finding the shortest feasible path between the starting point and the ending point. The constraint condition is that it does not intersect with the obstacle, and the corner of the mobile robot during walking should not be too large. The algorithm takes two conditions as the feasibility evaluation function of the planning path, that is, the total length of the path and the average size of the corners of each turning point. For the infeasible path, the fitness is punished, so that its fitness is worse than the feasible path. .
(1) The total length of the path. In order to prevent the mobile robot from colliding with obstacles, it should be kept at a certain safe distance from the obstacles. Assume that the safe radius of the mobile robot is r; the distance between the mobile robot and the obstacle is d, then the total length of the path Len is calculated by equation (1):
Where: d(pi-1, pi) is the length between the turning point pi-1 and pi. If the path between pi-1 and pi is not feasible, the penalty function method is used to penalize its fitness. The penalty function is defined as follows:
Where: ε is the penalty factor. The evaluation function for the path can be written as:
To determine whether the path between the two points is feasible, it is only necessary to judge whether the connection between the two points and the sides of the obstacle intersect. According to the geometric principle, judging whether two line segments intersect can be determined by the following two steps: rapid rejection test; straddle test. In view of the length of the article, these two experiments will not be elaborated here.
The evaluation path is the shortest path length. By using the penalty factor, the infeasible path can be lengthened, thereby reducing its fitness value.
(2) Path smoothness. The characteristics of the mobile robot determine that it is not suitable to turn with too large corners during walking, so the whole walking path should be smooth and smooth, that is, the corner value at each turning point should be as small as possible. It is assumed here that the maximum value of the corner cannot exceed π/2, and the smoothness can be calculated using the average corner value of the path:
Where: ξ is a constant that tends to zero (ξ>0); αi(0≤αi≤π, i=2,3,...,n-1) represents the angle between the two vectors AC, CB, B The coordinates of point C are (xi-2, yi-1), (xi, yi), (xi-1, yi-1); k is the number of αi greater than or equal to π/2, that is, when When an angle is greater than or equal to π/2, the fitness is penalized. When n=2, the path is the connection between the start point and the end point. If it is feasible, the M value tends to zero. It can be seen that the smaller the M value, the better the smoothness of the path.
The evaluation function of the above two conditions is obtained, and the fitness function of the entire path can be obtained. The weighted summation using various evaluation functions is a commonly used method for determining the fitness function. Since the weighting coefficients are not constant, but vary with the path and obstacle conditions, it is difficult to adjust and determine the weighting coefficients in this case. Therefore, when determining the fitness function, try to minimize the number of items of the fitness function, but you must fuse the two conditions of the path planning into the genetic optimization process. Here, the form in which the evaluation function is multiplied is used, as shown in the equation (6).
f=1/(ML) (6)
With f as the basis for the selection operation, the smaller the path length and the average corner, the better the fitness.
1.5 Genetic operators
(1) Select an operator. A selection strategy that combines the tournament selection method with the elite retention method. In the selection of the tournament selection method, K individuals are randomly selected in the group for comparison. The individuals with the best fitness will be selected as the parent of the next generation, and the parameter K is called the competition scale. This type of selection enables individuals with good fitness in the population to have a greater chance of survival. At the same time, because it only uses the relative value of fitness as the selection criterion, and does not directly proportional to the numerical value of fitness, thus avoiding the influence of super-individual, to avoid the occurrence of premature convergence and stagnation to some extent. The elite retention method is the best individual in the current population. It does not participate in genetic operations and can be directly copied to the next generation, replacing the individuals with the least fitness among the sub-populations produced by the crossover and mutation operations. The advantage is that during the search process. It can make a generation of optimal individuals not be destroyed by genetic manipulation, which ensures that the genetic algorithm converges to the optimal solution with probability. Experience has shown that individuals who retain 2% to 5% of the population as a whole have the best results.
(2) Crossover operator. Using the single-point crossover method, randomly select one intersection point (except the start point and the end point) on the two parents, and exchange the chromosomes of the two individuals after their respective intersections. Considering that the length of the planned path is variable, in order to prevent an excessively cumbersome or simple path after the cross operation, the length of the generated new individual is limited, that is, the maximum length cannot exceed Nmax, and the loop cannot be generated, if not, Reacquire the intersection of the two parent individuals.
(3) Insert the operator. Two insertion operators are designed. The first type is targeted, that is, inserting one or more turning points between two turning points connecting the obstacles through the obstacle, so that the generated path avoids the obstacle, as shown in Fig. 1(a); The second type is a general insertion that inserts a randomly generated turning point with a certain probability, as shown in Figure 1(b).
(4) Disturbance operator. Two kinds of perturbation operators are also designed. The first one only selects the turning point where the path is not feasible for small-scale adjustment, making its path feasible, as shown in Figure 1(c); the second is whether the path is feasible or not. Arbitrarily select a position and adjust its turning point coordinates with probability pm. In the early days of evolution, the number of solutions that were not feasible was large, and the scope of adjustment was larger. In the later stages of evolution, the scope of adjustment gradually narrowed, as shown in Figure 1(d).
(5) Delete the operator. Create a storage space REC, in a path, if the line connecting the point (xi-1, yi-1) and the point (xi, yi) passes the obstacle, but (xi-1, yi-1) and (xi+ If the connection of 1,yi-1) does not pass the obstacle, the point (xi, yi) is added to the REC. If the REC is not empty, randomly select a point to delete it (see Figure 1(e)); otherwise, select a path point arbitrarily in the path and delete it with probability pd, as shown in Figure 1(f).
(6) Smoothing operator. The smoothing operator only operates on the largest corner of the feasible path, as shown in Figure 1(g). The vertex pj of the corner α is deleted, and the points pj-1, p1, p2, and pj+1 are sequentially connected to form a feasible path segment sequence pj-1p1 → p1p2 → p2pj+1.
(7) Inversion operator. Randomly select two intermediate turning points in the path and reverse the turning point between them. The inversion operator can make a sharp change in the path, which has a positive meaning for a path with more turning points. The usual crossover and mutation operators are not easy to achieve this effect, and the inversion operator can correct the genetic errors that may occur during genetic evolution, as shown in Figure 1(h).
1.6 Genetic Operator Probability Selection
Choosing the appropriate genetic operator to execute the probability is one of the keys to whether the genetic algorithm can converge to the optimal solution. In the early stage of the evolutionary process, there are a large number of infeasible solutions in the population, so the probability of the crossover operator and the perturbation operator should be larger, and the smoothing operator takes a smaller probability. With the advancement of the evolutionary process, the feasible solution If the number is increased, the probability of the smoothing operator should be increased appropriately to improve the smoothing performance of the feasible solution. At the same time, in order to prevent the crossover operator and the perturbation operator from destroying the feasible solution, it is necessary to reduce the execution probability and fine-tune the shape of the feasible solution with a small disturbance probability. Among them, the perturbation operator (1) and the insertion operator (1) are heuristic operations on the path turning point, which are optimized for the infeasible path. For these operators, a higher probability should always be selected. Inserting the operator (2) increases the number of turning points of the path and should take a smaller probability.
1.7 Termination conditions
Generally, in the case of ignorance of the problem, the algorithm can be terminated after the objective function reaches an acceptable range. In addition, the maximum evolution algebra can be set to force the termination of the algorithm within a given evolutionary algebra to ensure computational time requirements. For practical purposes, the maximum evolutionary algebra termination criterion is adopted here, and the feasible path with the best fitness is selected.
1.8 Algorithm Flow
The improved flow based on niche genetic algorithm is shown in Figure 2. The specific algorithm is described as follows:
(1) Initialize the population, select N points along the distance between the starting point and the ending point, and randomly select the ordinate of the turning point on the vertical line of these points, and make these turning points not in the obstacle;
(2) Each generation of individuals is divided into n categories, and each individual with a large degree of fitness is selected as an excellent representative of a class to form a population. Population size Gi (i = 1, 2, ..., n + 1);
(3) Calculate the fitness of all individuals in the population, retain their best individuals, then use the tournament selection method, select the parent individual to perform the crossover operation, and check whether the obtained individual progeny chromosome length exceeds N, if not If it is exceeded, it will be retained, otherwise it will be discarded.
(4) Perform mutation, insertion, disturbance, deletion, and smoothing operations on newly generated progeny individuals with a set probability. In this process, a pre-selection mechanism is adopted to compare the size of the substring and the parent string, and if the fitness of the substring is higher than the fitness of the parent string, the parent string is replaced; otherwise, the parent string is unchanged;
(5) Repeat steps (3) and (4) until the number of new individuals obtained is equal to the number of parent groups;
(6) replacing the least adaptable individual in the new population with the retained previous generation of the best individual;
(7) Check the algorithm stop condition. If the match is aborted, otherwise jump to step (3) and the algorithm continues.
2 simulation
The environmental information of the optimal path planning and design of the mobile robot mainly includes the identification of various obstacle information in the active area of ​​the mobile robot. This article regards various obstacles as infeasible areas and is represented by polygons of arbitrary shape. In the VC 2005 environment, the above algorithm is simulated. The algorithm parameters are selected as the path maximum turning point 30, the initial turning point number 20, the population size 100, the tournament size is 5, and the maximum evolution algebra G=80. In the first 20 generations of the algorithm, the crossover probability pc=0.6, the perturbation probability pm=0.6, the insertion operator 2pi=0.6, the smoothing operator probability ps=0.1; after 20 generations pc=0.1, pm=0.2, pi=0.01 , ps=0.7.
In the initial stage of the algorithm, because there are more turning points, the deletion probability should be larger, which can reduce the number of turning points and thus reduce the length of the path; but in the later stage of the algorithm, the path points are less, and then use larger Deletion probability makes it easy for the algorithm to fall into the local solution, and the probability of convergence to the optimal solution is greatly reduced. Therefore, the deletion probability in the late evolution should be reduced to ensure the diversity of the path. The initial deletion probability is chosen to be 0.8. After about 20 generations, 0.1 is selected, and the probability of perturbation operator 1 and insertion operator 1 is always 0.8. Select two different environments (see Figure 3), run the above algorithm 10 times each, and select the best path to display in Figure 3 (a), Figure 3 (b). As can be seen from Figure 3, the improved genetic algorithm has good adaptability to various environments. Among them, the situation in Fig. 3(a) is the simplest, and the optimal result is obtained only after 19 generations; Fig. 3(b) has evolved after 36 generations; it converges to the optimal solution.
In order to compare with the performance of the standard genetic algorithm, the first and second experiments were carried out using the algorithm and standard genetic operators respectively. The selection of the standard genetic algorithm adopts the tournament selection method, and its crossover probability and mutation probability are the same as the algorithm in this paper. The running results are shown in Table 1 and Table 2.
It can be seen from the data in Table 1 and Table 2 that the algorithm is superior to the standard genetic algorithm regardless of the running time or the path length of convergence. Mainly because the algorithm designed a new genetic operator for the planning path, which speeds up the evolution and is easier to converge to the optimal solution.
3 Conclusion
The niche technology based on pre-selection mechanism is adopted, and the genetic operator is designed based on heuristic knowledge. The standard genetic algorithm has been improved and expanded, and applied to the path planning of mobile robot walking. The algorithm takes into account the rapidity of genetic evolution and the diversity of the population, effectively suppresses the occurrence of "premature" phenomenon, and can search for local optimal solutions and global optimal solutions. Experiments show that the algorithm can converge to the optimal solution in a small evolutionary algebra in different environments. The execution speed and success rate of the algorithm are significantly higher than the standard genetic algorithm. In addition, the selection of appropriate crossover and mutation probabilities at different stages of evolution has a critical impact on the evolutionary results. This paper divides the algorithm into two phases and sets different genetic operational probabilities. This method is relatively simple and cannot be Fully adapt to changes in the population. How to make the algorithm automatically adjust and optimize these parameters according to the evolution of the population requires further research and improvement.
3.2v12-30Ah Lithium Battery Cells
3.2v12-30Ah Lithium Battery Cells,3.2v12-30Ah Lithium Battery Cells price,3.2v12-30Ah Lithium Battery Cells product
Jiangsu Zhitai New Energy Technology Co.,Ltd , https://www.ztbatteries.com