# LSTM-DQN-APF Path Planning Algorithm Empowered by Twins in Complex Scenarios
## 4 Twin System Modeling and LSTM-DQN-APF Algorithm
### Algorithm Validation Test and Analysis
#### 4.3.4 Experiment 3: Algorithm Validation Test for Urban Warfare Scenario
During the experiment, the UAV adopts the traditional artificial potential field method and the improved artificial potential field method, respectively, and is considered to have completed a flight mission when it starts from the starting position (0,0,0) and successfully reaches the task point while ensuring that it avoids all the obstacles in the scene. In order to ensure the reliability of the experimental results, 10 independent experiments were conducted for each task point. The performance of the three algorithms is evaluated by comparing the flight trajectories, flight times, and flight distances of the three algorithms in accomplishing the tasks. The detailed information of the setup task points is shown in Table 5. The task points are set from near to far, covering different spatial locations and obstacle distributions, aiming to comprehensively test the navigation performance and adaptability of the artificial potential field method. Figure 8: (**a**) Panoramic and (**b**) dynamic threat map of urban scenes. As shown in Figure 9, the experimental trajectory data of the traditional artificial potential field method and the improved artificial potential field method in the UAV virtual-real integration verification platform for Task 1 is presented. The blue represents LSTM-DQN-APF, the green represents Ge-Apf, and the red represents APF. It can be seen that compared to APF and GE-Apf, the LSTM-DQN-APF algorithm trajectory is smoother and does not exhibit severe fluctuations or abrupt changes. From Figure 10, it can be seen that the flight time of LSTM-DQN-APF, represented by blue, is significantly shorter in all 10 experiments compared to APF, represented by red, and Ge-Apf, represented by green. The average flight time of the LSTM-DQN-APF algorithm is 12.87 s, while the average flight times of Ge-Apf and APF are 16.65 s and 19.16 s, respectively. The difference in flight times reflects the significant improvement in flight efficiency of LSTM-DQN-APF. The shorter flight time not only means that the UAV can complete flight missions faster but also reduces energy consumption, thereby extending the UAV's endurance. Figure 10 compares the performance of the three algorithms in terms of flight distance. The average flight distance of the LSTM-DQN-APF algorithm to the target point (20,20,5) is 32.89 m, while the Ge-Apf and APF algorithms are 36.73 m and 39.81 m, respectively. The average variance of the flight time for APF is 15.424 s, for Ge-Apf it is 6.72 s, and for LSTM-DQN-APF it is 1.336 s; the average variance of the flight distance for APF is 67.942 m, for Ge-Apf it is 9.41 m, and for LSTM-DQN-APF it is 9.896 m.  
Figure 11 shows the analysis of the trajectory data of the UAV flying to the target point (40,20,5) in task 2. From the figure, it can be seen that its main obstacle is the building 1 located at (20,10,0) with a height of 10 m. In the face of this obstacle, LSTM-DQN-APF, Ge-Apf, and APF chose different avoidance directions. Compared to Ge-Apf and APF, LSTM-DQN-APF's trajectory was smoother, and the distance consumed to avoid the obstacle was smaller. In Figure 12, it can be seen that LSTM-DQN-APF outperforms Ge-Apf and APF in both flight time and flight distance. The average flight time of LSTM-DQN-APF is 21.15 s, and the average flight distance is 51.23 m, while the average flight time of Ge-Apf is 26.98 s, and the average flight distance is 65.42 m. The average flight time of APF is 30.33 s, and the \begin{table}
\begin{tabular}{c c} \hline
**Mandates** & **Target Point Position (x,y,z)/m** \\ \hline Task I & (20,20,5) \\ Task II & (40,20,5) \\ \hline \end{tabular}
\end{table} 
Table 5: Task point locations. Figure 9: **(a)** 3D and **(b)** 2D obstacle avoidance trajectory maps of the UAV for Task 1 (blue: LSTM-DQN-APF, green: GE-APF, red: APF).