Graph-Based Modeling and Decomposition of Energy Infrastructures
Abstract
Nonlinear optimization problems are found at the heart of real-time operations of critical infrastructures. These problems are computationally challenging because they embed complex physical models that exhibit space-time dynamics. We propose modeling these problems as graph-structured optimization problems, and illustrate how their structure can be exploited at the modeling level (for parallelizing function/derivative computations) and at the solver level (for parallelizing linear algebra operations). Specifically, we present a restricted additive Schwarz scheme that enables flexible decomposition of complex graph structures within an interior-point algorithm. The proposed approach is implemented as a general-purpose nonlinear programming solver that we call MadNLP.jl; this Julia-based solver is interfaced to the graph-based modeling package Plasmo.jl. The efficiency of this framework is demonstrated via problems arising in transient gas network optimization and multi-period AC optimal power flow. We show that our framework accelerates the solution (compared to off-the-shelf tools) by over 300%; specifically, solution times are reduced from 72.36 sec to 23.84 sec for the gas problem and from 515.81 sec to 149.45 sec for the power flow problem.
keywords:
Nonlinear Optimization, Decomposition, Graphs, Energy Systems1 Introduction
Real-time operation of modern energy infrastructures requires solving large-scale nonlinear programs (NLPs). Application examples include transient gas network optimization (Sundar and Zlotnik, 2018) and multi-period optimal power flow problems (Geth et al., 2020; Kim and Anitescu, 2020). Achieving real-time solutions for these problems is challenging, as they embed complex physical models that require space-time discretization. NLPs arising in this context can easily reach millions of variables and constraints and defy the scope of off-the-shelf solvers. Specifically, scalability bottlenecks are often encountered at the modeling level (function and derivative computations) and at the solver level (computation of the search step).
Large-scale NLPs arising in energy infrastructures have the key characteristic that they exhibit sparse graphs structures; we refer to such problems as graph-structured optimization problems (Jalving et al., 2019; Shin et al., 2020b; Jalving et al., 2020). Graph-structured problems can be conveniently modeled using specialized modeling platforms such as Plasmo.jl (Jalving et al., 2019, 2020) and solved using structure-exploiting optimization solvers such as PIPS-NLP (Chiang et al., 2014)). Plasmo.jl is a graph-based modeling platform that enables the modular construction and analysis of highly complex models; this platform also leverages the algebraic modeling capabilities of JuMP.jl (Dunning et al., 2017) and facilitates access to infrastructure modeling tools such as GasModels.jl and PowerModels.jl (Bent et al., 2020; Coffrin et al., 2018).
Another key benefit of Plasmo.jl is that it can communicate model structures to solvers, and this facilitates the implementation of different decomposition strategies, notably the alternating direction method of multipliers (Boyd et al., 2011), overlapping Schwarz (Shin et al., 2020a), and parallel interior-point (IP) methods (Chiang et al., 2014; Rodriguez et al., 2020).
In this paper, we present a new and flexible decomposition framework for graph-structured optimization problems. Our framework uses a restricted additive Schwarz (RAS) decomposition scheme implemented within a filter line-search IP method (Wächter and Biegler, 2006). We present a Julia-based implementation of this approach, which we call MadNLP.jl (https://github.com/zavalab/MadNLP.jl). We use our framework to experiment with different decomposition strategies that exploit parallelism at the modeling and at the solver level. Specifically, we consider a scheme that parallelizes function and derivative computations by exploiting the modular structure of Plasmo.jl. We also consider a scheme that uses RAS (Cai and Sarkis, 1999) for parallelizing step computations. RAS has been widely used for the solution of large linear algebra systems arising from discretized partial differential equations (PDEs) (Balay et al., 2019), but we have recently shown that it can also be applied to solve general linear systems arising in graph-structured optimization (Shin et al., 2020b; Gerstner et al., 2016). Our computational results indicate that our framework can accelerate computations by up to 300% (compared to off-the-shelf tools).
The paper is organized as follows: In Section 2, we define the graph-structured problem of interest and discuss how its structure can be exploited at the modeling level. In Section 3, we discuss parallel decomposition schemes. In Section 4, we apply these schemes to transient gas network optimization and multi-period AC optimal power flow problems. Section 5 presents concluding remarks.
2 Graph-Based Modeling
Optimization problems arising in energy infrastructures can be expressed as a graph-structured optimization problem of the form:
(1a) | ||||
(1b) | ||||
(1c) | ||||
(1d) |
Here, the undirected graph is an ordered pair of the nonempty, strictly ordered node set and the edge set ; denotes the neighborhood of on . For each , is the decision variable; is the objective function; is the inner equality constraint function; is the linking constraint function; is the dual variable associated with (1b); is the dual variable associated with (1c); is the dual variable associated with (1d). General inequality constraints can be handled by introducing slack variables.
In the context of energy infrastructures, the graph may intuitively be used as an abstraction of the space-time structure of the problem. Specifically, each node is a component located at a particular spatial location and at a particular time point (e.g., a subset of buses, generators, storage facilities, and electric lines in power networks or a subset of junctions, compressors, and pipelines in gas networks). The link constraints (1c) may represent spatial connections (e.g., interconnecting electric lines in power networks or pipelines in gas networks) or temporal connections. Furthermore, we will show that the graph can also be used as a general abstraction in which each node represents an individual variable or constraint of the problem (the graph encodes the general sparsity structure of the problem). The ability to represent the same optimization problem in different forms provides flexibility to identify efficient decomposition strategies.
We define the short-hand notation for (1):
(2a) | ||||
(2b) | ||||
(2c) |
where , , , , , and . Here, and are the primal-dual variable dimensions, and denotes the vector concatenation. We use boldface symbols to denote quantities associated with multiple nodes.
Each node may contain more than or less than one variable and constraint (). Thus, the problem graph may be different from the primal-dual coupling graph , where , . Here, is the Lagrangian of (2), and we use syntax . We can observe that a node in corresponds to a set of nodes in , which contains multiple variables and constraints. Example graphs and for a transient gas network problem are depicted in Figure 1 (a detailed problem formulation can be found in Section 4.1). Graph contains 24 nodes, each corresponding to a time point in a prediction horizon. Periodicity (over a 24 hours period) is enforced as constraints (this periodicity creates the cycle shape of ). In this graph, each node embeds the spatial structure of the problem (network and pipelines). Graph unfolds the temporal and spatial structure and shows the interconnectivity between all variables and constraints in the problem.
3 Graph-Based Decomposition
We proceed to describe our IP solver MadNLP.jl, comprising a new Schwarz decomposition scheme that exploits graph structures within an IP method, and we describe its interface to Plasmo.jl.
3.1 Interior-Point Method
The IP method implemented in MadNLP.jl finds the solution of (2) by solving a sequence of barrier subproblems:
(3) |
with a decreasing sequence for parameter . The KKT conditions for (3) give the nonlinear equations:
(4) |
where , , and . A solution of KKT system (4) is obtained by computing primal-dual Newton steps from:
(5) |
where , , and are regularization parameters. The step computed from (5) is safeguarded by a line-search filter procedure to induce global convergence (Wächter and Biegler, 2006). Typically, the solution of the linear system (5) is the most computationally intensive step in the IP method. This system is typically solved using direct linear solvers that are based on factorizations (e.g., as those implemented in HSL routines (HSL, 2007)). Decomposition strategies based on Schur complements (Chiang et al., 2014) and iterative strategies (Curtis et al., 2012; Rodriguez et al., 2020) have also been proposed. The solution of (5) based on a direct block factorization reveals the inertia (the number of positive, zero, negative eigenvalues) of . This inertia information is crucial in determining the acceptability of the computed step and in triggering the regularization of the linear system. However, inertia is not available when using iterative solution algorithms (as that proposed in this work). In MadNLP.jl, we use an inertia-free regularization strategy to determine the acceptability of the step (Chiang and Zavala, 2016). This method performs a simple negative curvature test to trigger regularization.
3.2 Restricted Additive Schwarz (RAS)
We propose a solution strategy for (5) based on an RAS scheme. We define some concepts and quantities that help explain our algorithm. Consider a partition of ; we call non-overlapping subdomains. This partition can be obtained by applying a graph partitioning scheme to . We then construct a family of overlapping subdomains (these are constructed by expanding ). The expansion procedure is performed by progressively incorporating adjacent nodes (Shin et al., 2020b) (the size of overlap represents the expansion level). We observe that:
where denotes disjoint union. With and , we define the corresponding index sets in the space of primal-dual variables in as follows:
where is the index set of in . We now observe that:
We state the RAS scheme for solving (5) as:
(6) |
Here, is the RAS iteration counter, is the residual; ; ; , where is the -th standard basis of , and if and otherwise.
The RAS scheme (6) involves the following steps. We first obtain the residual at the current step ; then, for each overlapping subdomains , the associated residual is extracted as . The -th subsystem is then solved by applying . In MadNLP.jl, a factorization of is computed with a direct solver and stored, so that the system can be repeatedly solved whenever the new right-hand-side is given. Subsequently, the solution for the -th overlapping subdomain is restricted to the non-overlapping subdomain and then mapped back to the full-space by applying (the indices associated with are set to zero in this step). Key defining features of RAS are the concepts of overlap and restriction. The overlap allows the dampening of the adverse effect of the truncated domain, and the restriction procedure discards the part of the solution where the adverse truncation effect is strong.
It has been empirically observed that the convergence of the RAS algorithm improves as the size of overlap increases and as the conditioning of improves (Cai and Saad, 1996). For positive definite , an exponential relationship between the convergence rate and the size of overlap has been established (Shin et al., 2020b). When , the RAS scheme reduces to a block-Jacobi scheme (decentralized) while, when is maximal (), the RAS scheme becomes a direct solution method (centralized). In this sense, RAS provides a bridge between fully decentralized and fully centralized schemes (thus providing flexibility). In the Schwarz submodule of , is set automatically based on the relative size of , and adaptively adjusted whenever a convergence issue occurs. Algorithm (6) uses a simple static iteration (also called a Richardson iteration), but more sophisticated iterative methods (e.g., the generalized mean residual (GMRES) method) can also be used (by treating as a preconditioner). Both Richardson and GMRES iterators are implemented in MadNLP.jl.
The construction of partitions for the RAS scheme is illustrated in Figure 2; these partitions correspond to the transient gas network example of Figure 1. Here, by partitioning the problem graph (first subfigure), the node set is divided into 4 subdomains (second subfigure). These subdomains are associated with the primal-dual index sets (third subfigure). After applying expansions, the associated blocks of are identified (last subfigure); these blocks are used by the RAS scheme (6).
3.3 Implementation in MadNLP.jl
The abstraction layers within MadNLP.jl are shown in Figure 3. The problem is modeled as an OptiGraph object (the core modeling object of Plasmo.jl). The OptiGraph is interfaced with multiple JuMP.jl models. The JuMP.jl model objects provide a set of local function oracles (objective, objective gradient, constraint, constraint Jacobian, and Lagrangian hessian). The Plasmo.jl-MadNLP.jl interface collects these local function oracles and creates a set of oracles for the full problem, where the local oracles are evaluated in parallel.
The Solver object of is created from the OptiGraph object of Plasmo.jl. The Solver object of MadNLP.jl uses a line-search filter IP method (Wächter and Biegler, 2006) to solve the problem. The step computation is performed by the linear solver specified by the user. The linear solver can be specified either as a direct solver or as the RAS solver. When the RAS solver is chosen, multiple subproblem solver objects are created by using standard direct solvers (e.g., by using Ma57 of HSL routines). These subproblem solvers are used for factorization and backsolve for blocks. The RAS scheme (6) exploits multi-thread parallelism available in Julia. After termination of the IP solution procedure, the primal-dual solutions are sent back to the OptiGraph object and Model objects from JuMP.jl so that the user can query the solution via the interface provided by Plasmo.jl and JuMP.jl. See Figure 3 for a comparison with a conventional implementation.
4 Case Studies
The proposed computational framework was tested using transient gas network and multi-period AC power flow problems. In this section, we present the problem statements followed by numerical results and discussion.
4.1 Transient Gas Network
We consider a transient gas network problem (Sundar and Zlotnik, 2018) of the form:
(7a) | ||||
(7b) | ||||
(7c) | ||||
(7d) | ||||
(7e) | ||||
(7f) | ||||
(7g) | ||||
(7h) | ||||
(7i) |
where , , and . Here, is the set of junctions; is the set of pipelines; is the set of compressors; is the set of receipts; is the set of demands; is the set of receipts at junction ; is the set of demands at junction ; is the time index set; is the densitiy; is the average mass flux; is the negative mass flux; is the compression ratio; is the supply; is the demand; is the time derivative of density; is the power consumption of compressor; is the mass flow; is the gas price; is the economic factor; , and are physical parameters. To implicitly enforce the periodicity, we let , where is the end time index. The gas network under study consists of 2 compressors, 6 junctions (35 junctions after discretization), 4 pipelines (32 pipelines after discretization), 1 receiving points and 5 transfer points (which work either as receipt or delivery). The model is constructed using GasModels.jl (Bent et al., 2020).
4.2 Multi-Period AC Power Flow
We consider a multi-period AC power flow problem with storage (Geth et al., 2020) of the form:
(8a) | ||||
(8b) | ||||
(8c) | ||||
(8d) | ||||
(8e) | ||||
(8f) | ||||
(8g) | ||||
(8h) | ||||
(8i) | ||||
(8j) | ||||
(8k) |
Here, is the set of generators; is the set of buses; is the set of (directed) branches; is the set of branches with inverted directions; is the set of storage; is the time index set; is the voltage; is the state of charge; is the power flow; is the power generation; is the complex power injected by the storage; is the charging rate; is the discharging rate; is the reactive power slack; are the generation costs; is the power demand; is the admittance; is the branch complex transformation parameter; is the charging efficiency; is the storage energy loss; is the time interval. Note that (8) can be reformulated as an NLP with real variables by separately treating the real and imaginary part of the variables and equations (a polar formulation is used here). The power network under study is a variant of IEEE 14 bus test system; this comprises buses, generators, storage, shunt, and branches. The detailed model is constructed with PowerModels.jl (Coffrin et al., 2018).
4.3 Results and Discussion
We compare the proposed method (MadNLP.jl interfaced with Plasmo.jl and Schwarz), with the conventional method (MadNLP.jl interfaced with serial/parallel direct solvers Ma57 or MKL-Pardiso along with non-graph based algebraic modeling language JuMP.jl). The conventional methods are referred to as JuMP-Ma57 and JuMP-PardisoMKL, and the proposed method is referred to as Plasmo-Schwarz/Ma57. Furthermore, the mix of proposed/conventional approaches (JuMP-Schwarz/Ma57, Plasmo-Ma57, and Plasmo-PardisoMKL) is also tested together. For JuMP-Schwarz/Ma57, the graph partitioning tool METIS was used to partition the primal-dual coupling graph directly. A Richardson scheme was used as an iterator for the RAS scheme. The study was performed by solving the gas (7) and power (8) problems while varying the size of the problems (by increasing the length of the prediction horizon). The code was run on a server computer equipped with 2 CPUs of Intel Xeon CPU E5-2698 v4 running 2.20GHz (20 core for each), and 20 threads are used for the computation. Code to reproduce the results can be found in https://github.com/zavalab/JuliaBox/tree/master/AdchemCaseStudy
For both problems, we found that the graph-based approach can significantly accelerate the solution (see Figure 4). In particular, comparing JuMP-Ma57 and Plasmo-Schwarz/Ma57, Plasmo-Schwarz/Ma57 becomes faster than JuMP-Ma57 when the prediction horizon is 3 days or more. Function evaluations are always faster in Plasmo.jl compared to JuMP.jl because the computational savings from function evaluations directly reduce the total solution time (parallelizing the function evaluation itself has no impact on the other part of the algorithm). On the other hand, one can see that the speed-up from parallel linear algebra is only observed when the problem size is sufficiently large (3 days in the gas network and 60 days in the power network). This is because the reduction in the problem size also reduces the overlap size. In our implementation, we set the size of overlap using the relative size of the block (the size of the overlap is reduced if the overall problem size is reduced). As a result, the RAS scheme (6) may become slow, and the number of required factorization/backsolve steps increases. This indicates that the use of RAS is beneficial only when the problem size is sufficiently large. For the gas problems, the acceleration of linear algebra computations was more pronounced. In contrast, for the power problems, the acceleration of function evaluations was more pronounced. This is because the AC power flow formulation has a large number of nonlinear expressions. By comparing the linear solver time for JuMP-Schwarz/Ma57 and Plasmo-Schwarz/Ma57, we see the advantage of using a graph-based modeling language for obtaining the partitions . We recall that for JuMP-Schwarz/Ma57, the Metis graph partitioning routine is directly applied to while Plasmo-Schwarz/Ma57 uses the user-provided problem graph . One can observe that, in general, the linear solver time is shorter for PlasmoNLP-Schwarz/Ma57. This indicates that the user-provided graph information can be leveraged for obtaining high-quality partitions.
5 Conclusions and Future Work
We have presented a graph-based modeling and decomposition framework for large-scale nonlinear programs arising in energy infrastructures. Here, we introduce a new decomposition paradigm for linear algebra systems within an interior-point method: a restricted additive Schwarz (RAS) scheme. We implement this framework in the Julia package MadNLP.jl and show that the RAS approach accelerates computations (compared to off-the-shelf approaches) by up to 300%. This work focused on applying RAS to conduct temporal decomposition; applying RAS as a spatial decomposition scheme is a future direction of interest. A surprising finding was that the RAS scheme is effective at handling instances with a large number of active inequality constraints. We are interested in determining the reasons for this by investigating the convergence properties of the RAS scheme within an interior-point context.
We acknowledge Andreas Wächter for helpful comments and Jordan Jalving for implementing the requested features in Plasmo.jl.
References
- Balay et al. (2019) Balay, S., Abhyankar, S., Adams, M., Brown, J., Brune, P., Buschelman, K., Dalcin, L., Dener, A., Eijkhout, V., Gropp, W., et al. (2019). PETSc users manual.
- Bent et al. (2020) Bent, R., Sundar, K., and Fobes, D. (2020). GasModels.jl. https://github.com/lanl-ansi/GasModels.jl.
- Boyd et al. (2011) Boyd, S., Parikh, N., and Chu, E. (2011). Distributed optimization and statistical learning via the alternating direction method of multipliers. Now Publishers Inc.
- Cai and Saad (1996) Cai, X.C. and Saad, Y. (1996). Overlapping domain decomposition algorithms for general sparse matrices. Numerical linear algebra with applications, 3(3), 221–237.
- Cai and Sarkis (1999) Cai, X.C. and Sarkis, M. (1999). A restricted additive schwarz preconditioner for general sparse linear systems. SIAM Journal on Scientific Computing, 21(2), 792–797.
- Chiang and Zavala (2016) Chiang, N.Y. and Zavala, V.M. (2016). An inertia-free filter line-search algorithm for large-scale nonlinear programming. Computational Optimization and Applications, 64(2), 327–354.
- Chiang et al. (2014) Chiang, N., Petra, C.G., and Zavala, V.M. (2014). Structured nonconvex optimization of large-scale energy systems using PIPS-NLP. In 2014 Power Systems Computation Conference, 1–7. IEEE.
- Coffrin et al. (2018) Coffrin, C., Bent, R., Sundar, K., Ng, Y., and Lubin, M. (2018). PowerModels.jl: An open-source framework for exploring power flow formulations. In 2018 Power Systems Computation Conference (PSCC), 1–8. 10.23919/PSCC.2018.8442948.
- Curtis et al. (2012) Curtis, F.E., Huber, J., Schenk, O., and Wächter, A. (2012). A note on the implementation of an interior-point algorithm for nonlinear optimization with inexact step computations. Mathematical programming, 136(1), 209–227.
- Dunning et al. (2017) Dunning, I., Huchette, J., and Lubin, M. (2017). JuMP: A modeling language for mathematical optimization. SIAM Review, 59(2), 295–320.
- Gerstner et al. (2016) Gerstner, P., Schick, M., Heuveline, V., Meyer-Hübner, N., Suriyah, M., Leibfried, T., Slednev, V., Fichtner, W., and Bertsch, V.V. (2016). A domain decomposition approach for solving dynamic optimal power flow problems in parallel with application to the german transmission grid. Preprint Series of the Engineering Mathematics and Computing Lab, (1).
- Geth et al. (2020) Geth, F., Coffrin, C., and Fobes, D.M. (2020). A flexible storage model for power network optimization. arXiv preprint arXiv:2004.14768.
- HSL (2007) HSL, A. (2007). collection of fortran codes for large-scale scientific computation. See http://www. hsl. rl. ac. uk.
- Jalving et al. (2019) Jalving, J., Cao, Y., and Zavala, V.M. (2019). Graph-based modeling and simulation of complex systems. Computers & Chemical Engineering, 125, 134–154.
- Jalving et al. (2020) Jalving, J., Shin, S., and Zavala, V.M. (2020). A graph-based modeling abstraction for optimization: Concepts and implementation in plasmo. jl. arXiv preprint arXiv:2006.05378.
- Kim and Anitescu (2020) Kim, Y. and Anitescu, M. (2020). A real-time optimization with warm-start of multiperiod ac optimal power flows. Electric Power Systems Research, 189, 106721.
- Rodriguez et al. (2020) Rodriguez, J.S., Laird, C.D., and Zavala, V.M. (2020). Scalable preconditioning of block-structured linear algebra systems using admm. Computers & Chemical Engineering, 133, 106478.
- Shin et al. (2020a) Shin, S., Anitescu, M., and Zavala, V.M. (2020a). Overlapping schwarz decomposition for constrained quadratic programs. arXiv preprint arXiv:2003.07502.
- Shin et al. (2020b) Shin, S., Zavala, V.M., and Anitescu, M. (2020b). Decentralized schemes with overlap for solving graph-structured optimization problems. IEEE Transactions on Control of Network Systems.
- Sundar and Zlotnik (2018) Sundar, K. and Zlotnik, A. (2018). State and parameter estimation for natural gas pipeline networks using transient state data. IEEE Transactions on Control Systems Technology, 27(5), 2110–2124.
- Wächter and Biegler (2006) Wächter, A. and Biegler, L.T. (2006). On the implementation of an interior-point filter line-search algorithm for large-scale nonlinear programming. Mathematical programming, 106(1), 25–57.