## 3 SOCP Optimization
### SOCP Approximation for the Power Flow Equations  
The main idea behind the SOCP of the power flow is to transform non-convex (bilinear) constraints into second order cone constraints. The formulation allows transforming the power flow equations, that are a nonlinear / non-convex problem, into a series of convex constraints. The proposed SOCP model is built on the approximation proposed by [PERSON] in [26]. A new matrix \(W=[w_{km}]\in\mathbb{C}^{n\times n}\) is defined, as follows:  
\[w_{km}=v_{k}^{*}v_{m}. \tag{10}\]  
Therefore, power flow equations (2) can be represented as the following equivalent equation:  
\[s_{k}^{*}+s_{k}^{\text{new}^{*}}-d_{k}^{*}=\sum_{m\in\mathcal{N}}y_{km}w_{km}, \ \forall k\in\mathcal{N}. \tag{11}\]  
Note (11) is affine and the non-convexity appears in (10), which in turns implies the following expression:  
\[\|w_{km}\|^{2}=\|v_{k}\|^{2}\|v_{m}\|^{2}. \tag{12}\]A new vector \(U\in\mathbb{R}^{n}\) is defined, with entries \(u_{k}=\left\|v_{k}\right\|^{2}\), then (12) is transformed into (13):  
\[\|w_{km}\|^{2}=u_{k}u_{m}. \tag{13}\]  
Being a complex number, \(w_{km}\) stores information related to the angle of the voltages whereas \(u_{k},u_{m}\) stores information related to the magnitude. We use the following hyperbolic representation for the right hand side of (13):  
\[u_{k}u_{m}=\frac{1}{4}(u_{k}+u_{m})^{2}-\frac{1}{4}(u_{k}-u_{m})^{2}.\]  
Resulting in the following equivalent expression:  
\[\|w_{km}\|^{2}+\frac{1}{4}(u_{k}-u_{m})^{2}=\frac{1}{4}(u_{k}+u_{m})^{2}. \tag{14}\]  
At this point, the problem is still not-convex, however, (14) relaxed and transformed into the following constraint:  
\[4\|w_{km}\|^{2}+(u_{k}-u_{m})^{2}\leq(u_{k}+u_{m})^{2}. \tag{15}\]  
Notice that (15) represents a second order cone, namely:  
\[\left\|\left( \begin{array}{c}2w_{km}\\ u_{k}-u_{m}\end{array} \right)\right\|\leq u_{k}+u_{m} \tag{16}\]  
where the term inside the norm in the left hand side of the inequality is a vector in \(\mathbb{C}^{2}\) (square (16) to demonstrate it is equivalent to (15)). The problem is now convex and tractable, except for the binary constraints given by (7). The problem must be solved in the framework of MI-SOCP. The new decision variables \(u_{k}\) allow also to transform (3) into the following convex constraint:  
\[(1-\delta)^{2}\leq u_{k}\leq(1+\delta)^{2}. \tag{17}\]  
This constraint is equivalent to (3) since \(1-\delta\geq 0\) and therefore the inequality holds even if it is squared (i.e., (17) is not an approximation but an equivalent constraint). The objective function (1) although already convex, is transformed into a simpler affine equation using the new variables \(w_{km}\):  
\[\min\ p_{L}=\text{real}(y_{km}w_{km})\]  
remember that both \(y_{km}\) and \(w_{km}\) are represented as complex variables but the objective \(p_{L}\) is a real function. In theory, these variables are separated in real and imaginary parts. However, the convex representation is more compact and can be directly implemented in practice using languages such as Matlab and/or Python. Combining all the aforementioned considerations, the MI-SOCP model is obtained:  
\[\min\ p_{L} =\text{real}(y_{km}w_{km})\] \[s_{k}^{*}+s_{k}^{\text{new}*}-d_{k}^{*} =\sum_{m\in\mathcal{N}}y_{km}w_{km},\ \forall k\in\mathcal{N}\] \[\left\|\left( \begin{array}{c}2w_{km}\\ u_{k}-u_{m}\end{array}