so it is switched off or in sleep mode working under a negligible power consumption. The total cost $C$ for active host is shown in Eq. (3).

$$\label{first}
C=\sum_{t=t_0}^T \left( C_p\sum_{i=0}^n a_{ti} + C_v \sum_{j=0}^n v_{tj}\right)$$

In Eq. (3), initial time is $t_0$; the total time is $T$, $a_{ti}$ indicating whether the host $i$ is active at the time $t$; $v_{tj}$ indicating whether the host $j$ is experiencing an SLA violation at the time $t$. The dynamic VM consolidation upper bound of the competitive ratio of the optimal online deterministic algorithm (ALG) comparing with optimal offline algorithm (OPT) is shown in Eq. (4).

$$\label{first}
\frac{ALG(I)}{OPT(I)} \leq 1+\frac{ms}{2(m+1)}$$

Heuristics for VM Consolidation
-------------------------------

The CPU utilization threshold is calculated by analysing the historical data which is based on the resource usages by the VMs. The heuristics based analysis improves the decision making for the service allocation. The Heuristics algorithm automatically adjusts the utilization threshold with the help of a statistical analysis on the historical data which gathered during VMs lifetime. A previous study shows that the heuristics algorithm improves the energy consumption and service the quality \[18\]. The VM consolidation using historical CPU utilization had continued throughout the simulation as illustrated 