## 4 Workload and Data Center Modeling
### Analytical Modeling Approach
#### 4.1.2 Data Center Modeling
Using the aforementioned relations and equations, the data center is modeled as described in Algorithm 2. It starts by reading the logs and extracting the statistical values needed to build the Bayesian network transition matrix \(S\), as in Equation (17). \[S= \begin{bmatrix}1&P(BA)&0&0&0&0&0&P(FM)\\ P(AEDCB)&1&P(CAB)&0&0&0&0&P(FM)\\ 0&P(BEDC)&1&P(DABC)&0&0&0&P(FM)\\ 0&0&P(CED)&1&P(EABCD)&0&0&P(FM)\\ 0&0&0&P(DE)&1&P(UIMABCD)&0&P(FM)\\ P(A)&0&0&0&0&1&0&P(FM)\\ P(A)&0&0&0&0&0&1&0\\ 0&0&0&0&0&0&0&1\\ \end{bmatrix}  \tag{17}\]  
Using statistical analysis for the transition table, we found the values of the \(S\) matrix as in Table 3. The probability values are measured every time window \(T_{w}\) during the training phase to be used in the next prediction time window. The next phase will use the pre-built Bayesian transition table of the machine list for the prediction of the data center's scaling value for the next time window. ```
1:\(MList\) /* MList Data center machine list information. */
2:\(t\gets 0\), \(T_{w}\leftarrow\) 180, \(T_{FM}\leftarrow\) 999999999999 /* Initialize starting time, time window size and failed state time, time in second. */
3:while true do /* Training Part, in current time window \(T_{w}\) */
4:\(MC\leftarrow\) getMachinesCapacity\((T_{w},MList)\) /* Get Data center Machines capacity size from logs. */
5:\(S\leftarrow\) GetMachinesStatesProbability\((T_{w},MList)\) /* Read Data center Machines state statistical values. */
6:\(T\leftarrow\) GetMachinesStatesTime\((T_{w},MList)\) /* Find average time of states \(T_{A}\), \(T_{B}\), \(T_{C}\), \(T_{D}\), \(T_{E}\), \(T_{UL}\), \(T_{NM}\) during \(T_{w}\). Generate full matrix \(T\). */
7:\(M_{nt}\), \(P(NM_{t})\leftarrow\) FindStiatics\((MList)\) /* Find average number of addad machine and their probabilities during time window \(T_{w}\). */
8:\(MS\leftarrow\) [ \(S\) T] /* Build data center machines states statistical tensor values. */
9:\(Trans\leftarrow\) TransitionActions\((MS)\) /* Build transitions tracking table in Trans matrix from MS. */ / * Find scaling values by reading transition actions, transition from state \(A\) to state UM is to provision resources, and transition from state UM to \(A\) is to de-provision resources. * \(S_{out}\leftarrow\sum_{i=d}^{un}Trans\) /* Find scale out \(S_{out}\). */
10:\(S_{in}\leftarrow-\sum_{i=m}^{d}Trans\) /* Find scale in \(S_{in}\). */
11:\(PR\gets S_{out}+S_{in}\) /* Find over all provisioned value PR. */
12:\(CT\gets t\times T_{w}\) /* Update current time. */
13:\(t\gets t+1\) /* Update time index \(t\). */
14:\(Prediction\) Part, next time window \(T_{w+1}\) */
15:foritem in MList do * PTrans \(\leftarrow\) Equation (15), Equation (16) MS\((item)\)
16:endfor /*Using MS matrix iterate over predicted next machine state using Equations (15), (16) for all states A to UM to create prediction transition matrix PTrans*/
17:\(PS_{out}\leftarrow\sum_{i=d}^{un}PTrans\)
18:\(PS_{in}\leftarrow-\sum_{i=m}^{un}PTrans\)
19:\(PR_{t}\gets S_{out}+S_{in}\) /* Find predicted scale value \(PR^{\prime}\)/
20:endwhile
```  
**Algorithm 2** Data Center Modeling.