# Research on Offshore Vessel Trajectory Prediction Based on PSO-CNN-RGRU-Attention
## 3 Methods
### Model Hyperparameter Optimization  
The experimental environment was configured as follows: the PC was equipped with 32 GB of RAM (Manufacturer: Samsung, City: Seoul, Country: Republic of Korea), an AMD Ryzen 9 5950 CPU (Manufacturer: AMD, City: Santa Clara, State: CA, Country: USA), and an NVIDIA GeForce RTX 3080 GPU (Manufacturer: NVIDIA, City: Santa Clara, State: CA, Country: USA). The operating system was Windows (Manufacturer: Microsoft, City: Redmond, State: WA, Country: USA), and the software used was Anaconda3 (Manufacturer: Anaconda, Inc., City: Austin, State: TX, Country: USA). The programming language was Python 3.8 (Manufacturer: Python Software Foundation, Community-based, Global), with the deep learning framework being TensorFlow 2.11.0 and Keras 2.11.0 (Manufacturer: Google, City: Mountain View, State: CA, Country: USA). To validate the performance of the model, this paper conducted experimental comparisons among the following models: PSO-BP, PSO-LSTM, PSO-GRU, PSO-BiLSTM, PSO-BiGRU, PSO-CNN-LSTM, PSO-CNN-GRU, PSO-GRU-LSTM, PSO-CNN-LSTM-Attention, and PSO-CNN-RGRU-Attention. In order to explore the relatively optimal parameter configuration of the PSO algorithm, this paper conducted multiple rounds of comparative experiments with different parameter combinations. After comprehensively considering multi-dimensional indicators such as the convergence characteristics of the algorithm, the solution accuracy, and the computational efficiency, the parameter settings of the PSO algorithm were determined, as shown in Table 1.  
In this set of PSO algorithm parameter settings, the inertia weight w was set to 0.8, which can better balance the global and local search capabilities, enabling particles to find a balance between exploring new areas and approaching the optimal solution area. The number of particles was set to 5. For simple optimization problems, this can reduce computational costs, speed up the running speed, and facilitate preliminary testing and debugging of the algorithm. The individual learning factor \(C_{1}\) and the global learning factor \(C_{2}\) were both set to 2. The former emphasizes that particles utilize their own historical experience to explore potential local optimal solutions, while the latter focuses on guiding particles to converge towards the global optimal solution and accelerate convergence. The number of iterations was set to 20 times. Given the search space and objective function characteristics of simple optimization problems, this was sufficient for particles to fully explore and adjust, and took into account computational resources and time costs to avoid ineffective iterations. For the hyperparameter optimization of the current model, the focus was on adjusting the learning rate and the number of neurons. Both the learning rate and the number of neurons played a critical role in determining the model's performance, so using the Particle \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Inertia** & **Number of Particles** & **Individual Learning Factor \(C_{1}\)** & **Global Learning Factor \(C_{2}\)** & **Number of Iterations** \\ \hline
0.8 & 5 & 2 & 2 & 20 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Parameters of the PSO Algorithm. Swarm Optimization (PSO) algorithm for preliminary optimization of these parameters provided a solid starting point. To compare the predictive performance of different models, suitable initial ranges for hyperparameters were selected after conducting multiple experiments for each model. The Adam optimizer was set for the models, with a batch size of 64 for all models. Since the models converged after 30 training epochs, the epoch count was set to 30. This paper utilized the Particle Swarm Optimization algorithm to optimize the hyperparameters for the following models: PSO-BP, PSO-LSTM, PSO-GRU, PSO-BiLSTM, PSO-BiGRU, PSO-CNN-LSTM, PSO-CNN-GRU, PSO-GRU-LSTM, PSO-CNN-LSTM-Attention, and PSO-CNN-RGRU-Attention.