{'fraction_non_alphanumeric': 0.04073118932038835, 'fraction_numerical': 0.010138551779935275, 'mean_word_length': 4.273733333333333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
When to Preprocess? Keeping Information Fresh for Computing Enable Internet of Things

Age of information (AoI), a notion that measures the information freshness, is an essential performance measure for time-critical applications in Internet of Things (IoT). With the surge of computing resources at the IoT devices, it is possible to preprocess the information packets that contain the status update before sending them to the destination so as to alleviate the transmission burden. However, the additional time and energy expenditure induced by computing also make the optimal updating a non-trivial problem. In this paper, we consider a time-critical IoT system, where the IoT device is capable of preprocessing the status update before the transmission. Particularly, we aim to jointly design the preprocessing and transmission so that the weighted sum of the average AoI of the destination and the energy consumption of the IoT device is minimized. Due to the heterogeneity in transmission and computation capacities, the durations of distinct actions of the IoT device are non-uniform. Therefore, we formulate the status updating problem as an infinite horizon average cost semi-Markov decision process (SMDP) and then transform it into a discrete-time Markov decision process. We demonstrate that the optimal policy is of threshold type with respect to the AoI. Equipped with this, a structure-aware relative policy iteration algorithm is proposed to obtain the optimal policy of the SMDP. Our analysis shows that preprocessing is more beneficial in regimes of high AoIs, given it can reduce the time required for updates. We further prove the switching structure of the optimal policy in a special scenario, where the status updates are transmitted over a reliable channel, and derive the optimal threshold. Finally, simulation results demonstrate the efficacy of preprocessing and show that the proposed policy outperforms two baseline policies.


I. INTRODUCTION
There is a growing need for real-time status monitoring and controlling with the overwhelming proliferation of the Internet of Things (IoT), such as sensor networks, camera networks, and vehicular networks, to name but a few [1]. Timely updates of status at the destination are crucial for effective monitoring and control in these applications [2], [3]. As such, we use the metric of age of information (AoI), which is defined from the receiver's perspective as the time elapsed since the most recently received status update was generated at the IoT device [4], to quantify the freshness of information. In general, minimization of the AoI requires the sampling frequency, queueing delay, and transmission latency be jointly optimized at the IoT device, which have been extensively studied in previous works [5]- [7].
Actually, besides performing simple monitoring tasks, new designed IoT devices with computing capability is able to conduct more intricate tasks, such as data compression, feature extraction, and initial classification [8], [9]. Preprocessing the status update at the IoT device can reduce the transmission time but give rise to an additional preprocessing time. Therefore, a natural question arises at once: Is it instrumental in reducing AoI by preprocessing the status updates before the transmission? And if yes, how to jointly schedule the preprocessing and transmission? These questions motivate the study of the computing-enable IoT in this paper.
A recent line of research has exerted substantial efforts in studying the AoI minimization with computing-enabled IoT devices [8]- [12]. In [8], the local computing scheme was analyzed under the zero-wait policy by using tandem queueing model and was compared with the remote computing scheme in terms of the average AoI. The tandem queueing model was further extended in [9], where the status updates from multiple sources are preprocessed with different priorities. The closed-form expression for the average peak AoI was derived and the effects of the processing rate on the peak AoI was analyzed. In [10], both average AoI and average peak AoI were analyzed for the computing-enable IoT device with various tandem queueing models, including preemptive and non-preemptive queueing disciplines. However, these studies are primarily concerned with the AoI analysis of a computingenabled IoT system with a predetermined preprocessing and transmission policy.
The optimal control of the preprocessing at the IoT device has been studied in [11], [12]. In [11], each status update is generated with zero-wait policy and preprocessed to regenerate arXiv:2108.01919v1 [cs.IT] 4 Aug 2021 a partial update. The partial update generation process was optimized to minimize the average AoI and maintain a desired level of information fidelity. However, the time consumption of the preprocessing has not been considered. In [12], the processing is used to improve the quality of the status update at the cost of increasing the age. Both the waiting time and the processing time were optimized to find the minimum of the average AoI subject to a desired level of distortion for each update. Nonetheless, the transmission time was assumed to be ignorable.
The status updating problem in a time-critical IoT system is studied in this paper, where the IoT device is capable of preprocessing the status updates. In particular, our goal is to control the preprocessing and transmission procedure jointly at the IoT device in order to reduce the weighted sum of the average AoI associated with the destination and the energy consumed by the IoT device. Under this setup, the IoT device can stay idle, transmit the status update directly, or preprocess and transmit the status update. Due to the limited transmission and computation capacities, each status update takes multiple minislots to be preprocessed and transmitted. Moreover, because the processing rate and transmission rate are different in general, the time for transmitting directly and that for preprocessing-and-transmiting are unequal. While the model of non-uniform transmission time has also been investigated in [13], [14], where either the status updates are of different sizes and hence the durations of the same action may be non-uniform [13], or the sizes of the status updates are different for different devices [14], in this work, it is the duration of distinct actions that are non-uniform. The key contributions of this paper are summarized as follows: • By accounting for the non-uniform duration of distinct actions, we formulate the status updating problem as an infinite horizon average cost semi-Markov decision process (SMDP). In consequence, the Bellman equation for the uniform time step average cost MDP does not directly apply. To address this issue, we transform the SMDP to an equivalent uniform time step MDP. Then, we analyze the structure of the optimal update policy and put forth a relative policy iteration algorithm to obtain the optimal update policy based on the structural properties. We prove that to minimize the long-term average cost, the updating action with a shorter expected duration should be chosen when the AoI is large enough to dominate the cost. Therefore, the IoT device should preprocess the status update before the transmission for large AoIs, when the preprocessing results in a shorter expected update duration than direct transmission. • The optimal status updating problem is further studied in a special scenario where the status updates are transmitted over a reliable channel. Then, we demonstrate that the optimal update policy has a switch-type structure as to AoI in two cases. In the first case, the action of being idle is excluded in the optimal policy, while in the second case the action with lower energy efficiency is excluded in the optimal policy. The optimal thresholds are further derived in both cases.  Figure 1. An illustration of the IoT status monitoring system.
• We evaluate the performance of the optimal update policy and compare it with two zero-wait policies by conducting extensive simulations. The results demonstrate that the optimal update policy can effectively schedule the preprocessing and transmission and walk a fine line between the AoI and the energy consumption.
The rest of the paper is organized as follows: Section II presents the system model. In Section III, we provide the SMDP formulation of the problem and propose the structureaware relative policy iteration algorithm. In Section IV, we study the structure property of the optimal policy in a special scenario. In Section V, the simulation results are discussed, followed by the conclusion in Section VI.

II. SYSTEM MODEL
As illustrated in Fig. 1, we consider a time-critical IoT status updating system with a single IoT device and a destination. 1 The IoT device is composed of a sensor which is capable of tracking the status of the underlying physical process, a processor which is capable of preprocessing the status update, and a transmitter which can deliver the status update over a wireless channel to the destination. The model with a single source-destination pair is simple but sufficient enough to investigate a wide range of applications. We assume that the IoT device adheres to the generate-at-will policy, which implies that a fresh status update is generated anytime an update decision is made.
A time-slotted system is considered, where time is divided into minislots with equal duration of τ (in seconds). In this system, a status update with T u packets is generated at the beginning of a minislot and at most one packet can be transmitted in one minislot. As such, the total duration for transmitting a single status update is T u minislots. The preprocessing at the IoT device could be data compression, feature extraction, or initial classification. In this work, we consider the preprocessing in general practice. Specifically, we characterize the preprocessing operation with three parameters, namely, the size of the status update before preprocessing T u , the size of the status update after preprocessing T u , and the number of CPU cycles per bit required to complete this 1 Although we consider only one device, the result in this paper can be extended to the IoT system with multiple devices by formulating the status updating problem as a restless multi-armed bandit (RMAB) problem. To solve the RMAB problem, Whittle's index policy can be employed, where we decouple the problem with multiple devices into multiple sub-problems. There is only a single source-destination pair in each sub-problem, which is exactly the model we considered in this work.
operation v. 2 Let l denote the number of bits per packet. Since the number of bit of the status update before processing is T u l, the number of minislots required for preprocessing one status update is then given by where f (in Hz) is the CPU frequency of the processor. We assume that the destination (e.g., a base station or an access point) has a more powerful computing capability. Therefore, the processing time at the destination is negligible compared to the processing time at the IoT device or the transmission time.
We refer to a decision epoch of the IoT device as a time step, as illustrated in Fig. 2. In each time step, the IoT device must determine whether to sample and transmit an update directly or preprocess the update before the transmission. Let a p (t) ∈ {0, 1} denote the computing action at time step t, where a p (t) = 1 indicates that the device preprocesses the status update, and a p (t) = 0, otherwise. Let a u (t) ∈ {0, 1} denote the updating action at time step t, where a u (t) = 1 indicates that the device samples and transmits the status update to the destination and a u (t) = 0, otherwise. Let a(t) (a p (t), a u (t)) ∈ A {(0, 0), (0, 1), (1, 1)} denote the device's control action vector at time step t, where A is the feasible action space. In particular, if a(t) = (0, 0), the device will stay idle in one minislot. If a(t) = (0, 1), the device will sample and transmit the update directly without preprocessing. If a(t) = (1, 1), the device will first preprocess the status update after sampling and then transmit it to the destination. Notably, the action vector (1, 0) is not feasible because this action incurs energy consumption but does not provide the destination with a fresh status update.
It is important to emphasize that the duration of a time step is not uniform. Specifically, let L(a(t)) denote the number of minislots in time step t with action a(t) being taken, we can then express L(a(t)) as follows if a(t) = (0, 1), We further denote by L u (a(t)) the transmission time corresponding to action a(t), which is given as follows Let C p denote the computation energy consumption per minislot when a p (t) = 1 and C u denote the communication energy consumption per minislot when a u (t) = 1. In particular, the computation energy consumption per minislot is given by where κ is the effective switched capacitance depending on the chip architecture. By assuming a constant transmission power P of the IoT device, the communication energy consumption per minislot is C u = P τ . Then, the total energy consumption associated with action a(t) at time step t is given by if a(t) = (0, 1), It is assumed that channel fading is constant in each minislot but varies independently across them. The channel state information is also assumed to be available only at the destination and the IoT device transmits an update at a fixed rate. We use a memoryless Bernoulli process h(t, i) ∈ {0, 1} to characterize the transmission failure because of outage, where h(t, i) = 1 indicates that the packet is transmitted successfully at the ith minislot of time step t, and h(t, i) = 0, otherwise. The transmission success probability of a packet is defined as where B is the channel bandwidth, γ is the channel gain between the IoT device and the destination, and σ 2 is the noise power. We assume that the status update can be successfully recovered at the destination if all the packets are transmitted successfully during one time step. We denote by h(t) ∈ {0, 1} the transmission status of an update at time step t, i.e., h(t) = L(a(t)) i=L(a(t))−Lu(a(t))+1 h(t, i), where h(t) = 1 indicates that the update is transmitted successfully, and h(t) = 0, otherwise. Thus, the transmission success probability of an update is given by Pr{h(t) = 1} = p Lu(a(t)) s and the transmission failure probability of an update is given by Pr{h(t) = 0} = 1 − p Lu(a(t)) s . We assume that there exists an instantaneous error-free single-bit ACK/NACK feedback from the destination to the IoT device. After a status update arrives at the destination, an ACK signal (a NACK signal) is sent in case of a successful reception (a failure).
The freshness of the status update is measured via AoI, which is defined as the time elapsed since the generation of the most recently received status update. Formally, let U (t) denote the time step at which the most up-to-date status update successfully received by the destination was generated. Then, the AoI at the i-th minislot of time step t can be defined as where the first term represents the number of minislots in the previous time steps since U (t) and i − 1 is the number of minislots in the current time step. For simplicity, we represent the AoI at the beginning of time step t as δ(t), i.e., δ(t) = δ(t, 1) = t−1 n=U (t) L(a(n)). Since it is pointless to receive a status update with a very large age for time-critical IoT application, we letδ be the upper  limit of the AoI, which is assumed to be finite but arbitrarily large [7]. Then, we present the dynamics of the AoI as follows We also illustrate the AoI evolution process in Fig. 2.

A. SMDP Formulation
Since the duration of each time step depends on the action taken in that time step, the time interval between two sequential actions is inconstant. Therefore, the optimal updating problem belongs to the class of SMDP. An SMDP can be defined as a tuple (S, is the transition probability, and r is the cost function. In particular, at the beginning of the time step t, the agent observes the system state s(t) and chooses an action a(t). As a consequence, the system remains at s(t) until the next decision epoch. Then, the system state transitions to s(t + 1) and the agent receives a cost R(t). We note that this is different from MDP, where the transition time is fixed and independent of the actions. In the following, we formally define the state, action, transition probability, and cost function of the SMDP.
1) State : The state of the SMDP at time step t s(t) is defined to be the AoI at the beginning of that time step, i.e., s(t) = δ(t). Since we limit the maximum value of the AoI, the state space is expressed as S {1, 2, · · · ,δ}.
2) Action: The action at time step t is a(t) and the action 3) Decision Epoch: A decision is making at the beginning of a time step. The time interval between two adjacent decision epochs is L(a(t)), which depends on the action taking in time step t. 4) Transition Probability: We denote by Pr(s(t + 1) | s(t), a(t)) the transition probability that a state transits from s(t) to s(t + 1) with action a(t). According to the AoI evolution dynamic in (8), the transition probability can be given as follows

5) Cost:
We aim to minimize the weighted sum of the average AoI associated with the destination and the energy consumed by the IoT device. As such, we define the cost at a time step as the weighted sum of the AoI and the energy consumption. Specifically, the cost at time step t is represented as where ω is the weighting factor. Our goal is to find an update policy π = (a(1), a(2), . . .) that reduces the average cost to the lowest possible level. Under a set of stationary deterministic policy Π and a given initial system state s(1), the objective can be formulated as follows: Since the duration of the time step is not uniform, the average cost in (11) is defined as the limit of the expected total cost over a finite number of time steps divided by the expected cumulative time of these time steps [5]. In this work, we restrict our attention to stationary unichain policy, under which the Markov chain is composed of a single recurrent class and a set of transient states. Thus, the average cost is independent on the initial state and the Markov chain has a unique stationary distribution [15].
To solve this problem, we transform the SMDP into an equivalent discrete time MDP using uniformization [15], [16]. LetS andĀ denote the state space and action space of the transformed MDP. They are the same as those in the original SMDP, i.e.,S = S andĀ = A. For any s ∈S and a ∈Ā, the cost in the MDP is given bȳ , (12) and the transition probability is given bȳ where is chosen in 0, min a L(a) . Then, by solving the Bellman equation in (14), one can obtain the optimal policy π * of the original SMDP that minimizes the average cost. According to [16], we have where θ is the optimal value to (11) for all initial state and V (s) is the value function for the discrete-time MDP. Then, the optimal policy can be given by for any s ∈ S. Theoretically, we can obtain the optimal policy π * via (15). However, the value function V (·) does not have closed-form solution in general, which makes this problem challenging. Although numerical algorithms such as value iteration and policy iteration can solve this problem, they incur high computational complexity and do not provide many design insights. For a better understanding of the system, we will investigate the structural properties of the optimal update policy in the next subsection.

B. Structural Analysis and Algorithm Design
In this subsection, we first show that the structure of the optimal policy is of threshold-type with respect to the AoI. Then, we propose a relative policy iteration algorithm based on the threshold structure to obtain the optimal policy π * for (11).
To begin with, we show some key properties of the value function V (s) in the following lemmas.
Since V (s) is a concave function, its slope is non-increasing. We drive the lower bound of the slope of V (s) in the following lemma. Before that, we define an auxiliary variable a f , which is given by Lemma 3. For any s 1 , s 2 ∈ S, such that Proof: See Appendix C. We are now in position to show the structure of the optimal update policy.
Proof: See Appendix D. Theorem 1 depicts the structural properties of the optimal policy π * of the SMDP in two cases. We note that Tu p Tu s and Tp+T u p T u s can be interpreted as the expected duration of repeatedly taking action (0, 1) and that of taking action (1, 1) to get one success transmission, respectively. Therefore, Theorem 1 also suggests when to choose which updating action in the high AoI regime. Particularly, in order to minimize the longterm average cost, the updating action with a shorter expected duration should be chosen when the AoI is large enough to dominate the cost. For example, in the first case where the preprocessing incurs a larger expected update duration, it is better to transmit the update directly for a large enough AoI, while in the second case where preprocessing can help shorten the expected update duration, it is no doubt to choose preprocessing-and-transmission when the AoI is large enough. The reason why we do not consider the energy consumption of both actions in the conditions is that the difference between the energy consumption of different actions is constant and the age increasingly dominates the cost as the AoI grows larger. We further illustrate the threshold structure of the optimal policy in Fig. 3, where the structure of optimal policy falls into case 1 when v ≤ 10, and otherwise when v ≥ 12. Remark 1. We note that the result in Theorem 1 can be extended to the case of discrete transmit power control. The Algorithm 1 Relative Policy Iteration based on the Threshold Structure 1: Initialization: Set π * 0 (s) = (0, 0) for all s ∈ S, select a reference state s † , and set k = 0. 2: Policy Evaluation: Given π * k , compute the value of θ k and V k (s) from the linear system of equations action with the largest transmit power would be the optimal one when the AoI is large enough, because the largest transmit power can bring the shortest expected duration.
According to Theorem 1, there exists a threshold Ω in the optimal update policy. Although the exact values of Ω depend on the particular values of V (s), the structure only depends on the properties of V (s). Therefore, a low-complexity relative policy iteration algorithm can be developed by incorporating the threshold structure into a standard relative policy iteration algorithm. In particular, we will no longer need to minimize the righthand side of (14) for all states to find π * , thereby reducing the computational complexity. The details are given in Algorithm 1.

IV. SPECIAL CASE STUDY: TRANSMISSION OVER A RELIABLE CHANNEL
In this section, we consider a special scenario where the packets are transmitted over a reliable channel. Accordingly, the status updating problem can be simplified. From (8) we can see that the states smaller than min{T u , T p +T u } are nonrecurrent states. Since the policies in non-recurrent states has no effect on the average cost, we can only consider the state space S † min{T u , T p + T u }, · · · ,δ when discussing the optimal policy.

A. Case 1
Based on the model of the reliable channel, we give the first simplification of the optimal policy.   Proof: See Appendix E. Lemma 4 indicates that the IoT device will never stay idle with the optimal policy when the AoI dominates in the cost. Accordingly, the threshold structure in Theorem 1 can be simplified, which is presented in the theorem below.
Proof: According to Lemma 4, we can exclude action (0, 0) from the optimal policy when 1 2 L(a f )(L(a f ) + 1) ≥ ωC(a f ). Moreover, since we have proved the threshold structure of the optimal policy in a general case in Theorem 1, the optimal policy can be further proved to satisfy the switching structure in (19) and (20).
Theorem 2 depicts the structure of the optimal policy π * for the SMDP in (11) when p s = 1 and 1 2 L(a f )(L(a f ) + 1) ≥ ωC(a f ). We further illustrate the analytical results of Theorem 2 in Fig. 4, where T u ≤ T p + T u and C(a = (0, 1)) > C(a = (1, 1)). It can be seen from Fig. 4 that the optimal policy is of the threshold type. Moreover, the threshold increases along with ω. This indicates that, when the weighting factor is large, it is not desirable to directly transmit a new status update to the destination due to a high weighted energy consumption.
We then denote a 1 = arg min    Theorem 2, we can proceed to reduce the recurrent state space of the computing-enable IoT system. Proof: As illustrated in Fig. 5, we can use a Discrete Time Markov Chain (DTMC) to model the MDP constructed by any threshold policy of the type in Theorem 2 with the threshold of Ω. It can be seen from Fig. 5(a) and Fig. 5(c), respectively, that there is only one recurrent state L(a 1 ) when Ω = L(a 1 ) and L(a 2 ) when Ω > L(a 2 ). Also we can see from Fig. 5(b) that the recurrent states are L(a 1 ) and L(a 2 ) when L(a 1 ) < Ω ≤ L(a 2 ).
Under the threshold policy, we proceed with analyzing the average cost of any threshold Ω.
For a given threshold Ω, the average cost of the threshold policy in Theorem 2 is given by

(21)
Proof: See Appendix F. By leveraging the above results, we can find the set of the optimal threshold Ω * . Theorem 3. If J 1 is smaller than J 2 and J 3 , we have Ω * = L(a 1 ). If J 2 is smaller than J 1 and J 3 , we have L(a 1 ) < Ω * ≤ L(a 2 ). If J 3 is smaller than J 1 and J 2 , we have Ω * > L(a 2 ).
Proof: According to Lemma 6, we can determine the set of the optimal threshold Ω * by comparing the values of J 1 , J 2 and J 3 .
We have proved in Lemma 5 that under the threshold policy in Theorem 2, only a few states of the system are recurrent states. Once the set of the optimal threshold is determined, we can determine the optimal policy in the recurrent states. Therefore, the specific value of the threshold is not a necessity. As long as we take any value in the set of the optimal threshold, we can achieve the goal of minimizing the average cost.

B. Case 2
Based on the model of the reliable channel, we give the second simplification of the optimal policy. Recall that a 1 = arg min  L(a2) . Proof: See Appendix G. Lemma 7 reveals that the action with a lower energy efficiency (i.e., a larger energy consumption per minislot) shall be excluded in the optimal policy. Accordingly, the threshold structure in Theorem 1 is simplified in the following theorem.
Theorem 4. For s ∈ S † , the optimal policy is of a switch-type structure when C(a1) L(a1) ≤ C(a2) L(a2) , namely, there is a threshold Ω ≥ min{T u , T p + T u }, such that π * (s) = (0, 0), L(a 1 ) ≤ s < Ω, Proof: According to Lemma 7, we can exclude a 2 from the optimal policy when C(a1) L(a1) ≤ C(a2) L(a2) . Moreover, since we have proved the threshold structure of the optimal policy in a general case in Theorem 1, the optimal policy can be further proved to satisfy the switching structure in (22). Theorem 4 depicts the structure of the optimal policy π * for the SMDP in (11) when p s = 1 and C(a1) L(a1) ≤ C(a2) L(a2) . Fig.  6 illustrates the analytical results of Theorem 4, where p s = 1 and C u ≥ TpCp+T u Cu Tp+T u . We can see from Fig. 6 that, in order to strike a balance between the AoI and the energy consumption, the IoT device does not transmit until the AoI is large. We can also see that the threshold increases with the increasing of the weighting factor ω. This is due to a higher weighted energy consumption in average cost when ω grows larger. Under the threshold policy in Theorem 4, we proceed with analyzing the average cost. Proof: See Appendix H. By leveraging the above results, we can find the optimal threshold value Ω * . Theorem 5. The optimal threshold Ω * of the optimal update policy in Theorem 4 is given by Proof: See Appendix I. From the expression of the optimal threshold Ω * , we can see that the threshold is monotonically increasing with respect to ω and C(a 1 ), which is consistent with the result in Fig. 6. This indicates that, when the weighting factor or the energy consumption is large, transmitting a new status update can achieve better result than keeping idle only in the large AoI regime.
Remark 2. In this section, by studying the special cases, we show that the optimal policy has a switching structure with respect to only two actions. Moreover, the optimal threshold can be obtained in closed-form, which reveals how the system parameters affect the threshold policy. It is worth noting that, in practice, the conclusions obtained from the special cases study can be applied in the high SNR regime and the obtained optimal policy can be used as an approximation of the optimal policy when the success rate is high.

V. SIMULATION RESULTS
In this section, we present the simulation results to explore the effects of system parameters on the optimal update policy and demonstrate the efficacy of the proposed scheme by comparing it with two other zero-wait policies, i.e., zerowait no-computation policy and zero-wait computation policy. Particularly, in both baseline policies, the IoT device starts a new transmission immediately after the previous transmission is finished. In the zero-wait no-computation policy, the IoT device transmits each status update without preprocessing, while, in the zero-wait computation policy, the IoT device preprocesses each status update and then transmits the processed status update. In the simulations, we truncate the state space by setting the upper limit of the number of states to be 200.

A. Performance Evaluation in the General Case
In Fig. 7, the average cost of the optimal policy and the two baseline policies are compared with respect to the transmission success probability p s . As we can see from Fig. 7(a), the optimal policy outperforms the zero-wait policies. Moreover, the average cost decreases as p s increases. The reason can be explained with the aid of Fig 7(b). First, it is evident that the average AoI of all the three policies decreases with the increasing of p s since the AoI is more likely to be reset with a larger transmission success probability. Second, because the IoT device with zero-wait policies keep updating continuously, the average energy consumption remains a constant irrespective of p s . For 0.1 ≤ p s ≤ 1, we can see that the average energy consumption steadily decreases with the increase of p s . This is due to the fact that less transmission is needed to reduce the AoI when p s is larger. Therefore, the optimal policy can adapt to the channel quality. Through this comparison, we can see that although the optimal update policy does not yield the minimum AoI, it has a smaller energy consumption than the zero-wait policies. By trading off the AoI for energy consumption, the optimal update policy achieves the smallest average cost.
In Fig. 8, the average cost of the optimal policy and the two baseline policies are compared with respect to the number of CPU cycles required to preprocess one bit v. We can see from Fig. 8(a) that the optimal policy outperforms both baseline policies. It is easy to see that the performance of zero-wait no-computation policy is irrespective of v since each status update is transmitted directly without preprocessing. In contrast, the average cost of the optimal policy and the zero-wait computation policy is non-decreasing as v grows. Particularly, we can see from Fig. 8(b) that the average AoI of the zero-wait computation policy increases with v. Since the status update is more and more computation intensive as v grows, the preprocessing at the IoT device requires more and more time, which leads to an increase in the average AoI. However, since the computation energy consumption per minislot in this setup is less than the transmission energy consumption per minislot, the average energy consumption of the zero-wait computation policy is shown to decline with v. In other words, although the duration and total energy consumption are increasing as v increases, the average energy consumption is decreasing. Moreover, we can see from Fig.  8(b) that the average AoI of the optimal update policy is nondecreasing with v except when 14 ≤ v ≤ 16. The reason why the average AoI of the optimal policy drops for 14 ≤ v ≤ 16 can be explained with Fig. 3. Since v = 16, the optimal policy completely abandons the action of (1, 1). The change of the optimal policy effectively reduces the average AoI of the system, but induces a sudden increase in the average energy consumption at v = 16. We can also see that the average energy consumption increases as v increases. This is because the optimal policy makes sacrifices in energy consumption in order to ensure that the AoI is increased at a slower pace. It could be concluded that the optimal update policy can adjust adaptively based on the degree of computational intensity of the status update.

B. Performance Evaluation in the Special Cases
In this subsection, we show the performance of two different special cases in Section IV that the packets are transmitted over a reliable channel. In Fig. 9, the average cost of the optimal policy and the two baseline policies are compared with respect to the weighting factor ω when T u ≤ T p + T u and 1 2 (T p + T u )(T p + T u + 1) ≥ ω(T p C p + T u C u ). As we can see from Fig. 9(a), the optimal policy outperforms both two baseline policies. Moreover, the optimal policy coincides with the zero-wait no-computation policy when ω is small and coincides with the zero-wait computation policy when ω is large. This is because, in this simulation setup, when w ≤ 0.55, we have min(J 1 , J 2 , J 3 ) = J 1 and the optimal policy is to always transmit the status update directly, while when w ≥ 0.75, we have min(J 1 , J 2 , J 3 ) = J 3 and the optimal policy is to always preprocess and transmit the status update. Moreover, when 0.60 ≤ w ≤ 0.70, we have min(J 1 , J 2 , J 3 ) = J 2 and the optimal policy is to execute the above two actions in turns. That is the reason why the optimal policy outperforms the two zero-wait policies in this regime. In Fig. 10, the average cost of the optimal policy and the two baseline policies are compared with respect to ω when T u ≥ T p + T u and C u ≥ TpCp+T u Cu Tp+T u . As we can see from Fig. 10(a), the optimal policy outperforms both two baseline policies. As the weight factor increases, the average cost of the optimal policy and the baseline policies increase but with different rates. From Fig. 10(b) we can see that the average AoI and the energy consumption of the two zero-wait baseline policies are constant for any ω. The gap between the optimal policy and the zero-wait baseline policies grows with ω in 10(a), because the zero-wait policies suffer from a higher weighted energy consumption when the weighting factor is large. For the optimal policy, we can see that, with the increase of ω, its average energy consumption tends to be smaller while the average AoI tends to be larger. This is the result of the balance between the AoI reduction and the energy consumption. Theorem 8 shows that the threshold of the optimal policy in this case will increase with ω. Therefore, when ω is large, the IoT device will update only when the AoI is large enough.

VI. CONCLUSION
In this paper, we have studied the problem for optimizing information freshness in computing-enabled IoT systems by jointly controlling the preprocessing and transmission at the IoT device. To minimize the weighted sum of the average AoI associated with the destination and the energy consumed by the IoT device, we have formulated an infinite horizon average cost SMDP. By transforming the SMDP to an equivalent uniform time step MDP, we have investigated the structure of the optimal update policy and provided a structure-aware relative policy iteration algorithm. We have further proved the switch-type structure of the optimal policy in a special scenario where the status updates are transmitted over a reliable channel. Simulation results have shown that the optimal update policy can adjust adaptively based on the channel quality and the degree of computational intensity of the status update. By comparing the optimal update policy with two other zero-wait policies, it is shown that the optimal update policy achieves a good balance between the AoI reduction and the energy consumption.

A. Proof of Lemma 1
According to the value iteration algorithm (VIA) [17, Chapter 4.3], we prove Lemma 1 by using mathematical induction. We first denote by V k (s) and Q k (s, a) the state value function and state-action value functions at iteration k, respectively. In particular, Q k (s, a) is defined as: where s is given by (8). For each state s, VIA calculates V k+1 (s) according to Under any initialization of V 0 (s), the generated sequence {V k (s)} converges to V (s), i.e., where V (s) satisfies the Bellman equation in (14). Therefore, we can prove the monotonicity of V (s) by showing that this property is also possessed by V k (s) for any k. Particularly, we need to prove that for any s 1 , s 2 ∈ S, such that s 1 ≤ s 2 , We initialize V 0 (s) = 0 for all s ∈ S without sacrificing generality. Then, we prove (28) by using mathematical induction. First, since V 0 (s) = 0 for all s ∈ S, (28) holds for k = 0. Next, we assume that (28) holds up till k > 0 and inspect whether it holds for k + 1.

B. Proof of Lemma 2
The proof follows the same procedure of Lemma 1. The concavity of V (s) in s can be proved by showing that for any s 1 , s 2 ∈ S and w ∈ N , such that s 1 ≤ s 2 , (31) We initialize V 0 (s) = 0 for all s ∈ S without sacrificing generality. Thus, (31) holds for k = 0. Next, we assume that (31) holds up till k > 0 and inspect whether it holds for k + 1. For convenience, we now define ∆Q(s, s , a) = Q(s, a) − Q(s , a).

H. Proof of Lemma 8
The MDP can be modeled via a DTMC with the same states for any threshold policy of the type in Theorem 4, which is illustrated in Fig. 11. We can easily see from Fig. 11 that this Markov chain is of a cyclic structure, in which the state will cycle back and forth in the states between L(a 1 ) and Ω.
In each cycle, the device will take Ω − L(a 1 ) minislots to stay idle in the states from L(a 1 ) to Ω − 1. Once the AoI reaches the threshold, a new status update will be generated and action a 1 is taken, which takes L(a 1 ) minislots. Therefore, each cycle takes Ω minislots in total. With the cyclic structure, we can obtain the average cost by finding the average cost in a cycle.
The average cost resulted by keeping idle in a cycle is given by The average cost resulted by updating in a cycle is given by J 2 (Ω) = 1 Ω R(Ω, a 1 ).
Then, the average cost obtained by the threshold policy in We derive the optimal threshold Ω * by relaxing Ω to a continuous variable. We first calculate the second order derivative of J(Ω) as follow, It is easy to see that ∂ 2 J(Ω) ∂Ω 2 ≥ 0. Therefore, J(Ω) is a convex function with respect to Ω. Then, we calculate the first order derivative of J(Ω) as follow, By setting ∂J(Ω) ∂Ω to zero, we can obtain the optimal threshold The solution to ∂J(Ω) ∂Ω = 0 is Ω = 2ωC(a 1 ).
Since Ω may not be an integer, the optimal threshold can be expressed as Ω * = arg min (J( Ω ), J( Ω )) .