5G Optimized Caching and Downlink Resource Sharing for Smart Cities

In smart cities, millions of things, systems, and people are interconnected and communicate with each other over wireless sensor networks, Internet of Things (IoT), and 5G networks. A tremendous amount of data traffic, which is frequently generated by the things in wireless multimedia sensor networks (WMSNs) and/or IoT, is accessed by a massive number of mobile users (MUs). These MUs are all competing to access the 5G network for data as well as urban applications and services. This can in turn cause exhaustion to the 5G network. In such cases, users can experience low data delivery and traffic congestions through backhaul links by macro base stations (MBSs). In this paper, we propose a joint caching and downlink resource sharing optimization framework (CSF) in 5G networks to assist WMSNs to efficiently deliver multimedia contents to the MUs. The CSF enables the MBSs to optimally decide how many replicas of each multimedia content to cache in which fem to base stations for high multimedia content hit rate. It also optimally exploits the MUs that are willing to share their downlink resources and that have retrieved multimedia contents, for offloading with device-to-device communications. The objective is to eventually maximize the system delivery capacity. Simulation results demonstrate that the CSF provides the best performance in terms of hit rate and system delivery capacity.


I. INTRODUCTION
In megacities, the proliferation of urban residents poses various challenges to job pools, economic development, sustainable environment, and welfare and social resilience.These challenges can be overcome in the context of smart cities by adopting disruptive information and communications technologies (ICT).Basically, a multi-layer platform of ICT system is deployed, consisting of the things (sensors, mobile and wearable devices, cameras, actuators, and machines) to capture data from the surroundings, communication systems to deliver the data, and data centers for the purpose of monitoring and analyzing.A smart city can provide many advanced applications and services (AASs).These applications can include surveillance, management, and entertainment, relying on wireless sensor networks (WSNs), Internet of things (IoT), and 5G networks.These can play a prominent role as parts of being ''smart'' to allow the data to be transmitted efficiently over the system at low cost [2].
By 2020, smart cities will witness the ongoing growth of up to more than 50 billion connected devices together with a huge amount of data conveyed in the era of IoT [3].The data of structural health of buildings, transportation systems, e-health and e-learning services, smart home and environment, and public safety applications.This has been generated by the things in WSNs and/or IoT and by the AASs in smart cities, is stored in data centers.A large portion of the data traffic is requested by a massive number of mobile users (MUs), which will reach 11.6 billion by 2021 [4], via the macro base stations (MBSs) in 5G networks.Simultaneously, the MBSs superimpose to provide the MUs with conventional cellular traffic.These in turn make 5G networks congested and thus low data delivery capacity performance due to the problem of traffic congestion in the backhaul links of the MBSs.
In fact, it is rigorous to develop such high-speed backhaul links of the MBSs to improve the delivery capacity performance due to their costly production [5].Meanwhile, several technical solutions have been widely altered by the innovation of network architecture and optimization designs such as ultra-dense small-cell technology [6], device-todevice (D2D) communications [7], massive multiple-input multiple-output (MIMO) [8], and optimization designs [9].However, these solutions are basically under the constraints on spectrum resources and signaling overhead.Thus, it is not sufficient to tackle the problems of traffic congestion in the backhaul links of the MBSs and high demand of massive number of MUs [10].
Recently, caching and spectrum resource sharing schemes have been applied to all the bodies and tiers of 5G networks, from the user devices and small-cell base stations (SBSs) to the MBSs.Caching, i.e., D2D caching [7], [11]- [14], femtocaching [15]- [18], small-cell caching [5], [19]- [23], MBS caching [24], [25], multi-tier caching [6], [26]- [32], can mitigate the traffic congestion in the backhaul links of the MBSs by placing the strategic data in close proximity to the MUs.And, spectrum resource sharing, i.e., [33]- [38], can improve the performance of spectral use and reuse to serve a massive number of MUs.To the best of our knowledge, in current literature there is a lack of research works in integrating WSNs into 5G networks.We believe this is needed to provide MUs with AASs in smart cities and offer a joint solution of caching and spectrum resource sharing in 5G networks to efficiently improve the data delivery capacity performance and mitigate the backhaul bottlenecks at the MBSs.Even though in many AASs of a smart city, the integration of WSNs and mobile cellular networks (or 5G networks) has been considered as a feasible architecture for collecting sensed data [39]- [42], the benefits of caching and spectrum resource sharing in 5G networks have not been utilized.
In this paper, to provide the MUs with AASs in smart cities, we extend our previous work [1] by taking into account the integration of wireless sensor networks (WSNs) and 5G networks in the context of smart cities with different challenges and more efficient solutions.Particularly, in [1], the scenario was "disaster", and thus the performance metrics focused on ensuring high connectivity and high response due to severe disruptions in the communication networks.However, in smart cities, the connectivity and response metrics are not important.Instead, smart cities face congestion problems because there is a huge amount of rich data generated by WSNs and requested by a massive number of MUs throughout 5G networks.To this end, we focus on how to maximize the average number of replicas of contents to provide the MUs with AASs at high hit rates.Importantly, during providing a high hit rate, we also carefully consider the throughput of each content requested by the MUs from WSNs to limit the number of replicas not exceeding this requested throughput.It makes our proposed caching scheme more efficient corresponding to the demand of MUs.
In addition, in [1], to maximize the system capacity, the decision to cache does not depend on the condition of storage capacity of the D2D transmitters (TXs) and the access rate of multimedia contents.The decision to share does not consider the interference effect of D2D communications on the target SINR of the CUs.In this work extension, all the storage capacity of the TXs and the access rate of contents as well as the interference effect of D2D communications on the target SINR of the CUs are considered to maximize the system delivery capacity more efficiently.The objective is to deliver a huge amount of data traffic to the MUs at a high hit rate and a high system delivery capacity.Meanwhile, we mitigate the tremendous traffic in the backhaul links of the MBSs.We specifically focus on delivering multimedia contents.This accounts for a large portion of data traffic generated by wireless multimedia sensor networks (WMSNs) consisting of WSNs and multimedia devices such as cameras and microphones.
To do so, we design a joint caching and downlink resource sharing optimization framework (CSF) consisting of two optimization solutions.In the first solution, we assume that the hit rate of a multimedia content can be represented by its number of replicas associated with its access rate or popularity and we formulate the number of replicas optimization (NRO) problem.The NRO problem is then solved for the optimal number of replicas to maximize the average number of replicas, and thus providing high hit rate.In the second solution, the system delivery capacity is maximized by solving where to cache and with whom to share optimization (CSO) problem.The objective is to find the optimal set of femto base stations (FBSs) to cache the replicas and the optimal set of MUs.These MUs share their downlink resources and have retrieved multimedia contents for offloading with D2D communications.The contributions of our work are summarized as follows: • We propose a CSF consisting of NRO and CSO solutions applied to smart cities that can exploit the storage to cache and downlink resource to share in 5G networks.
The CSF can convey the WMSNs' multimedia contents to the MUs at a high hit rate and high delivery capacity.
• The NRO problem is formulated and solved for optimal number of replicas of each multimedia content to maximize the average number of replicas for a high hit rate.The optimal results, namely the number of replicas to cache, are found in accordance with the popularity and the demand of multimedia contents to prevent from wasted throughput, e.g., reserved throughput is much larger than requested throughput.
• After knowing how many replicas to cache, we continue to answer the questions of where (which FBSs) to cache and who (which MUs) to share their downlink resources and available retrieved multimedia contents by formulating and solving the CSO problem?The optimal solution to the CSO problem enables the WMSNs' multimedia contents to be delivered to the MUs from the MBSs, FBSs, and by D2D communications.This way, the system delivery capacity is maximized.In addition, the effect of interference of D2D communications on the MUs that share their downlink resources with D2D communications, is strictly considered as a constraint in the CSO problem to ensure the target signal to interference plus noise ratio (SINR) of the sharing MUs.
• Simulation results are insightfully discussed and comparison is presented between different schemes to demonstrate the benefits of the proposed CSF.The rest of this paper is organized as follows.In Section II, related works are reviewed.We introduce the system models, i.e., the CSF in 5G networks for WMSNs and the formulations of a hit rate and system delivery capacities, in Section III.Section IV presents the NRO and CSO problems and solutions.Section V is dedicated to demonstrating the benefits of the proposed optimization framework compared to other schemes through simulation results and discussions.Finally, we conclude the paper in Section VI.

II. RELATED WORKS
In this section, we review some key caching [5]- [7], [11]- [32] and spectrum resource sharing [33]- [38] techniques, which are used to mitigate the traffic congestion in the backhaul links of the MBSs and improve the spectrum efficiency, in order to serve a massive number of MUs in 5G networks.
A. CACHING TECHNIQUES 1) D2D CACHING D2D caching is one of the promising technologies at the edge of 5G networks to tackle the congestion in the backhaul links of the MBSs [7], [11]- [14].In [7], a multihop network is established relying on D2D communications for fast content distribution, without occupying the backhaul links of the MBSs.A cross-layer optimization is designed by jointly routing the contents at the network layer and allocating the spectrum at the media access control layer to minimize the average delay in multihop D2D networks.Aiming at maximizing the content delivery probability in a stochastic D2D communication network, probabilistic caching placement optimization problems have been studied in [11] and [12].The results show that a cache-aided throughput-based maximization approach provides higher content delivery probability compared to a cache hit probability-based one [11].Caching the most popular contents is the simple way to maximize the content delivery probability [12].For more practical applications, Wang et al. [13] further considered the mobility characteristic of the MUs in the caching placement strategy.The proposed mobility-aware caching placement strategy outperforms both random caching and popular caching strategies in terms of data offloading ratio.Park et al. [14] have proposed a smart MBS-assisted partial-flow D2D offloading system that can handle the multimedia contents, find the MUs who have cached the contents, and obtain the whole traffic for offloading with D2D communications, so as to support seamless multimedia services.However, the proposed caching placement optimization solutions have not considered the available storage resource in the SBSs and the MBSs, together with the MUs, for cooperatively delivering multimedia contents.

2) FEMTOCACHING
Utilizing considerable storage resource in the FBSs has been studied to alleviate the bottleneck at the MBSs [15]- [18].In particular, Golrezaei et al. [15] have proposed a new multimedia distribution architecture based on the collaboration of femtocaching and D2D communications to increase the system throughput.The problem of which FBSs to cache the multimedia contents associated with their popularities was also solved to minimize the average time for multimedia donwloading [16] and to maximize the number of MUs served by the FBSs [17].Especially Vo et al. [18] have designed a femtocaching framework that not only minimizes the bandwidth consumed at the MBSs and wasted at the FBSs but also provides high playback quality and high hit rate.This can be done by a joint technique of femtocaching and layered multiple description coding with embedded forward error correction for video transmissions.The existing problem in [15]- [18] is a lack of exploiting D2D caching to provide the MUs with high hit rate and high system deliver capacity.

3) SMALL CELL CACHING
Caching in small-cell 5G networks has been drawing much attention as a disruptive solution for offloading the backhaul links of the MBSs [5], [19]- [23].In [5] and [19], proactively caching in SBSs has been proposed based on the fact that storing popular contents at the SBSs and exploiting the MUs' social relationships can efficiently improve the performance of caching in terms of less backhaul congestion, low delay to the MUs, and high network savings.Stochastic geometry theory has been applied to caching in SBSs to derive theoretical download probability, which enables to analyze the caching performance and optimize the caching probability of each content group [20].Directly focusing on minimizing the backhaul load, Liao et al. [21], [22] have found the optimal content placement in all the SBSs by restructuring the contents with maximum distance separable (MDS) codes.In addition, mobility of the MUs, storage constraint of the SBSs, and delay deadline and popularity of the contents were carefully included in optimal distributed caching policy to minimize the traffic load at the MSBs [23].However, the aforementioned works have not taken into account the caching collaboration in all the MBSs, SBSs, and MUs, to maximize the system delivery capacity.

4) MBS CACHING
A simple and efficient way to cache in 5G networks can be done at the MSBs [24], [25].Following the same approach of MDS codes with [21] and [22] for caching, online cache content placement was designed in [24].The design allows VOLUME 6, 2018 to evaluate the trade-off between caching at the MBSs and caching at the fronthaul of high-capacity core network, which is directly connected to the MBSs.The performance shows that the former, which is not better than the latter in terms of number of served MUs, is still much better to be applied to gain higher spectral efficiency in future 5G networks.It is interesting in [25] that mmWave small cells with directional antennas can be utilized to proactively cache the video contents at the MBSs.Allocating proper storage of each MBS to the MUs can provide the high-mobility MUs with high-quality mobile video streaming at low connection and retrieval delays.It is observed that the joint solution of caching in multiple MBSs, SBSs, and MUs has not been exploited to extend the performance of MBS caching.

5) MULTI-TIER CACHING
A more efficient approach to caching in 5G networks is multi-tier caching [6], [26]- [32].In [6], caching has been extended from MBSs to MUs using a social group utility maximization game that exploits the social trust and physical reciprocity of the MUs.This way, the social group cost, i.e., the incentive to cache in the MUs for D2D communications, is minimized.By jointly caching in the FBSs (or MBSs) and MUs, Jiang et al. [26] (or [27]) have solved an optimal cooperative content caching and delivery problem for the best caching set of FBSs (or MBSs) and MUs to reduce the average downloading latency and enhance the local cache hit rate.In a green approach, maximizing the cache hit rate at high energy efficiency can be achieved by further taking into account the MUs' mobility [28] or mitigating traffic and energy consumption at the backhaul links can be done by a joint optimal technique of transmission and D2D and MBS caching policies [29], [32].A more complicated solution for optimal caching placement in three-tier 5G networks including MBSs, FBSs, and pico base stations, has been studied to maximize the hit probability [30] and system capacity [31].Although providing a general multi-tier caching architecture in 5G networks, [6], [26]- [32] have not taken the advantage of both storage and spectrum resource sharing schemes for D2D communications, to gain higher system delivery capacity.

B. SPECTRUM RESOURCE SHARING TECHNIQUES
In 5G networks, solutions for efficient spectrum use, reuse, sharing, and management are essential to meet the proliferation of MUs and of their demand for AASs due to the limitation of spectral resource [33]- [38].In particular, Akhtar et al. [33] have overcome the problem of inaccurate decision of cognitive spectrum sensing, seriously spectrum sharing in dense D2D communications, by proposing a synergistic spectrum sharing mechanism.The results show that the proposed mechanism is reliable for high spectrum efficiency.In [34], storage resource of MUs and spectrum resource in D2D underlaid cellular networks were exploited to cache and share respectively, for high successful transmission probability.Mainly focusing on block-fading environment, an optimal power policy was proposed to minimize the spectrum sharing outage probability of the secondary users [35].It is interesting that the benefits of spatial gain and spectrum sharing can be utilized to provide a significant improvement of sum rate in full duplex D2D underlaying cellular networks [36] and massive MIMO systems [37].Based on the fact that mitigating the interference between the SBSs and MBSs can improve the throughput, Mach and Becvar [38] have designed a centralized algorithm to dynamically switch between overlay mode and underlay mode for spectrum sharing.The proposed algorithm can further reduce the energy consumption of the SBSs without degrading the performance of the MBSs.However, spectrum resource sharing has not been integrated with caching to gain higher performance of hit rate and system delivery capacities.

III. SYSTEM MODELS A. 5G CSF FOR WMSNS
In this paper, we consider an integrated system consisting of a three-tier 5G network and a WMSN as shown in Fig. 1.The three-tier 5G network includes one MBS, J FBSs and (K + 2N ) MUs.The MUs are divided into K cellular users (CUs) that share their downlink resources with N D2D pairs, each of a D2D transmitter (TX) and a D2D receiver (RX).A 5G caching model is established by the MBS, FBSs (with femtocaching) and the TXs (with D2D caching) to support the system in delivering multimedia contents captured from the WMSN to the MUs.In this system, the multimedia contents can be streamed 1) from the MBS and FBSs to the CUs and TXs and 2) from the MBS, FBSs, and TXs to the RXs.It is important to note that the femtocaching scheme is deployed to provide high hit rate to access the multimedia contents and high system delivery capacity, while the D2D caching scheme is to further improve the system delivery capacity by utilizing downlink resources shared by the CUs.The WMSN has I sensor clusters, each covers a particular area and sends its captured multimedia content to the 5G network.We assume that the multimedia contents are sent from the WMSN to the 5G network for caching by joint active duty scheduling and encoding rate allocation in [41].The detailed CSF for high hit rate and high system delivery capacity is shown in Fig. 2 and operates in four steps as follows: • Step 1: The MBS collects all the system parameters in the whole cell including I , J , K , N , R i , r i , W , G x,y X,Y , etc., shown in Table 1.These parameters are then used (or updated if there are any significant changes) for formulating and solving the NRO and CSO problems.
• Step 2: Formulate and solve the NRO problem for optimal number of replicas of each multimedia content c i , based on the parameters in step 1.The objective is to maximize the average number of replicas for high hit rate.
• Step 3: Formulate and solve the CSO problem for optimal caching index u j,i and optimal sharing index v k,n , based on the parameters set in step 1 and optimal results of c i found in step 2. The objective is to maximize the overall system delivery capacity.
• Step 4: The MBS deploys the CSF to cache the multimedia contents in the proper FBSs and to share the downlink resources between the right CUs and TX-RX pairs for offloading with D2D communications.

B. HIT RATE
In the hit rate model, let c i be the number of replicas of the i-th multimedia content cached in all the FBSs, the average number of replicas per each multimedia content, which can be used to represent the hit rate performance, is computed by where r i = i −α I i=1 i −α , namely Zipf-like distribution [43], is the access rate (or popularity) of the i-th multimedia content reflected by the skewed access rate α ≥ 0 among the contents.α = 0 indicates that all multimedia contents have the same access rate of 1/I , while the higher the value of α increases, the higher the skewed access rate is.
Eq. ( 1), which is the objective function in NRO problem, is maximized by finding optimal values of c i for high hit rate.The NRO problem will be discussed in the next section.

C. CHANNEL AND SYSTEM DELIVERY CAPACITY 1) CHANNEL
Because the MBS is overlaid with the FBSs, the channel splitting and F-ALOHA [44], [45] are applied to control the crosstier and co-tier interference.Each D2D pair (i.e., TX and RX) can share the downlink transmission resource of any CUs.This resource sharing causes the interference effects of MBS on the RXs and of the TXs on the CUs.We denote G x,y X,Y as the channel gains between X and Y; here X ∈ {M, F, T} standing for {MBS, FBS, TX} and Y ∈ {C, T, R} standing for {CU, TX, RX}; x ∈ {j, n}, j = 0, 1, 2, . . ., J , j = 0 indicates the MBS, n = 1, 2, . . ., N and y ∈ {k, n}, k = 1, 2, . . ., K .G x,y X,Y is modeled by the exponential power fading coefficient h x,y X,Y and the standard power law path loss function g X,Y [45].Here, ξ is the path loss exponent, d is the distance between X and Y, and ||.|| is the Euclidean norm.

2) SYSTEM DELIVERY CAPACITY
To derive the system delivery capacity, we primarily analyze the signal to interference plus noise ratio (SINR) of CUs, TXs, and RXs in the sequel.
For CUs, the k-th CU can simultaneously share its downlink resource with the n-th D2D pair and receive multimedia contents from the MBS and FBSs.The SINRs of the channels from the MBS and FBSs to the k-th CU are given by where P 0 M is the transmission power of the MBS, G 0,k M,C is the channel gain between the MBS and the k-th CU, N 0 is the power of additive white Gaussian noise (AWGN), and v k,n is the sharing index used to indicate that the k-th CU agrees to share its downlink resource with the n-th D2D pair (v k,n = 1) or not (v k,n = 0).If v k,n = 1, the k-th CU is affected by the interference from the n-th TX of the n-th D2D pair with transmission power P n T over the channel gain G n,k T,C between the n-th TX and the k-th CU.In addition, u j,i is the caching index used to indicate that the j-th FBS makes a decision to cache the i-th multimedia content, P j F is the transmission power of the j-th FBS, and G j,k F,C is the channel gain between the j-th FBS and the k-th CU.
In (2), p n,i is the probability that the n-th TX decides to cache the i-th multimedia content defined by here a, b ∈ [0, 1], a + b = 1, and β n is the percentage of available storage of the n-th TX.It means that the n-the TX decides to cache or not depending on its storage condition and the access rate r i of the i-th multimedia content.Similarly, for TXs, the SINRs of the channels from the MBS and FBSs to the n-th TX are given by Considering the RXs of D2D pairs, they are served not only by the MBS, but also by the FBSs and TXs, the SINRs of the channels from the MBS, FBSs, and TXs to the n-th RX are therefore described in sequence as follows: and It is noticed in ( 9) that the n-th RX is affected by the interference from the MBS with transmission power P 0 M over the channel gain G 0,n M,R between the MBS and the n-th RX.
From ( 2)-( 9), by using Shannon-like capacity, the capacity of CUs, TXs, and TXs are respectively given by Finally, the overall average system delivery capacity to each requester (i.e., CU, TX, or RX) is shown as We observe that the overall average system capacity (13) can be maximized by finding the optimal caching index u j,i and optimal sharing index v k,n .This CSO problem will be formulated in the next section.

IV. NRO AND CSO PROBLEMS AND SOLUTIONS A. NRO
As we mentioned in (1), a high hit rate can be obtained by finding the optimal number of replicas of each multimedia content c i to maximize the average number of replicas I .To do so, we further take into account the constraints of storage of all FBSs; reserved throughput of MBS, FBSs, and TXs; and required throughput of all MUs.The NRO problem is formulated as below.max where the first and the second constraints are used to ensure that at least one replica of each multimedia content is cached in the FBSs and to limit the number of replicas of each (all) multimedia content(s).The third constraint is to avoid the wasted throughput, in case the reserved throughput (R i Res ) is greater than the required throughput (R i Req ), i.e., too many FBSs together with the MBS and TXs provide the MUs with replicas of the i-th multimedia content.The R i Res and R i Req for the i-th multimedia content are respectively given by where R i M , R i F , and R i T are the reserved throughput at the MBS, FBSs, and TXs for the i-th multimedia content to serve the MUs.
Substituting ( 16) and ( 17) for the third constraint of (15), we have By combining (18) and the first constraint of ( 15), the NRO problem can be rewritten as max where The linear programming optimization problem in ( 19) and ( 20) can be solved by using primal-dual interior point method (a variant of Mehrotra's predictor-corrector algorithm) [46], [47].It is noticed that the operator max in ( 21) is to guarantee that the upper bound C i of the first constraint in (20) cannot be less than 1.

B. CSO
Taking into account the constraints on the optimal number of replicas (i.e., c i found by solving ( 14) and ( 15)) and the target SINR γ 0 of CUs, the CSO problem is formulated and solved to maximize the overall system delivery capacity R in (13) by finding u j,i and v k,n .Mathematically, the CSO problem is expressed as follows: In (23), the first constraint is to make sure that the number of FBSs decides to cache the i-th multimedia content cannot exceed the optimal number of replicas c i of the ith multimedia content found by solving the NRO problem.The second constraint comes from (2) by letting γ 0,k,i M,C ≥ γ 0 .It is used to limit the effect of interference of D2D pairs on the CUs.In this constraint, to ensure high target SINR of the CUs by increasing γ 0 , the number of D2D pairs associated to each CU decreases.Finding the optimal caching index u j,i and optimal sharing index v k,n in ( 22) and ( 23) is equivalent to finding two optimal matrices u * J×I and v * K×N in two matrix search spaces: U = {u 1 J ×I , u 2 J ×I , . . ., u 2 J ×I J ×I } and V = {v 1 K ×N , v 2 K ×N , . . ., v 2 K ×N K ×N }, respectively.Exhaustive binary matrix search, which can be used to solve (22) and (23), is given in Algorithm 1.In Algorithm 1, the memory and time complexities, which depend on the total search space of U and V, are equivalent to O(2 J ×I +K ×N ).In dense 5G networks, the CSO problem is difficult to be solved by centralized search at the MBS.In this scenario, the search space is divided into multiple sub-search spaces, and then distributed exhaustive binary search of each sub-search space can be independently done by each FBS.Afterwards, the sub-optimal results from the FBSs are sent to the MBS for finding global optimal solution.

V. PERFORMANCE EVALUATION A. SIMULATION SETUP
For simplicity but without loss of generality, we deploy the system with important parameters listed in Table 2.The distances between the MBS and MUs, the FBSs and MUs, the CUs and TXs, and the TXs and RXs, are randomly distributed from 100m to 500m, 50m to 250m, 50m to 100m, and 1m to 50m, respectively.

B. PERFORMANCE METRICS 1) HIT RATE PERFORMANCE
To evaluate the hit rate performance of our NRO, we compare NRO to the other two schemes named equal number of replicas (ENR) and worst number of replicas (WNR).In ENR, the number of replicas of each multimedia content , while in WNR, c i WNR is inversely proportional to r i such that I i=1 c i WNR = I i=1 c i .We first evaluate the performance of NRO, ENR, and WNR versus the total caching capacity of the FBSs by changing ρ in the range from 1 J = 0.2 to 1 (20) and keeping α = 1.In Fig. 3, the NRO yields the highest average number of replicas for the highest hit rate compared to both ENR and WNR.The higher caching capacity of FBSs introduces a higher hit rate but getting saturated if each FBS caches all the considered multimedia contents.In comparison versus α  in the range from 0 to 2 and ρ = 0.5, the results in Fig. 4 show that while the ENR does not change and the WNR decreases with respect to the increase of α, the average number of replicas of NRO always increases to gain the best hit rate performance.In addition, by keeping α = 1 and ρ = 0.5, the proposed NRO also outperforms the ENR and WNR versus the number of FBSs (J ) and number of multimedia contents (I ) as illustrated in Fig. 5 and Fig. 6.The benefit of NRO can be achieved based on the fact that the number of replicas c i is found directly proportional to the access rate r i of the i-th multimedia content, meanwhile the ENR and WNR cannot do.Obviously, in Fig. 4 and Fig. 6, the hit rate of WNR degrades versus the increase of r i because c i WNR is inversely proportional to r i .

2) SYSTEM DELIVERY CAPACITY PERFORMANCE
The performance of the system delivery capacity is investigated by comparing our CSO to average delivery capacity (ADC), worst delivery capacity (WDC) schemes, maximum delivery capacity without MUs' caching and   downlink resource sharing (None-MUCS) [18], and maximum delivery capacity without femtocaching (None-FBSC) [48].In ADC and WDC, the system delivery capacity is respectively averaged and minimized over the feasible combinations of the total search space.Meanwhile, in None-MUCS and None-FBSC, the system delivery capacity is maximized over two scenarios: 1) without D2D caching and downlink resource sharing for offloading with D2D communications and 2) without caching multimedia contents in the FBSs.To mitigate the memory and time complexities of searching, we reduce the number of multimedia contents from 10 to 4.
We first evaluate the performance of the system delivery capacity versus the total caching capacity of the FBSs by changing ρ and letting α = 1.We do not compare our CSO to None-FBSC because changing ρ is meaningless due to J = 0.As shown in Fig. 7, the system delivery capacity of CSO, ADC, WDC, and None-MUCS obviously gets higher and gradually saturated when ρ increases for more number of replicas cached in the FBSs.In addition, we can see that because of without MUs' caching and downlink resource sharing, the None-MUCS results in lower system delivery capacity than the CSO, but it outpaces the ADC and WDC.
Fig. 8 plots the performance of system delivery capacity versus α.We can find that the system delivery capacity significantly decreases in case of None-FBSC, i.e., the None-FBSC is only better than the WDC.It means that femtocaching plays an important role in improving the performance of system delivery capacity compared to D2D caching and downlink resource sharing.It is observed in Fig. 8 that the average system delivery capacity of None-FBSC keeps unchanged because α mostly impacts on femtocaching rather than D2D caching and downlink resource sharing.To insightfully understand the impact of femtocaching on the performance of system delivery capacity, Fig. 9 further depicts the CSO, ADC, WDC, and None-MUCS versus the number of FBSs.Obviously, the results demonstrate that the larger scale of FBSs provides higher system delivery capacity performance, except for the WDC.In all cases, our proposed CSO always gains the highest performance compared to the others.The impact of the number of CUs, that are willing to share their downlink resources is also investigated as shown in Fig. 10.Fig. 10 reveals that the performance of the system delivery capacity is higher with respect to the increase of the number of CUs K , when more CUs share the downlink resources for offloading with D2D communications.Especially, when K = 0, the CSO and None-MUCS have the same result meaning that D2D caching becomes unuseful if there is no CU to share the downlink resource.Similarly, the results of WDC and None-FBSC are the same showing that without both femtocaching and downlink resource sharing make the performance worse.
Finally, we evaluate the performance of the system delivery capacity under the effect of the target SINR of the CUs by changing γ 0 from 0dB to 30dB.It can be seen in Fig. 11 that in case of CSO and None-FBSC, more D2D communications in close proximity are not exploited because they do not satisfy the target SINR of the CUs as formulated in the second constraint of (23).This in turn decreases the system performance if γ 0 increases.The increase of γ also removes  more infeasible matrices from the search spaces U and V that deteriorate the system performance.For example, when the TX-RX distance for D2D communications is longer than the TX-CU distance, it causes the CUs high interference, but not significantly improving D2D communications capacity.Therefore, the system performance of the WDC is higher when γ increases.The system performance decrease of CSO and increase of WDC keeps the system performance of ADC unchanged versus γ .In addition, the system delivery capacity of None-MUCS does not change because D2D caching and CUs' downlink resource sharing are not considered.It is clear to notice that the system performances of the CSO and the None-FBSC respectively converge on the system performances of None-MUCS and WDC when γ increases.

VI. CONCLUSION
We have designed a joint caching and downlink resource sharing optimization framework (CSF) that is built on exploiting the caching storage of all MBSs, FBSs, and TXs, as well as the downlink resource of the CUs in 5G networks to assist WMSNs in smart cities.The CSF consists of two optimization problems, namely number of replicas optimization problem and where to cache and who to share optimization problem, which are solved to gain a high hit rate and a high system delivery capacity.The simulation results show that our proposed design can serve the MUs the best system performance compared to other schemes.

FIGURE 1 .
FIGURE 1. 5G caching and downlink resource sharing model for WMSNs in smart cities.

FIGURE 4 .
FIGURE 4. Hit rate performance versus skewed access rate coefficient α.

FIGURE 5 .
FIGURE 5. Hit rate performance versus number of FBSs J.

FIGURE 6 .
FIGURE 6. Hit rate performance versus number of multimedia contents I.

FIGURE 9 .
FIGURE 9. Capacity performance versus number of FBSs J.

FIGURE 10 .
FIGURE 10.Capacity performance versus number of CUs K .

FIGURE 11 .
FIGURE 11.Capacity performance versus the target SINR of CUs γ .