## 2 Background and Related Work  
In this study, we employ the hidden Markov model [13], which determines whether we use the edge cloud layer or not. Given the hidden Markov model \(\lambda\) = (\(A\), \(B\), \(\pi\)) and a sequence of observations \(O\) = (\(O_{0}\), \(O_{1}\),..., \(O_{T-1}\)), our resource consolidation algorithm determines \(P(O\mid\lambda)\), where \(A\) is the state transition probabilities, \(B\) is an observation probability matrix, and \(\pi\) is the initial state distribution. Next, we uncover the hidden part of the hidden Markov model by finding an optimal state sequence for  
Figure 1: An example of mobile services using Internet of Nanothings (IoNT) with and without the edge cloud layer. the underlying Markov process. Then, we determine a model of the form \(\lambda=(A,B,\pi)\) that maximizes the probability of \(O\). For the details of the hidden Markov model, refer to [14; 15]. Figure 2 depicts the hidden Markov model composed of hidden states and observed processes. We consider the observed process as monitoring information of the system and then calculate probabilities for the hidden states. Table 1 shows notations in the hidden Markov model. To calculate \(P(O|\lambda)\), we can determine the \(P(O|X,\lambda)\) by the definition of \(B\) as follows:  
\[P(O|X,\lambda)=b_{x0}(O_{0})b_{x1}(O_{1})\,\ldots\,\,b_{xT-1}(O_{T-1}), \tag{1}\]  
where \(X\) is state sequences, that is, \((x_{0},\,x_{1},\,\ldots\,,\,x_{T-1})\). Then, it calculates \(P(X|\lambda)\) by the definitions of \(\pi\) and \(A\) as follows:  
\[P(X|\lambda)=\pi_{x0}a_{x0,x1}a_{x1,x2}\,\ldots\,\,a_{xT-2,xT-1}. \tag{2}\]  
Since \(P(O,X|\lambda)=P(O|X,\lambda)P(X|\lambda)\), we can determine \(P(O|\lambda)\) with state sequences as follow:  
\[P(O|\lambda)=\sum\
olimits_{X}P(O,\,\,X|\lambda)=\sum\
olimits_{X}P(O|X,\,\, \lambda)P(X|\lambda). \tag{3}\]  
Next, to calculate the optimal state sequence, we define \(\beta_{t}(i)\) as follows:  
\[\beta_{t}(i)=P(O_{t+1},O_{t+2},\ldots\,\,O_{T-1}\mid x_{t}=q_{i},\,\lambda). \tag{4}\] \begin{table}
\begin{tabular}{c c} \hline
**Notation** & **Meaning** \\ \hline \(T\) & The length of the observation sequence. \\ \(N\) & The number of states in the model. \\ \(M\) & The number of observation symbols. \\ \(Q\) & The distinct states of the Markov process, that is, \(\{q_{0},\,q_{1},\,\ldots\,q_{N-1}\}\). \\ \(V\) & The set of possible observations, that is, \(\{0,\,1,\ldots,\,M\)\(-1\}\). \\ \(A\) & The state transition probabilities. \\ \(B\) & The observation probability matrix. \\ \(\pi\) & The initial state distribution. \\ \(O\) & The observation sequence, that is, \(\{0_{0},\,O_{1},\,\ldots,\,O_{T-1}\}\). \\ \(X\) & The hidden state sequence, that is, \\  & \(\{X_{0},\,X_{1},\,\ldots,\,X_{T-1}\}\). \\ \hline \end{tabular}
\end{table} 
Table 1: Notations in the hidden Markov model (HMM). Figure 2: The hidden Markov model. In addition, we define \(\gamma_{t}(i)\) for \(t=(0,\,1,\,\ldots,\,T\!-\!1)\) and \(i=(0,\,1,\,\ldots,\,N\!-\!1)\) as follows:  
\[\gamma_{t}(i)=P(x_{t}=q_{i}|O_{r}\lambda). \tag{5}\]  
Since \(\alpha_{t}(i)\) is for until \(t\) and \(\beta_{t}(i)\) is after \(t\), \(\gamma t(i)\) can be calculated as follows:  
\[\gamma_{t}(i)=\alpha_{t}(i)\beta_{t}(i)/P(O|\lambda). \tag{6}\]  
Thus, the optimal state at \(t\) is \(x_{t}=\max\,\gamma_{t}(i)\). To illustrate the hidden Markov model, we use the parameters in Table 2. The parameter \(A=\left[ \begin{array}{cc}0.6&0.4\\ 0.4&0.6\end{array} \right]\) means that when the current state is stable (\(S\)), the probabilities that the next states will be stable (\(U\)) are 60% and 40%, respectively, and when the current state is unstable (\(U\)), the probabilities that the next states will be stable (\(S\)) and unstable (\(U\)) are 40% and 60%, respectively. The parameter \(B=\left[ \begin{array}{ccc}0.1&0.3&0.6\\ 0.6&0.3&0.1\end{array}