# Deep Learning-Based Optimization for Maritime Relay Networks
## 3 Relay Network Based on Deep Learning  
The proposed algorithm utilizes a CNN-GRU architecture to optimize relay link prediction and evaluate link connectivity, thereby enhancing communication quality and link reliability in maritime environments while enabling longer successful communication cycles. The model efficiently extracts features from input data through Convolutional Neural Network (CNN) layers and passes the processed data to Gated Recurrent Unit (GRU) layers for prediction and adaptive adjustments. Similar to Long Short-Term Memory (LSTM) networks, GRUs effectively handle time-series data, extracting useful temporal information and identifying long-term dependencies. The core structure of the algorithm, as shown in Figure 2, consists of two main components: a feature extractor and an estimator. The dynamic nature of the maritime environment and the motion of ships pose significant challenges to predicting the optimal relay link. The proposed solution addresses these challenges by utilizing features extracted from time-series data. It incorporates several factors that influence communication quality between ships, including their speed and direction of movement, the distance between ships, signal quality (SNR) and the presence of K relays. By collectively analyzing these factors, the optimal relay is selected, and the connectivity probability of the optimal relay link is determined. The input features are structured as parameters over a series of time points, represented as samples X with multiple attributes. These samples are fed into the convolutional layer (CL) of the CNN model and are defined as:  
\[X=\{x_{1},x_{2},\ldots,x_{t}\}, \tag{22}\]  
\[x_{t}=\big{[}v_{1t},v_{2t},v_{3t},\theta_{1t},\theta_{2t},\theta_{3t},L_{1t}, L_{2t},h_{1t},h_{2t},h_{3t},\gamma_{1t},\gamma_{2t}\big{]}. \tag{23}\]  
Figure 2: CNN-GRU algorithm network structure. The output data correspond to the prediction label and connectivity probability of training samples, which can be expressed as:  
\[Y=\{(\hat{K}_{1}^{*},P_{1}),(\hat{K}_{2}^{*},P_{2}),\ldots,(\hat{K}_{n}^{*},P_{n })\}, \tag{24}\]  
where \(\hat{K}_{i}^{*}\) represents the predicted label of the \(i\)-th time slot, and \(P_{i}\) denotes the corresponding connectivity probability. In maritime networks, huge amounts of historical data are produced during navigation and can be utilized as training samples. In this work, it is neither economical nor practical to collect these data within a short time. To validate the proposed algorithm and to reduce the cost of experiment, we designed a software-aided data generating method. This method implements the data acquisition presented in Section 2.2 and also generates both navigation and hydrological parameters. Input data and output labels are produced out of these data and packed into training and prediction samples. The Algorithm 1 of method is summarized as follows. ```
Step 1: Generate input data  Set up parameters. 1.1 Generate distances  Generate \(\mathbf{d_{1}}\) and \(\mathbf{d_{2}}\) with uniform distribution \(\mathbf{d_{i}}\sim U(d_{a},d_{b})\), which reflects the spatial randomness of node deployment within a defined operational area. 1.2 Generate wave heights  Generate \(\mathbf{h_{1}}\), \(\mathbf{h_{2}}\) and \(\mathbf{h_{3}}\) with Gaussian distribution \(\mathbf{h_{i}}\sim N(\mu,\sigma^{2})\), which is widely used in oceanography to approximate the variability of wave heights under diverse sea conditions. 1.3 Generate speed and direction  Generate \(\mathbf{v_{1}},\mathbf{v_{2}}\), and \(\mathbf{v_{3}}\), \(\mathbf{\theta_{1}},\mathbf{\theta_{2}}\), and \(\mathbf{\theta_{3}}\) follow the uniform distribution \(\mathbf{v_{i}}\sim U(v_{a},v_{b})\), \(\mathbf{\theta_{i}}\sim U(\mathbf{\theta_{a}},\mathbf{\theta_{b}})\). These distributions capture the random nature of node movement while remaining within environmental and operational constraints.