Path Optimization of Welding Robot Based on Ant Colony and Genetic Algorithm

,


Introduction
In modern intelligent industrial production, the path optimization problem of welding robots has always been an important research object in the field of robotics. Under the requirements of large-scale industrial production tasks, the path judgment of artificial experience is difficult to meet the requirements of production efficiency [1]. ACO optimization should not only consider the obstacle judgment and the shortest path but also analyze the time and energy consumption of the robot in a complex environment [2]. The research is establishing a simulation model for welding robot parameters and welding task data samples and using the improved ACO and optimized GA to solve the problem of optimizing the distance of the welding robot's path point and the shortest time trajectory planning problem of the fixed-point path. GA and ACO are commonly used simulation intelligence algorithms, which are often used in path optimization and combinatorial solving problems [3]. Therefore, the research combines relevant theories and the specific welding tasks of the robot to calculate the shortest space path of the solder joint, and on the basis of ensuring the welding accuracy and accessibility, to formulate an optimal welding path. At the same time, on this basis, the shortest time trajectory planning of the robot is carried out to ensure that the robot can complete the welding task efficiently and accurately. This is of great significance to improve the working efficiency of the body in white welding production line, increase the economic benefits of production, and extend the service life of the robot. Aiming at the defects of premature convergence and insufficient local search capability of GA, the research is carried out by introducing the penalty factor and the probability correction method of the sine function. For the problem that the pheromone function of the ACO drowns the expected function, a random disturbance factor is introduced in this study. For different optimizations and applications of algorithms, this research is expected to provide an optimized robot path selection method for industrial tasks with multiple solder joints and to improve the production efficiency of industrial intelligence.

Literature Review
Fang et al. proposed a sensor which used particle optimization ACO to numerically optimize the structure of artificial magnetic conductors. Experiments demonstrate the potential of this in practical application, and the sensor has the advantages of less energy cost and less time consumption in monitoring liquid samples [4]. Wang et al. established a model of ship power system and a network reconstruction according to the operational characteristics and proposed an ACO to solve the network in [5]. Umar et al. use saACO to improve the effectiveness and optimal vehicle maneuvering of road images captured using a stereo vision system. Vehicle lane detection systems show good performance of saACO-based lane detection systems and better performance compared to standard ACO methods [6]. Saemi et al. designed a metaheuristic algorithm based on ACO. The results of the study show that the proposed ACO has efficient performance in solving ensemble problems [7]. Shobaki et al. proposed an ACO algorithm. Data shows that the ACO algorithm and B&B model are almost the same in computing time consumption. However, ACO is superior to the B&B algorithm in a large number of hard scheduling areas [8]. In order to eliminate vegetation interference, Xia et al. established a spectral mixture analysis model based on ACO. The comparison of the ETM image with the resulting image shows that the method can remove vegetation interference [9]. Chadi et al. propose a general high-level flexible genetic algorithm with a "general approach to encoding problems into instances of different heuristics." Experiments show that the proposed algorithm will also provide a time series tracking capability for further analysis and potential improvements [10]. Yu et al. explored a method of GA and conducted an image restoration experiment based on the algorithm. The parameters are optimized, which proves the feasibility of implementing genetic algorithm with memristor [11]. Liu et al. developed a hybrid genetic algorithm, whose principle is the combination of 2-opt algorithm and genetic algorithm. When the model is used to solve the path problem with the lowest electric energy consumption of electric vehicles, its calculation time and optimization performance are higher than those of the simulated annealing algorithm [12].
Lin et al. creatively used artificial potential field machine global search and improved dynamic window method to optimize local search. Experiments show that the robot under the process of movement and thus perform path optimization [13]. Sadiq et al. proposed an improved ACO. When the method is applied to the motion of the robot arm, it can obtain the optimal path planning that meets the moving target. Experiments show that efficient in achieving optimal paths and trajectories [14]. Touzani et al. proposed a fast algorithm for generating a ranking approximate optimal solution to the multirobot task ranking problem by modeling the problem as a new minimum (and maximum) multiple generalized traveling salesman problem "minimum (and "maximum") MGTSP" model to realize high school production of automobile assembly lines [15]. Wang et al. proposed a 2norm-based motion optimization method for a highly redundant mobile humanoid robot and designed a kinematic model through the entire modeling process. Compared with the before and after motion optimization based on the robot 2-norm algorithm, the optimized robot motion has the smallest fluctuation during the entire movement tracking and manipulation process, the smoothness is improved, the energy consumption is limited, and the path is short [16]. Facing the path optimization problem of automobile spraying robot, Hua et al. proposed method of adjacent paths and built a spraying task model and a robot virtual model. In the experiment, this method can calculate the motion, robot angle, and angular velocity to provide high-quality automobile spraying [17].
To sum up, there are a lot of research results on the optimization of robot moving path at home and abroad, but few of them divide the welding task path of welding robot into the shortest distance optimization and the shortest time optimization. Therefore, in this study, the ACO-GA model will be used for analysis from the distance layer and the time layer. The main purpose of this paper is to fully exploit the advantages of the algorithm and combine it with the research problems to achieve efficient and accurate improvement of robot motion performance.

Research on Path Optimization of Welding
Robot Based on GA and ACO 3.1. Path Planning Method of Welding Robot Based on Improved Parameters of Ant Colony Algorithm. The path planning problem of the welding robot can be regarded as the traveling salesman problem, and each position node is regarded as a welding point. The traditional path optimization method based on experience-based selection of solder joint order is difficult to adapt to the multijoint task of large-scale equipment. Based on this, a biological foraging behavior model based on the ant colony algorithm (ACO) is studied to deal with the path point order of the discrete solder joint task of welding robot [18]. In the common path planning algorithms for mobile robots in Figure 1, the ant colony algorithm has heuristic search and positive feedback mechanism, which can effectively avoid the path optimization from falling into local optimization. ACO designs are to determine the sequence of welding points and minimize the collision of the robot's path. When the robot traverses all the welding points, the ant colony algorithm finds the shortest foraging behavior of the biological ant colony. Firstly, the path objective function of the welding robot is determined as Journal of Applied Mathematics In formula (1), it L min represents the shortest path distance; the n number of a i , b i , c i solder joints; and the threedimensional position of the solder joints. Ants will secrete and perceive pheromones on the path they go through when they are foraging. The shorter the path, the stronger the ant perception pheromone is, which leads to more ants that tend to move towards the path. But as time goes on, the pheromones of the path increase continuously and the longer the path is, the fewer pheromones can be perceived by ants, which ultimately leads to fewer ants choosing the path. The positive feedback mechanism and heuristic search presented by the group behavior of ants can seek the shortest path optimization of foraging behavior. The path optimization problem of welding robots is brought into the ant algorithm, and the a calculation formula of the path selection probability of individual ants from position i to position j is as follows: where P a ij ðtÞ represents the path probability that the τ ij ðtÞ ant t chooses j from the location to the location i at the moment, t represents the information concentration between the η ij location i and the location at the moment, j represents the heuristic function between the two locations, ω represents the pheromone weight, and ψ represents the weights of the heuristic function. In order to prevent the path channel from overriding the expected information of the heuristic function in the iterative process, the pheromone changes of ant selection path need to be updated constantly, and the mathematical model of the change of pheromone concentration is expressed as In formula (3), τ ij ðt + nÞ represents t + n in the pheromone concentration between two points in φ time, and i, j represents the pheromone volatilization factor. mrepresents the total number of individuals in the ant colony and represents△τ a ij ðtÞthe pheromone increment left by the ants on the path between two pointsi, jafter the iteration cycle.a the formula for calculating the increment of pheromone secreted by ants in the formula is shown in Equation (4) includes a pheromone increment calculation method based on the total pheromone secreted by ants and the length of the ant's local path, which Q represents total pheromones released by all ants in ant colony and d ij is the distance from position i to position j. The path selection strategy of the initial ant colony algorithm relies on the roulette method, however, under the influence of the positive feedback mechanism of ACO. Therefore, in the iterative calculation process of the algorithm, the path selection of the ant colony tends to the path with high pheromone concentration. It is more and more obvious [19]. In order to ensure the stability of the algorithm in the convergence of complex computation, the research integrates the overall pheromone and the path length model and calculates the pheromone increment. Therefore, the overall length of the path traversed by the individual ants is used to L k represent the path length. The longer the distance, the more pheromone and the less increments. Also, in order to avoid the decrease of the global search performance of the algorithm, the pheromone concentration floods the heuristic function and falls into the local optimum problem. The study introduces a dynamic random disturbance factor to increase the probability of ants choosing other paths. Therefore, t the probability calculation formula of the path selected by an individual ant from a position to a position at a j moment is changed as follows: In formula (5), μ represents the random disturbance scale factor, and its value range is [0, 1]. With the increase of ACO iterative calculation, μ × e μ/t the value of the disturbance factor with the inverse exponential becomes closer and P 0 closer. Therefore, the path probability will be calculated according to the original ACO if the number of  3 Journal of Applied Mathematics iterations is less. The path probability is calculated according to the original ACO, and when the μ × e μ/t factor is greater than or equal to the random disturbance rate P 0 , the probability selection of iterative calculation is introduced into the disturbance factor to increase the randomness and global path optimization capability of the algorithm. A brief description of the shortest path and shortest time multiple optimization framework of the welding robot proposed in this study is shown in Figure 2.

The Shortest Time Trajectory Optimization of the Genetic
Algorithm of the Fixed-Point Path of the Welding Robot. The strategy of studying the path optimization of the welding robot is to determine the path point of the welding robot through the improved ACO. Since the B-spline curve has the characteristics of end point and continuity, it can ensure the smoothness of the fitted curve when it is applied to the robot path space trajectory planning [20]. Therefore, after determining the robot path points, the research uses the genetic algorithm (GA) to segment the robot trajectory obtained by the B-spline interpolation method and optimizes the time of the overall path trajectory by optimizing the time of each path movement. First, the basis function of B-spline curve is determined by recursive function, and its basis function model is mathematically expressed as In formula (6), i represents the position point number, which is the degree k of B-spline curve, and the u value interval is [0, 1]. According to the basis function model determined by the recursive function, the basis function of the cubic B-spline curve used in the research is expressed as In formula (7), j is the index value, and n is the number of the control point. According to the basis function of the cubic B-spline curve, the overall equation of the B-spline curve is expressed as In formula (8), V i represents the arrangement number of the vertices of the curve; therefore, the vertices of the k last B-spline curve form a characteristic polygon matrix. Let k = 3 and then write the expression of the basis function as Putting Equation (9) Because this research is based on the given path points, in order to make the robot's motion track more accurate and stable, the time optimal trajectory planning of the welding robot is studied [21]. The purpose is to reduce the total operation time of the welding robot and improve the product production efficiency [22]. Planning the fixed-point trajectory of the welding robot through the cubic B-spline curve, the time optimization function of the trajectory planning is determined as the objective function of the genetic algorithm, and the objective function is expressed as In formula (11), n is the welding points, so the welding robot trajectory is divided into n − 1 time segments, and the time segment is expressed as T i . The study uses the fitness function of the genetic algorithm and the crossover mutation operator to optimize the trajectory planning of the cubic Bspline interpolation, and the optimization purpose is to output the fixed-point path trajectory with the shortest time. The selection of fitness function directly affects the convergence speed of genetic algorithm and whether the optimal solution can be found, because the genetic algorithm basically does not use external information in evolutionary search but only uses the fitness function to search based on the fitness of each individual of the population [23]. Firstly, a penalty function is introduced into the trajectory planning of the total equation of the B-spline curve, and the fitness function of the genetic algorithm is determined as In formula (12), σ is the penalty factor, which PðtÞ is the penalty item, and the specific mathematical expression of the penalty item is shown in In formula (13),Gis the total population of the genetic algorithm,mrepresents the population number, andθrepresents the joint angle of theϖwelding robot, represents the joint angular velocity of theρwelding robot, and represents the joint angular acceleration of the welding robot. The genetic algo-rithm optimizes the trajectory planning of cubic B-spline interpolation and also relies on the introduction of crossover operator and mutation operator. The function of GA crossover is to maintain the properties of outstanding individuals and obtain new outstanding individuals through crossbreeding. The calculation formula of crossover probability is as follows: ð14Þ In formula (14), p c max and p c min represent the maximum crossing probability value and the minimum crossing probability value, respectively, f a indicates the average fitness of the genetic population, f represents the fitness value of the individual offspring, and f min represents the minimum fitness value of the offspring. When the above calculation formula adopts the sine function to optimize the probability calculation of the algorithm, the purpose is to adapt the crossover probability of the sink to the f a of the population. Therefore, when the f is greater than the average fitness function of the population, the crossover probability takes the largest value and in other cases, it is calculated as formula (14). Similarly, the formula for calculating the mutation probability of the legacy algorithm is shown in In formula (15), p m max and p m min represent the maximum variation probability and the minimum variation probability, respectively. By optimizing the pheromone incremental calculation strategy of ant colony algorithm and increasing the random disturbance scale factor. After the shortest path point sequence of the welding robot is obtained, the fixed-point path trajectory of the robot is planned by introducing the difference of the cubic B-spline curve, the objective function of the algorithm is designed in sections, and the adaptation of the optimized genetic algorithm is used [24]. The degree optimization and crossover mutation operator are used to calculate the shortest time trajectory of the fixed-point path [25]. The overall optimization process of the algorithm is shown in Figure 3.

Parameter Research and Shortest Path Optimization
Performance Experiment of ACO. When ACO-GA is applied to the path optimization of welding robot, its performance is closely related to the parameters of the algorithm. In order to ensure the accuracy and stability of the ant colony algorithm, the research will explore the reasonable parameters of the algorithm through simulation experiments. The simulation model of the robot welding task in this experiment is 5 Journal of Applied Mathematics completed by the process designer software, and the welding task data samples are established by the process database resources in the platform. The data samples applied in this experiment include 24 welding points as path points. The parameters of ACO are shown in Table 1.
The performance of the ant colony algorithm is closely related to the value of each parameter, and reasonable parameter configuration can ensure the accuracy and stability of the optimal solution of the ant colony algorithm. Since there is no universal value selection for each parameter value in the ant colony algorithm, it is usually necessary to define each parameter value according to different solving tasks, which is random and has a great impact on the algorithm's solving performance. Therefore, comparative experiments will be conducted to determine the best parameters.
Firstly, determine the ant number parameter and pheromone volatile factor parameter of the ACO, set the total amount of pheromone in the ant colony algorithm as 10 5 , the pheromone weight as 5, and the heuristic function weight as 1.9, and the max iterations is 500 times. There are 24 welding points. When the parameter of the number of ants is set, the parameter of pheromone volatile factor is set to 0.2, and when the parameter of pheromone volatile factor is set, the number of ants is set to 30. The simulation experiment of 10 groups of data was carried out for each parameter, the experimental platform was completed through the MATLAB platform, and the shortest distance of each parameter was the average of 10 groups of data. The specific results are shown in Figure 4.
It can be seen from the combination (Figure 4) that the path search performance of ACO increases with the increase of the number of ants. In the whole range of the number of ants, the optimal path solution of the algorithm has been in a downward trend, and the optimal path has decreased from 982.56 cm to 957.27 cm. When the number of ants is in the range of 25-50, the optimal target solution of the algorithm tends to be stable, and the range of fluctuation is small. Within the range of [5,50], the shortest path is 956.09 cm when the number of ants is 45. Therefore, the reasonable value range of the number of ants in ACO is optimized [25,50]. In the simulation of pheromone volatilization coefficient parameters, the path optimization performance of ACO increases with the increase of pheromone volatilization factor in the early stage and decreases with the increase of pheromone factor in the later stage. When the volatility coefficient is in the range of 0.05-0.25, the optimal path solution of the algorithm has been in a downward trend, and the optimal path solution has decreased from 970.01 cm to 940.49 cm. When the number of ants is more than 25 but less than 50, the optimal path target solution of the algorithm rises. Within the value range of factor of [0.05, 0.9], the shortest path is 940.49 cm. Therefore, the best value of factor in the optimization of ACO parameters is 0.25. Similarly, in order to determine the pheromone weight and heuristic function weight of the ant colony algorithm, when the pheromone weight is set, the heuristic function weight parameter is set to be 1.9, and when the heuristic function weight parameter is set, the pheromone weight is set to be 5. The other experimental parameters are the same as the simulation in Figure 4. The specific experimental results are shown in Figure 5.
In Figure 5, the global search of optimized ACO is positively correlated with the pheromone weight value of the model. When the number of ants is in the range of 1-4, the optimal path solution of the algorithm has been in a downward trend, and the optimal path solution has decreased from 988.08 cm to 949.14 cm. When the pheromone weight is greater than 4, the optimal target solution of the algorithm tends to be stable, and the fluctuation is small. Within the pheromone weight range of [1,10], the shortest path is 946.58 cm when the weight is 9. Therefore, the reasonable value range of the number of ants in the ACO algorithm is [4,10]. In the heuristic function weight parameter simulation, the path optimization ability of ACO increases with the increase of the heuristic function weight in the early stage but is negatively correlated with the heuristic function weight in the later stage. When the weight of the heuristic function is in the range of 0.1-1, the optimal path solution of the algorithm has been in a downward trend, and the optimal path solution has decreased from 982.08 cm to 959.59 cm. When the weight of the heuristic function is in the range of 1-1.9, the optimal path objective solution of the algorithm tends to be stable, and the fluctuation range is small. When the weight is greater than 1.9, the optimal solution of the shortest path function of the algorithm increases. Within the value range of the weight value of [0.1, 1.9], the shortest path is 958.84 cm. Therefore, the optimal value of pheromone weight of the algorithm is 4, and the optimal value of expected function weight is 1.9. Then, the total pheromone amount of the ACO algorithm is set as 105, the number of ants is 30, the    Journal of Applied Mathematics pheromone volatilization factor is 0.25, the pheromone weight is 4, the heuristic function weight is 1.9, and max iteration is 500. There are 24 welding points. Compare the iteration target results of ACO with optimization parameters and traditional ACO algorithm, as shown in Figure 6.
The iterative process shown in Figure 6 shows that after the number of iterations of the traditional ACO is 250, the path objective function is stable, and the value of the l path is stable at 944 cm. When the number of iterations of the ACO algorithm introduced by the optimization parameters and random disturbance factors is close to 100, the algorithm completes the convergence, and the optimal path of the objective function of the algorithm is stable at 823 cm. The optimal path optimization value of the ACO is 121 cm less than that of the traditional algorithm. Experiments show that the random disturbance factors and parameter optimization values studied can effectively increase the iterative calculation efficiency and path optimization performance of the algorithm.
The verification and parameter exploration of the algorithm in this experiment rely on the MATLAB platform. The parameters obtained from the comparison experiment include the ant number parameter of the ant colony algorithm, the pheromone volatilization factor parameter, the pheromone weight, and the heuristic function weight. The results of parameter comparison experiment are summarized as follows: the reasonable value range of ant number is [25,50], and the best value of volatilization coefficient is 0.25. The best value of pheromone weight is 4, and the best value of expected function weight is 1.9.

Simulation Test of Fixed-Point Path Trajectory Strategy
of Welding Robot Integrated with Genetic Algorithm. The welding robot in this experiment takes a streamlined and flexible high-load robot in service as a sample. After the fixed-point path trajectory planning obtained by the Bspline curve, the improved GA is used to obtain the shortest trajectory optimization, genetic algorithm, and simulation. The parameters of the welding robot are shown in Table 2.
MP and CP of the GA algorithm in the table represent genetic mutation probability and genetic crossover probability, respectively. In order to verify that the genetic algorithm has the optimization effect on the trajectory planning of Bspline curve difference, the simulation experiment is conducted through the MATLAB software platform. The experimental parameters are shown in Table 2. The object of the experiment is the single B-spline curve programming and the five initial value optimization experiments of the optimization genetic algorithm, as shown in Figure 7.
In Figure 7 that the simulation task of this experiment contains 24 solder joints, the trajectory movement time between each solder joint is divided into 4 stages. The time of a single algorithm in each stage is equal, and the overall time-consuming of the robot welding task is 128 s, while the optimization results of the other five genetic algorithms are 97.6 s, 96.2 s, 98.5 s, 97.8 s, and 96.8 s, respectively. The total time consumption is 96.3 s, which is 31.7 s less than the optimized algorithm, and the time consumption optimization efficiency is 24.7%. The optimized genetic algorithm can shorten the welding task time of the welding robot under the path point determination. At the same time, this    Figure 8.
In the broken line trend in Figure 8, the robot joint angle of the optimized genetic algorithm is lower than the robot angle of the B-spline curve difference method as a whole during the welding task, and the robot joint angular velocity of the genetic algorithm is also lower than that of the single B-spline curve method. The maximum difference of angle during the mission is 3.7 rad, and the maximum difference of angular velocity is 2.2 rad. The data show that the optimal scheduling of the genetic algorithm reduces the shaking amplitude of joints and the speed fluctuation of start and stop during the task process of the robot. The optimization algorithm can improve the welding quality of the robot and reduce the energy consumption of the welding task.   Journal of Applied Mathematics Finally, the time consumption of the robot welding task under the optimization of different models is compared experimentally. The specific results are shown in Figure 9.
In Figure 9, a represents the particle swarm optimization algorithm, b represents the A * algorithm, and c represents the optimized genetic algorithm used in the study. The images show that the optimized genetic algorithm performs the best in shortest time trajectory planning for fixed-point paths. During the task of 24 solder joints, the time consumption of the robot movement is lower than the other two algorithms in terms of the genetic algorithm as a whole. In the simulation experiment, the total time-consuming of the particle swarm algorithm is 113.9 s, the total time-consuming of the A * algorithm is 107.2 s, and the total time-consuming of the proposed algorithm is 96.3 s. The optimization algorithm takes 17.6 s less than the traditional particle swarm algorithm and 11 s less than the single A * algorithm.

Conclusion
To verify parameter optimization and random disturbance factor introduction of ACO, the optimal function of the algorithm is obtained through simulation experiments, and the application of traditional algorithm and optimization algorithm in path optimization scheduling is compared. The experiment shows that the unoptimized ACO algorithm converges after 250 iterations, and the path optimal solution is 944 cm, while the optimization algorithm converges after nearly 100 iterations, and the path optimal solution is 823 cm. At the same time, the welding robot and algorithm simulation are carried out for the optimization of the genetic algorithm. The experimental data show that the traditional B-spline curve algorithm has a welding task of 128 s, the time of the optimizing genetic algorithm is 96.3 s, and the time efficiency is increased by 24.7%. In the comparison of algorithms, the optimized genetic algorithm takes 17.6 s less time than the traditional algorithm and 11 s less time than the single A * algorithm. Finally, comparing the results of single B-spline curve algorithm and combined optimization genetic algorithm, the maximum difference of angle and angular velocity is 3.7 rad and 2.2 rad, respectively. The experimental data can prove that the welding robot ACO and the optimized genetic algorithm are not only stable but also reduce the time-consuming. The disadvantage of this experiment is that all the results are from simulation data. The performance needs more specific practical experiments to verify.

Data Availability
The data used and/or analyzed during the current study are available from the corresponding author on reasonable request.

Conflicts of Interest
The authors declare that they have no conflicts of interest.