Aiming at the problem that the preference parameter and damping parameter in affinity propagation algorithm have limitations to the result of clustering, this paper puts forward an affinity propagation algorithm which based on particle swarm optimization (PSO-AP). By taking the two parameters in algorithm as a particle, then adjust it Intelligently by particle swarm optimization (PSO) algorithm, and improve the effect of clustering. The results of experiment show that the algorithm has effectively solved the problem, improved the result of clustering and the accuracy of damping.