Smart City Landscape Design Based on Improved Particle Swarm Optimization Algorithm

Aiming at the shortcomings of standard particle swarm optimization (PSO) algorithms that easily fall into local optimum, this paper proposes an optimization algorithm (LTQPSO) that improves quantum behavioral particle swarms. Aiming at the problem of premature convergence of the particle swarm algorithm, the evolution speed of individual particles and the population dispersion are used to dynamically adjust the inertia weights to make them adaptive and controllable, thereby avoiding premature convergence. At the same time, the natural selection method is introduced into the traditional position update formula to maintain the diversity of the population, strengthen the global search ability of the LTQPSO algorithm, and accelerate the convergence speed of the algorithm. +e improved LTQPSO algorithm is applied to landscape trail path planning, and the research results prove the effectiveness and feasibility of the algorithm.


Introduction
On the premise of prioritizing environmental beautification, the optimal path design of landscape trails in the green belt should be people-oriented. Landscape trails are places for people to take a leisurely stroll. erefore, establishing an optimal road model is essential for designing landscape trails that are convenient for pedestrians. People have carried out many aspects of research on landscape trail design and proposed some related optimization algorithms. Among them, the particle swarm optimization algorithm (PSO algorithm) was proposed by Russell Eberhart and James Kennedy in 1995. e algorithm is derived from the bird predation behavior of the group [1][2][3]. e PSO algorithm is simple to operate and has the characteristics of portability, easy implementation, fast convergence, and so forth and can obtain satisfactory solutions through self-adjustment, so it has received extensive attention from many scholars. At present, the theoretical research on particle swarm optimization algorithm is mainly to analyze the convergence of the algorithm. Due to the randomness of the particle swarm optimization algorithm, it is not very good to use some mathematical methods to verify the convergence effect of the algorithm. erefore, it is particularly important to study the trajectory of particles in the algorithm, the distribution of particles in the group, and its mathematical theory. Rabanel et al. [4] studied the trajectory of a single particle in the population and related parameters in the algorithm. Xie et al. [5] studied the convergence of the particle swarm optimization algorithm and gave the parameter value range to improve the algorithm's search ability. Cui et al. [6] introduced a compression factor in the algorithm to control the particle trajectory and ensure the convergence of the algorithm. Qi et al. [7] analyzed the stability of the particle swarm optimization algorithm from the perspective of dynamics by using the Lyapunov stability and passive system theory in mathematics. Jatana and Suri [8] analyzed and verified the convergence of the algorithm from the interaction between particles. Yadav [9] theoretically analyzed the impact of speed on the convergence of the particle swarm optimization algorithm and gave a concrete proof. Chen and Li [10] used Markov's related theories to derive the necessary conditions for the convergence of the standard particle swarm optimization algorithm. e research on the improvement of particle swarm optimization algorithm is mainly in the following aspects: the particle swarm optimization algorithm is improved from the perspective of inertia weight, learning factor, position and velocity update formula, and fusion with other algorithms [11][12][13][14]. In terms of inertia weight improvement, Li et al. [15] proposed a particle swarm optimization algorithm with linearly decreasing inertia weight, which improved the overall search ability of the algorithm. Nagra et al. [16] used random strategies to improve inertia weights. e improved algorithm not only improved the accuracy of the solution but also improved the solution speed of the algorithm. Elbaz et al. [17] used the cosine function to make nonlinear adjustments to the inertia weight, which improved the search efficiency of the algorithm and could effectively improve the premature phenomenon. In terms of learning factors, Wang et al. [18] proposed a particle swarm algorithm with variable acceleration factor, which improved the overall search ability of the algorithm. In terms of algorithm update formula improvement, Wei et al. [19] removed the speed formula in the algorithm and only the position update formula in the algorithm and proved the convergence of the improved algorithm; the algorithm became simpler and more efficient. Xu et al. [20] used the linear combination of the individual optimal position and the global optimal position to modify the individual optimal position and the global optimal position in the velocity formula, and the convergence speed of the algorithm was greatly improved. Luo and Gao [21] improved the location update formula, which effectively improved the search efficiency of the algorithm. In terms of fusion with other algorithms, Zheng et al. [22] added the selection mechanism in the genetic algorithm to the particle swarm optimization algorithm. e improved algorithm has an obvious optimization effect in solving the optimization problem of high-dimensional complex functions. Meshkati and Safi-Esfahani [23] merged the artificial bee colony algorithm with the particle algorithm optimization algorithm and successfully applied it to image segmentation. Che et al. [2] introduced the ant colony algorithm, and the improved particle swarm optimization algorithm has played a good optimization effect on solving the multiprocessor scheduling problem. Saffaran et al. [24] integrated the mechanism of the simulated annealing algorithm into the particle swarm optimization algorithm, thereby speeding up the algorithm's convergence speed and improving the algorithm's solution accuracy. Tang et al. [25] merged the differential evolution algorithm with the particle swarm algorithm to speed up the convergence speed of the algorithm. Wu et al. [26] designed an improved quantum evolution algorithm IPOQEA based on a niche coevolution strategy and enhanced particle swarm optimization (PSO). A method of boarding gate allocation based on IPOQEA is proposed, which allocates flights to appropriate boarding gates in different time periods. Finally, the actual operation data of Baiyun Airport is taken as an example to verify the effectiveness of the proposed method. In order to solve these problems, Wu et al. [27] designed an optimal mutation strategy based on the complementary advantages of five mutation strategies to develop a new improved DE algorithm WMSDE with wavelet basis functions, which can improve search quality and accelerate convergence to avoid falling into local optima and stagnation.
Although the above algorithm has achieved good results, the PSO algorithm is still easy to fall into the local optimum.
is will not only not achieve better experimental results but also increase time consumption. erefore, this paper proposes an optimization algorithm based on improved particle swarms. e contributions of this article are as follows: (1) Aiming at the problem of premature convergence of the particle swarm algorithm, this paper uses the evolution speed of individual particles and the population dispersion to dynamically adjust the inertia weights to make them adaptive and controllable, thereby avoiding premature convergence. (2) is paper introduces the natural selection method into the traditional location update formula to maintain the diversity of the population, strengthen the global search ability of the LTQPSO algorithm, and accelerate the convergence speed of the algorithm.

Particle Swarm Optimization Algorithm
2.1. Introduction to Particle Swarm Optimization Algorithm. e particle swarm optimization algorithm [28] is a mathematical simulation model of the process of birds looking for food. In particle swarm optimization (PSO), two simple equations of motion are designed to guide particles to find the global optimal solution in order to simulate the predator-prey flight behavior of birds, thus realizing the mathematical modelling of swarm behavior. At the same time, as an iterative algorithm based on population, the concept of PSO algorithm is simple and easy to implement. In solving real engineering optimization problems, PSO algorithm has been successfully applied in many fields [29].
In the basic particle swarm optimization algorithm, each particle is regarded as a potential solution of the problem to be optimized, and each particle has a fitness value determined by the optimization function. At the same time, each particle continuously iteratively updates its own speed and position, and the global optimal position finally found is the optimal solution to the problem to be optimized found by the algorithm.

Basic Principles of Particle Swarm Optimization
Algorithm. Assuming that, in an n 1 -dimensional target search space, there are n 2 particles in the population, the position of the i-th particle can be expressed as A i � (a i1 , ..., a in 1 ), and the velocity of the particle is e optimal position searched by the i-th particle itself so far is denoted as la, and the optimal position found by the entire particle swarm is denoted as lb. Equations (1) and (2) give the particle speed and position update formulas: Among them, B p i in formula (1) represents the velocity of the i-th particle in the p-th iteration; A p i represents the position of the i-th particle in the p-th iteration; k 1 and k 2 are learning factors, and usually c 1 � c 2 � 2; l 1 and l 2 are two random numbers with values within [0.1]; p represents the current iteration number of the algorithm.
e inertia weight f is introduced and formula (1) is improved. e revised speed update formula is as follows: e experimental results in [30] show that when the inertia weight value f > 1.2, the particles can be developed in a larger search space, thereby improving the accuracy of the algorithm; when the inertia weight value f < 0.8, the particle will quickly move closer to the global optimal solution, and the algorithm can perform a fine search in a local area. en when the value range of the inertia weight is within [0.8, 1.2], the algorithm may obtain the global optimal value, and it also requires a suitable number of iterations. Reference [30] also shows that introducing the inertia weight of the linear decrement strategy in formula (3) can significantly improve the performance of the algorithm.

Basic Steps and Flowchart of Particle Swarm Optimization
Algorithm.
e basic steps of the particle swarm optimization algorithm are as follows: Step 1: Set relevant parameters in the particle swarm algorithm Step 2: Initialize the position and velocity of all particles in the population Step 3: Calculate the fitness value of each particle in the particle swarm algorithm, and calculate the optimal position of the particle and the optimal position of the entire group at the same time Step 4: Use formulas (2) and (3) to update the velocity and position of the particles Step 5: If the maximum number of iterations is reached, the algorithm stops calculating and enters Step 6; otherwise, it returns to Step 3 Step 6: Output the optimal value e flow chart of the particle swarm optimization algorithm is shown in Figure 1.

Problems of Particle Swarm Optimization Algorithm.
Because the particle swarm optimization algorithm has the advantages of simple concept, few adjustment parameters, simple programming, and easy implementation, it has been successfully applied in many practical engineering optimization fields, but the particle swarm optimization algorithm itself still has the following problems [31,32].

Improvement of Inertia Weight Strategy.
e improvement strategy of inertia weight has always been a hot research topic of many scholars. e general improvement strategy is based on the following idea: in the early stage of algorithm search, the inertia weight can obtain a larger weight, and the algorithm's global search ability is strengthened. In the later stage of the algorithm search, the inertia weight can obtain a smaller weight, which is beneficial to the algorithm for local search. However, most of the improved inertia weighting strategies based on this idea lack rigorous theoretical proofs. Sometimes, the improved algorithm based on this strategy will decrease particle velocity in the late search period, leading to the tendency of particles in the population to the optimal solution position, the diversity of the population will be gradually lost, and the search efficiency of the algorithm will also be gradually weakened, resulting in the inability of the algorithm to jump out of the local optimum.

Parameter Setting.
In the particle swarm optimization algorithm, when different parameters are selected with different values, the optimization results of the particle swarm optimization algorithm are also different; for different improved algorithms, there is no specific parameter setting standard to solve the problem. For particle swarm optimization algorithm in specific practical applications, the improved algorithm may not be able to achieve good optimization performance, and sometimes it is necessary to combine the problem itself to make corresponding improvements to the algorithm.

Algorithm Convergence Speed and Solution Accuracy.
For most improved particle swarm optimization algorithms, when solving multimodal function problems, the algorithm may often fall into the local optimal value point. As a result, the particles may not be able to escape the local optimum in the subsequent search process and premature convergence appears. e accuracy of the solution is also difficult to improve. For most improved particle swarm algorithms, how to improve the convergence speed of the algorithm after reaching the specified accuracy is also one of the main research problems of the particle swarm algorithm.

QPSO Algorithm.
According to the basic convergence properties of particle swarms and inspired by the basic theories of quantum physics, Sun et al. proposed the Quantum Particle Swarm Optimization (QPSO) algorithm. is algorithm improves the search strategy of the entire PSO algorithm. Its evolution equation does not require a velocity vector and has a simple form, fewer parameters, and easier control. e QPSO algorithm is superior to all developed PSO algorithms in terms of search capabilities.
To transform the PSO algorithm, the equation expression obtained is as follows: Among them, the position of the i-th particle at time p is 1(p), . . . , a i , D(p)), the best position of the individual is la i � (la i1 (p), . . . , la i d (p)), the best position of the group is lb i � (lb i1 (p), . . . , lb i d (p)), the average best position is lm � (D 1 (p), . . . , D d (p)), the dimension and number of particles are d and n, respectively, λ is expansioncompression factor, k 1 and k 2 represent learning factors, and l 1 and l 2 represent uniformly distributed values. e particle swarm algorithm of formula (5) is collectively called the quantum behavior particle swarm optimization algorithm.

e Principle of Hybrid Improved Quantum Behavior
Particle Swarm Optimization Algorithm. In the evolutionary algorithm, reasonable algorithm control parameters have a greater impact on the performance of the algorithm. In order to improve the convergence of the QPSO algorithm, its evolutionary expressions (4) and (7) have been studied. According to the attraction point of the particle C ij (p + 1), formula (5) can be transformed into From equations (4) and (8), we can see that there is a certain relationship between the point of attraction C ij (p + 1) of the updated particle and the best position lb(p) of the global population and the best position la(p) of the current particle. A ij (p + 1) is also related to the difference between the current particle's average position lm and its own position A(p). At present, many researchers have studied the influence of the average position lm of the entire group on the search behavior of the particle group during the search process. For the average position lm of the entire group, many methods for controlling parameters have been proposed. e inertial weight is an important part of the adjustable parameters of QPSO. When the inertial weight becomes larger, the global search performance of the algorithm can be improved, and the little the inertial weight can enhance the local search performance of the algorithm. However, the inertia weight value of the QPSO algorithm will decrease linearly as the evolutionary algebra becomes larger. If this method is used to describe the actual nonlinear and complex search process, the algorithm is more likely to fall into the local optimization extremum prematurely. As a result, the convergence speed of the algorithm also slows down.
In the selection of algorithm parameters, this paper uses the evolution speed of individual particles and the dispersion of the group to dynamically adjust the weight of inertia, so that the weight of inertia is adaptive, so as to avoid falling into the local optimum; at the same time, natural selection is introduced into the optimal position postprocessing. e advantage of this method is to maintain the diversity and stability of the population, strengthen the global search ability of the QPSO algorithm, and improve the convergence speed of the algorithm.
Assuming that F(lb(p)) and F(C i (p)), respectively, represent the fitness value of the global optimal position and the fitness value of the current optimal position, the evolution speed of individual particles is defined as In the range of 0 < g ≤ 1, the smaller the value of g is, the faster the evolution speed will be. e particle position is consistent with its historical optimal position, and the current fitness value is compared with the changed particle fitness value. When the value of g remains at 1, it can be determined that the algorithm has obtained the optimal solution of the particle.
Suppose that the standard deviation of the best position of the particle in the dimension of the particle is A(p) � (C 1 (la i , 1(p)), ..., C d (la i , d(p))), and, at the same time, the separation of the particle population in the evolution process is It can be seen from formula (10) that H can describe the degree of discretization of particles and the diversity of the population. If the value of H increases, the degree of discretization of particles increases, but the diversity of particle populations will decrease. When H � 1, the best position la is exactly the same as the current position A, but the value of H will continue to change.
We use standard functions to test the proposed inertia weights. e selected test functions are two nonlinear unimodal functions Sphere and two nonlinear multimodal raster functions. e number of test particles is 20, the maximum number of iterations is 100, and the particle dimension is 4. In the QPSO algorithm, k 1 � 1, k 2 � 2.1, and the expansion-contraction coefficient decreases from 1.0 to 0.5 in turn. In the maximum number of iterations, the floating range of individual particle evolution velocity is 0 ∼ 1, and the degree of population dispersion approximates 1 after constant oscillation, so it can be seen that the inertia weight can maintain the stability and diversity of the population. Using the above-mentioned transformation equation based on inertia weight to improve the QPSO algorithm, the equation for the improved QPSO algorithm is It can be seen from equations (11) and (12) that the velocity parameters of individual particles have a greater impact on the changes in the best position of the particles and the optimal position of the global population. In the process of adjusting the particle position of the population dispersion, these parameters are dynamic control parameters.
In order to improve the accuracy and stability of the algorithm in this paper, the natural selection algorithm is used to select the position of the particles. In the iterative process, the particles are arranged according to the function value from good to bad, and the state quantity of the best particle is selected according to the selection rule. e worst particle is finally sorted with the changed particle population. Equation (12) sorts the previous particle population and saves the historical optimal solution of each individual. Figure 2 shows the basic flow of the LTQPSO algorithm.

LTQPSO Algorithm Parameters.
For the path planning of the particle swarm algorithm, repeated simulation experiments are usually required. In the evolutionary algorithm, the number of particles, the particle dimension, and the maximum number of iterations are three crucial parameters. When planning the optimal path, first determine the basic parameters and then consider the working environment and establish an estimation method for the relationship between the parameters to realize the connection path planning. In this paper, through a convergent and feasible parameter simulation experiment based on the LTQPSO algorithm in a barrier-free environment, a linear regression equation of the basic parameters is obtained.
In order to further analyze the relationship between the change of particle dimension and the number of iterations, this paper uses Matlab 2014a for simulation, the particle dimension is d (5 ≤d ≤ 20), the learning factors k 1 � 2 and k 2 � 2.1, and expansion-contraction coefficient is successively decreased from 1.0 to 0.5. Using the method where the values of k 1 and k 2 are fixed and λ decreases in sequence, the optimal path using polar coordinates and rectangular coordinates in a barrier-free environment is 14.14 m. Because the initial distribution has an effect on the convergence speed, the initial distribution is set to a uniform distribution and a normal distribution. e specific method of the simulation experiment is as follows: according to the order of the particle dimensions, the number of particles and the number of iterations are sequentially increased to repeat the experiment, and the average value of the optimal solution is obtained by performing 100 experiments and recording the largest and smallest values when the standard deviation is less than 0.05. e feasible convergence interval can be represented by the maximum value and the minimum value. For the parameters of the algorithm in this paper, the regression analysis of the two initial distributions is performed, respectively. Figure 3 shows the maximum and minimum number of particles and Complexity 5 the number of iterations of 100 experimental results obtained by averaging the initial distribution of LTQPSO under the change of particle dimensions. From Figure 3, we can see the change characteristics of the number of particles and the number of iterations. e change of its parameters is similar to that of the exponential function, so a one-variable linear regression equation can be used to express the basic parameters of path planning. Table 1 lists the regression analysis results of the basic parameters obtained by using the Matlab regression analysis "Regress" command.
From the experimental results of the parameter regression analysis in Table 1, it can be seen that the regression variation difference of the maximum value of the basic parameters of the LTQPSO algorithm is better than the minimum value. e unary linear regression equation of the basic parameters is e number of particles that converged in the average initial distribution and the number of iterations can be calculated by formula (13) according to the change of the number of particles in the LTQPSO algorithm.
According to the above method, using the LTQPSO algorithm to perform 100 experiments on the particle dimensions under a normal distribution, the maximum number of particles, the minimum number of particles, and the number of iterations obtained are shown in Figure 4. e change characteristics of the number of particles and the number of iterations can be seen in Figure 4. e change of parameters is similar to that of the exponential function, so a linear regression equation can be used to express the basic parameters of path planning.  6 Complexity Table 2 lists the regression analysis results of the basic parameters obtained by using the Matlab regression analysis "Regress" command. According to the experimental results of parameter regression analysis in Table 2, the regression variation difference of the maximum value of the basic parameters of the LTQPSO algorithm is better than the minimum value. e unary linear regression equation of the basic parameters is S � round 0.3107L 1.0865 . (14) In summary, in the path planning of mobile robots based on the LQPSO algorithm proposed in this paper, the LTQPSO algorithm can use equations (13) and (14) to determine the basic parameters, so it can be used for path planning of landscape trails.

Comparison Algorithm.
Using the adaptive BP algorithm with momentum term, basic particle swarm optimization (BPSO) algorithm and improved particle swarm optimization (LTQPSO) algorithm's error curve is shown in Figure 5.
It can be seen from Figure 5 that the improved particle swarm optimization algorithm achieves the given error accuracy at about 260 steps, while the basic particle swarm optimization algorithm and the adaptive BP algorithm with momentum term use about 880 steps and 1,900 steps, respectively. By comparing the optimization error curves of different algorithms, the results show that the improved PSO has a much faster convergence rate, and the proposed algorithm has a smaller error.
Using improved particle swarm optimization to approximate the given function, the curve obtained is shown in Figure 6. Linear regression analysis is performed on the optimized simulation output results and target results, and the analysis results are shown in Figure 7. It can be seen from Figure 7 that the correlation coefficient between the optimized output result and the target result reaches 0.999.
In order to verify the effectiveness of the proposed improved particle swarm algorithm, the above test function was optimized with 200 steps, and the test was repeated 30 times. e test results of the network mean square error obtained by the optimization of the three algorithms are shown in Table 3. e test results in Table 3 show that the optimal MSE and the worst MSE of the proposed algorithm are the lowest, and the variance is also the smallest, which shows that the algorithm proposed in this paper has strong stability. It can be   known from the experimental results that the improved particle swarm optimization algorithm effectively improves the optimization accuracy and efficiency compared with the BP algorithm and the basic particle swarm algorithm.

Comparison of Algorithm Running Time and Number of
Iterations. e traditional design method consumes huge computing resources and wastes time.
e design of the optimization algorithm in this paper solves this problem well. e genetic algorithm has the best effect at present. e biggest feature of particle swarm optimization algorithm is that it can save time and computing resources more than genetic algorithm. e comparison result is shown in Figure 8.
It can be seen from Figure 8 that the algorithm in this paper can complete convergence in about 500 generations, while the genetic algorithm needs 1100 generations, and other algorithms need more than that. At the same time, comparing the running times of the algorithms, the running time of the genetic algorithm is 369.43 s, and the particle swarm optimization algorithm only takes 146.97 s. It is shown that the particle swarm optimization algorithm is faster than the genetic algorithm in design. Combined with the performance comparison in Table 3, it can be seen that the particle swarm optimization algorithm has improved the design efficiency of landscape trail path planning. Table 4 shows the running time results of different algorithms. e computational complexity of the algorithm is proportional to the running time. It can be seen from Table 4 that the complexity of the algorithm in this paper is the lowest, and the corresponding running time is also the lowest.      Figure 5: Error curve of particle swarm optimization algorithm.

Conclusion
e landscape trail optimization model designed by the improved particle swarm algorithm is feasible and effective and can reduce the construction cost of landscape trails. is paper proposes an optimization algorithm for improving quantum behavioral particle swarms (LTQPSO). Aiming at the problem of premature convergence of the particle swarm algorithm, the evolution speed of individual particles and the population dispersion are used to dynamically adjust the inertia weights to make them adaptive and controllable, thereby avoiding premature convergence. At the same time, the natural selection method is introduced into the traditional position update formula to maintain the diversity of the population, strengthen the global search ability of the LTQPSO algorithm, and accelerate the convergence speed of the algorithm. e improved LTQPSO algorithm is applied to landscape trail path planning. e research results prove that the algorithm is easier to guide and has a more efficient global search capability, showing higher efficiency and robustness.

Data Availability
e data used to support the findings of this study are available upon request from the corresponding author.