With the situation of global energy crisis and environment pollution, it is imperative to develop and utilize renewable energy such as wave energy. In this paper, a permanent magnet linear generator (PMLG) with 9 poles 10 slots is optimized and the direct-drive wave power generation with PMLG as the energy conversion mechanism directly converts the wave energy into electric energy. First, the structure of PMLG was proposed and the mathematical equation of detent force was deduced. The main parameters which related to the detent force and power density were analyzed. Then, parameters were classified into strong-sensitivity and non-sensitivity parameters based on the value of sensitivity SC and FEM-IPSO method was applied to optimize sensitive parameters. The simulation results show that the detent force is decreased 80.33%, and the maximum output power reaches 803.8 W which is higher than the initial design. Finally, A PMLG prototype was manufactured, and the detent force and Induced Electromotive Force (EMF) are measured, the results show that the optimization method is correctness. The oceanic test indicate that wave energy is efficiently converted into electrical energy through the direct-drive wave power take-off system, and the practicability and effectiveness of the scheme are illustrated by experiments.