# Prediction of Ship-Unloading Time Using Neural Networks
## 3 Related Methods
### Random Vector Functional Link Network (RVFL)  
RVFL is a single hidden layer feedforward neural network (SLFNN) that features direct connections between the input layer and the output layer nodes. The input weights from the input layer to the hidden layer are generated randomly within specified intervals, while the output weights are computed analytically using either the least-square method or the pseudo-inverse method.  
Formally, the RVFL model with \(L\) hidden nodes can be described as:  
\[f(x_{i})=\sum_{k=1}^{d}\beta_{k}x_{ik}+\sum_{k=d+1}^{k+L}\beta_{k}g(\alpha_{k} ^{T}X+b_{k}),\ i=1,\ldots,N. \tag{5}\]  
The optimization problem of the standard RVFL model can be written as:  
\[\min_{\beta\in\mathbb{R}^{d+L}}\frac{1}{2}\|\beta\|^{2}+\frac{1}{2}\lambda\|H \beta-Y\|^{2}, \tag{6}\]  
where, \(H=[H_{1}\ H_{2}]_{N\times(d+L)}\),  
\[H_{1}=\begin{vmatrix}x_{11}&x_{12}&\cdots&x_{1d}\\ \vdots&\vdots&\ddots&\vdots\\ x_{N1}&x_{N2}&\cdots&x_{Nd}\end{vmatrix}, \tag{7}\]  
\[H_{2}=\begin{vmatrix}\theta(\alpha_{1}\cdot x_{1}+\sigma_{1})&\theta(\alpha_ {2}\cdot x_{1}+\sigma_{2})&\cdots&\theta(\alpha_{L}\cdot x_{1}+\sigma_{L})\\ \vdots&\vdots&\ddots&\vdots\\ \theta(\alpha_{1}\cdot x_{N}+\sigma_{1})&\theta(\alpha_{2}\cdot x_{N}+\sigma_ {2})&\cdots&\theta(\alpha_{L}\cdot x_{N}+\sigma_{L})\end{vmatrix}, \tag{8}\]  
\[\beta=\begin{bmatrix}\beta_{1}\\ \beta_{2}\\ \vdots\\ \beta_{d+L}\end{bmatrix}_{(d+L)\times m},\ Y=\begin{bmatrix}y_{1}\\ y_{2}\\ \vdots\\ y_{N}\end{bmatrix}_{N\times m}.\]  
where, \(\beta_{k}=[\beta_{k1}\), \(\beta_{k2}\), \(\ldots\), \(\beta_{km}]\) is the output weight vector connecting the \(k\)th input (hidden) node to the output nodes, \(1\leq k\leq d+L\), and \(\alpha_{j}=[\alpha_{j1}\), \(\alpha_{j2}\), \(\ldots\), \(\alpha_{id}]\) is the weight vector connecting the \(j\)th hidden node to the input nodes, \(1\leq j\leq L\). Additionally, \(x_{i}=[x_{i1}\), \(x_{i2}\), \(\ldots\), \(x_{id}]\) is the \(i\)th sample. For the target matrix, \(y_{i}=[y_{1}\), \(y_{2}\), \(\ldots\), \(y_{im}]\), \(1\leq i\leq N\). Moreover,\(\theta\left(\cdot\right)\) and \(\sigma_{i}\) are the non-constant activation function and the bias term of \(i\)th hidden node, respectively. \(\lambda\) is a regularization coefficient.  
The optimal solution to the problem (6) when \(\delta=\frac{1}{\lambda}=0\) reads as follows:  
\[\beta=H^{+}\ Y, \tag{9}\]  
where \(H^{+}\) represents the Moore-Penrose generalized inverse of the matrix \(H\). The regularization term is employed to avoid the over-fitting issue. The RVFL algorithm is described in Algorithm 2.  
```
Inputs: Input \(X=\{x_{1},\ \ldots,x_{N}\}\), \(x_{i}\in R^{d}\) and output \(Y=\{y_{1},\ \ldots,y_{N}\}\), \(y_{i}\in\ R^{m}\); Bias \(b=[\beta_{1},\ \ldots,\beta_{L}]\); The number of nodes in hidden layer \(L\); the range of weights \(\sigma\); regularization parameter \(\lambda\). Outputs:\(W_{0}\).
1: Initialize: randomly selecting the initial weights in range of \([-\sigma,\ \sigma]\). \(W_{initial}\in[-\sigma,\ \sigma]^{L\times d}\);
2: Calculate activation values of the hidden layer: \(Z_{pre}=f_{a}(W_{initial}\ X+b)\), where \(f_{a}\) is an activation function;
3: Establish enhancement layer to implement direct link: \(H=\begin{bmatrix}Z_{pre},\ X\end{bmatrix}\);
4: Calculate output weights through regularized least squares method: \(W_{0}=Y\times H^{T}\times\left(\lambda\ +\mathrm{H}H^{T}\right)^{-1}\);
5: Return \(W_{0}\), there by \(\hat{Y}\ =\ W_{0}\times H\) can be calculated.
```  
**Algorithm 2**RVFL algorithm