# Optimization of Buoy Shape for Wave Energy Converter Based on Particle Swarm Algorithm
## 2 Theory and Methodology
### Optimization Methods
\tag{8}\]  
where \(i\in{1,2,\cdots N}\), \(N\) is the number of particles, \(d\in{1,2,\cdots G}\), \(G\) is the number of particle dimensions, \(k\) is the number of iterations, \(r_{1},r_{2}\in[0,\ 1]\), \(c_{1},c_{2}\) are the individual learning factor and the population learning factor, respectively, \(\omega\) is the inertia weights, \(x_{id}^{k}\) is the position of the \(i\)-\(th\) particle in the \(d\)-\(th\) dimension in the \(k\)-\(th\) iterations, \(v_{id}^{k}\) is the velocity of the \(i\)-\(th\) particle in the \(d\)-\(th\) dimension in the \(k\)-\(th\) iterations, \(p_{id,pbest}^{k}\) is the historical optimal position of the \(i\)-\(th\) particle in the \(d\)-\(th\) dimension after the \(k\)-\(th\) iterations, and \(p_{d,gbest}^{k}\) is the historical optimal position of the population in the \(d\)-\(th\) dimension after the \(k\)-\(th\) iterations. Based on the above introduction to the PSO algorithm, the pseudocode of the PSO is revealed in Figure 4.  
Initialize the population of particles with random positions and velocities  
Initialize the best-known positions of each particle  
Initialize the global best-known position  
Set maximum number of iterations or a termination criterion  
While termination criterion is not met:  
For each particle:  
Evaluate the fitness of the current position  
If the current position is better than the best-known position:  
Update the best-known position of the particle  
If the current position is better than the global best-known position:  
Update the global best-known position  
For each particle:  
Update the velocity using the formula:  
velocity(+1) = inertia * velocity(t) + c1 * rand() * (best_known_position -  
current_position) + c2 * rand() * (global_best_known_position - current_position)  
Update the position using the formula:  
position(+1) = position() + velocity(+1)  
Increment the iteration counter  
End While  
Return the global best-known position  
**Figure 4.** PSO algorithm pseudocode. The following Table 1 shows the parameter settings of the PSO. The number of particles [39] is typically between 20 and 1000, with a range of 20 to 40 being suitable for simple problems. A smaller population size may lead to getting trapped in local optima, while increasing the number of particles can enhance convergence speed, allowing for faster discovery of the global optimum. However, a larger population size also entails increased computational costs per iteration. For this study, a population size of 30 seemed appropriate. The shape vector consisted of 5 variables, corresponding to a dimensionality of 5. The number of iterations usually depends on the difficulty of the question; it needs to be adjusted according to the actual situation in the process of optimization. Due to the significant computational burden and file modifications involved in the joint simulation in this study, a value of 20 iterations was deemed appropriate. The inertia factor [40,41] typically ranges from 0.4 to 2, while the acceleration factor [42] typically ranges from 0 to 4. Choosing intermediate values is generally suitable. \(v_{max}\) refers to the maximum velocity of the particle; it was set to 10-20% of the particle variation range. The range of variation of the particles is shown in Equation (9). The above steps allow for the use of the PSO algorithm for buoy shape optimization to find the global optimal solution. The specific technical path is shown in Figure 5.  
For the PSO, the value of the fitness was calculated by substituting the vector into a specific objective function, which was chosen to determine the shape of the buoy. In recent years, the technical challenges of wave power generation have focused on efficient energy conversion technology and the optimization of the hydrodynamic performance of buoys. The buoy captures waves for primary energy conversion, which is related to the hydrodynamic performance of the buoy, while the secondary energy conversion depends on the mechanical structure and the method of energy conversion.