# An SDN Focused Approach for Energy Aware Traffic Engineering in Data Centers
## 3 Optimization Problem  
We formulate the following optimization problem to determine the optimal topology and state of links (either disabled or in an optimal state for served traffic). We consider only fixed sized network devices since this is the trend in currently deployed DC network topologies. Furthermore, since we envisage our approach to be deployed in real-life scenarios, we exclude the option to put into sleep mode a whole device. Definitions:  
\(V\): set of network devices in a given topology. Device \(v\in V\) has a base power consumption of \(\text{B}_{v}\)  
\(E\): set of links between the devices. Links are assumed to be bi-directional thus link \(l=(v,v^{\prime})\) originates from device \(v\) and terminates at device \(v^{\prime}\) where \(v,v^{\prime}\in V\)\(F\): set of flows from Access only devices. Flow \((s,t)\in F\) originates from device \(s\) and terminates at device \(t\) where \(s,t\in V\)  
\(ST\): set of possible power states \(n\) for a link  
\(P_{l}^{(n)}\): power consumption of link \(l\) when operating in state \(n\)  
\(C_{l}^{s}\): capacity of link \(l\in E\) operating on a state \(n\in ST\)  
\(x_{l}^{(s,t)}\): flow from \(s\) to \(t\), where \(s,t\in V\), passing through link \(l\in E\)  
\(\Phi_{l}(\text{r})\): power consumed at link \(l\in E\) when carrying traffic \(r\)  
\(\tau_{(s,t)}\): flow from device \(s\) to \(t\) where \(s,t\in V\)  
Decision Variables:  
\(S_{l}^{(n)}\): a binary variable vector to describe the state of a link. Value \(S_{l}^{(n)}\) equals to 1 if link \(l\) is in state \(n\)  
\(y_{v}\): a binary variable describing the state of device \(v\) and equals to 0 when a device is in sleep state \(z_{l}\): a binary variable defining if link \(l\) is in sleep mode and equals to 1 when is serving any volume of traffic  
Our objective is to minimize the following gain function that calculates the total power consumed from network devices  
\[\text{Minimize}:\ \sum\
olimits_{v\in V}B_{v^{\prime}}y_{v}+\sum\
olimits_{l \in E}\sum\
olimits_{n\in ST}\ S_{l}^{(n)}\cdot P_{l}^{(n)} \tag{1}\]  
While maintaining the following constraints:  
\[\sum\
olimits_{(v,\,v^{\prime})\in E}x_{(v,v^{\prime})}^{(s,t)}-\sum\
olimits _{(v,\,v^{\prime})\in E}x_{(v,v)}^{(s,t)}=\left\{ \begin{array}{cl}\tau_{s,t}& if\ v=s\\ -\tau_{s,t}&if\ v=t\\ 0&otherwise\end{array} \right.,\forall\ (s,t)\in F\text{ and }v\in V \tag{2}\]  
\[\sum\
olimits_{(s,\,t)\in F}x_{l}^{(s,t)}\leq C_{l}^{(n)},\ \forall\ l\in E,\ n\in ST \tag{3}\]  
\[z_{l}\cdot C_{l}^{(n)}\geq\sum\
olimits_{(s,t)\in F}x_{l}^{(s,t)},\ \forall\ l\in E,\ n\in ST \tag{4}\]  
\[z_{(v^{\prime},\,v)}=z_{(v^{\prime},\,v)},\forall\ l=(v,v^{\prime})\in E \tag{5}\]  
\[y_{v}\Bigl{(}\sum\
olimits_{(v,v^{\prime})\in E}C_{(v,v^{\prime})}^{(n)}+\sum \
olimits_{(v^{\prime},v)\in E}C_{(v^{\prime},v)}^{(n)}\Bigr{)}\geq\sum \
olimits_{(s,t)\in F}\Biggl{(}\sum\
olimits_{(v,v^{\prime})\in E}x_{(v,v^{ \prime})}^{(s,t)}+\sum\
olimits_{(v,v)\in E}x_{(v^{\prime},v)}^{(s,t)}\Biggr{)} \tag{6}\]  
\[C_{l}^{(n-1)}\leq\sum\
olimits_{(s,t)\in F}x_{l}^{(s,t)}\leq C_{l}^{(n)} \tag{7}\]  
\[\sum\
olimits_{l\in E,n\in ST}S_{l}^{(n)}=1 \tag{8}\]  
\[\Phi_{l}(\text{r})=\sum\
olimits_{n\in ST}S_{l}^{(n)}\cdot P_{l}^{(n)} \tag{9}\]  
Equation (2) guarantees flow preservation, i.e., flow that enters a device is also coming out of it without packet loss. Equation (3) guarantees that capacity constrains are not violated and the sum of all the flows coming from an interface cannot be greater than the capacity of the interface. The fact that a link must be on a specific state and not on sleep mode and in parallel be on the same state on both interconnected devices is defined in Equations (4) and (5). Equation (6) guarantees that a device (and the interconnected one) are kept online if they serve any amount of traffic. Capacity constraint in Equation (7) ensures that the traffic through an interface is not grater then the capacity for a given state. Each interface can only be on one state and this is guaranteed by Equation (8).