Efficient Resource Allocation Using Distributed Edge Computing in D2D Based 5G-HCN With Network Slicing

Fifth Generation (5G) cellular networks aim to overcome the pressing demands posed by dynamic Quality of Service (QoS) constraints, which have primarily remained unaddressed using conventional network infrastructure. Cellular networks of the future necessitate the formulation of efficient resource allocation schemes that readily meet throughput requirements. The idea of combining Device-to-Device (D2D), Mobile Edge Computing (MEC), and Network slicing (NS) can improve spectrum utilization with better performance and scalability. This work presents a spectrum efficiency optimization problem in D2D based 5G-Heterogeneous Cellular Network (5G-HCN) with NS. Owing to the shortage of resources, we propose an underlay model where macro-cell users (MUs), small-cell users (SUs), and D2D users (DUs) reuse the resources while considering the effects of interference. The goal is to maximize the average network spectrum efficiency (SE) and throughput without degrading the system performance. The problem at hand is naturally a non-convex mixed-integer non-linear programming (MINLP) problem that is intractable. Therefore, we have suggested a distributed resource allocation strategy with an edge computing (DRA-EC) approach to find the sub-optimal solution. In distributed augmented Lagrange method, each edge router located at BS will solve its problem locally, and the consensus algorithm will find the global solution using these local estimates. The central slice controller will cut the customized network slices according to the bandwidth requirements of each user type with optimized spectrum information. The simulation outcomes prove that our proposed method is near the central optimization scheme with low computational complexity. It is much better because it reduces the computational time and system overhead.


I. INTRODUCTION
For 5G and beyond 5G, the elastic redesign of conventional networks is expected to shift the pattern with which human beings and machines interact. Ericsson Mobility Report [1] predicts that out of ten, every fourth user will have 5G mobile subscriptions by 2026, which is about 60% of the world's population. 5G cellular networks will have enhanced speeds and a minimum delay than the previous generations [2].
The associate editor coordinating the review of this manuscript and approving it for publication was Peng-Yong Kong .
The spectrum shortage due to full occupancy of frequency bands is the main hurdle behind 5G cellular networks. The major challenge in research is assigning the resources efficiently that will optimize the spectrum utilization [3]. The scarcity in the spectrum is an outcome of inefficient and random spectrum allocation techniques. HCNs comprising macro-cells underlaid with multiple small-cells offer tremendous capability to improve the reuse of frequency and network capacity [4]. Furthermore, D2D-based communication offers a promising solution as it remains the primary method for improving the performance of 5G cellular networks.
The concept of D2D is to allow direct connection among the devices that are close enough with very little or no BS involvement. Therefore, this is an important technique to offload the BS traffic [5]. Due to proximity, the users in D2D communication have low power, and less transmission delay, resulting in increased SE and throughput. Examples include sharing files, audio or videos, online gaming, disaster management, and traffic offloading. However, the integration of D2D in the system opens many challenges, including modeselection, energy consumption, device discovery, interference, mobility management, and network security [6].
The exponential increase in the number of devices is a test for future research due to their diverse needs of reliability, speed, and latency [7]. For this, NS is the distinct characteristic of 5G system architecture that creates flexible logical networks over typical hardware infrastructure [8]. With the continuous progress in 5G, NS will be the future's next big thing enabling service-based customized end-to-end logical networks called network slices [9]. Slices can be allocated depending on specific QoS like throughput, latency, or reliability [10]. The core reason behind the prevalence of NS today is the reduced system capital expense (CAPEX) and operational expenditure (OPEX) because of efficient spectral utilization [11], [12]. 5G NS facilitates the customers to enjoy the processing of data and other services that have a substantial commercial perspective [13].
MEC is an evolving paradigm. It enables the central cloud computing network functionality at the edge node proximal to the end devices. MEC can provide an advantage in the effective utilization of system backhaul, computational, and storage resources. The researchers are expecting that from 2020; the edge nodes will manage about 45% of the data instead of a central cloud system [14]. MEC can optimize the network resources by processing and managing the data at the edge server before sending it to the central cloud. This will result in offloading [15] with improved system performance [16].
The latest emerging idea is to integrate D2D, NS, and MEC technology in future network designs, as proposed in our previous work [8]. In this work, we have proposed a system to optimize the SE and throughput in D2D and NS-based 5G-HCN by using the distributed MEC solution. This system will then send the optimized value of SE to the central network slice controller that will cut the network slices according to the data received from the edge layer. The goal of this research work is to solve the problem of resource allocation in 5G-HCN using edge computing, which is a perfect option instead of a central scheme because it will reduce the computation time and offload the system resources.
Section II discusses the related work, and Section III depicts the gaps in research and the motivation of our work. Then Section IV is about our main research contributions. Section V explains in detail the proposed system model. Further, Section VI demonstrates the problem formulation and optimization. Section VII derives the expression of the proposed technique for solving the optimization problem. Section VIII is related to simulation results and discussion. Finally, Section IX is on conclusion and future recommendations.

II. RELATED WORK
5G with HCNs design has emerged as the promising topic of research due to their enhanced capability of resource management and utilization [17]. Recently, work done in [18] provided the detailed survey on resource allocation in 5G HCNs with an explanation of existing literature, future trends, and possible challenges. The authors in [19] proposed a heterogeneous network scheme that guaranteed the QoS and fairness of all users while minimizing the interference. Similarly, the work proposed in [20] investigated the resource allocation scheme in heterogeneous networks considering the system robustness and interference efficiency. In [21], the researchers optimized the robust energy efficiency problem with security information.
Many researchers have studied and proposed techniques to meet the challenges of resource allocation and managing the ever-increasing network load demands because of the spectrum scarcity [22]. Heterogeneous network deployment with a macro cell and many small cells can improve the spectrum efficiency [23], [24]. The work in D2D communication has gained researcher's attention from the past few years with the evolution towards 5G [25]. There are two categories of D2D communications modes: licensed and unlicensed bands. The licensed frequency bands can be further divided into two types based on the frequency sharing method among the cellular users and D2D as underlay and overlay mode [26]. The proposed work is based on the underlay mode in which the cellular and D2D users share the frequency/channel resulting in interference which is the major problem in the heterogeneous environment for achieving the spectrum efficiency [27], [28]. The work done by [29] is to increase the capacity by efficient spectrum allocation using the coalition game to overcome the interference. The research in D2D was initially on conventional networks, but the works from the past few years have shown tremendous growth of adding them in virtualized networks [30]. The study done in [31] was on resource sharing in D2D based systems, [32] investigated D2D systems using joint spectrum and power assignment for both central and distributed techniques for resource allocation. Similarly, [33] proposed a semi-decentralized approach to maximize the sum rate considering interference. The MEC and D2D are essential technologies for offloading the high data rate traffic from the central network. [34] investigated MEC-D2D combination to maximize the no. of supported devices. [35] worked on D2D based 5G heterogeneous networks using MEC. The authors in [36]- [38] investigated the advantage of using MEC to improve the system performance and minimize the delay.
Many works have been done to achieve efficient radio resource management in virtual networks [39], [40]. Existing literature on NS has two main categories: (1) Infrastructure based slicing and (2) Resource spectrum-based slicing. The work proposed in [41] was to maximize the profit of MVNO by joint power allocation and slice resource allocation considering the backhaul capacity and user's QoS. [42] proposed the resource (power and channel) allocation techniques to optimize the network throughput in multi-slices and multi-user cases. These works [41]- [43] were better in performance, but the approaches burdened the central controller because each slice must allocate resources individually. In [44], the authors proposed the virtualization framework for resource block allocation to its users using the auction-based game method but did not consider spectrum efficiency with D2D and edge computing. [45] discussed two cases of slicing; one is based on QoS to create dedicated slices depending on different services, and the second on infrastructure sharing in which the resource sharing is among the multi-tenants.
The work in [46] considered hierarchical resource allocation using NS in fog networks which overcome the issues of core layer load in which the global resource manager first assigns resources to the local resource manager in the slices, and these resources are then efficiently allocated to users using Stackelberg game. This scheme optimized the spectrum efficiency, but D2D and edge computing were missing. The problem of optimizing energy efficiency in the wireless heterogeneous virtualized network was proposed in [47]. However, this work focused on maximizing the revenue of infrastructure providers (InPs) and mobile virtual network operators (MVNO) instead of assigning resources by improving spectrum efficiency and adding D2D. In [48], the authors introduced a resource management technique in multi-tenant cloud-based radio access networks to perform the resource slicing considering QoS and interference, but this work also did not consider D2D communication and spectrum efficiency optimization. Similar work was proposed in [49] for resource slicing in two-tier HCNs and allocate the resources based on QoS. This scheme efficiently computed the optimum bandwidth slicing ratio in a virtualized HCN but did not use an edge computing-based approach with D2D for spectrum efficiency optimization. The work proposed in [31] investigated the centralized method of maximizing the D2D pairs sum rate without disturbing the data rate requirements of CUs using subchannel sharing, but it did not consider the HCN with NS and distributed computing. In [33], the authors proposed the semi-decentralized method of optimized resource allocation and power control with interference-aware D2D setup. However, HCN and NS with edge-based computation were missing in that work.
All the research works described above on 5G cellular networks with network slicing were mainly focused on increasing the overall system utility and revenue. Primarily, the researchers goal was to design such a system that would benefit business models. None of them considered improving the spectrum efficiency with D2D based system for network slicing and to solve the resource allocation problem using distributed edge based computing.

III. RESEARCH GAPS & MOTIVATION
The key motivation towards this research is that to the best of our knowledge, there is no single work on improving the spectral efficiency in 5G-HCN with D2D and NS. Furthermore, to solve such a problem using distributed MEC technique. Previous works mainly exploited the SE in these technologies individually or with two of them. Like resource management for 5G-HCN with or without D2D, with or without NS, and with or without MEC. Similarly, D2D with virtualized networks and D2D with MEC scenario. Therefore in [8], we have proposed an architecture that will integrate D2D, MEC, and NS technology to meet most of the requirements of future 5G networks. All future research focuses on designing techniques that wisely use the spectrum. D2D and network slicing are the critical enablers for achieving this for enhanced system performance and reduced cost (less hardware). The main concern is the interference management so that resource allocation will not affect the SINR (Signal to Interference and Noise Ratio) requirements of users.

IV. CONTRIBUTION
The significant contribution in this work is that no previous research considered solving SE maximization combining D2D, NS, and MEC in 5G-HCNs. This work is the first attempt to solve such a problem using distributed edge computing optimization approach called DRA-EC. Previously, the researchers have mainly proposed resource allocation by centralized methods that burden the central system and cause a delay in transmission. Our proposed scheme solves the problem of ever-increasing spectrum demand in less time.
• To develop a system model for D2D based 5G-HCN with randomly distributed users (MUs and SUs). The proposed model has two layers: the upper and the lower layer.
• In the upper layer, firstly, a less complex and sub-optimal solution solves the base station to user equipment (BS-UE) association problem using a greedy algorithm based on achievable SNR (Signal to Noise ratio). Secondly, the D2D mode switching problem is solved using a joint distance-dependent algorithm.
• In the lower layer, we formulate the resource allocation problem using the distributed edge computing method to maximize the throughput and spectrum efficiency of the 5G HCN considering the interference and SINR constraints.
• The proposed problem is a non-convex MINLP problem transformed and decomposed into a convex problem. The problem is then solved by using the augmented Lagrange multiplier and consensus algorithm. The simulation results are compared with the other schemes and concluded that the computation time and load improves considerably.

B. CHANNEL CHARACTERISTICS
The total channel bandwidth is distributed into several subchannels, each of them occupying a band of 180kHz frequency [50]. The Noise power for the system is Additive White Gaussian Noise (AWGN) represented by σ given as: N O is noise power spectral density, NF represents noise figure, and β is the sub-channel bandwidth.
Shadowing and Rayleigh random variables are used for channel modeling to evaluate the fading in combination with the path loss models between transmitter and receiver. The distance-dependent path loss models considered are Okumu-raHata model [51]: where PL k , PL j and PL d p is the path loss received by macrocell, small-cell and D2D users respectively. d is the distance from the BS to its associated UE. In case of D2D, this is the distance between the D2D transmitter and receiver.
The complete system is in frequency reuse mode with MBS and SBS sharing a similar set of sub-channels denoted by R = { 1, 2 . . . r, . . . N }. However, we have assumed that the same type of UEs (user equipment) associated with one BS do not reuse the sub-channel. Therefore, alleviating the co-tier interference, but the cross-tier interference is there. For each sub-channel r ∈ R, the predefined threshold level for maximum allowable interference r Max is set to protect the SINR of each UE. The CSI (channel state information) from feedback control channels decides this threshold value. The sub-channel will be assigned only if the cross-tier interference is below r Max . Let P m ,P j , and P d is the maximum allowable transmission power of MBS, SBS, and D2D, respectively.

C. BS-UE ASSOCIATION
To solve the upper layer, the first step is the BS-UE association. The purpose of this is to associate the UEs with their respective BS (base station) (MBS or SBS), which can deliver high channel quality. The wide-band SNR received by UE u associated with BS c is estimated as follows: where c = 0, if the BS is MBS and c = 1, if the BS is SBS, P c,u is the transmission power from base station to UE, g c,u denotes the channel gain from BS to UE and σ represent the channel noise. For any user u ∈ {U }, the achievable data rate, R c,u is given by Shannon Equation: β is the sub-channel bandwidth. Next, the BS-UE association problem formulation can be performed as: subject to where Q tot in eq. (8) refers to the total available system capacity (backhaul/ fronthaul), and it ensures that the total UE data rate is bounded by its capacity on the link [48]. The constraint in (8) guarantees that the backhaul/ fronthaul link can at least carry the minimum data rate required by the associated UEs, (9) ensures that each BS can only attach one UE at a time. Proposition 1: The optimization problem (BS-UE association) depicted in (7) is NP-complete 0-1 multipleknapsacks [52].
Proof: Refer to Appendix A. The dynamic methods for programming are not efficient for a multiple-knapsack case because of larger computational complexity [48]. To find the feasible sub-optimal solution, we have proposed a greedy method as in Algorithm 1. The UEs are associated with that particular BS which provides them with the highest SNR. For that purpose, we compute the achievable SNR from all the base stations to that particular user. The BS that delivers the highest value of SNR will be nominated to assess the (8). If it satisfies, the user will associate itself with the desired BS. Otherwise, it will select the next highest value of SNR from BS to UE and repeat Step-2: Find the user association with cell, SNR max a u c,u end the process for all the users. We assumed that every UE must be attached to the BS. Q rem,c in algorithm 1 represent the remaining system capacity. It is basically the variable in which the updated value is stored. Initially, Q rem,c = Q tot which means that the remaining system capacity is the same as the total available capacity. Once the process of BS-UE association begins, the value of Q rem,c starts decreasing, and the value is updated in this variable. This process continues until the full system capacity is utilized or all the users are associated with their respective BS. The constraint (8) must fulfill for the algorithm to run smoothly.
The BS-UE association will result in two types of UEs. The set of K macro-cell users (MUE) K = { 1, 2 . . . k . . . K} associated with MBS and the set of L small-cell users (SUE) L = { 1, 2 . . . l . . . L} also associated with their respective SBS.

D. D2D MODE SWITCHING
The next step is to determine the possible D2D pairs in the system. This is executed by D2D mode switching as in Algorithm 2. U tot refers to the total users in the system before D2D mode switching. U tot = U mbs + U sbs which means total users in the system are equal to no. of MBS and SBS users respectively. R tot refers to the total no. of available resources (channels) in the system and R tot < U tot means that the total available resources are less than total users in our model.
D2D mode selection will switch particular users from cellular to D2D mode based on distance criteria. Using the Euclidean distance calculations [53], the algorithm calculates the distance of each user u from all the other users and generates the list of users that are equal to, or below certain threshold D2D distance d thres . If the two users are in the range of d thres , the resource is available and their link gain is higher only then they are eligible to switch to D2D mode; otherwise, they will remain in cellular mode. The value of d thres is set initially when the system model is defined and it is not fixed and can be varied for analysis. The set of D DUs is given as: Step-1: Find the proximal distance d between devices if resource r is available if D2D mode link gain is higher then the UE U will select the D2D mode else the UE U will select the cellular mode end end end After the D2D mode switching, we now have three types of users (1) MUE, (2) SUE, and (3) DUE.

VI. PROBLEM FORMULATION
This section formulates the resource allocation problem for efficiently assigning spectrum to each user considering their interference and QoS requirements as all the users reuse the spectrum resources [54]. The respective resource allocation indicator functions are given as: The SINR λ r k received by k th MUE associated with MBS using r th sub-channel is given as: where r k represents the interference experienced by MUE. P m , P j and P d p is the transmit power of MBS, SBS and D2D VOLUME 9, 2021 user respectively. g r m,k is the channel gain from MBS to MUE k, g r s,k , g r d,k is the gain from all SBS and D2D transmitters using same sub-channel r, σ 2 is noise.
Similarly, the SINR λ r j,l received by l th SUE associated with j th SBS using r th sub-channel is given as: λ r j,l = a r j,l P j g r j,l P m g r m,l + s=1→L s =j P s g r s,l + ∀ d P d g r d p ,l + σ 2 (19) where, r j,l represents the interference experienced by SUE. g r j,l is the channel gain from SBS to SUE l, g r m,l , g r s,l , g r d p ,l is the channel gain from MBS, other SBS and D2D transmitter to SUE l using resource r.
And the acheivable SINR λ r d p of d pth D2D user using r th sub-channel is given as: where, r d p represents the interference experienced by DUE. g r d p ,d r is the channel gain between D2D pair, g r m,d p , g r j,d p is the channel gain from MBS and SBS to d pth D2D user using same sub-channel r.
Thus the total achievable throughput by MUE from MBS, SUE from j th SBS and DUE respectively is given below: β in equation (23), (24) and (25) is the same sub-channel bandwidth for MBS and SBS which is 180KHz.
The spectrum efficiency (SE) in each case can be represented in equation (26), (27) and (28): The decision variable δ d p indicates if any user will select the D2D mode or not.
1 if any user d p uses the D2D mode 0 otherwise The decision variable δ c represents if any user is in cellular mode.
In case the small cell user is considered, δ c transforms into δ j while for macrocell user it is δ k .

A. OPTIMIZATION PROBLEM
Objective is to maximise the average system throughput by efficiently allocating spectrum to all the users considering interference. The optimization problem P1 is given as: subject to: The problem P1 in (31) is a maximization of the overall system throughput. The constraint in (32), (33) and (34) ensures that one type of user can reuse up to one channel resource and one channel resource can be reused by at most one user type. The constraint (35), (36) and (37) limits the interference and guarantees that the interference experienced by each user type reusing sub-channel r must be below maximum allowable value. Therefore, it must meet each type of user (MUE, SUE, and DUE). The constraint (38), (39), and (40) is mode selection indicators that can be either 0 or 1 if the user is in cellular or D2D mode.

VII. PROPOSED TECHNIQUE
In order to examine the complexity of P1 in (31), we considered: Proposition 2: The optimization problem in (31) is NP hard and difficult to solve in direct way.
Proof: Refer to Appendix B. P1 is a non-convex MINLP (mixed-integer non-linear) programming problem that is computationally problematic. Therefore, finding a solution for such a problem is unfeasible [55], [56]. To find the solution, we must convert it into a convex optimization problem. For our system model, the size of the solution becomes significant with the increase in no. of small cells and users. Therefore, we have proposed the distributed optimization method (DRA-EC) called the distributed resource allocation using edge computing. Recently, the distributed optimization-based solutions have emerged as the highly prevalent research area [57], [58]. Furthermore, to solve such a problem using Lagrange multiplier has been proved in [50] and [60].
Therefore, we transformed the original problem P1 to make it separable, and multiple local copies of global variables are defined. We can now divide the optimization problem (31) into three subproblems based on three types of users in the system. Let x, y, and z represent three subproblems: macro-cell, small cell, and D2D case, respectively. x represents the data rate equation for a macro cell, y for a small cell, and z for D2D users. The idea of dividing this is that we are solving the optimization problem in a distributive manner. Each edge router located at each type of base station will solve its optimization problem locally.
Consider that we have E edge servers located at each BS used to solve the distributed optimization problem. Hence the overall problem (31) become divided into E sub-problems.
When we decompose the problem, the constraints from (35) -(37) become local constraints which means that each edge router will solve its optimization problem locally considering these interference constraints. These local constraints are now transformed as below: E denotes the edge router. Each edge router located at each base station will solve its optimization problem considering the QoS requirement of users.
The constraints from (32) -(34) become global constraints and can be defined as consensus constraint.
subject to u∈U a r u ≤ 1, ∀ r ∈ R, ∀ u ∈ U In our solution, we first find the local approximate of the previous global constraint functions (35) - (37). An augmented Lagrangian multiplier method is used for each local constraint to find the local maxima. Then the consensus-based algorithm is used with finite steps among iterations to gain a joint agreement on these local approximates [61], [62].
Proposition 3: The augmented Lagrangian multiplier method with consensus algorithm converges at a faster rate practically as compared to other distributed techniques.
Proof: Refer to Appendix C. Remarks: The theoretical analysis confirms that the given algorithm approach converges at a rate of O(1/k) and produces a steady-state error that is manageable by various consensus-based steps.

A. SOLVING LOCAL VARIABLE
From above discussion, we get the local constraints from (46) -(48) solved by each edge server or agent individually. The edge servers will optimize the problem to find local maxima. Following augmented langrangian steps, the partial lagrangian for MUE can be represented by: Partial Lagrangian for SUE can be represented by: r∈R L r (y r j,l , η r l ) (52) r∈R L r (y r j,l , η r l ) = j∈J l∈L a r j,l βlog(1 + λ r j,l ) Partial Lagrangian for D2D users can be represented by: where η r k , η r l and η r d p are Lagrangian multipliers. Overall Partial Lagrangian can be represented by: where u ∈ {k, l, d p }

B. SOLVING GLOBAL VARIABLE
In a multi-agent system, each agent must have the information of global constraint. The global constraint agrees upon the consensus by using the local estimates as calculated above [61]. For our system, the global constraint 49) is coupled, and all agents must cooperatively determine it by administering mutual consensus. Consider the reformulation of (53) in closed form as follows: where for all edge servers k = 1, 2 . . . e, y k is decision vector of each edge server and c k is it local cost. While the coupled constraint in (58) can be expressed in closed form as: The results of the optimization problem give us optimum throughput and SE values through the distributed method. Each edge router solves its resource optimization problem, like for MUE, SUE, and D2D users. These resulting values are then used by the slice controller, specializing in creating and deleting slices. The slice orchestrator will then cut the network slices according to the network requirements and optimum spectrum allocations.

C. COMPUTATIONAL COMPLEXITY ANALYSIS
The computational complexity of any algorithm can be calculated depending on the overall number of flops it takes to execute the process. The work in [63] explains in detail the representation of a flop by simple floating-point operations. Each operation in the algorithm has its subsequent number of flops: multiplication, addition, division, logical operator, assignment operator, matrix multiplication, Etc. To compute the complexity of our proposed scheme DRA-EC, we first have to determine the number of iterations, variables, and constraints. As explained in Section IV our system is divided into two layers. The upper layer complexity can be analyzed from Algorithm 1 (BS-UE association), whose complexity can be counted as O(|C||U|) and from Algorithm 2 (D2D mode switching), the complexity is: O(|R||U|). The lower layer involves the resource allocation method using augmented Lagrange multipliers defined as S and T , respectively. The complexity of this during each iteration can be computed for channel assignment as O(|K||M||N |) operations. Accordingly, the updates in Lagrange multipliers need O(|K||M||N |) operations according to (51), (53) and (54). Here, T is a polynomial function for sum iterations O(T (|K||M||N |) 2 ). Hence the total computational complexity of the proposed algorithm is counted as O(ST (|K||M||N |) 2 + 3|D|).

D. CONVERGENCE ANALYSIS
The convergence of an algorithm depends on the number of iterations it takes for the output to become closer and closer to a particular estimate or limit. For iterative algorithms, there is a separate error in each stage, and the algorithm's goal is to minimize the error. The algorithm converges when the error becomes smaller and smaller value. The global optimum of an algorithm is when the system has the least possible error. Such an algorithm converges to the optimum global value.The computation of feasible region or global maxima is challenging for resource allocation problems in cellular networks. At the same time, it is significant to analyze in order to guarantee the algorithm's convergence. We proposed the DRA-EC scheme, the process of updating the spectrum allocation and Lagrange multiplier is repeated until the lowest possible error, and the algorithm converges. Proof: Please see the reference [64] for the proof of algorithm convergence.
Our proposed distributed algorithm converges at a faster rate than the central algorithm because it is tough to compute the global maxima of a single complex central system with different types of users and their needs. Such a system will take a much longer time to converge, or in some cases, it may diverge. Therefore, we have distributed this complex system so that edge routers present at each type (macro, small and D2D) will compute their local maxima first. All these tasks are done in parallel, and the values obtained from local maxima are then analyzed to find the global maxima. Thus this algorithm converges faster with fewer chances of errors.

A. SIMULATION PARAMETERS
In this work, we have considered a single cell 5G-HCN that consists of one MBS located in the center with four SBS randomly distributed within the cell. We assumed that the total no. of users in the system is 200. Each BS can be associated with a maximum of 40 UEs. The coverage radius of MBS and SBS is 1000m × 1000m and 200 m, respectively. The channel is assumed to be with zero-mean and unit variance. The path-loss models considered are discussed in Section V-B [51]. The summary of performance parameters used in simulations are in Table 2.

B. RESULTS AND DISCUSSION
This subsection demonstrates the theoretical expressions numerically to evaluate the simulation results. The simulations are performed on MATLAB latest version using 1000 Monte-Carlo simulations. We used Intel(R) Core(TM) i5-6200U CPU @ 2.40GHz 16GB RAM with 64-bit Windows 10 operating system. The proposed setup is for maximizing the overall system throughput and spectral efficiency.
Initially, we evaluate the performance of the proposed DRA-EC scheme in 5G-HCN without using D2D users. Fig. 2 is the graphical representation of average throughput vs. no. of cellular users in the system. It shows that the average system throughput value for both MBS and all SBSs increases with the increase in the no. of users, and this value is highest for MBS users because of its high transmission power (43 dBm). The transmit power of all the SBSs is the same (30 dBm); that is why their average received throughput values appear identical but actually, they are different. By zooming the plot, we can conclude that values are very close, with a slight difference.
Similarly, Fig. 3 illustrates the comparison of average SE achieved vs. no. of cellular users in each BS (MBS and SBS). It is clear from the plot that the average SE curve for both  MBS and all SBSs increases with the increase in the no. of users. As explained above, the higher value of MBS is due to the more significant value of MBS transmit power compared to SBSs. The portion of the graph is zoomed to show that there is a difference in values of each SBS, but they are very close. Fig. 4 represents the analysis of the proposed DRA-EC scheme with D2D users. In Fig. 4, we have compared the effect on the average throughput by increasing the no. of D2D pairs in each BS. We varied the no. of D2D pairs allowed in each BS from 0 to 10 and then computed the average received throughput in each case. The rest of the parameters are kept the same as in Table 2. We observed that the system throughput and efficiency increase by adding the D2D pairs to the cellular network. Further, we concluded that the trend increases with the number of D2D pairs in the system because more users can reuse the spectrum. It is noted that the cellular VOLUME 9, 2021 users must meet the minimum SINR criteria when increasing the number of D2D pairs.
We compared our proposed DRA-EC scheme with other centralized and distributed methods to evaluate the performance.
1) RA-CO: Resource allocation with central optimization. We performed a simulation analysis of our proposed system model using central optimization in this scheme. The rest of the parameters are the same as with distributed. 2) RA-SD [33]: This scheme is on resource allocation using a semi-distributed method for D2D based cellular networks. 3) JSPA-CO [31]: Joint spectrum and power allocation scheme to observe the system performance by using a centralized optimization scheme. 4) JSPA-DO [31]: The decentralized approach to compare the system (joint spectrum and power allocation) performance in D2D based system. 5) RO: Random optimization scheme is designed by randomly assigning resources without optimization technique. Fig. 5 demonstrates the comparison of average throughput with no. of users. We considered six different schemes for evaluation. It is concluded from the results that our proposed scheme DRA-EC with D2D users is near to the RA-CO. The average throughput of both these schemes is highest compared to others due to heterogeneous and D2D based network design. The throughput value decreases when DRA-EC and RA-CO schemes are considered without D2D. The curve for JSPA-CO has the lowest value because it is based on a single macrocell instead of a heterogeneous network design. The significance of this figure is that the heterogeneous cellular network setup with macrocells, small cells, and D2D is most efficient in managing the spectrum.   no. of D2D pairs. We compared our results with different schemes as mentioned earlier for evaluation. It is concluded that our proposed system outperforms in performance and SE compared to all the other methods except RA-CO. The SE [b/s/Hz] values in the DRA-EC scheme are very close to the central optimization, which is fair enough. However, our proposed distributed system (DRA-EC) performs better than the central (RA-CO) due to its computational efficiency. All the calculations will be done in parallel by edge computing in each BS and then sent to the central controller in the distributed scheme. This will save time and reduce the load on the central system. On the other hand, the central optimization method will take more time in computation, and the entire load is on a central system. Fig. 7 demonstrates the relation of average SE achieved vs. D2D transmit power. The results of the proposed system are  compared with other schemes. We varied the value of transmit power from -5dBm to 30dBm, and the rest of the parameters are the same as in Table 2. The SE for all the cases increases with the increase in D2D transmit power, and the value is highest for both proposed schemes DRA-EC and RA-CO. The results of distributed optimization are very close to the central optimization scheme. However, the power should be increased in a controlled manner because above a specific value, it will start interfering with the cellular users and will degrade their performance requirements. Fig. 8 represents the analysis of computational time taken by both the schemes DRA-EC and RA-CO. The plot shows the trend of algorithm computation time vs. no. of iterations. It can be concluded that the time taken in DRA-EC is significantly less than RA-CO because the latter performs all the processing tasks centrally. This will burden the system by increasing computation complexity. On the other hand, in DRA-EC, each base station has its edge computing server to compute the tasks in parallel. Thus the optimization problem is solved in a distributed manner so that it will take less time.

C. PERFORMANCE EVALUATION
We analyzed in detail the performance gap of both algorithms RA-CO (central) and DRA-EC (distributed) theoretically and analytically. The primary significance of our proposed distributed scheme (DRA-EC) is that its performance results are very close to the central optimization, taking less computation time than other methods. From the results in Fig. 6, Fig. 7 and Fig. 8 we have proved that our proposed scheme is better in performance as compared to others. In RA-CO, the central slice controller gathers data like CSI and interference from BS before the resource allocation. This process is very complex for networks with constantly varying CSI, and when this information exchange has to repeat many times, that will burden the network. All the processing performed is central, which will take a longer time to execute and will slow down the system performance. On the other hand, the computational load in our proposed (DRA-EC) scheme is substantially less. Each BS has an edge router in this scheme that collects the CSI (interference) at the edge layer and optimizes its resource allocation problem locally. The computational tasks are distributed in parallel, and the information needed at each edge router is only from its respective link. The central controller will then cut the required optimized network slice according to the results received from each edge server. This method will save much time and offload the core network, which will considerably improve system performance. In the RA-CO approach, the system must know the interference information among D2D pairs and cellular users (MUs and SUs) to D2D receivers. This data collection is very complicated practically and will involve much overhead, while this data is collected locally only in DRA-EC. The iterations might cause additional overhead, which is pretty low as the BS is only interested in data collection and broadcasting.

IX. CONCLUSION AND FUTURE RECOMMENDATIONS
This work presents a distributed scheme with resource (spectrum) optimization in D2D based under-laying 5G-HCN with network slicing. The complete system reuses the spectrum while considering the effect of interference upon allocating resources to each type of user (MUE, SUE, and DUE). We have proposed a multi-layered framework for our model comprising upper and lower layers. The upper layer solves the UE-BS association problem using a greedy algorithm and a D2D mode switching problem using a distance-dependent algorithm. The lower layer solves the spectrum optimization problem of a complete system with the DRA-EC approach. The proposed scheme distinguishes itself from existing models because distributed edge computing devices solve the underlying resource optimization problem. This approach reduces the load of a central controller and minimizes the computational time. The results of SE and throughput are very close as in the centralized process which is good enough. After optimization, these results can be used by central slice controller for efficient utilization of spectrum by slicing the network according to system demands. Our proposed scheme can be extended to function at the core layer of the network to relate backhaul capacity with spectrum efficiency and develop techniques for efficient network slicing. In the future, we can create application-based scenarios for D2D and MEC platforms such as content caching and information-centric networks. Furthermore, we can formulate new intelligent schemes of resource allocation in 5G networks leveraging machine learning and deep reinforcement learning techniques.

APPENDIX A ''PROOF OF PROPOSITION 1''
The 0-1 multiple knapsacks are defined to be as a combinatorial optimization problem in mathematics as follows: Definition: Let us assume that V and W are the sets of items and knapsacks, respectively. Each item i V has a weight of y i and provides a non-negative profit value of z i , whereas each knapsack j W has a capacity of Y j . The solution to a given problem is to fill all the knapsacks with the available items. This technique will maximize the overall profit for each knapsack without surpassing the total capacity. By evaluating the above definition for Eq. (7), we get variables mapping in terms of our problem as: V = U a , W = C, i = u, j = c, y i = R min,u , Y j = Q § , z i = c,u .

APPENDIX B ''PROOF OF PROPOSITION 2''
Let us suppose that the possible (a k ), (a j,l ), (a d p ) and (δ) are given.
If we consider Eq. (31) subject to (32) - (40). Obviously, the proposed function and all its constraints are smooth. The throughput equations R k , R j,l and R d p are non-linear logarithmic functions with non-convex constraints (35) - (37). Therefore,(31) is a smooth, non-linear and non-convex optimization problem. These types of programming problems have been demonstrated as commonly NP-hard and are computationally troublesome [55]. Moreover, the problem can be regarded as a throughput (Data-rate) maximization problem which has already been proved to be NP-hard in [56] and [65] that further justified the NP-hardness of (31). [61] investigated the solution of multi-agent constrained problem using the distributed algorithm. They proved that the method of augmented Lagrangian multiplier method converges at a faster rate practically as compared to other distributed techniques [62]. The convergence relies on the separability of the global constraints into local constraints. Once we find the local maxima/minima, then to achieve the global maxima, we use the consensus-based algorithm. It is a method to attain an agreement on a particular value between various distributed procedures. Consensus is built in a multi-agent system to ensure the reliability of a system. Finding Solutions for such types of problems are significant in distributed and multiple nodes systems as proved in [61]. Similarly, our proposed approach can solve this following these steps.