## 2 Algorithm  
The cost function of the SA-PSO hybrid algorithm is the distance between the target light intensity and the intensity diffracted by the calculated DOE, as defined by Equation (1). \[f=\sqrt{\sum_{m,n=1}^{m=M,n=N}\left(I_{m,n}-I_{m,n,ex}\right)^{2}} \tag{1}\]  
where \(I_{m,n}\) is the intensity diffracted by the calculated DOE, \(I_{m,n,ex}\) is the expected target light intensity, and \(M\) and \(N\) represent the number of rows and columns of the matrix, respectively. During the annealing process, the initial solution and the new solution after random perturbation are compared by using an acceptance probability term. According to the Metropolis principle [34], the acceptance probability \(P_{t}\) is related to the current synthetic temperature \(t\). \[P_{t}(i\Rightarrow j)=\left\{ \begin{array}{ll}1&f_{j}\leq f_{i}\\ exp\left[\frac{f_{i}-f_{j}}{t}\right]&f_{j}>f_{i}\end{array} \right. \tag{2}\]  
where \(f_{i}\) is the cost function value of the solution before the disturbance, and \(f_{j}\) is the cost function value of the new solution. It should be noted that, the \"solution\" represents the phase distribution of the DOE. The light intensity distribution on the target plane is calculated from a forward diffraction from the phase distribution of the DOE, and then \(f\) can be obtained by using Equation (1). The diffraction model can be the angular spectrum, the Fresnel or the Fraunhofer, depending on the distance from the DOE to the target plane [35]. By using the Metropolis principle, it is more likely to accept worse solutions at higher synthetic temperatures, but almost only better solutions can be accepted at lower synthetic temperatures. We set a disturbance coefficient \(la\) to control the disturbance's severity. \[la=\alpha\times t+\beta \tag{3}\]where \(\alpha\) is the linear attenuation coefficient and \(\beta\) represents the smallest disturbance value. Through adjusting the values of \(\alpha\) and \(\beta\), intense disturbances at higher synthetic temperatures and slow disturbances at lower synthetic temperatures can be obtained. In this way, the initial particle swarm at synthetic temperature \(t\) is obtained, and the size of particle swarm is 30. The choice of \(\alpha\) and \(\beta\) depends on the initial synthetic temperature and the ending synthetic temperature. If the linear change strategy in Equation (3) is used, the values of \(\alpha\) and \(\beta\) can be calculated by the method of undetermined coefficients. In the PSO process, the cost function in Equation (1) is still used to evaluate the initialized population, and then the population is updated according to the following rules:  
\[V_{id}(n+1)=\omega V_{id}(n)+C_{1}\times\phi_{1}\times(P_{id}-X_{id}(n))+C_{2} \times\phi_{2}\times\left(P_{gd}-X_{id}(n)\right) \tag{4}\]  
\[X_{id}(n+1)=X_{id}(n)+V_{id}(n+1) \tag{5}\]  
where \(\omega\) is the variable speed update rate, which denotes that the new generation of particle swarms is affected by the overall speed of the previous generation. The value of \(\omega\) is a constant between 0.8 and 1.2 based on experience. \(P_{id}\) is the optimal solution of single particles and \(P_{gd}\) is the optimal solution of particle swarms. \(C_{1}\) and \(C_{2}\) are constants between 1 and 2, which respectively represent the influence weight of \(P_{id}\) and \(P_{gd}\) on \(V_{id}(n+1)\), the larger value, with the greater influence on \(V_{id}(n+1)\). \(\phi_{1}\) and \(\phi_{2}\) are random numbers between 0 and 1, randomly changed in every updating in PSO. \(X_{id}(n)\) represents the solution, i.e., the phase distribution of the DOE obtained after the \(n\)-th update. \(V_{id}(n+1)\) represents the amount of change when \(X_{id}(n)\) is updated. The disturbance coefficient \(la\) is also introduced to ensure that the first several evolutions can shuttle quickly in the solution space, while later evolutions can search finely in the solution space at a slower speed.