## 4 Design of a Self-Adaptive Evolutionary Algorithm
### SAEA Operations
#### 4.6.2 Mutation Operation
```
Mutation(\(Offspring_{gg},p^{m}\)) in:\(Offspring_{g}\)--offspring chromosomes in generation \(g\); \(p^{m}\)--mutation probability out\(Offspring_{g}\)--mutated offspring chromosomes in generation \(g\)
0:\(|Offspring_{g}|\leftarrow|Offspring_{g}|\)\(\lhd\) Initialization
1:\(q\gets 1\)
2:while\(q\leq|Offspring_{g}|\)do
3:\(Offspring_{gq}^{p^{\prime}}\leftarrow\textbf{Float}(Offspring_{qq}^{p^{ \prime}},p^{m})\)\(\lhd\) Mutate the crossover probability
4:\(Offspring_{qq}^{p^{\prime}}\leftarrow\textbf{Float}(Offspring_{qq}^{p^{ \prime}},p^{m})\)\(\lhd\) Mutate the mutation probability
5:\(Val_{1}\leftarrow\textbf{Rand}(0.00;1.00)\)\(\lhd\) Generate a random value between 0.00 and 1.00
6:\(Val_{2}\leftarrow\textbf{Rand}(0.00;1.00)\)\(\lhd\) Generate a random value between 0.00 and 1.00
7:if\(Val_{1}\leq 0.50\)then
8:if\(Val_{2}\leq 0.50\)then
9:\(Offspring_{qq}^{birth}\leftarrow\textbf{Insert}(Offspring_{qq}^{birth},p^{m})\)\(\lhd\) Mutate the genes with berthing positions
10:else
11:\(Offspring_{qq}^{pessel}\leftarrow\textbf{swap}(Offspring_{qq}^{pessel},p^{m})\)\(\lhd\) Mutate the genes with vessel identifiers
12:endif
13:else
14:if\(Val_{2}\leq 0.50\)then
15:\(Offspring_{qq}^{birth}\leftarrow\textbf{swap}(Offspring_{qq}^{birth},p^{m})\)\(\lhd\) Mutate the genes with berthing positions
16:else
17:\(Offspring_{qq}^{pessel}\leftarrow\textbf{Insert}(Offspring_{qq}^{pessel},p^{m})\)\(\lhd\) Mutate the genes with vessel identifiers
18:endif
19:endif
20:\(q\gets q+1\)
21:endwhile
22:return\(Offspring_{g}\)
```  
**Algorithm 3**Custom Mutation Operator. Examples of the SAEA mutation operations are presented in Figures 6 and 7. In the first example, illustrated in Figure 6, the crossover and mutation probabilities are altered using the floating-point mutation from 0.50 and 0.04 to 0.40 and 0.05, respectively. In the meantime, the gene with berthing position \"2\" is shifted from locus \"6\" to locus \"3\" using the insert mutation (see the integer portion of the offspring, representing the berthing positions). In the second example, illustrated in Figure 7, the crossover and mutation probabilities are altered using the floating-point mutation from 0.45 and 0.01 to 0.30 and 0.03, respectively. In the meantime, the genes with vessels \"6\" and \"5\" are swapped using the swap mutation (see the integer portion of the offspring, representing the vessel identifiers). The number of genes to be altered as a result of the insert and swap mutation operations is defined by mutation probability parameter \(p^{m}\), which is encoded in each offspring chromosome of the population (since the proposed SAEA algorithm is self-adaptive). Note that application of the SAEA crossover and mutation operators may produce the infeasible offspring. In the first example (see Figure 6), the gene with vessel \"7\", which is assigned for service at berthing position \"2\", is inserted between the genes with vessels \"2\" and \"5\", which are both assigned for service at berthing position \"1\". The latter assignment causes a disruption in the service order of vessels, which are assigned to berthing position \"1\", and makes the offspring chromosome infeasible. To prevent infeasibility of the offspring chromosomes, the genes with vessel identifierswill be sorted by berthing positions after application of the custom mutation operator (see Figure 6). Such sorting procedure will allow repairing the generated infeasible individuals. In the considered example, the gene with vessel \"7\" is shifted to the other vessels that are assigned for service at berthing position \"2\", which allows avoiding disruption of the vessel service order at berthing position \"1\".