## 6 Discussion
### Optimization Analysis  
The required number of iterations was compared with the achieved reduction of the required peak charging power. Investigating this relationship shows the complexity of the optimization as well as the performance of its implementation. The obtained results can be  
Figure 7: Modified daily energy load diagram without “Ferry 6” (Test 2). compared according to different criteria. For most objectives, the global optimum solution increases with the number of particles since more particles can explore the same space in more detail compared to a smaller number of particles. Therefore, the function can find an optimum before the initially set number of iterations is achieved. However, the increased number of particles implies that each iteration is more complex. Furthermore, the situation becomes even more complex for dynamic environments where each possible solution interacts with each other and influences the searched space. Namely, the dynamic environment changes the searched space in each iteration. Theoretically, the global optimum can also change in each iteration. The newly created solution may be less favorable than the previously established global optimum. Therefore, a larger number of iterations are required to achieve the function's objective when using dynamic functions. As the environment constantly changes, the space is searched in more detail by increasing the number of particles. Consequently, the process itself takes longer. For instance, when the number of iterations is set to 1000, the data processing time takes 6 min compared to 104 min when the number of iterations is set to 20,000. A special emphasis was placed on determining the relationship between the required number of iterations and the savings in the required charging power. The aforementioned optimization task is described in Figure 8, which shows the relationship between the required number of iterations to converge in the global minimum as a function of the daily energy needs of \"Ferry 6.\"  
From the figure, it can be observed that the number of iterations required to achieve the objective function depends on the daily energy needs of an individual ferry. When the daily energy needs of \"Ferry 6\" are approximately 0.5 MW, there is a situation where several ferries of similar power are connected to the charger at the same time. In that case, the optimization is complex, and the optimization effect is reduced. When analyzing the proposed optimization model, three different energy states of \"Ferry 6\" were considered when energy needs are set to 0 MW, 0.48 MW, and 1.82 MW, separately. One parameter was observed as a variable, namely the daily energy needs of \"Ferry 6\", with all other constant parameters. The graph shown in Figure 9 depicts the state where the needs of \"Ferry 6\" are equal to 0. In this case, the algorithm optimizes the energy needs of the other eight ships connected to the charger and thus reduces the required peak charging power by 20%. The largest peak power reduction was achieved at the very beginning of the optimization, and the global minimum was achieved in iteration number 402. Figure 8: Dependency of the required number of iterations to achieve the minima concerning the daily energy needs of “Ferry 6”. Furthermore, Figure 10 shows the optimization process when the daily energy needs of \"Ferry 6\" are 0.48 MW. The stated amount is selected because it is approximately equal to the energy needs of all other ships at peak load. It must be pointed out that the optimization procedure is complex in such a situation. During the 1000 iterations, a 0.76% decrease in peak power is achieved. Particularly interesting is the interval from iteration number 580 to iteration number 807 highlighted in Figure 10 as there is no decrease in the objective function. In this interval, the algorithm analyzes solutions where each new one generated is inferior to the previously achieved function minimum.