## 2 Methods
### Theoretical Analysis of PSO  
Particle swarm optimization (PSO) [7, 8] was proposed as a nonlinear optimization algorithm. With the rapid development of artificial intelligence and deep learning, PSO has a wide range of applications in many fields, such as the design of semiconductor lasers [12], intelligence-bearing fault diagnosis [13], and water quality monitoring [14].  
PSO was applied to optimize the cubic phase mask of the wavefront coding system in this study. In this article, PSO is based on the standard \"GBEST\" version, which is the original form of PSO. The population of particles \(D\) is the sum of particles. The parameter of cubic phase mask parameter in Equation (1) is denoted as \(\alpha_{d}\), representing the position of the \(d\)th particle in the particles. Then, the position of the current particles can be denoted as an array  
\[A=[\alpha_{1},\alpha_{2},\alpha_{3},\ldots,\alpha_{d},\ldots,\alpha_{D}]\]  
Array \(A\) is updated with each iteration. \(I\) denotes the number of iterations in PSO. \(\alpha^{\mathrm{global}}\) is the best location obtained so far by any particle in the population.  
The fitness \(s(\alpha_{d})\), the distance between the desired solution and the \(d\)th particle, is the coincidence consistency of the MTF curves in Equation (3). Ideally, \(s(\alpha_{d})\) is equal to zero when the \(d\)th particle is the desired solution. Equation (4) is the constraint on the solution space. The fitness of the current particles can be denoted as array  
\[S=[s(\alpha_{1}),s(\alpha_{2}),s(\alpha_{3}),\ldots,s(\alpha_{d}),\ldots,s( \alpha_{D})]\]  
Velocity is an important parameter of PSO. \(v_{d}\) is described as the \(d\)th particle velocity. The velocity represents the particle's ability to explore the solution space. The velocity of the current particles can be denoted as array  
\[V=[v_{1},v_{2},v_{3},\ldots,v_{d},\ldots,v_{D}].\]  
The local optimal solution \(\alpha_{d}^{\text{local}}\) is the best location of the \(d\)th particle so far. The local optimal solution of the current particles can be denoted as the array  
\[A^{\text{local}}=[\alpha_{1}^{\text{local}},\alpha_{2}^{\text{local}},\alpha_ {3}^{\text{local}},\ldots,\alpha_{d}^{\text{local}},\ldots,\alpha_{D}^{\text{ local}}].\]  
In a similar way, the local optimal fitness of the current particles can be denoted as the array  
\[S^{\text{local}}=[s(\alpha_{1}^{\text{local}}),s(\alpha_{2}^{\text{local}}), s(\alpha_{3}^{\text{local}}),\ldots,s(\alpha_{d}^{\text{local}}),\ldots,s( \alpha_{D}^{\text{local}})].\]  
The global optimal fitness is \(s(\alpha^{\text{global}})\).  
The locations and velocities are related to the experience, which is determined by the locations and velocities of all particles before their last move. They are updated after each iteration by these formulas [7; 15]:  
\[v_{d}=v_{d}+c_{1}\cdot\text{rand}\cdot(\alpha_{d}^{\text{local}}-\alpha_{d})+ c_{2}\cdot\text{rand}\cdot(\alpha^{\text{global}}-\alpha_{d}) \tag{5}\]  
\[\alpha_{d}=\alpha_{d}^{\text{local}}+v_{d} \tag{6}\]  
where rand is a function of generating a random number between 0 and 1, setting the acceleration constants \(c_{1}=2\) and \(c_{2}=2\)[7; 15].