## 4 Materials and Methods  
### Mathematical Background of PSO in General  
PSO is a technique proposed and developed by engineer [PERSON] and psychologist [PERSON] [26]. PSO is a random search optimization algorithm based on cluster intelligence and inspired by the behavior of flocks of birds. In this nature-based algorithm, individuals are referred to as particles and fly through the search space, seeking the best global position that optimizes a given problem [27]. All possible solutions are initialized into a group of particles characterized by position, velocity, and fitness values. The position of each particle represents a potential solution to be optimized, the particle's velocity represents the direction and distance of the particle's movement, and the fitness value of the particle can be calculated according to the objective function. The optimal value of the individual and the optimal value of the population are calculated while the velocity and position of the particle are updated. The algorithm stops when it reaches the maximum number of iterations or the particle's position is less than the given threshold value. Compared to other optimization algorithms, PSO has high accuracy and increased problem-solving speed and is easy to use [28]. Due to the abovementioned advantages, it is often used to manage and optimize energy systems. The velocity \(\overset{\
eg i}{V}_{t}\) and the position \(\overset{\
eg i}{x}_{t}\) of each particle in the swarm is represented by \(d\)-dimensional vectors. They are defined by the individual and the collective knowledge in each iteration. Collective knowledge influences the flight trajectories of the particles over the space of possible solutions. The search stops when optimum criteria are fulfilled. The velocity \(d\)-dimensional vectors in every iteration, \(t\), is updated according to the following equation [29]:  
\[\overset{\
eg i}{V}_{t+1}=\overset{\
eg i}{V}_{t}+\varphi_{1}R_{1t}^{i}\! \left(\overset{\
eg i}{\rho}_{t}-\overset{\
eg i}{x}_{t}\right)+\varphi_{2}R_{ 2t}^{i}\!\left(\overset{\
eg i}{g}_{t}-\overset{\
eg i}{x}_{t}\right) \tag{1}\]  
where \(\varphi_{1}\) and \(\varphi_{2}\) are two real acceleration coefficients known as cognitive and social weights, respectively; \(\overset{\
eg i}{p}_{t}\) and \(\overset{\
eg i}{g}_{t}\) are the personal best of particle \(i\) at iteration \(t\); and \(R_{1t}^{i}\) and \(R_{2t}^{i}\) are uniformly distributed \(d\)-dimensional random vectors. The position of each particle \(i\), at every iteration \(t\), varies according to the following equation [30]:  
\[\overset{\
eg i}{x}_{t+1}^{i}=\overset{\
eg i}{x}_{t}^{i}+\overset{\
eg i}{ x}_{t+1}^{i} \tag{2}\]The global best solution is formally defined as follows:  
\[\hat{y}_{t}\in\left\{\overrightarrow{\rho_{t}},\overrightarrow{\rho_{t}}, \overrightarrow{\rho_{t}},\,\ldots,\,\overrightarrow{\rho_{t}}\right\}\mid f( \hat{y}_{t})=\min\biggl{(}\left\{f\biggl{(}\overrightarrow{\rho_{t}},f\left( \overrightarrow{\rho_{t}},\overrightarrow{\rho_{t}},\overrightarrow{\rho_{t}} \right),\,\ldots,\,f\left(\overrightarrow{\rho_{t}},\right),\right\}\biggr{)} \tag{3}\]  
where \(\hat{y}\) represent the position of the best or target particle in the entire swarm in a \(d\)-dimensional space. Furthermore, the Poisson distribution was used to form possible solutions in discrete signals because the normal distribution does not describe the phenomenon. Since such a distribution in such a complex problem can hardly find a local and global optimum for certain conditions, a higher priority is given using the greedy algorithm. The greedy algorithm is used to solve the problem to give a local optimum at each stage, intending to find the global optimum [31]. Due to their high efficiency, they are a suitable choice for implementing various optimization tasks [32]. The initial greedy algorithm prioritizes the ship whose current energy needs are the highest in amount. Thus, a greedy algorithm reduces the required number of iterations and uses particles to achieve the global optimum.