# Borehole Trajectory Optimization Design Based on the SAC Algorithm with a Self-Attention Mechanism
## 3 Reinforcement Learning Environment Modeling and Design  
### Three-Dimensional Geological Data Generation  
Accurately grasping geological parameters is a key prerequisite for optimizing wellbore trajectory design and ensuring safe and efficient drilling. These parameters reveal the core information such as the distribution state of underground rock strata, rock hardness, pore pressure and fracture pressure, which directly determine the feasibility of wellbore trajectory, potential drilling risk and final construction cost. Especially in areas with faults, folds, or complex lithology, if there is a lack of detailed geological data support, the designed trajectory can easily fail to effectively avoid high-risk areas, which in turn leads to serious accidents such as wellbore collapse, sticking, and even lost circulation. In order to ensure the scientificity of well trajectory design and construction safety, it is necessary to fully integrate high-quality geological data in the design stage. The introduction of WGAN (Wasserstein generative adversarial network) technology has opened up a new path for the generation and expansion of geological data. This technology significantly improves the training stability of traditional GAN in sparse geological data scenarios through the confrontation mechanism between the Wasserstein distance reconstruction generator and discriminator. Compared with traditional GANs, which use JS divergence as the loss function, WGAN effectively avoids mode collapse (a common issue where generated data becomes overly homogeneous) and stabilizes gradient updates during training. This improvement enables WGAN to generate geological data with higher fidelity--specifically, more accurate reproduction of complex spatial distributions of stratigraphic interfaces, fault strikes, and pore pressure fields, which are critical for simulating real geological conditions. This technology significantly improves the training stability of traditional GAN in sparse geological data scenarios through the confrontation mechanism between the Wasserstein distance reconstruction generator and discriminator. The generated data used in this study are synthetic, generated by WGAN based on public geological samples (e.g., logging data from a typical oilfield). The generated data not only has outstanding authenticity and diversity, but also provides rich geological sample support for 3D drilling environment modeling. This directly improves the accuracy and engineering practicability of the geological model and provides a reliable basis for the optimization design of the wellbore trajectory. The related network structure is shown in Figure 3.  
Detailed components (Generator: generates 3D geological data; Discriminator: evaluates data authenticity) and data flow (real geological samples \(\rightarrow\) Generator \(\rightarrow\) synthetic data \(\rightarrow\) Discriminator feedback). Inputs include lithology logs and pore pressure measurements; outputs are 3D point cloud data in.ply format. In this paper, a three-dimensional wellbore trajectory simulation environment is constructed, which mainly refers to the typical scenarios and parameter ranges in actual oil and gas well trajectory planning. The starting point of the borehole is located at a fixed point (wellhead) on the surface, and the target point is located at a predetermined reservoir location underground. In order to be representative, the target depth is set to about 800 m, 1200 m North, and 1000 m East. The WGAN model is used to train the known geological data, and the geological section is randomly generated. The training results are shown in Figure 4.  
In Figure 4, an added legend (color codes for lithology: red = sandstone, blue = shale, gray = fault zones), coordinates (North-East, in meters), and five profiles are generated to cover different stratigraphic zones. Figure 4 is supplemented. Figure 4a shows the  
Figure 4: Complex geologic profiles generated by WGAN models. Figure 3: WGAN network structure for generating geological data.