**3. System model**

An IIoT system with a remotely located CC and multiple distributed on-site ESs is considered, as shown in **Figure 1**. Each ES connects multiple IIoT sensors for a known purpose (e.g., mechanical bearings' vibration monitoring) and is used to control devices (e.g., management of its data sampling rates), preprocessing the gathered original data, and further analyzing by offloading them to CC. Denote the ESs's set as I ¼ f g 1, 2, … , *N* , where ∣I∣ ¼ *N*. Denote *Si* as the set of ES *i*'s associated devices. For example, we consider mechanical bearing vibration monitoring task [5], the vibration sensors sample the conditions of operation in the coverage area managed by ES *i* with specific sampling rate. After that, ES *i* collects vibration signals, then selects an appropriate mode1 to preprocessing it. Afterwards, to conduct the computation-intensive data analysis, preprocessed data will be offloaded by ES *i* to CC. Clearly, this collaboration between edge clouds needs to be sustained by a good closed-loop management with three task decisions: (*i*) sampling rate adaptation of sensors, (*ii*) pre-processing mode selection for ESs, and (*iii*) computational and communication resources' allocation.

<sup>1</sup> Here, the preprocessing modes potentially denote different data cleaning or denoising methods [9].

**Figure 1.**

*An example of edge preprocessing enabled IIoT.*

In addition, we investigate a time-slotted operation framework in order to portray the intrinsic IIoT systems' time-varying dynamics. Denote *τ* as time index, and *τ* ∈ T ¼ f g 1, 2, … , *T* . We show in **Table 1** all the important symbols appeared in this chapter for easy reference.

#### **3.1 Communication model**

IIoT devices'sampling rates can be adjusted according to the purpose of different applications. Define K ¼ *φ*1, *φ*<sup>2</sup> f g , … , *φ<sup>K</sup>* as the candidate sampling rate set, where *φ<sup>K</sup>* (measured by Hz) indicates original sampling rate, *K* as the maximum sampling rate level. Calculate any level *k*'s sampling rate as *φ<sup>k</sup>* ¼ *kφK=K*, where 1≤ *k*≤*K*. In addition, *vK* is defined as the original data size generated in each time slot with maximum sampling rate *φK*. *θ* indicates the time slot duration. We define *x<sup>τ</sup> <sup>i</sup>*,*<sup>k</sup>* ¼ 1, which denotes that in time slot *τ*, ES *i* chooses *k*-th sampling rate of all its affiliated devices. Else, *xτ <sup>i</sup>*,*<sup>k</sup>* <sup>¼</sup> 0. Denote *<sup>λ</sup><sup>τ</sup> <sup>i</sup>*,*<sup>n</sup>* (measured by every second's data number) as device *n*'s data arrival rate under ES *i*'s control. Knowing all devices'sampling rate, the task size generated in time slot *τ* ES *i* is formulated by combining collected data from every its affiliated devices in current time slot, which is expressed as

$$d\_i(\boldsymbol{\pi}) = \sum\_{n \in \mathcal{S}\_i} \sum\_{k=1}^K \boldsymbol{\pi}\_{i,k}^{\boldsymbol{\pi}} \boldsymbol{\lambda}\_{i,n}^{\boldsymbol{\pi}} \theta \boldsymbol{v}\_k k / K. \tag{1}$$

*Perspective Chapter: Edge-Cloud Collaboration for Industrial IoT – An Online Approach DOI: http://dx.doi.org/10.5772/intechopen.110475*


**Table 1.** *List of important notations.*

Then, ES *i* will preprocess this task. As data denoising application for preprocessing [10] usually reduces the computational task size, we particularly focus on it here. Assuming that *my* denotes maximum transforming rate in size of the computational task using the preprocessing mode *y*∈ Y, then after preprocessing, ES *i*'s task size in time slot *τ* is represented as

$$d\_i(\boldsymbol{\pi}) = d\_i(\boldsymbol{\pi}) \Big[ \sum\_{\mathcal{Y} \in \mathcal{Y}} I\_{i,\mathcal{Y}}^{\boldsymbol{\pi}} \mathcal{m}\_{\mathcal{Y}} \Big]. \tag{2}$$

All tasks' input bits should further transmit to CC for learning and analysis. The wireless channel between CC and ESs remains constant within each time slot and varies between time slots following independent identical distribution [11]. Based on the Shannon formula, CC and ES *i*'s transmission rate is

$$r\_i(\tau) = \begin{cases} a\_i(\tau)W \log\_2 \left( 1 + \frac{p\_i^{\mathrm{ES}} h\_{i,\epsilon}^{\tau}}{a\_i(\tau) \mathcal{W} \mathcal{N}\_0} \right), & a\_i(\tau) > 0 \\ 0, & a\_i(\tau) = 0 \end{cases} \tag{3}$$

where *W* and *N*<sup>0</sup> denote communication bandwidth and channel noise power spectral density, respectively. *pES <sup>i</sup>* is the predefined transmission power of ES *i*. From ES *i* to CC, channel gain is defined as *h<sup>τ</sup> <sup>i</sup>*,*<sup>c</sup>*. It includes the effects of small-scale fading, path loss, and shadowing [12]. Significantly, *h<sup>τ</sup> <sup>i</sup>*,*<sup>c</sup>* is an environmental state uncontrollably where positive constant *hmax* has an upper bound [13]. Denote *αi*ð Þ*τ* as ES *i*'s bandwidth allocation ratio over time slot *τ*. It should satisfy conditions listed below: <sup>0</sup>≤*αi*ð Þ*<sup>τ</sup>* <sup>≤</sup>1, and <sup>P</sup>*<sup>N</sup> <sup>i</sup>*¼<sup>1</sup>*αi*ð Þ*<sup>τ</sup>* <sup>≤</sup>1. The similar definitions appear in [2, 13].

Computational task's transmission delay after preprocessing from ES *i* to CC is calculated as

$$F\_i^{tra}(\tau) = b\_i(\tau) / r\_i(\tau),\tag{4}$$

and the corresponding transmission energy consumption is

$$e\_i^{\text{tra}}(\boldsymbol{\pi}) = p\_i^{\text{ES}} F\_i^{\text{tra}}(\boldsymbol{\pi}). \tag{5}$$

#### **3.2 Computation model**

#### *3.2.1 Edge preprocessing model*

ES can provide several optional modes of data preprocessing. Denote *y* as a feasible algorithm of data denoising in a complete set Y, and the corresponding CPU computation speed (cycles/s) for each data denoising algorithm is denoted by *f <sup>y</sup>*, ∀*y*∈Y.

Denote *I τ <sup>i</sup>*,*<sup>y</sup>* ∈f g 0, 1 as ES *i*'s selection index of preprocessing mode at time slot *τ*. *I τ <sup>i</sup>*,*<sup>y</sup>* ¼ 1 represents ES *i* has selected preprocessing algorithm *y*∈Y. Otherwise, *I τ <sup>i</sup>*,*<sup>y</sup>* ¼ 0. It is obvious that we have P *<sup>y</sup>* <sup>∈</sup>Y*I τ <sup>i</sup>*,*<sup>y</sup>* ¼ 1. It is important to note that the computational delay for selecting mode *y* for data preprocessing of ES *i* at time slot *τ* can be indicated as

$$T\_i^{\mathcal{Y}}(\mathfrak{r}) = d\_i(\mathfrak{r}) \beta\_i / f\_{\mathfrak{y}},\tag{6}$$

where *β<sup>i</sup>* denotes CPU cycles' number that are needed to compute one bit in ES *i*. Thus *di*ð Þ*τ β<sup>i</sup>* is computational resource which is required by preprocessing step. After that, ES *i*'s preprocessing computational delay in slot *τ* is indicated as

$$F\_i^{pre}(\tau) = \sum\_{\mathcal{Y} \in \mathcal{Y}} I\_{i,\mathcal{Y}}^{\tau} T\_i^{\mathcal{Y}}(\tau). \tag{7}$$

Therefore, ES *i*'s CPU computation speed (in cycles/s) is described as *fi* ð Þ¼ *<sup>τ</sup>* <sup>P</sup> *<sup>y</sup>*∈<sup>Y</sup>*I τ <sup>i</sup>*,*yf <sup>y</sup>:* Hence, ES *i*'s preprocessing energy consumption in time slot *τ* can be characterized as

$$
\sigma\_i^{pr\epsilon}(\mathfrak{r}) = \varpi\_i^{ES} f\_i^3(\mathfrak{r}) F\_i^{pr\epsilon}(\mathfrak{r}),\tag{8}
$$

where *zES <sup>i</sup>* is ES *i*'s effective switching capacitance, which is dependent on its chip architecture [14].

#### *3.2.2 Cloud computing model*

Tasks received by CC are collected from multiple ESs and each ES's allocated cloud resources. Let *ci*ð Þ*τ* be cloud resources' allocated proportion for ES *i*. The proportion should satisfy conditions list below:0 <sup>≤</sup>*ci*ð Þ*<sup>τ</sup>* <sup>≤</sup>1, and <sup>P</sup>*<sup>N</sup> <sup>i</sup>*¼<sup>1</sup>*ci*ð Þ*<sup>τ</sup>* <sup>≤</sup>1. After that, CC'<sup>s</sup> computation delay in processing ES i's computation tasks should be indicated as

$$F\_i^\varepsilon(\tau) = b\_i(\tau)\varepsilon\_\varepsilon / \left(c\_i(\tau)f\_{\cdot\varepsilon}\right),\tag{9}$$

where *f <sup>c</sup>* and *ε<sup>c</sup>* respectively denote CC's CPU computation speed and CPU cycles number required to compute one bit in CC. In addition, CC's energy consumption for processing ES *i*'s computational task is represented as

$$e\_i^\epsilon(\tau) = \mathbf{z}\_\mathbf{c} \left( c\_i(\tau) f\_\mathbf{c} \right)^3 F\_i^\epsilon(\tau),\tag{10}$$

where *zc* is effective switched capacitance of CC [14].

#### **3.3 Accuracy model for IIoT data analysis**

Tasks' processing accuracy relies on two factors, ESs' data preprocessing method and IIoT devices' data sampling rate. We hypothesize that *g φ<sup>k</sup>* ð Þ, ∀*φ<sup>k</sup>* ∈ K is the association between sampling rate and accuracy, and *gy*ð Þ*y* , ∀*y*∈ Y is the association between preprocessing mode and accuracy. Moreover, learning models deployed in cloud center may have computational errors, resulting in reduced processing accuracy, which is denoted by *hc* ≤1 [5].

Because of sampling rate control, cloud process and preprocessing method control are independent with each other [2]. Task processing's accuracy for ES *i* is

$$A\_i(\tau) = \mathbf{g}\left(\sum\_{k=1}^K \mathbf{x}\_{i,k}^\tau \boldsymbol{\rho}\_k\right) \cdot \left[\sum\_{\mathcal{Y}} I\_{i,\mathcal{Y}}^\tau \mathbf{g}\_{\mathcal{Y}}(\boldsymbol{y})\right] h\_c. \tag{11}$$

It is important that we can modify the model flexibly in practice to another form depending on various demands. The analysis framework remains valid. In addition, data-based experiments allow to obtain accuracy values regarding sampling rate and preprocessing mode [2].

#### **4. Problem formulation**

ESs' preprocessing mode and sensors'sampling rate can influence the computing accuracy, and the computing resources and bandwidth allocation of CC can influence the efficiency of computing and transmission. Significantly, these decisions are all closely associated. For example, if the wireless channel condition is poor or computation load of the system is large, ESs can select efficient preprocessing method and reduce the sampling rate. Hence, the CC may increase the computing and communication resources allocation ratios correspondingly. The advantage of the operations is to decrease the execution delay, transmission delay, and energy consumption. The disadvantage is that it will lose some processing accuracy. It shows that a trade-off exists in service delay, processing accuracy, and system energy consumption. For improving IIoT system's energy efficiency, we intend to minimize system energy consumption, which includes ESs' computing energy consumptions, ECs' offloading transmission energy consumption, and CC's energy consumption, with guaranteed processing accuracy and service delay. Every ES's computation task represents an application. We calculate time slot *τ*'s energy consumption as

$$E\_i(\boldsymbol{\pi}) = e\_i^{\rm ES}(\boldsymbol{\pi}) + e\_i^{\rm trt}(\boldsymbol{\pi}) + e\_i^{\boldsymbol{\varepsilon}}(\boldsymbol{\pi}). \tag{12}$$

Because of the industrial environment's time-varying features, for minimizing long-term dynamic energy consumption, we need to manage the IIoT edge cloud

collaboration system. Therefore, the EC computing system's average energy consumption is selected as performance measurement, i.e., <sup>1</sup> *T* P*<sup>T</sup> τ*¼1 P*<sup>N</sup> <sup>i</sup>*¼<sup>1</sup>*Ei*ð Þ*<sup>τ</sup>* . Then we jointly optimize sampling rates of sensors, preprocessing method of ESs, and computing and communication resources of edge cloud, which denotes as

*Ji*ð Þ*<sup>τ</sup>* <sup>≜</sup> *<sup>x</sup><sup>τ</sup> <sup>i</sup>*,*k*,*I τ <sup>i</sup>*,*y*, *αi*ð Þ*τ* ,*ci*ð Þ*τ* h i, <sup>∀</sup>*<sup>i</sup>* <sup>∈</sup> <sup>I</sup>, can be represented as

$$\mathcal{D}\mathcal{P}\_1: \min\_{\{l\_i(\mathbf{r}), \forall i \in \mathcal{I}\}} \quad \frac{1}{T} \sum\_{\tau=1}^T \sum\_{i=1}^N E\_i(\tau) \tag{13}$$

$$\text{s.t.} \mathbf{0} \le a\_i(\boldsymbol{\tau}) \le \mathbf{1}, \sum\_{i=1}^{N} a\_i(\boldsymbol{\tau}) \le \mathbf{1}, \forall i \in \mathcal{I}, \tag{14}$$

$$0 \le c\_i(\tau) \le 1, \sum\_{i=1}^N c\_i(\tau) \le 1, \forall i \in \mathcal{I},\tag{15}$$

$$I\_{i,y}^{\mathbf{r}} \in \{\mathbf{0}, \mathbf{1}\}, \sum\_{\mathbf{y} \in \mathcal{Y}} I\_{i,y}^{\mathbf{r}} = \mathbf{1}, \forall i \in \mathcal{I}, \tag{16}$$

$$\mathfrak{x}\_{i,k}^{\mathfrak{r}} \in \{0, 1\}, \sum\_{k=1}^{K} \mathfrak{x}\_{i,k}^{\mathfrak{r}} = \mathfrak{1}, \forall i \in \mathcal{I}, \tag{17}$$

$$\lim\_{T \to +\infty} \frac{1}{T} \sum\_{\tau=1}^{T} H\_i(\tau) \le H\_i^{th}, \forall i \in \mathcal{I}, \tag{18}$$

$$\lim\_{T \to +\infty} \frac{1}{T} \sum\_{\tau=1}^{T} A\_i(\tau) \ge A\_i^{th}, \forall i \in \mathcal{T}, \tag{19}$$

where (14)-(17) respectively represent the constraints of bandwidth allocation, cloud computing resource allocation, preprocessing method selection, and sampling rate.

Constraint (18) is average service delay in the long term. Constraint (19) is processing accuracy. They are the constraints of ES *i*∈ I which have unique purposes, where *Hth <sup>i</sup>* and *Ath <sup>i</sup>* are requirements of application related threshold. *Hi*ð Þ*τ* denotes the ES *<sup>i</sup>*'s delay performance, so that *Hi*ð Þ¼ *<sup>τ</sup> <sup>F</sup>ES <sup>i</sup>* ð Þþ *<sup>τ</sup> <sup>F</sup>tra <sup>i</sup>* ð Þþ *<sup>τ</sup> <sup>F</sup><sup>c</sup> <sup>i</sup>*ð Þ*τ* , ∀*i*∈ I.

**Remark** *P*1 is a dynamic stochastic optimization problem and we must decide all these decisions in the time slot. The problem's objective is minimizing system energy consumption in a long-term way in dynamic network. Due to two reasons, solving the problem is challenging: (*i*) due to the number of previous information is extremely large, the statistics of data arrival rates and time-varying channel conditions may be hard to obtain in IIoT systems; and (*ii*) because of the quick growth of the ES and IIoT devices's number, traditional dynamic programming is difficult to handle its large state space and action space, which will result in high computational complexity [11]. Lyapunov optimization [15] is used to solve long-term stochastic optimization problem, but preprocessing mode selection *I τ <sup>i</sup>*,*<sup>y</sup>* and sampling rate adaption *x<sup>τ</sup> <sup>i</sup>*,*<sup>k</sup>* are discrete binary decision variable. Further, constraints (18) and (19) are nonlinear, making *P*1 be a mixed integer nonlinear programming problems. To handle the problem, heuristic algorithms are a low-complexity solution. However, the solution cannot guarantee algorithm performance, so in IIoT applications, it is not recommended. To address this issue, an online algorithm is designed to solve this question in the next section. In the

*Perspective Chapter: Edge-Cloud Collaboration for Industrial IoT – An Online Approach DOI: http://dx.doi.org/10.5772/intechopen.110475*

first step, according to current network states, we use Lyapunov optimization method to decompose the long-term optimization problem into real-time optimization subproblems. In the second step, based on Markov approximation technology, we developed an approximation algorithm. We consider the future impact and introduce the continuous probability model, and obtain the asymptotic optimal solution of the subproblem within the verified analysis range.

#### **5. Online resource management algorithm**

#### **5.1 Lyapunov-based online method**

Dealing with the long-term accuracy and delay constraints are main challenges to solve problem *P*1. Therefore, we use the Lyapunov optimization method. For IIoT applications, Lyapunov optimization method constructs overdue delay queues and accuracy deficit queues. The problem decomposition's detailed procedure is shown as follows.

First, we define the delay overflow queues and accuracy deficit queues of IIoT applications. For each ES *i*, the dynamic changes of the accuracy deficit queue are represented below:

$$Q\_i(\boldsymbol{\tau} + \mathbf{1}) = \left[A\_i^{\text{th}} - A\_i(\boldsymbol{\tau})\right]^+ + Q\_i(\boldsymbol{\tau}).\tag{20}$$

Here, if Z is a non-negative value, ½ � Z <sup>þ</sup> ¼ Z. Otherwise, it is 0. *Qi*ð Þ*τ* indicates that there exists a deviation between the instantaneous accuracy and ES*i*'s required longterm accuracy at time slot *τ*.

We represent overdue delay queue's dynamic change of ES *i* below:

$$\mathbf{M}\_{i}(\boldsymbol{\tau} + \mathbf{1}) = \left[H\_{i}(\boldsymbol{\tau}) - H\_{i}^{th}\right]^{+} + \mathbf{M}\_{i}(\boldsymbol{\tau}),\tag{21}$$

where *Mi*ð Þ*τ* represents the *i*-th ES's deviation between computation task's service delay and long-term required delay in time slot *τ*.

Then, Lyapunov function is defined according to [15] as

$$L(\Theta(\tau)) \triangleq \frac{1}{2} \sum\_{i \in I} \left[ Q\_i(\tau)^2 + M\_i(\tau)^2 \right],\tag{22}$$

where Θð Þ*τ* ≜ *Qi* ½ � ð Þ*τ* , *Mi*ð Þ*τ* .

Thus, the Lyapunov drift can be represented as

$$\Delta(\Theta(\tau)) = \mathbb{E}[L(\Theta(\tau+1)) - L(\Theta(\tau)) | \Theta(\tau)].\tag{23}$$

Accordingly, we represent the Lyapunov drift-penalty function as

$$
\Delta\_V(\Theta(\tau)) = \Delta(\Theta(\tau)) + V \cdot \mathbb{E}[E\_i(\tau)|\Theta(\tau)],\tag{24}
$$

where *V* ∈ð Þ 0, þ∞ is a control parameter. Next, the upper bound of Δ*V*ð Þ Θð Þ*τ* is derived for any feasible solution *Ji*ð Þ*τ* , ∀*i*∈ I, which is written in Theorem 1.1.

Theorem 1.1 Δ*V*ð Þ Qð Þ*τ* has an upper bounded for any *Ji*ð Þ*τ* , ∀*i* ∈I, which can be written as

$$\begin{split} \Delta\_{V}(\Theta(\tau)) \leq & B + \mathbb{E} \sum\_{i=1}^{N} \left\{ Q\_{i}(\tau) \left[ A\_{i}^{th} - A\_{i}(\tau) \right] + \mathcal{M}\_{i}(\tau) \left[ H\_{i}(\tau) - H\_{i}^{th} \right] | \Theta(\tau) \right\} \\ \quad + & \mathsf{V} \cdot \mathbb{E} [E\_{i}(\tau) | \Theta(\tau)], \end{split} \tag{25}$$

where *B* is a positive constant which can adjust the tradeoff between the satisfaction degree of the long-term accuracy and service delay constraints and the energy consumption cost.

**Proof:** We square two sides of accuracy deficit dynamics and we have

$$\begin{split} \left[Q\_{i}^{2}(\tau+\mathsf{1}) = \left[\left[A\_{i}^{\mathrm{th}} - A\_{i}(\tau)\right]^{+}\right]^{2} + Q\_{i}^{2}(\tau) + 2Q\_{i}(\tau)\left[A\_{i}^{\mathrm{th}} - A\_{i}(\tau)\right]^{+} \\ \leq & \left[A\_{i}^{\mathrm{th}} - A\_{i}(\tau)\right]^{2} + Q\_{i}^{2}(\tau) + 2Q\_{i}(\tau)\left[A\_{i}^{\mathrm{th}} - A\_{i}(\tau)\right]. \end{split} \tag{26}$$

We subtract *Q*<sup>2</sup> *<sup>i</sup>*ð Þ*τ* from two sides and then multiply by 0.5. Then, for *i* ∈ I ¼ f g 1,2,3, … , *N* , we sum up these inequalities. So, we have

$$\frac{1}{2} \sum\_{i=1}^{N} \left[ Q\_i^2(\tau + 1) - Q\_i^2(\tau) \right] \le \frac{1}{2} \sum\_{i=1}^{N} \left[ A\_i^{th} - A\_i(\tau) \right]^2 + \sum\_{i=1}^{N} Q\_i(\tau) \left[ A\_i^{th} - A\_i(\tau) \right]. \tag{27}$$

Similarly, for delay overflow dynamics in (15), we can make such operations

$$\begin{split} M\_i^2(\tau + \mathbf{1}) &= \left[ \left[ H\_i(\tau) - H\_i^{th} \right]^+ \right]^2 + \mathcal{M}\_i^2(\tau) + 2\mathcal{M}\_i(\tau) \left[ H\_i(\tau) - H\_i^{th} \right]^+ \\ &\le \left[ H\_i(\tau) - H\_i^{th} \right]^2 + \mathcal{M}\_i^2(\tau) + 2\mathcal{M}\_i(\tau) \left[ H\_i(\tau) - H\_i^{th} \right]. \end{split} \tag{28}$$

We subtract *M*<sup>2</sup> *<sup>i</sup>*ð Þ*τ* from two sides and multiply by 0.5. Then, for *i* ∈ I, we sum up these inequalities:

$$\frac{1}{2} \sum\_{i=1}^{N} \left[ M\_i^2(\tau + 1) - M\_i^2(\tau) \right] \le \frac{1}{2} \sum\_{i=1}^{N} \left[ H\_i(\tau) - H\_i^{th} \right]^2 + \sum\_{i=1}^{N} M\_i(\tau) \left[ H\_i(\tau) - H\_i^{th} \right]. \tag{29}$$

Combine (22) and (23), we can get

$$\begin{split} L(\boldsymbol{\Theta}(\boldsymbol{\tau}+\mathbf{1})) - L(\boldsymbol{\Theta}(\boldsymbol{\tau})) &\leq \frac{1}{2} \sum\_{i=1}^{N} \left[ A\_{i}^{th} - A\_{i}(\boldsymbol{\tau}) \right]^{2} + \frac{1}{2} \sum\_{i=1}^{N} \left[ H\_{i}(\boldsymbol{\tau}) - H\_{i}^{th} \right]^{2} \\ &+ Q\_{i}(\boldsymbol{\tau}) \left[ A\_{i}^{th} - A\_{i}(\boldsymbol{\tau}) \right] + \mathcal{M}\_{i}(\boldsymbol{\tau}) \left[ H\_{i}(\boldsymbol{\tau}) - H\_{i}^{th} \right]. \end{split} \tag{30}$$

Finally, *V* � *Ei*ð Þ*τ* is added to two sides of (30) and take expectation of two sides of Θð Þ*τ* as the condition. Then, desired result can be obtained in (25), where B ¼ 1 2 P*<sup>N</sup> <sup>i</sup>*¼<sup>1</sup> *<sup>A</sup>th <sup>i</sup>* � *Ai*ð Þ*<sup>τ</sup>* � �<sup>2</sup> þ 1 2 P*<sup>N</sup> <sup>i</sup>*¼<sup>1</sup> *Hi*ð Þ� *<sup>τ</sup> <sup>H</sup>th i* � �<sup>2</sup> *:*

The online joint preprocessing method selection, sampling rate adaption. and resource management algorithm aims to minimize Δ*V*ð Þ Θð Þ*τ* 's upper bound in Theoerm 1.1. The service delay and processing accuracy should be maintained at an expected level. At the same time, we can minimize the CC and ESs'system energy consumption. Algorithm 1 shows the details. Note that *P*2's constraints and *P*1's constraints are the same. The *P*2's objective function corresponds to the right side of (25). In every time slot *τ*, we solve *P*2 to obtain the optimal preprocessing method selection, sampling rate adaption, and resource management. Then, we update overdue delay queues and accuracy deficit queues.

**Algorithm 1:** Online Joint Sampling Rate Adaption, Preprocessing Mode and Resource Management Algorithm (OSPRA).


$$\begin{split} \mathbf{P}\_{2} : \min\_{\{l\_{i}(\tau)\}} U\_{i}(\tau) &= \mathbf{B} + \mathbb{E} \sum\_{i=1}^{N} \left\{ \mathbf{Q}\_{i}(\tau) \left[ A\_{i}^{th} - A\_{i}(\tau) \right] + \mathbf{M}\_{i}(\tau) \cdot \left[ H\_{i}(\tau) - H\_{i}^{th} \right] | \Theta(\tau) \right\} \\ &+ V \mathbb{E} [E\_{i}(\tau) | \Theta(\tau)] \\ \text{s.t.} & \quad (\mathbf{14}) - (\mathbf{19}). \end{split}$$

4.Update queue *Qi*ð Þ*τ* and *Mi*ð Þ*τ* depending on (20) and (21).

5.Return the best value of *Ji*ð Þ*τ* .

6. *τ* ¼ *τ* þ 1.

Sampling rate adaption *x<sup>τ</sup> <sup>i</sup>*,*<sup>k</sup>* and preprocessing method selection *I τ <sup>i</sup>*,*<sup>y</sup>* are discrete binary decision variable. Meanwhile, the CC's bandwidth and computation resource allocation is nonlinear. Therefore, problem *P*2 is mixed integer nonlinear programming (MINLP) problem.

Theorem 1.2 Problem *P*2 is NP-hard.

**Proof:** Firstly, we discuss a specific problem case. In this case, we fix the CC's bandwidth and computation resource allocation. Therefore, sampling rate and preprocessing method are selected discretely in problem *P*2. We can easily reduce the case to a multiple knapsack problem and the problem is known as NP-hard [16].

To address this issue, network configurations are set up as a time-reversible continuous-time Markov chain's states. We can prove that after a finite number of iterations, the CC's preprocessing method selection, sampling rate adaption, and the bandwidth and computation resource allocation can achieve stable states.

#### **5.2 Approximately optimal solution for** *P***2**

Denote feasible solutions's set as *J*, and the feasible solution of problem *P*2 satisfy *j*∈*J*. Denote the probability of adopting solution *j* at time slot *τ* as *qj* . Then, problem *P*2 can be converted into the equivalent form:

$$\begin{aligned} \min\_{q \ge 0} \qquad & \sum\_{j \in I} q\_j \sum\_{i \in \mathcal{I}} U\_i(j, \tau) \\ \text{s.t.} \qquad & \sum\_{j \in I} q\_j = 1, \end{aligned} \tag{31}$$

where P *<sup>i</sup>*<sup>∈</sup> <sup>I</sup>*Ui*ð Þ *j*, *τ* is *qj* 's weight. The optimal solution of problem (31) results in minimum weight. We may transform the problem continuously by using log-sum-exp approximation [17].

First, convex log-sum-exp function *Gδ*ð Þ *j*, *τ* is used to approximate the optimization objective *Ui*ð Þ *j*, *τ* , which is represented below:

$$G\_{\delta}(j,\tau) = \frac{1}{\delta} \log \left[ \sum\_{j \in J} \exp \left( \delta \sum\_{i \in \mathcal{I}} U\_i(j,\tau) \right) \right],\tag{32}$$

and we analytically show its approximation gap in Theorem 1.3.

Theorem 1.3 The convex log-sum-exp function *Gδ*ð Þ *j*, *t* in (32) can approximate the optimization objective in (31) by

$$\min\_{j \in J} \sum\_{i \in \mathcal{I}} U\_i(j, \tau) - \frac{1}{\delta} \log |j| \le \mathcal{G}\_\delta(j, \tau) \le \min\_{j \in J} \sum\_{i \in \mathcal{I}} U\_i(j, \tau),$$

where *δ* is a positive constant and the approximation gap is upper-bounded by <sup>1</sup> *<sup>δ</sup>* log∣*J*∣.

**Proof:** Given the constant *δ*, inequality holds:

$$\begin{split} \min\_{j \in \mathcal{J}} \sum\_{i \in \mathcal{I}} U\_i(j, \boldsymbol{\tau}) &\geq \frac{1}{\delta} \log \left[ \exp \left( \delta \min\_{j \in \mathcal{J}} \sum\_{i \in \mathcal{I}} U\_i(j, \boldsymbol{\tau}) \right) \right] \\ &\geq \min\_{j \in \mathcal{J}} \sum\_{i \in \mathcal{I}} U\_i(j, \boldsymbol{\tau}) - \frac{1}{\delta} \log |\boldsymbol{J}|. \end{split} \tag{33}$$

Convex log-sum-exp function's value precisely approximates min function's result, when *δ* approaches infinity, i.e.,

$$\min\_{j \in \mathcal{J}} \sum\_{i \in \mathcal{I}} U\_i(j, \boldsymbol{\tau}) = \min\_{\delta \to \infty} \frac{1}{\delta} \log \left[ \sum\_{j \in \mathcal{J}} \exp \left( \delta \sum\_{i \in \mathcal{I}} U\_i(j, \boldsymbol{\tau}) \right) \right]. \tag{34}$$

What's more, the value of the problem's optimal solution and log-sum-exp function *Gδ*ð Þ *j*, *τ* are equal according to Theorem 1.3, which is represented as follows:

$$\begin{aligned} \min\_{q \ge 0} \quad & \sum\_{j \in J} q\_j \sum\_{i \in \mathcal{I}} U\_i(j, \boldsymbol{\tau}) + \frac{1}{\delta} \sum\_{j \in J} q\_j \log q\_j, \\ \text{s.t.} \quad & \sum\_{j \in J} q\_j = \mathbf{1}. \end{aligned} \tag{35}$$

Namely, we can convert problem (31) to problem (35).

By solving the KKT condition [17] of problem (35) can be represented as follows:

*Perspective Chapter: Edge-Cloud Collaboration for Industrial IoT – An Online Approach DOI: http://dx.doi.org/10.5772/intechopen.110475*

$$\begin{cases} \sum\_{i \in \mathcal{I}} U\_i(j, \tau) - \frac{1}{\delta} \log q\_j^\* + \frac{1}{\delta} + \eta = 0 \\ \sum\_{j \in \mathcal{J}} q\_j^\* = \mathbf{1}, \\ \eta \ge \mathbf{0}, \end{cases} \tag{36}$$

We can obtain the probability distribution *q* <sup>∗</sup> *<sup>j</sup>* of optimal solution as follows:

$$q\_j^\* = \frac{\exp\left(-\sum\_{i \in \mathcal{I}} \delta U\_i(j, \mathfrak{r})\right)}{\sum\_{j' \in \mathcal{I}} \exp\left(-\sum\_{i \in \mathcal{I}} \delta U\_i(j', \mathfrak{r})\right)}, \forall j \in \mathcal{I}. \tag{37}$$

We can see that the different solutions's probabilities have direct ratio with corresponding weights *Ui*ð Þ *j*, *τ* . Every solution *j*∈ *J* is paired with a specific state, we construct a time-reversible Markov sequential chain [18] which has a stationary distribution *q* <sup>∗</sup> *<sup>j</sup>* . Switching one solution to another and transitioning between two states are equal. ES selecting new preprocessing mode and sampling rate and CC adopting new computation and communication resource allocation decision trigger it.

**Algorithm 2:** Markov Approximation-Based Algorithm for *P*2.

1.**Initialization:** Initialize *Ui*ð Þ *<sup>j</sup>*, *<sup>τ</sup>* by initializing sampling rate *<sup>x</sup><sup>τ</sup> <sup>i</sup>*,*<sup>k</sup>*, preprocessing mode *I τ <sup>i</sup>*,*<sup>y</sup>*, and resource allocation in ESs and cloud center.

#### 2.**End initialization**

#### 3.**Loop:**


#### 9.**End Loop**

We must guarantee that random two states can convert if we want to build a timereversible Markov sequential chain. Therefore, we limit one preprocessing method selection and sampling rate in ES and CC's one communication and computation resource allocation in time slot. If we make a decision of preprocessing mode *I y <sup>i</sup>*ð Þ*τ* , sampling rate *xki* , computation and communication resource allocation *αi*ð Þ*τ* , *ci*ð Þ*τ* , previous solution *j* converts to new solution *j* <sup>0</sup> of transition rate *qj*,*<sup>j</sup>* <sup>0</sup> non-negatively. To satisfy the time-reversibility feature, we have designed a transition rate which can satisfy the equation which is written as follows:

$$q\_j^\* \cdot q\_{j,j'} = q\_{j'}^\* \cdot q\_{j',j}, \forall j, j' \in J,\tag{38}$$

The feasible solution's transition rate is represented as

$$q\_{j,j'} = \vartheta \exp\left[-\frac{1}{2}\delta(U(j',\tau) - U(j,\tau))\right], \forall j, j' \in J \tag{39}$$

where *ϑ* is a positive constant. Transition rate *qj*,*<sup>j</sup>* <sup>0</sup> increases if weight gap *j* <sup>0</sup> � *j* increases. It means that adopting a lower-weight solution has higher probability.

Algorithm 2 shows the algorithm based on Markov approximation which intends to solve problem *P*2. It can be executed on network platform. It can collect large amount of network state information to make real-time decisions. The algorithm combines in feasible solutions randomly to update time-reversible Markov sequential chain's state in update iterations. If *Ui j* <sup>∗</sup> ð Þ , *<sup>τ</sup>* is minimized by a feasible solution *<sup>j</sup>* <sup>∗</sup> , it will be recorded and the algorithm explores the following combination in solutions until all combinations have been attempted.

#### **6. Performance analysis**

The algorithm combines Markov approximation and Lyapunov optimization and the performance of algorithm is analyzed theoretically.

#### **6.1 Time complexity analysis**

The introduced algorithm includes two algorithms (algorithms 1 and 2) mainly. In algorithm 1, Lyapunov optimization is used to resolve resource management, preprocessing method selection, and sampling rate adaption in dynamic environment. Therefore, algorithm 1 generates many feasible solutions. In solution update iteration, algorithm 2 records the optimal solution found up to now until it explores all feasible solutions. The Markov approximation algorithm converges with linear rate quickly, through adjusting appropriate parameters. Therefore, we can get the asymptotic optimal solution quickly. In the process of iteration, a solution is chosen by the system randomly for updating control information. Because long-term problem is decomposed into some instant subquestions by using Lyapunov optimization, we focus on solving approximate solutions' complexity. As we defined in Section III, Sampling rate adaptation has *K* feasible solutions at most, and preprocessing method has *y* feasible solutions at most. There are *yK* feasible solutions at most in set *U j*ð Þ , *τ* , because both are discrete. Each ES traverses all the solutions. Denote *ρ* as the ESs' average iteration number which aims to get the stationary Markov chain. Moreover, OSPRA algorithm's complexity of time can be represented as *O Ky* ð Þ*ρ* .

#### **6.2 Optimality analysis**

Theorem 1.4 We set up coefficients *δ* and *V*, the optimality gap of initial problem's optimal solution and introduced algorithm's approximate solution theoretically is written as follows:

$$\sum\_{\tau=0}^{T-1} \mathbb{E}[E\_i(\tau)|\Theta(\tau)] \le p^\* + B/V + \log|I|/(\delta V),\tag{40}$$

*Perspective Chapter: Edge-Cloud Collaboration for Industrial IoT – An Online Approach DOI: http://dx.doi.org/10.5772/intechopen.110475*

where *p*<sup>∗</sup> means the optimal solution theoretically.

**Proof:** Since executing drift-penalty algorithm can get accuracy strategies *Hi*ð Þ*τ* and time delay *Ai*ð Þ*<sup>τ</sup>* in time slot *<sup>τ</sup>*, we presume that accuracy actions *<sup>H</sup>*<sup>∗</sup> *<sup>i</sup>* ð Þ*τ* and time delay *A*<sup>∗</sup> *<sup>i</sup>* ð Þ*τ* are in the best decision.

Based on Theorem 1.1, the both sides' expectations can be represented as

$$\begin{split} \Delta\_{\mathsf{V}}(\Theta(\tau)) &= \Delta(\Theta(\tau)) + \mathsf{V} \cdot \mathbb{E}[E\_i(\tau)|\Theta(\tau)] \\ \leq &\mathcal{B} + \mathbb{E} \sum\_{i=1}^{N} \left\{ Q\_i(\tau) \left[ A\_i^{th} - A\_i^\* \left( \tau \right) \right] + M\_i(\tau) \left[ H\_i^\* \left( \tau \right) - H\_i^{th} \right] \Theta(\tau) \right\} + \mathsf{V} \cdot \mathbb{E} \left[ E\_i^\* \left( \tau \right) | \Theta(\tau) \right] \\ \leq &\mathcal{B} + \mathsf{V} \cdot p^\* \,. \end{split} \tag{41}$$

Then, by getting the summation of above derivation (41), we get

$$\begin{split} (\mathcal{B} + V \cdot p^\*) \cdot T &\geq \sum\_{\tau=0}^{T-1} \mathbb{E}[\Delta\_V(\Theta(\tau)) | \Theta(\tau)] \\ &= \mathbb{E}[L(\Theta(\tau))] + V \cdot \sum\_{\tau=0}^{T-1} \mathbb{E}[E\_i(\tau) | \Theta(\tau)] - \mathbb{E}[L(\Theta(\mathcal{O}))]. \end{split} \tag{42}$$

Finally, we move ½*L*ð Þ Θð Þ 0 to the inequality's left side, and divide two sides by *V*. Since ½*L*ð Þ Θð Þ 0 ≥0, we can find Theorem 1.4's conclusion.

From Theorem 1.4, if *V*(the control parameter) is sufficiently large, the algorithm can obtain the approximate solution which reaches the optimal solution *p*<sup>∗</sup> infinitely.

### **7. Simulation results**

We carry on simulations to evaluate the proposed online algorithm's performance on joint preprocessing method selection, sampling rate adaption, and resource management in IIoT systems with the support of edge-cloud collaboration. Particularly, we show the performance of energy consumption, service delay, and processing accuracy, respectively.

#### **7.1 Simulation setup**

We setup an IIoT system with edge-cloud collaboration which has a remote CC and multiple distributed ESs on site. For example, in bearing vibration fault monitoring applications, each ES connects to 10 IIoT devices and is used to collect mechanical equipments's data of bearing vibration. Then, by one of the three preprocessing methods, the raw data can be preprocessed (which are WT [19], BiNOSP [20], CLPM [10]) and are offloaded to CC for further data analysis. We define that there are three candidate sampling rates for IIoT devices, which are initial sampling rates 33, 66, and 100%, and set the initial sampling rate *φK*=18 kHz [5]. Referring to [5], 0.59, 0.73, and 0.884 are respectively the three sampling rates' corresponding processing accuracies (**Table 2**).

Besides, we simulate the following benchmarks for comparison, aiming to show the advantage of the OSPRA algorithm.


**Table 2.**

*Simulation parameters.*


**Figure 2.** *Introduced algorithm's accuracy performance.*

management problem and optimal offloading decision for an edge-cloud collaboration framework. However, it ignores the network uncertainties [21].

#### **7.2 Performance evaluation**

Here, we consider the computation tasks' average processing accuracy in ESs over a long run, and illustrate the algorithm's convergence performance in **Figure 2**. This figure shows that the initial average accuracy maintains in a high level, as the initial accuracy value is initially defined as zero. Furthermore, since the obtainable communication and computation resources are sufficient at the beginning, this algorithm tends to increase the average accuracy to the target value very rapidly. Moreover, despite the fluctuations, the computation tasks' average accuracy converges to the target value quickly after some time slots. Therefore, it can be concluded that the algorithm's stability is verified by the simulation.

Considering that the arrival rate of the end terminal's data traffic is an uncontrolled environmental variable while it directly affects each computation task's size, the impact of various data arrival rate on the final data processing accuracy can significantly affect the adaptability of OSPRA in such complicated and noisy environments. **Figure 3** demonstrates the box-plot distribution of the data processing accuracy under different rates of data arrivals. By increasing this rate, the distribution range of the accuracy only fluctuates very slightly. In particular, it shows that the maximum probability of error is smaller than 0.7. Moreover, the average value of the processing

**Figure 3.** *Introduced algorithm's accuracy performance in terms of data arrival rates.*

accuracy can be well controlled within a restricted range between 0.8 and 0.802, which indicates a good robustness of the proposed OSPRA to the instantaneous variations of the task size.

The average energy consumption of the proposed algorithm with various accuracy requirements is shown in **Figure 4**. It can be observed that if the accuracy requirement improves, the system has to in turn increase the sampling rate or choose a superior denoising performance in edge preprocessing method. As a result, the average energy consumption increases. LOSPA algorithm overlooks network uncertainties, so that the average energy consumption reduces smoothly. Changing processing accuracy does not have decisive performance impact. Oppositely, the average energy consumption increases for both OSPRA and AGRMA algorithms. However, in terms of minimizing the energy consumption, the proposed OSPRA obviously performs better. The reason is that AGRMA does not choose to preprocess at ESs, so that the sampling rate must increase when accuracy requirements increase. Oppositely, OSPRA can reach a trade-off between the preprocessing method selection and sampling rate, and therefore it can decrease the energy consumption and satisfy the accuracy requirements concurrently.

**Figure 5** evaluates the energy consumption of the overall system with the increase of the Lyapunov control parameter *V* for different algorithms. When *V* ≤50, the average energy consumption rapidly reduces as *V* increases. When *V* ≥ 100, the average energy consumption prefers to be stable, because computing resources and channel capacity have an upper limit. The asymptotic optimality of the proposed algorithm can be seen as there exists a bounded deviation between the proposed algorithm's

*Perspective Chapter: Edge-Cloud Collaboration for Industrial IoT – An Online Approach DOI: http://dx.doi.org/10.5772/intechopen.110475*

**Figure 5.** *Average energy with different parameter V.*

average energy consumption and the optimal one, which numerically verifies Theorems 1.1 and 1.3. Besides, in this figure, we can find that the proposed OSPRA can control parameter *V* for adjusting the energy consumption weights of different users. That is to say, it guides us to select the parameter *V* according to various application requirements. It is worth noting that although we also draw the other two benchmark schemes' performances for comparison, both of them are independent of the control parameter *V*.

#### **8. Conclusion**

In this chapter, we have investigated a joint optimization problem of preprocessing method selection, sampling rate adaptation, and computing and communication resource allocation for IIoT systems with edge-cloud collaboration. With the objective of minimizing the energy consumption of the whole system while guaranteeing all applications' long-term service delay and data processing accuracy, a novel algorithm, called OSPRA, has been proposed. It has been proved that this proposed algorithm can solve the formulated problem in a dynamic way under network uncertainties. In addition, the feasibility and superiority of OSPRA have also been verified by extensive theoretical analysis and simulations.
