# Optimal Siting and Sizing of FACTS in Distribution Networks Using the Black Widow Algorithm
## 2 Mathematical Formulation
### Model Interpretation and Characterization  
The general MINLP model defined from (1) to (9) can be interpreted as follows:  
1. The first component of the objective function, defined in (1), is associated with the annualized expected costs of energy losses in all the branches of the distribution network. The second component of the objective function, presented in Equation (2), quantifies the expected investment in FACTS to be installed. In addition, the sum of both components defines the objective function studied in this research, as presented in Equation (3).
2. Equation (4) and Equation (5) correspond to the power equilibrium restrictions per node and period. These are nonlinear and non-convex constraints whose solution requires the implementation of a numerical method.
3. The voltage regulation constraint is defined in Equation (6). This is one of the most typical operating conditions for electrical networks, as it is imposed by regulatory entities at any voltage level in order to ensure the quality of the voltage service for all end users [33].
4. Equation (7) is a binary constraint that defines whether a FACTS device will be installed at a particular node \(k\). If \(y_{k}=1\), the compensation device is sized; otherwise, its size must be zero. Box-type constraint (8) sets the daily dispatch of a FACTS device connected at node \(k\) by defining the reactive power injection per period. In addition, inequality constraint (9) defines the maximum number of compensation devices available for installation in the distribution network under analysis.  
**Remark 2**: _Given the complexity of the optimization model (1)-(9) (i.e., the nonlinearities and non-convexities of the objective function and the power balance constraints), and as recommended by the authors of [25], one of the most suitable optimization approaches is the hybridization of a combinatorial optimizer with an efficient power flow approach within a master-slave programming structure._  
To illustrate the complexity of the exact MINLP model defined in (1)-(9), Table 1 presents the number of variables and equality and inequality constraints that make up this optimization model. Note that, in order to quantify the number of variables and constraints, \(n\) represents the total number of nodes of the network, and \(h\) denotes the total periods of analysis.  
Note that the number of equations and variables in Table 1 increases polynomially with the number of nodes and periods of study. The number of equalities and inequalities is \((4h+1)n+4\), and the number of variables is \((5h+2)n+3\). Note that, for the IEEE 33-, 69-, and 85-node test feeders, when 48 periods of 30 min are considered, the number of equations is 6373, 13,321, and 16,409. In contrast, the number of variables for each test feeder is 7989, 16,701, and 20,573, respectively. Considering the above, it is important to mention that the expected processing times will increase as a function of the number of nodes and periods of analysis when using exact algorithms or master-slave approaches.  
This research proposes the hybridization of the black widow algorithm and the successive approximations power flow (SAPF) method as a new optimization approach to deal with the problem regarding the optimal siting and sizing of FACTS in medium-voltage distribution grids. The main details of the proposed solution methodology are presented in Section 3.