In order to accurately locate the partial discharge source in the transformer, a method of ultrasonic location based on NS-APSO (natural selection adaptive particle swarm optimization) is proposed in this paper. The idea of natural selection is integrated into the adaptive particle swarm optimization algorithm, in each iteration, the particles in the population are treated as "survival of the fitte and the poor particles are replaced by the good ones to improve the overall quality of the population. In order to enhance the practicability of the algorithm, a software is developed based on the GUI(graphical user interface) module of MATLAB, which can locate the local discharge power in different sizes of transformer. Comparing the positioning results with the results of the standard PSO algorithm, shows that the transformer ultrasonic positioning method based on NS-APSO algorithm has higher positioning accuracy and global search ability.