## 3 Methodology
### Proposed Algorithm  
Let \(\mathbb{E}^{\epsilon}(h)\) represent our target function that encompasses the energy consumption, resource wastage, and SLA violations of host \(h\) within a data center. As a first step toward our algorithm, we define \(\mathbb{P}^{df}(h,v)\). This denotes a potential power draw improvement of a host if it is also hosting VM \(v\):  
\[\mathbb{P}^{df}(h,v)=\mathbb{P}^{\prime}(h,v)-\mathbb{P}(h). \tag{5}\]  
Similarly, we define \(\mathbb{S}^{df}(h,v)\) as the potential SLA violation change of a host when it starts hosting a new VM \(v\):  
\[\mathbb{S}^{df}(h,v)=\mathbb{S}^{\prime}(h,v)-\mathbb{S}(h). \tag{6}\]  
We next define the overall improvement of the host as follows:  
\[\mathbb{F}(h,v)= \begin{cases}\mathbb{P}^{df}(h,v),&if\ \mathbb{S}^{df}(h,v)=0,\\ \mathbb{S}^{df}(h,v),&if\ \mathbb{P}^{df}(h,v)=0,\\ \mathbb{P}^{df}(h,v)\times\mathbb{S}^{df}(h,v),&if\ both\ terms\
eq 0,\\ 1,&otherwise.\end{cases}  \tag{7}\]  
We are using only non-zero improvement components, so we can use this in the denominator of our overall target function:  
\[\mathbb{E}^{\epsilon}(h)=\frac{\mathbb{P}^{\epsilon}(h)(1-\mathbb{R}^{\pi}(h) )}{\mathbb{F}(h,v)}. \tag{8}\]  
Now, we are ready to discuss Algorithm 1, which builds on the previously discussed equations. In general, our algorithm, just like any typical VMP, takes a list of PMs and a list of VMs as input, and then it produces a set of VM-PM pairs as output, in which each VM is hosted by certain hosts as guided by our target function. First, the VMs are sorted in decreasing order according to CPU demands. For each VM in the VM list, the algorithm checks the set of active servers that have enough resources to accommodate the VM request and calculates the energy efficiency for each one based on Equation (8). To calculate \(\mathbb{E}^{\epsilon}\) for each host, the algorithm determines the variation of power consumption before and after hosting VM \(v\) using Equation (5). Thus, the host with the lowest increase in the power consumption will have a better chance at hosting. The \(\mathbb{P}^{\epsilon}\) factor helps with choosing the server with the highest power efficiency. This means that the host with a higher \(\mathbb{P}^{\epsilon}\) is preferred, since it can host more VMs with a lower increase in power consumption compared to other PMs. This leads to minimizing the overall power consumption of the DC by utilizing as few hosts as possible. The potential SLA violation impact before and after VM placement is calculated using Equation (6). The resource usage factor of the nominated servers is calculated by considering two dimensions, CPU and RAM, based on Equation (3). This factor is important for selecting an appropriate PM in terms of resource utilization across multiple dimensions. Additionally,it aids in balancing the resource wastage of PMs by giving priority to those with higher resource utilization. ```
0:\(\mathbb{H}\) and \(\mathbb{V}\)
0:\(\mathbb{Z}:\) where \(\mathbb{Z}\) is \(\{(v_{1},h_{1}),(v_{2},h_{2}),(v_{3},h_{3}),...\}\)
1:for all\(v_{i}\in\mathbb{V}\) such that \(\mathbb{M}(v_{i})\geq\mathbb{M}(v_{i+1})\)do
2: \[h_{active}^{ch}= \begin{cases}\operatorname*{arg\,max}_{h_{j}\in A(\mathbb{H})} \mathbb{E}^{e}(h_{j}),&\text{if }\mathbb{R}^{q}(v_{i})\leq\mathbb{R}^{f}(h_{j})\\ -\infty,&\text{otherwise}\end{cases} \]
3:if\(h_{active}^{ch}\
eq-\infty\)then
4:\(\mathbb{Z}\cup(v_{i}\,,\,h_{active}^{ch})\)
5:else
6:\(h_{in-active}^{ch}=\operatorname*{arg\,max}_{h_{k}\in A(\mathbb{H})}\mathbb{ E}^{e}(h_{k})\)
7:\(\mathbb{Z}\cup(v_{i}\,,\,h_{in-active}^{ch})\)
8:endif
9:endfor
10:return\(\mathbb{Z}\)
```  
**Algorithm 1** VMP-ER Placement Algorithm. The energy-efficiency metric for each server will be obtained based on the power effiency, resource usage, and potential occurrence of SLA, which all contribute to the selection of PMs. The most suitable one will be chosen to host the VM while pairing between VM-PM is updated (line 4).