Distributed power generation has unparalleled advantages in energy substitution, environmental protection, improving system power supply reliability and reducing power supply costs. The purpose of this paper is to study the application of the improved particle swarm optimization algorithm(IPSO) in the location selection and sizing of distributed power generation. This paper first briefly introduces the characteristics of today's main distributed energy resources, and empirically analyzes the impact of distributed energy access on the distribution network. On this basis, a single-objective optimization model considering several constraints is established for the minimum investment cost and net loss of distributed generation. By examining the shortcomings of the standard particle swarm optimization algorithm, combining the optimization algorithm with various optimization techniques, a hybrid particle swarm optimization algorithm is proposed, and the effectiveness of the algorithm is studied. The optimization model is determined through the algorithm improvement, which further confirms the feasibility and effectiveness of the model and algorithm improvement. Then, in view of the environmental problems most concerned by modern society, advanced multi-objective algorithms are used to realize the overall optimization of power station location and power for distributed generation, and to provide decision makers with a variety of solutions. Experiments have shown that the overall optimization scheme in this paper can save about 20% of the cost, and through optimization, the network loss voltage can be reduced by about 30%.