The smooth and prompt integration of the general public into various economic, political, cultural, and other activities in contemporary society can be ensured by scientifically sound planning and the layout of public facilities in residential areas. An essential metric for assessing a nation's citizens' overall quality of life is the level of public service facility construction. The fundamental task of raising the standard of public service facilities is to elevate the spiritual civilization of the populace. A complex area with diverse socioeconomic and natural conditions is a residential area. This study examines the various modes of transportation used by residents in residential areas and divides the service offerings of public facilities in residential areas based on time and distance. The first step is to carry out optimization research on the design of public service facilities. The issue of public facility location planning in an area with obstacles is discussed. An improved algorithm model is created based on the algorithm principle after first discussing the research on the ant colony algorithm's method for path planning in complex space. This article proposes a path planning technique based on an enhanced algorithm. First, the environment is divided using the grid method, and then experiments are run on grid maps of various scales to improve the updating pheromone mechanism algorithms for measuring the effectiveness of path planning techniques. According to the simulation results, the improved algorithm presented in this article has a high convergence speed in a complex environment and can find a workable solution in about 65 iterations as opposed to the ant colony algorithm's need for about 80 iterations. Based on experiments, the algorithm proposed in this article has an average convergence speed of about 26 seconds, compared to an average convergence speed of about 35 seconds for the ant colony algorithm. It is clear that the algorithm suggested in this article has better work efficiency.