# Prediction of Ship-Unloading Time Using Neural Networks
## 3 Related Methods
### Stochastic Configuration Networks  
Like RVFL in structure, the SCN is also a single hidden-layer neural network; however, the number of nodes in its hidden layer is not fixed but is dynamically increased through a supervisory mechanism [20]. Additionally, the input parameters between the input layer and the hidden layer are generated randomly within a specified domain, and the output parameters from the hidden layer are computed using least squares. The key to the SCN algorithm is the introduction of a supervisory mechanism that facilitates the addition of hidden nodes, helping to minimize the loss function and ultimately achieve convergence. Given a set of \(N\) samples \(\{(x_{i},\ y_{i}),\ x_{i}\in R^{d},\ y_{i}\in R^{m},\ i=1,\ \ldots,\ N\}\). An SCN learning network with \(L-1\) hidden nodes can be represented as follows:  
\[f_{L-1}(X)=\sum_{j=1}^{L-1}\beta_{j}g_{j}(w_{j},b_{j},X), \tag{10}\]  
and the current residual error is:  
\[\mathbf{e}_{L-1}=f-\mathbf{f}_{L-1}=[\mathbf{e}_{L-1,1},\mathbf{e}_{L-1,2},\ldots,\mathbf{e}_{L-1,m}]. \tag{11}\]  
where, \(g_{j}(\cdot)\) is the activation function of hidden node \(j\), \(\beta_{j}\) is the output weight vector connecting the \(j\)th hidden node and \(w_{j}\) and \(b_{j}\) are input weights randomly generated in specified intervals \([-\lambda,\ +\lambda]^{d}\) and \([-\lambda,\ +\lambda]\), \(\lambda\) is a positive scalar. While a new hidden node is added to the network, the algorithm is considered convergent if the resulting sequence of residual errors is monotonically decreasing. \[f_{L}=f_{L-1}+\beta_{L}g_{L}(w_{L}\cdot X+b_{L}),\ e_{L}=f-f_{L},\ e_{L}\leq e_{L -1}. \tag{12}\]  
A result obtained from reference [20] satisfies the Formula (12), where:  
\[\beta_{L}=\frac{\langle e_{L-1},g_{L}\rangle}{\left\|g_{L}\right\|^{2}}. \tag{13}\]  
where,\[\left\{ \begin{array}{c}\langle e_{L-1},g_{L}\rangle^{2}\geq b_{g}^{2}\delta_{L},\\ 0<\|g_{L}\|<b_{g},\\ \delta_{L}=(1-r-u_{L})\|e_{L-1}\|^{2},\\ r>0,\;u_{L}>0,\;1-r-u_{L}>0,\\ \lim\limits_{L\rightarrow+\infty}u_{L}=0.\end{array} \right. \tag{14}\]  
The learning problem (11) can be converted to the following optimization task:  
\[[\beta_{1}^{*},\beta_{2}^{*},\cdots,\beta_{L}^{*}]=\underset{\beta}{\text{ argmin}}\|f-\sum\limits_{j=1}^{L}\beta_{j}g_{j}\|. \tag{15}\]  
Its equivalent matrix form reads as:  
\[\beta^{*}=\underset{\beta}{\text{argmin}}\|G_{L}\beta-Y\|^{2}=G_{L}^{+}Y, \tag{16}\]  
where \(G_{L}=[g_{1},g_{2},\ldots,g_{L}]\), \(G_{L}^{+}\) is the Moore-Penrose generalized inverse of the matrix \(G_{L}\). The SCN algorithm is detailed in Algorithm 3. For clarity, several formulas are introduced below. \[g_{L}(w_{L},b_{L},X)=\big{[}g_{L}(w_{L}^{\text{T}}x_{1}+b_{L}),\;g_{L}(w_{L}^{ \text{T}}x_{2}+b_{L}),\cdots,g_{L}(w_{L}^{\text{T}}x_{N}+b_{L})\big{]}^{T}, \tag{17}\]  
\[\beta_{L,q}=\frac{e_{L-1,q}(X)^{T}g_{L}(w_{L},b_{L},X)}{g_{L}(w_{L},b_{L},X)^{ T}g_{L}(w_{L},b_{L},X)},\;q=1,2,\cdots,m, \tag{18}\]  
and let  
\[\xi_{L,q} =e_{L-1,q}-e_{L,q} \tag{19}\] \[=\beta_{L,q}-(1-r-u_{L})e_{L-1,q}(X)^{T}e_{L-1,q}(X)\;.\]  
``` Input: \(X=\{x_{1},x_{2},\ldots,x_{N}\}\), \(x_{i}\in R^{d}\) and outputs \(Y=\{y_{1},y_{2},\ldots,y_{N}\}\), \(y_{i}\in R^{m}\); \(L_{\text{max}}\), \(\epsilon\), \(T_{\text{max}}\); \(\Lambda=\{\lambda_{\text{min}}\); \(\Delta\lambda\): \(\lambda_{\text{max}}\}\); Output: \(\beta^{*}\), \(w^{*}\), \(b^{*}\)
1. Initialize \(e_{0}\): \([y_{1},y_{2},\ldots,y_{N}]^{\text{T}}\), \(0<r<1\), two empty sets \(\Omega\) and \(\text{W}\);
2. While \(L\leq L\text{max}\) AND \(\|e_{0}\|>\epsilon\), Do Phase 1: Stochastic parameters configuration (steps 3-17):
3. For \(A\in\Lambda\)
4. For \(k=1\), \(2\), \(\ldots\), \(T_{\text{max}}\), Do
5. Randomly assign \(v_{L}\) and \(b_{L}\) from \([-\lambda,\lambda]^{d}\) and \([-\lambda,\lambda]\), respectively;
6. Calculate \(g_{L}\), \(\xi_{L,q}\) based on Equations (17) and (19), and \(\mu_{L}=(1-r)/(L+1)\);
7. If min \(\{\xi_{L,1},\xi_{L,2},\ldots,\xi_{L,q}\}\geq 0\)
8.