## 2 General Mathematical Model
### Constraints  
The main constraint of the model is given by the set of power flow equations that are given by (2):  
\[\left(\frac{s_{k}+s_{k}^{\text{new}}-d_{k}}{v_{k}}\right)^{*}=\sum_{m\in \mathcal{N}}y_{km}v_{m},\ \forall\ k\in\mathcal{N}, \tag{2}\]  
where \(s_{k}\), is the apparent power generated at node \(k\) by a existing generators, \(s_{k}^{\text{new}}\) is the apparent power generated by new DERs at node \(k\), and \(d_{k}\) is the apparent power demanded at node \(k\). Notice this constraint constitutes a set of \(2n\) non-affine equality equations (\(n\) for the real part and \(n\) for the imaginary part) which make the problem non-convex.  
The voltage in the slack node (substation) is supposed to be \(v_{1}=1+j0\); the rest of voltages are limited as follows:  
\[V^{\text{nom}}-\delta\leq\|v_{k}\|\leq V^{\text{nom}}+\delta,\ \forall\ k\in \mathcal{N}, \tag{3}\]  
where \(V^{\text{nom}}\) is rated voltage of the system and \(\delta\) is the maximum deviation given by the grid code (usually \(\delta\) is a constant between 0.05 pu to 0.1 pu). The left-hand side of this constraint is non-convex, however, the right hand side is.  
Flows in the distribution lines are limited by the following box constrain which is, of course, convex:  
\[\|s_{km}\|\leq\overline{s_{km}},\ \forall(km)\in\mathcal{E}, \tag{4}\]  
where \(s_{km}\) is the power flow through line \(km\) and \(\overline{s_{km}}\) is the maximum apparent power flow allowed.  
Capacity of generators, both existing and new are considered as follows:  
\[\|s_{k}\|\leq\overline{s}_{k},\ \forall\ k\in\mathcal{N}, \tag{5}\] \[\|s_{k}^{\text{new}}\|\leq z_{k}\|\overline{s}^{\text{new}}\|,\ \forall\ k\in\mathcal{N}, \tag{6}\]where \(\overline{s}_{k}\) is the maximum apparent power generated at node \(k\) by a existing generators, \(\overline{s}^{\text{new}}\) is the maximum apparent power generated by new DERs at node \(k\), and  
\[z_{k}\in\{0,1\},\ \forall k\in\mathcal{N} \tag{7}\]  
which denotes the binary variable of the problem, which has a value of 1 if a DER is installed at node \(k\) or 0 otherwise. There is a limit of DERs to be installed in the system, given by (8),  
\[\sum_{k\in\mathcal{N}}z_{k}\leq n_{T}. \tag{8}\]  
For the sake of completeness, the entire model is presented below:  
\[\begin{split}\min p_{L}&=\text{real}\bigg{(}\sum_{ k\in\mathcal{N}}\sum_{m\in\mathcal{N}}y_{km}v_{m}v_{k}^{*}\bigg{)}\\ (s_{k}+s_{k}^{\text{new}}-d_{k})^{*}&=\sum_{m\in \mathcal{N}}y_{km}v_{m}v_{k}^{*},\ \forall\ k\in\mathcal{N}\\ V^{\text{nom}}-\delta&\leq\|v_{k}\|\leq V^{\text{nom }}+\delta,\ \forall\ k\in\mathcal{N}\\ \|s_{bm}\|&\leq\overline{s_{bm}},\ \forall(km)\in \mathcal{E}\\ \|s_{k}\|&\leq\overline{s}_{k},\ \forall\ k\in \mathcal{N}\\ \|s_{k}^{\text{new}}\|&\leq z_{k}\|\overline{s}^{ \text{new}}\|,\ \forall\ k\in\mathcal{N}\\ \sum_{k\in\mathcal{N}}^{k}z_{k}&\leq n_{T}\\ z_{k}&\in\mathbb{B},\ \forall k\in\mathcal{N}\end{split} \tag{9}\]  
Model (9) is a non-convex non-linear integer programming problem. These problems are highly complex, hence the need to use approximate techniques for their solution. However, some constraints are convex and may be used to generate a tractable problem.