In this paper, the mechanism of vortex electromagnetic wave generated by coding metasurface is studied, and the shortcomings of this method are found through the research, what is more, the reasons for its production are analyzed and summarized. A genetic algorithm is proposed to optimize the arrangement of the encoded metasurface, so that the convergence and purity of the vortex electromagnetic wave generated by the metasurface can be improved, which is conducive to the next transmission detection work.