# Borehole Trajectory Optimization Design Based on the SAC Algorithm with a Self-Attention Mechanism
## 4 Experimental Design and Result Analysis
### Wellbore Trajectory Design Under Lateral Interference  
This group of experiments was designed to strengthen the guidance and avoidance effect of learning strategies on multi-path trajectories under the condition of a lateral obstacle body (expressed in the form of an inclined cylinder) in the wellbore path. The barrier body is set in the range of 300-600 m in the East, 200-500 m in the North, and about 600-800 m in the vertical depth, which represents the possible high-pressure zone, adjacent well safety control zone, or inaccessible geological anomaly body in the actual drilling process.  
It can be seen from the training trajectory distribution map (Figure 14) that some paths fail to effectively avoid the obstacle body in the initial stage, especially in the middle section, or there is a dense trajectory interference phenomenon, which reflects that some strategies lag behind in obstacle recognition or response. In the horizontal projection diagram, the trajectory passes through the obstacle interval intensively, forming a potential collision risk, which does not meet the safety design principles between wells. Colored lines: Different colors represent well trajectories of multiple wells or different sections of the same well, distinguishing by well, construction stage, or scheme. Red area: Marks key layers of engineering/geological interest.  
Figure 14 shows the training process under lateral obstacle interference. A clear distinction is made between paths: green lines represent successful paths (avoiding lateral obstacles and reaching the target), and red lines represent failed paths (colliding with obstacles or deviating from the target zone). The failure percentage is specified as 15% (calculated from 500 test runs), indicating the proportion of failed paths in the total training process.  
In contrast, before approaching the obstacle body, the optimal trajectory (Figure 15) realizes the obstacle avoidance reconstruction of the overall trajectory through the linkage adjustment of the azimuth angle and the inclination angle. In the horizontal plane, it can be observed that the path is obviously offset around the obstacle zone, and the trajectory is gently twisted, so as to achieve the goal of space avoidance. In the vertical plane projection, the trajectory shape remains continuous, especially the local depression presented in the East height projection is a curvature control result within a reasonable range. The sag is not trajectory instability, but the path is within the range of whipstocking ability, and the spatial offset is completed through multiple small radius arc segments to maintain the smoothness of obstacle avoidance and wellbore stability.  
Figure 14: _Cont._  
Figure 15 shows the optimal trajectories under lateral obstacle interference. All axes are clearly labeled with titles: \"North Coordinate (m)\", \"East Coordinate (m)\", and \"Vertical Depth (m)\" to specify units (meters). Context is provided: this figure illustrates the optimal paths generated by the SAC + self-attention model when avoiding lateral obstacles (located 300-500 m East of the target zone). This ensures clarity in spatial reference, scenario context, and visual elements.  
Figure 14: Training process for borehole trajectory design under lateral bypass interference.  
Figure 15: Optimal trajectories under lateral obstacle interference.  
From the engineering point of view, the continuous curvature transformation adopted by such trajectories in the obstacle section effectively reduces the stress concentration and vibration risk of drilling tools and facilitates geosteering and subsequent trajectory correction operations. The optimal trajectory maintains the accuracy of target arrival, shows the high adaptability and practical operability of intelligent trajectory planning in the face of a complex structural environment, and verifies the practical value of this method under complex field conditions.