A new method to set up the static magnetic¯eld of the targeted magnetic°uid hyperthermia is presented, and a new particle swarm optimization algorithm with Levy°ight (LF-PSO) is proposed. Magnetic¯eld generating system consists of 18 coils, deployed in the lesions of the peripheral symmetric space, the main principle is to heat magnetic nanoparticles by high frequency alternating magnetic¯eld to kill the cancer cells, while building a static magnetic¯eld in the periphery of the tumor region to protect healthy tissue from harm. Tumor location information may be shifted, so each treatment needs to recon¯gure the static magnetic¯eld. The set of magnetic heating coil currently adopted this new LF-PSO algorithm, in the reason of the particle swarm optimization algorithm with Levy°ight mechanism is characterized by good robustness, high precision of optimal search and it is easy to jump out of local optimum. Experimental results show that by building a new objective function, and comparing with the FEM algorithm, the LF-PSO algorithm has advantages of fast solving speed and high accuracy.