This article explores the construction of the mathematical model, method, and algorithm for solving the two-stage optimal location-allocation problem, along with the software implementation for algorithm execution. The developed algorithm enables the resolution of resource management and transportation problems from supply centers to consumer spaces. Considering that in the contemporary world where all resources and goods are transported over considerable distances in substantial volumes, the task of optimizing delivery routes and minimizing delivery costs remains relevant. The created algorithm can be integrated into a logistics system comprising two layers of resource delivery: initially to an intermediate supply center and subsequently to the ultimate consumer.