Adversarially robust learning for security-constrained optimal power flow

1 Introduction . Robust optimization problems are pervasive across many applications and domains – such as electric power systems , supply chain management , and civil engineering – where the goal is to construct some solution that is robust under any allowable instantiation of uncertainty [ 1 , 2 ] . While the aim is generally that these solutions be provably robust , there unfortunately remain many settings where it is either not easy or not possible to construct such solutions . This has often motivated the use of heuristic approaches . For instance , many approaches in adversarially robust deep learning formulate neural network training as a minimax game over neural network parameters and input perturbations , optimizing this problem via gradient-based techniques that do not yield provable robustness guarantees , but are nonetheless effective in practice [ 3 ] . In this work , we draw inspiration from adversarially robust training to address the problem of N-k security-constrained optimal power flow ( SCOPF ) . N-k SCOPF is a fundamental problem to schedule power generation in a way that is robust to k potential equipment failures ( e.g. , generator or line outages ) . Unfortunately , N-k SCOPF is prohibitively expensive to solve at scale , leading grid operators to use rough approximations in practice . To address this challenge , we frame N-k SCOPF as a minimax attacker-defender problem , where the “ defender ” aims to schedule power generation , and the “ attacker ” aims to pick adversarial equipment failures . The loss function of this problem requires solving implicit equations representing the physics of the electric grid as well as additional operational decisions that are made after an attack has occurred . As such , we optimize this problem using gradient-based techniques , and employ insights from the literature on implicit differentiation and implicit layers to cheaply compute gradients through the loss function . ⇤These authors contributed equally . 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) . Our key contributions are : • Formulation for minimax optimization with implicit variables . To streamline the presentation of concepts , we provide a generic formulation for gradient-based optimization of minimax problems with implicitly-defined variables . While our main focus in this paper is on N-k SCOPF , we believe this generic formulation may also be of broader interest for minimax settings with physics in the loop , as well as for tri-level optimization settings . • Formulation for gradient-based optimization of N-k SCOPF . We rewrite N-k SCOPF as a continuous minimax optimization problem , and demonstrate how to efficiently compute gradients through relevant implicit components . We also utilize the underlying structure of our optimization solvers to further streamline the outer minimization procedure . Importantly , the per-iteration cost of this approach is agnostic to the number of simultaneous outages k , despite the combinatorial blowup in the number of associated “ contingency scenarios. ” • Demonstration on N-1 , N-2 , and N-3 SCOPF . We demonstrate the efficacy of our method in addressing SCOPF settings that allow for one , two , or three simultaneous outages on a realistic 4622-node power system with over 38 billion potential N-3 outage scenarios . We find that our method incurs 3-4⇥ fewer N-3 feasibility violations than a baseline optimal power flow approach , and requires only 21 minutes to run on a standard laptop . 2 Related work . Adversarial robustness in deep learning . There has been a growing body of work that aims to parameterize neural networks in a manner that is robust to particular perturbations of their inputs , usually by casting neural network training as an attacker-defender game [ 3 , 4 ] . While there have been several promising approaches for certifiably robust neural network training [ 5–7 ] , in general , these approaches do not yet scale to large-sized networks and only address a limited set of threat models . As a result , there has been a lot of research in this area that aims to train robust neural networks using approximate , gradient-based training methods [ 8 , 9 ] , an approach we adopt in the context of SCOPF . In addition , a key part of this literature has been on constructing strong but cheap-to-compute attacks that can strengthen the outcomes of adversarially robust training , e.g. , the fast gradient sign method ( FGSM ) [ 8 ] and projected gradient descent ( PGD ) attacks [ 9 ] . In our experiments , we similarly show how a gradient-based adversarial robustness approach can be used to identify potential grid vulnerabilities , as an input to secure power system optimization . Implicit layers . Implicit differentiation techniques [ 10 , 11 ] have started to be used more widely within deep learning workflows , largely in the context of implicit layers , i.e. , neural network layers that represent implicit functions [ 12 ] . These include differentiable optimization layers [ 13–19 ] and physics-based layers [ 20 , 21 ] , among others [ 22 , 23 ] . Given the large number of parameters within any given deep network , a key aspect of this work has been in finding efficient ways to actually compute the relevant derivatives , e.g. , by strategically ordering multiplicative operations and reusing the results of previous computations . We similarly employ these kinds of strategies when computing implicit derivatives for our SCOPF optimization approach . We also note that some of the work on implicit differentiation in deep learning and related areas has been in service of solving bi-level optimization problems , e.g. , for decision-driven forecasting [ 24 , 25 ] , hyperparameter tuning [ 26–29 ] , or system identification and control [ 30 ] . We similarly consider the use of implicit differentiation for multi-level optimization ( in particular , tri-level optimization ) in the context of SCOPF . Security-constrained optimal power flow . In the electric power systems community , there has been a great deal of emphasis on optimizing power grid operations to be secure to sets of outages ( contingencies ) that may be particularly high risk . For instance , many grid operators in the United States require grids to be operated in a way that is N-1 secure ( i.e. , secure against any single outage ) , which has led to a focus in the literature on addressing N-1 SCOPF [ 31–34 ] . However , ensuring security against multiple simultaneous failures ( i.e. , solving N-k SCOPF for k > 1 ) is becoming increasingly critical , both as evidenced by recent major blackout events [ 35 , 36 ] and as climate change drives weather extremes [ 37 ] that may lead to correlated outages [ 38 ] . That said , due to the computational complexity of addressing N-k SCOPF in the general case , there have been few attempts at developing methods geared towards this setting . In particular , the computational complexity of N-k SCOPF grows combinatorially with k and the size of the system . Some previous attempts to solve N-k SCOPF have employed exhaustive methods [ 39 ] , Bender ’ s cuts to reduce the number of contingencies analyzed [ 40 ] , and bi-level optimization frameworks [ 40 , 41 ] . In particular , [ 41 ] used bi-level optimization to develop a systematic attacker-defender approach to address N-3 contingency scenarios , but used a simplified , linear power grid model to attain convergence . We similarly adopt a bi-level framework , but solve a realistic non-linear model of the grid by introducing fast gradient calculation methods inspired by the implicit layers literature , which allows us to scale our approach to a 4622-node system . 3 Generic problem formulation . Before diving into the details of our SCOPF formulation , we first provide a more generic formulation for gradient-based minimax optimization over an implicit loss function , which we will later build upon in the context of SCOPF . In particular , we consider the setting of continuous minimax optimization problems over “ defender ” ( minimizer ) variables x 2 X and “ attacker ” ( maximizer ) variables y 2 Y ; these are also referred to as first-stage and second-stage decision variables , respectively , in the bi-level optimization literature . In addition , we allow for “ third-stage ” decisions z 2 Z that are fully defined via a set of implicit constraints on x , y , and z . Specifically , we consider problems of the form minimize x2X max y2Y ` ( x , y , z ) s. t. g ( x , y , z ) = 0 , z 2 Z , ( 1 ) where X , Y , and Z are compact sets ; ` : X ⇥ Y ⇥ Z ! R is a standard , continuously differentiable loss function ( e.g. , softmax or mean squared error loss ) ; and g : X ⇥ Y ⇥ Z ! Rm is defined such that g ( x , y , z ) = 0 is an implicit function in z with some solution z 2 Z for all ( x , y ) 2 X ⇥ Y . We further restrict ourselves to those functions g that are continuously differentiable with non-singular Jacobians at their roots , i.e. , those functions that are compatible with the implicit function theorem [ 3 , 42 ] . We note that this formulation covers a wide range of settings , e.g. , many minimax problems with non-linear physical constraints , or many tri-level optimization problems where z is a solution to a continuous optimization problem parameterized by x and y ( both of which notions we will use in Section 4 for the setting of N-k SCOPF ) . Inspired by the literature on adversarial robustness in deep learning , we propose to solve problem ( 1 ) via gradient-based search on both the inner maximization and outer minimization problems . In particular , this entails ( a ) obtaining some ( approximately ) optimal y for the inner maximization problem via gradient-based techniques , given some initial value of x , ( b ) updating x using the gradient at the optimum of the inner maximization problem , and ( c ) repeating these steps until convergence . We now describe steps ( a ) and ( b ) in additional detail . 3.1 Solving the inner maximization problem . Let x̄ denote some fixed value for x . The inner maximization problem is then given by max y2Y ` ( x̄ , y , z ) s. t. g ( x̄ , y , z ) = 0 , z 2 Z . ( 2 ) We optimize this problem via projected gradient descent . Specifically , let y = y0 denote our initial guess for the optimal attack , and let P denote the projection operator . Until convergence ( or for some fixed number of iterations ) , we then ( i ) Obtain z ? such that g ( x̄ , y , z ? ) = 0 , z ? 2 Z . ( ii ) Update y PY ( y + ry ` ( x̄ , y , z ? ) ) for step size . Notably , step ( ii ) entails obtaining the gradient ry ` ( x̄ , y , z ? ) . By the chain rule , this involves the gradient through z ? , which is the solution to a set of implicit equations . Specifically , using the notation d to denote total derivatives ( e.g. , gradients ) and @ to denote partial derivatives , we have d ` ( x̄ , y , z ? ) dy = @ ` ( x̄ , y , z ? ) @ y + @ ` ( x̄ , y , z ? ) @ z ? dz ? dy . ( 3 ) By the implicit function theorem , we can then obtain an expression for dz ? /dy by noting that dg ( x̄ , y , z ? ) dy = @ g ( x̄ , y , z ? ) @ y + @ g ( x̄ , y , z ? ) @ z ? dz ? dy = 0 = ) dz ? dy = ⇣ @ g ( x̄ , y , z ? ) @ z ? ⌘ 1 @ g ( x̄ , y , z ? ) @ y , ( 4 ) which we can plug into Equation ( 3 ) to yield our full update . We note that in practice , we seldom want to compute the Jacobian dz ? /dy 2 Rdim ( Z ) ⇥dim ( Y ) explicitly due to the potentially large time and space complexity of doing so ; instead , it is often desirable to compute the left vector-matrix product ( @ /̀ @ z ? ) ( dz ? /dy ) 2 Rdim ( Y ) directly . We refer to this strategy as the “ vector-Jacobian product trick. ” The details of the relevant computations may vary based on the particular setting at hand , and we describe how we employ this trick for SCOPF in Section 4.3 .

Summary: In this paper, N-k SCOPF is formulated and solved through the lens of adversarial learning and the implicit function theory. Thus, problem formulation and the development of a multi-level optimization algorithm are two key contributions. Meanwhile, the paper is mostly well written and easy to follow.