# Borehole Trajectory Optimization Design Based on the SAC Algorithm with a Self-Attention Mechanism
## 4 Experimental Design and Result Analysis
### Wellbore Trajectory Design Under Vertical Obstacle Interference Scenarios  
In order to investigate the ability of the reinforcement learning model to deal with complex spatial constraints in the actual drilling process, three groups of typical obstacle wells are introduced in the three-dimensional wellbore path planning scene, which are located at the coordinate points (300,253), (600,500), and (900,700) in the North-east plane, and the safety avoidance radius is set to 100 m to simulate the real engineering scenarios such as dense well layout and old wellbore avoidance. In Figure 6, the trajectory avoidance training process is shown in a borehole initial obstacle environment. The figure includes four subfigures: (a) Three-dimensional spatial trajectory distribution; (b) North-East horizontal projection (showing planar position relationship between trajectories and obstacles); (c) North height projection (reflectingvertical depth changes of trajectories); and (d) East height projection (showing eastward displacement and depth correlation). When the obstacle is set in the initial section of the wellbore, all the trajectories of the training process are shown in bitmap 6. From the three-dimensional view, it can be seen that the trajectory, as a whole, is a continuous and smooth transition from vertical to horizontal, reflecting good wellbore trajectory design and construction. From the distribution of trajectories, most of the trajectories were able to effectively sense and bypass the obstacle area in advance, and there were no obvious collisions with the obstacle area. The trajectory shows more obvious lateral (East direction) displacement in the process of baffling, and safety avoidance is realized by adjusting the azimuth and inclination of the starting stage of the borehole trajectory inclination building. In the horizontal projection perspective, the trajectory obviously shows an active avoidance trend of obstacles. Most of the trajectories take deflection measures before approaching the obstacle, showing obvious adjustment to the East and North, indicating that the model has better ability to avoid and predict in advance. A small number of trajectories showed a greater deflection to stay away from the obstacle safety buffer. Although individual trajectories slightly deviated from the overall group trend, the overall convergence was good, and there was no irregularly scattered trajectory. From the North height projection, the smooth transition of the trajectory from vertical to horizontal can be observed. All trajectories show obvious vertical descent in the initial stage, and the trajectory is in a horizontal or near-horizontal state before reaching the location of the obstacle (about 300 North coordinates), effectively avoiding the interference height range of the obstacle. The deviation adjustment of the initial position is obvious, which reflects the flexibility of the wellbore planning stage and the effectiveness of the obstacle avoidance strategy. The integrity and consistency of the path are good, and the trajectory of the back section tends to be consistent, showing the maturity of the model trajectory control and optimization strategy. In the East height projection, the transition of the initial trajectory from the vertical state to the horizontal state can also be observed. Most of the trajectories show a significant shift to the East to avoid obstacles. This lateral displacement action begins to occur in the early stage, indicating that the reinforcement learning model can make early spatial adjustment in the face of obstacles. The trajectory tends to be stable at about 600 m in the East direction, and the depth is about 700-800 m, indicating that the obstacle avoidance measures have been completed in the earlier stage of path planning.