## 1 Introduction  
Diffractive optical elements (DOEs) have already played an important role in the fields of laser collimation [1; 2], optical storage [3; 4], projection systems [5; 6; 7], infrared focal plane arrays [8; 9], bioimaging [10; 11], terahertz [12], and so forth. However, the diffracted light pattern of the DOEs is not accurate due to the errors in design, fabrication and other factors. Among these factors, the impact of the design is particularly important. Basically, there are two methods for designing DOEs, one is a direct calculation based on single inverse diffraction, and the other is phase retrieval. The quality of the reconstruction is determined by the phase retrieval method being better than the single inverse diffraction method. The design accuracy of traditional phase retrieval algorithms, for example, the Gerchberg-Saxton (GS) algorithm [13; 14] and its modified versions [15; 16; 17; 18], and the Yang-Gu algorithm [19; 20], is relatively low, because such algorithms tend to fall into local extreme points and cannot jump out, leading to a failure in terms of good design performance. For the DOEs designed by the above algorithm, the diffraction pattern is often poor in uniformity, with more noise. Furthermore, maskless lithography [21] and 3D printing based on photopolymer resins [22; 23] need higher accurate and uniform exposure patterns as much as possible, which are formed by a liquid crystal on silicon chips (LCoS; work as dynamic DOEs). Hence, in the case that traditional design methods cannot meet the accuracy and uniformity requirement, it is necessary to explore new design methods.  
The search algorithms, including local search algorithms and global search algorithms, theoretically can get a better solution, compared with the traditional iterative algorithms. However, the former,including the steepest descent [24], conjugate gradient [25], and direct binary search (DBS) [26] algorithms, tend to fall into local extreme points and cannot jump out. The latter mainly includes the simulated annealing (SA) algorithm [27], genetics algorithm (GA) [28; 29; 30], particle swarm optimization (PSO) [31; 32; 33], etc. Because the SA algorithm needs to search enough time at each synthetic temperature to reach the global optimal solution, the entire annealing process is extremely time consuming. The GA has fast and random search capabilities and potential parallel computing possibilities, however, the convergent effect is highly dependent on the initial parameters set by experience and the choice of initial values. Although the PSO has certain intelligence that can make it perform exceptionally well when solving continuous function optimization problems, when it is used to design DOEs, PSO is proven to be premature, i.e., it has a poor local search ability. Generally speaking, in order to improve the quality of holographic projection, a hybrid search algorithm is needed to devise the design of DOEs with better performances.  
In this paper, we propose a hybrid algorithm combining PSO with SA, named the SA-PSO hybrid algorithm, which overcomes the time-consuming and low-efficiency random disturbances, and avoids falling into local optimal solutions. The simulation result shows that the performance has been improved compared with the traditional GS algorithm.  
The rest of the paper is organized as follows. In Section 2, the SA-PSO hybrid algorithm for designing DOEs is proposed. We use a flow chart to illustrate how the algorithm works. In Section 3, we use the SA-PSO hybrid algorithm to shape a plane wave into a Gaussian beam, and the results show a better uniformity than the GS algorithm. Section 4 presents the experiments to verify the good performance of the SA-PSO algorithm in optimizing the uniformity of the diffraction pattern. Finally, the conclusions are presented in Section 5.