# Bio-Inspired Sleep Control for Improving the Energy Efficiency of a MEC System
## 4 Bio-Inspired MECS Sleep Control Method  
### Sleep Decision by a MECS  
We use the lateral inhibition model to enable each MECS to autonomously determine its operational mode during a time slot. Lateral inhibition is a differentiation process among neighboring cells using Delta-Notch activation levels. We regard the sleep decision problem as a differentiation process because a MECS attempts to differentiate the operating mode (sleep or active) from the neighboring MECSs according to the utilization level. The Delta activation level of a cell represents the amount of inhibitory power exerted on neighboring cells. Therefore, we use the Delta activation level as the sleep probability of a MECS by ensuring that it is inversely proportional to the relative utilization to the local average utilization of the neighboring MECSs. We present the sleep decision algorithm of a MECS in Algorithm 1. The Notch activation level of a MECS \(i\) at the beginning of a time slot \(t\) is denoted as \(n_{i}(t)\). Additionally, we denote the Delta activation level of MECS \(i\) at the beginning of time slot \(t\) as \(d_{i}(t)\). At the beginning of each time slot, each MECS \(i\) calculates its utilization \(\mu_{i}(t)=\frac{\min\{Q_{i}(t)+\tau a_{i}(t),\tau b_{i}\}}{\overline{n_{i}}}\) and exchanges \(\mu_{i}(t)\) and \(d_{i}(t)\) with the neighboring MECSs \((\forall j\in N_{i})\) and calculates the average local utilization \((\bar{\mu}_{i}(t))\) and average local Delta level \((\bar{d}_{i}(t))\). \[\bar{\mu}_{i}(t)=\frac{1}{|N_{i}|}\sum_{j\in N_{i}}\mu_{j}(t). \tag{7}\]  
\[\bar{d}_{i}(t)=\frac{1}{|N_{i}|}\sum_{j\in N_{i}}d_{j}(t). \tag{8}\]  
Subsequently, a MECS \(i\) updates \(n_{i}(t)\) and \(d_{i}(t)\)\(K\) times or until convergence, whichever comes first (Lines 7-11). That is, for each iteration \(k\), the Delta and Notch activation levels (\(d^{\prime}_{i}(k)\) and \(n^{\prime}_{i}(k)\), respectively) are updated as follows:  
\[n^{\prime}_{i}(k+1)=(1-l_{n})n^{\prime}_{i}(k)+l_{n}f(\bar{d}_{i} (t)),\] \[d^{\prime}_{i}(k+1)=(1-l_{d})d^{\prime}_{i}(k)+l_{dS}\bigg{(}n^{ \prime}_{i}(k+1)\frac{\mu_{i}(t)}{\bar{\mu}_{i}(t)}\bigg{)}\]  
where \(l_{n}\) and \(l_{d}\) are the learning rates of the Notch and Delta activation levels, respectively. According to [30], the functions \(f(\cdot)\) and \(g(\cdot)\) are given by  
Figure 1: An overview of the sleep control mechanism. (**a**) Sleep example; (**b**) Wake-up example. \[f(x)=\frac{x^{k}}{a+x^{k}}\] \[g(x)=\frac{1}{1+bx^{k}},\]  
where \(a=0.01,b=100\), and \(k=h=2\). ```
1:At the beginning of time slot \(t\):
2: MECS \(i\) collects \(\mu_{j}(t)\)s and \(d_{j}(t)\)s from all \(j\in N_{i}\). 3:\(\bar{\mu}_{i}(t)=\frac{1}{|N_{i}|}\sum_{j\in N_{i}}\mu_{j}(t)\). 4:\(\bar{d}_{i}(t)=\frac{1}{|N_{i}|}\sum_{j\in N_{i}}d_{j}(t)\). 5:\(k=0\), \(\epsilon_{d}=10^{-4}\). 6:\(n^{\prime}_{i}(k)=n_{i}(t),d^{\prime}_{i}(k)=d_{i}(t)\), \(\delta_{d}=\epsilon_{d}+1\). 7:while\(k<K\mid\mid\delta_{d}>\epsilon_{d}\)do
8:\(n^{\prime}_{i}(k+1)=(1-l_{n})n^{\prime}_{i}(k)+l_{n}f(\bar{d}_{i}(t))\). 9:\(d^{\prime}_{i}(k+1)=(1-l_{d})d^{\prime}_{i}(k)+l_{d}g\Big{(}n^{\prime}_{i}(k+ 1)\frac{\mu_{i}(t)}{\bar{\mu}_{i}(t)}\Big{)}\). 10:\(\delta_{d}=d^{\prime}_{i}(k+1)-d^{\prime}_{i}(k)\)
11:\(k++\). 12:\(n_{i}(t)=n^{\prime}_{i}(k-1)\). 13:\(d_{i}(t)=d^{\prime}_{i}(k-1)\). 14:Draw a random number from a uniform distribution: \(p_{s}=U[0,1]\). 15:if\(p_{s}\leq d_{i}(t)\)then
16: Set \(\beta_{i}(t)=0\). 17: Transfer tasks in \(Q_{i}(t)\) to other MECSs by calling task_transfer() in Algorithm 2. 18:else
19: Set \(\beta_{i}(t)=1\). 20: Send \(\beta_{i}(t)\) to neighboring MECS \(j\), \(\forall j\in N_{i}\). ```  
**Algorithm 1** Bio-Inspired Sleep Decision Algorithm  
After acquiring an updated Delta activation level \(d_{i}(t)\) (line 13), a MECS \(i\) stochastically determines whether to sleep during time slot \(t\) (Lines 14-20). After making a sleep decision, MECS \(i\) sends \(\beta_{i}(t)\) to the neighboring MECSs. When MECS \(i\) decides to sleep, it transfers the tasks in \(Q_{i}(t)\) to the neighboring MECSs.