## 5 Complexity Analysis
```
1:\(\mathcal{SAEA}(\Theta,p^{c},p^{m},\Omega,\Phi,g^{lim},\)\(Data,I,J,K,T^{B},T^{A},T^{H\Gamma},L^{V},L^{B},D^{H},H^{V},H^{B},D^{V})\)
2:\(\Theta\)--population size; \(p^{c}\)--crossover probability; \(p^{m}\)--mutation probability; \(\Omega\)--tournament size, \(\Phi\)--number of individuals selected at each tournament; \(g^{lim}\)--maximum allowable number of generations; \(Data\)--input data for the **BSPSR** mathematical model; \(I=\{1,\ldots,m\}\)--set of vessels; \(J=\{1,\ldots,n\}\)--set of verbs; \(K=\{1,\ldots,s\}\)--set of service orders; \(T^{B}\)--berth availability; \(T^{A}\)--vessel arrival times; \(T^{HT}\)--vessel handling times; \(L^{V}\)--length of vessels; \(L^{B}\)--length of berths; \(D^{H}\)--horizontal clearance requirements; \(H^{V}\)--draft of vessels; \(H^{B}\)--depth of berths; \(D^{V}\)--vertical clearance requirements; **out**:\(\mathit{BestSol}\)--the best berth schedule
3:\(|\mathit{Pop}|\leftarrow\Theta\); \(|\mathit{Fit}|\leftarrow\Theta\); \(|\mathit{Parents}|\leftarrow\Theta\); \(|\mathit{Offspring}|\leftarrow\Theta\); \(|\mathit{Offspring}_{g}|\leftarrow\Theta\); \(|\mathit{Best}|\leftarrow\varnothing\)
4:\(g\gets 1\); \(\mathit{counter}\gets 1\)
5:while\(\mathit{counter}\leq\Theta\)do
6:\(\mathit{x}\leftarrow\mathit{PopInit}(I,J,K,T^{B},T^{A},T^{HT},L^{V},L^{B},D^{ H},H^{V},H^{B},D^{V})\)\(\triangleleft\) Generate a chromosome
7:\(\mathit{Pop}_{g}\gets\mathit{Pop}_{g}\cup\{x\}\)\(\triangleleft\) Append the generated chromosome
8:\(\mathit{counter}\gets\mathit{counter}+1\)
9:endwhile
10:\(Fit_{g}\leftarrow\mathit{FitnessEval}(\mathit{Data},\mathit{Pop}_{g})\)\(\triangleleft\) Evaluate fitness of the initial population
11:while\(g\leq g^{lim}\)do
12:\(g\gets g+1\)\(\triangleleft\) Update the generation count
13:\(\mathit{Best}\leftarrow\mathit{argmin}(Fit_{g})\)\(\triangleleft\) Store a copy of the fittest individual
14:\(\mathit{Parents}_{g}\leftarrow\mathit{RWS}(\mathit{Pop}_{g},Fit_{g})\)\(\triangleleft\) Identify the parent chromosomes
15:\(\mathit{Offspring}_{g}\leftarrow\mathit{Crossover}(\mathit{Parents}_{g},p^{c})\)\(\triangleleft\) Produce the offspring chromosomes
16:\(\mathit{Offspring}_{g}\leftarrow\mathit{Mutation}(\mathit{Offspring}_{g},p^{m})\)\(\triangleleft\) Mutate the offspring chromosomes
17:\(\mathit{Offspring}_{g}\leftarrow\mathit{Repair}(\mathit{Offspring}_{g})\)\(\triangleleft\) Repair the mutated offspring
18:\(Fit_{g}\leftarrow\mathit{FitnessEval}(\mathit{Data},\mathit{Offspring}_{g})\)\(\triangleleft\) Evaluate fitness of the mutated offspring
19:\(\mathit{Pop}_{g+1}\leftarrow\mathit{Pop}_{g+1}\cup\{\mathit{Best}\}\)\(\triangleleft\) Transfer the fittest individual to generation \(g+1\)
20:\(\mathit{Pop}_{g+1}\leftarrow\mathit{TourSelf}(\mathit{Offspring}_{g},Fit_{g},\Omega,\Phi)\)\(\triangleleft\) Identify the chromosomes for generation \(g+1\)
21:endwhile
22:\(\mathit{BestSol}\leftarrow\mathit{argmin}(Fit_{\mathit{Best}}\cup Fit_{g})\)\(\triangleleft\) Identify the best berth schedule
23:return\(\mathit{BestSol}\)
```  
**Algorithm 5**Self-Adaptive Evolutionary Algorithm (SAEA). Based on the SAEA pseudocode, it can be observed that within the main loop (steps 8-18), there are a total of 6 major functions, including the following:  
1. [label=(0)]
2. \(\mathit{RWS}\)\((\mathit{Pop}_{g},Fit_{g})\) with the computational complexity \(O(\Theta)\)--see Algorithm 2 (which does not include any sorting procedures);
3. \(\mathit{Crossover}\)\((\mathit{Parents}_{g},p^{c})\) with the computational complexity \(O(\Theta\cdot[|I|+2])\), i.e., the computational complexity of the developed crossover operator is proportional not only to the population size (\(\Theta\)), since the probability of a given parent to participate in the crossover operation is checked for each parent chromosome in the SAEA population, but also to the chromosome length (defined as \([|I|+2]\)--see Section 4.2 of the manuscript for more details);
4.