# A3C-R: A QoS-Oriented Energy-Saving Routing Algorithm for Software-Defined Networks
## 3 Modeling of QoS and Energy-Efficient Routing
### Modeling of Energy-Efficient Routing  
The energy consumption of switches in the network topology is mainly composed of two parts: fixed energy consumption and dynamic energy consumption. The fixed energy consumption is a constant related to the switch hardware. When the switch is turned on, there is energy consumption, and the dynamic energy consumption is a variable related to the forwarding rate of the switch port. This paper mainly conducts research on network energy consumption from the aspect of flow routing scheduling, aiming to transmit traffic evenly in the network topology, and reduce dynamic energy consumption related to port forwarding rate by improving link utilization. In this paper, the network topology, \(G\), is defined as a collection of forwarding nodes and links, which can be expressed as \(G=(V,E,C)\). Among them, \(V\) represents the collection of all switches and hosts, including all transmission nodes, \(E\) represents the collection of all links, and \(C\) represents the maximum bandwidth capacity of the link. In order to simplify the optimization idea of energy consumption, this paper abstracts the energy consumption of network ports as link energy consumption and adopts the energy consumption function of the more commonly used rate scaling model [18]. The calculation process of the energy consumption function \(p_{e}(x_{e})\) of the links in the network topology is shown in Formula (7). \[p_{e}(x_{e})=\left\{ \begin{array}{cc}0,&x_{e}=0\\ \sigma+\mu{x_{e}}^{\alpha},&0\leq x_{e}\leq C\end{array} \right. \tag{7}\]  
In Formula (7), \(x_{e}\) is the transmission rate of the link, \(\sigma\) represents the inherent energy consumption when the link is turned on, \(\mu{x_{e}}^{\alpha}\) represents the dynamic energy consumption of the link, where \(\mu\) represents the link rate correlation coefficient, and \(\alpha\) represents the link rate correlation index and \(\alpha>1\). We assume that each flow is independent and indivisible, and the set of flows is denoted as \(Flow=\{f_{1},f_{2},\cdots f_{i},\cdots,f_{n}|n\in N^{+}\}\) and \(f_{i}=(r_{i},d_{i},p_{i},q_{i},w_{i})\), where \(r_{i}\) represents the start time of the flow \(f_{i}\), \(d_{i}\) represents the end time of the flow \(f_{i}\), \(p_{i}\) represents the starting node of the transmission path of the flow \(f_{i}\), \(q_{i}\) represents the termination node of the transmission path of the flow \(f_{i}\), and \(w_{i}\) represents the data volume of the flow \(f_{i}\). Assume that the transmission rate of \(f_{i}\) at time, \(t\), is \(s_{i}(t)\), and Formula (8) needs to be satisfied. \[\int_{r_{i}}^{d_{i}}s_{i}(t)dt=w_{i},\ \ \forall f_{i}\in Flow \tag{8}\]  
If the link set of the flow transmission path is denoted as \(P_{i}\), our process of optimizing routing scheduling can be regarded as the solution to Formula (9). \[S=\{s_{i}(t),P_{i}|\forall f_{i}\in Flow,\forall t\in[r_{i},d_{i}]\} \tag{9}\]  
Define the active link in time \(T=[t_{1},t_{2}]\) as \(E_{a}\), and the total number of active links is denoted as \(L_{a}=|E_{a}|\). The total energy consumption of the link during the transmission of the flow on the active link is recorded as \(\phi_{f}(S)\), and the calculation process is shown in Formula (10). \[\left\{ \begin{array}{l}E_{a}=\{e\in E|\exists t\in[t_{1},t_{2}],x_{e}(t)>0\} \\ \phi_{f}(S)=(t_{2}-t_{1})\cdot|L_{a}|\cdot\sigma+\int_{t_{1}}^{t_{2}}\sum_{e\in E _{a}}\mu(x_{e}(t))^{\pi}dt\end{array} \right. \tag{10}\]  
We assume that the working status of network devices and links in the current network topology remains unchanged, which is equivalent to the fixed network energy consumption of the network topology. We only need to pay attention to the dynamic energy consumption during the flow transmission process. Therefore, reducing dynamic energy consumption requires keeping the flow uniform in time and space, which is equivalent to solving the minimum value of Formula (11).