The development of an algorithm based on dynamic programming for optimization of tree-like energy pipeline system

The problem of optimizing the transmission capacity of a pipeline network is important for ensuring its operability. The problem arises at different stages of the network life cycle (design, optimization, development). The problem is to determine the diameters of the pipelines, the locations of the pumps and the heads on them, the locations of the regulators (flow and pressure) and their parameters. The article proposes a new algorithm based on dynamic programming, which implements an original approach to organizing a computational procedure. The general principles of the algorithm and the content of its steps do not depend on the purpose of the network and the composition of its equipment. The algorithm is versatile and allows one to optimize networks for various purposes. The proposed algorithm is implemented in the IRNET software. On its basis, calculations were made for the development of real district heating systems.


Introduction
Among the design problems of energy pipeline systems the problem of optimizing the transmission capacity of the network is of particular importance. It consists in optimizing the diameters of the pipelines, determining the places of installation of pumps and heads on them, determining the places of installation of throttling equipment and its parameters. In this paper, the subject of research is the problem of ensuring the transmission capacity of tree-like energy networks.
In the 60s of the 20th century soviet scientist V. Khasilev [1] formulated the main provisions of the theory of hydraulic circuits [2,3]. Within the framework of this discipline, a unified mathematical matrix language has been developed to describe the topological and physical properties of pipeline networks. One of the basic principles of the theory of hydraulic circuits is that the methods and algorithms developed within this discipline must be versatile and able to be applied to calculate pipeline networks of various types and purposes. The possibility of creating such methods and algorithms is due to the generality of the topological properties of pipeline networks and the generality of the network laws of conservation of mass and energy.
At present, approaches based on the use of genetic algorithms [4], simulated annealing [5], and mixed integer programming [6][7] are widely used to solve the problem. The emergence of dynamic programming [8] has led to significant progress in methods for determining the optimal parameters of pipeline networks [9][10][11][12]. Among the studies devoted to the use of dynamic programming in determining the optimal parameters of heating networks, it should be noted [13,14]. At ESI SB RAS, an iterative method has been developed for optimizing the parameters of looped pipeline networks [15,3], which uses dynamic programming to optimize the network transformed into a tree.
This paper presents an algorithm based on dynamic programming to optimize the transmission capacity of pipeline tree-like power networks of various types and purposes. The proposed approach to the organization of the computational procedure allows for a new structure of the description of mathematical models and algorithms used to solve the optimization problem. As a result, there is a separation of these models and algorithms, which become universal, and their software implementations can be reused for solving problems of pipeline system optimization of various types and purposes.

Statement of the optimization problem
The problem of optimizing the transmission capacity of the pipeline network is as follows. The function of total network costs is minimized, which has the following form: (1) subject to: , , , , where (2) , h -total loss of head at the pipeline, P i H -increase in the head at the pump.
The total costs for the branch i ( i I  ) are described by a function B ( , , ) , the value of which is determined by the formula B PL P ( , , ) ( , ) ( , ), C -the cost of the pipeline, P i C -the cost of the pump.

Optimization algorithm
The authors have developed a new algorithm to optimize the transmission capacity of multisource tree-like pipeline networks. The main novelties of the proposed algorithm are:  universality, which is ensured by the independence of the properties and purpose of the network;  using a unified method for representing the network model and its elements;  a new approach to the organization of the computational procedure;  independence from mathematical models of equipment. The algorithm consists of the following steps. At step 1 of the algorithm, a system of linear equations (2) is solved to determine the vector x of volumetric flow rates on the branches. After that, the orientation of the branches is changed so that it corresponds to the direction from the root of the tree to its end nodes. When the orientation changes, the branches change to opposite signs of the corresponding vector x components.
At step 2 of the algorithm, data structures are formed for storing the components of conditionally-optimal solutions to the problem, which will be determined during the computational process of dynamic programming. Based on the calculated constraints on the heads, cells are constructed for storing the parameters of the network elements when constructing conditionally-optimal solutions to the problem.
At step 3 of the algorithm, conditionally-optimal solutions to the problem are constructed, each of which includes the parameters of the branches and nodes of the network. A construct operation is a bottom-up dynamic programming approach [16]. The algorithm implements the process of constructing conditionally-optimal solutions to the problem and is developed on the basis of the Depth-first search (DFS) algorithm [16]. In the algorithm, the reverse motion of the DFS is used to organize the process of constructing conditionally-optimal solutions from the end nodes to the root of the network tree. The construction of solution components for a branch is performed during the return movement of the DFS algorithm along the branch. When the algorithm returns to a node, conditionally-optimal solutions are joined and solution components are determined at this node.
The operation of determining the components of conditionally-optimal solutions at a cell for a branch is performed based on the Bellman's principle of optimality [8]. At branch i ( i I  ), that has initial j and final q nodes, the following subproblem is solved for a cell k After completing step 3 of the algorithm, the components of conditionally-optimal solutions for all network elements are found. As a result,  conditionally-optimal solutions to the problem have been constructed. Each of them (Fig. 1) corresponds to the head change curve from the root of the tree to the end nodes of the network. The component values for each of these conditionally-optimal solutions are stored in two-dimensional arrays.
At step 4 of the algorithm, the best of the found conditionally-optimal solutions to the problem is determined. The number of the best conditionally-optimal solution corresponding to the solution with the minimum total costs to the system is determined by the formula:

Conclusions
The problem of optimizing the transmission capacity of the pipeline network is of great importance and is solved at different stages of the network life cycle (design, optimization, development). The paper proposes a new algorithm based on dynamic programming, which implements a new approach to organizing a computational procedure. The general principles of the algorithm and the content of its steps do not depend on the purpose of the network and the composition of its equipment. The algorithm is versatile and allows optimization of networks for various purposes. The proposed algorithm is implemented in the IRNET software. On the basis of IRNET, calculations were made for the development of a real heat supply system in Saint-Petersburg [17], Bratsk [18], and the urban-type settlement Magistralny [19][20]. The resulting solution contains optimal parameters for new network elements and provides the required transmission capacity of the existing part of the network.