Study on the User Density Identification via Improved Whale Optimization Algorithm in Device-to-Device Communication

. The present study proposes a new algorithm for device-to-device (D2D) user density identification in a 5G network based on resource allocation. The method initially established a multiobjective optimization function that calculates system throughput and quality of service (QoS) of D2D users. The optimal resource allocation result of the multiobjective function is obtained via the improved whale optimization algorithm (IWOA). System throughput after resource allocation exhibits a linear relationship with the number of users. Therefore, the D2D user density areas are accurately identified via the throughput value. The simulation result reveals that the accuracy of D2D user density identification reaches 95%.


Introduction
With the popularization and performance improvement of smartphones, it is important for a 5G network to satisfy individuals' demands for ultrahigh tra c density and connection density.Conversely, it is necessary to consider the e ect of di erent resource allocation strategies under di erent scenarios and tra c loads [1].e resource allocation method of device-to-device (D2D) technology in D2D and cellular hybrid networks improves system throughput and decreases transmission delay, and D2D technology allows adjacent users to directly communicate.
e transmitting power of the node is low and can eliminate self-interference and solve the resource allocation problem in crowd-gathering scenarios [2], and throughput after resource allocation e ectively re ects regional D2D user density.us, the performance of the resource allocation algorithm directly determines the accuracy of the D2D user density.
Currently, the main achievements of extant studies on D2D resource allocation technology are as follows.e study [3] considers a communication scenario, and each D2D technology can reuse a cellular resource.e study proposes a method to solve the optimal power allocation scheme via establishing an optimal objective function.
e study [4] examines a scenario in which a pair of D2D multiplexers reuses a cellular downlink resource.Additionally, the study proposes a resource allocation method based on user interrupt probability and connection probability to maximize system throughput.e study [5] proposes a new resource allocation method based on the interference control mechanism of DT maximum/minimum power standard, and this decreases the interference of hybrid cellular networks.e study [6] proposes a method that guarantees the quality of service (QoS) although the method does not improve the throughput.e study [7] proposes the resource allocation method under a 28 GHz bandwidth, and this improves system throughput via limiting the interference value although it does not signi cantly decrease interference.
e study [8] proposes an adaptive power control method based on the cellular user interference threshold that maximizes energy e ciency under the condition of satisfying the minimum QoS of D2D users.In [9], the resource allocation problem in the underlying cellular network of D2D communication was de ned as a game of alliance formation, and the power allocation was optimized by the whale optimization algorithm (WOA). is method maximizes the throughput of the D2D system and guarantees the minimum rate per user.But it does not show any di erence between the WOA and traditional optimization algorithms.
In summary, the aforementioned methods including those in [3][4][5] are unable to guarantee the QoS of D2D users, and thus, this constitutes a simple choice for cellular users based on distance.
e aforementioned methods including those in [6][7][8][9] guarantee the QoS of D2D users although most of them do not limit the interference value and improve system throughput.erefore, the result of the resource allocation technology does not re ect real D2D user density areas.
For the aforementioned problem, this study presents a new resource allocation method in the 5G network.e method initially establishes a multiobjective optimization function that contains system throughput and QoS of D2D users.Furthermore, the multiobjective optimization function is solved via the improved whale optimization algorithm (IWOA), and the result corresponds to an optimal resource allocation method.
e method guarantees an approximate linear relationship between the system throughput and the number of users.erefore, D2D user density areas are accurately identi ed by the throughput value after performing the optimal resource allocation method.
is study consists of four main sections: Section 2 describes the 5G communication scenario and existing problems.Section 3 describes resource allocation based on the IWOA.Section 4 presents simulated results.Experimental results indicate that the proposed algorithm obtains a high-accuracy result for D2D user density identi cation.

Scenario Description
In this study, we assume that there are D2D users and cellular users in a scenario.Furthermore, there is disturbance between the D2D users and the cellular users.To satisfy the users' QoS, each cellular resource can be multiplexed by only one D2D pair, and each D2D pair can multiplex the multilink resource of cellular users.e D2D users can share spectrum resources of cellular users.e D2D users can communicate with each other through the cellular mode, D2D special mode, and D2D multiplexing mode.e D2D users can be grouped into the same group by distance [10].Figure 1 shows the D2D and cellular hybrid network system.
In this scenario, the path loss model can be de ned as follows [11]: where ε denotes the response lognormal shadow, α denotes the path loss index, μ denotes the path loss coe cient, and d denotes the communication distance.Normally, the path loss model can be divided into the line-of-sight (LOS) model PL LOS and the non-line-of-sight (NLOS) model PL NLOS , and equation ( 1) can be represented as Based on the Shannon equation, the throughput of the CU and DU is [12 where r DU j denotes the signal-to-interference-plus-noise ratio (SINR) of D2D users, j ∈ 1, . . ., M { } , in which M denotes the number of D2D users; r CU i denotes the SINR of cellular users, i ∈ 1, . . ., N { } , in which N denotes the number of cellular users; and B denotes the channel resource bandwidth.
r DU j and r CU i can be de ned as where G j,j denotes the channel gain between CU i and DU j , G i,B denotes the channel gain between CU i and the base station, G j,B denotes the channel gain between DU j and the base station, δ 2 ξ denotes the white Gaussian noise, P CU i denotes the transmitting power of CU i , and P DU j denotes the transmitting power of DU j .When x i,j 0, DU j does not multiplex the resource of CU i .Equation (5) can be rewritten as r DU j P DU j G j,j /δ 2 ξ .When x i,j 1, DU j multiplexes the resource of CU i .
Based on equation (3), the maximum system throughput of D2D users can be de ned as To identify the D2D user density, it is necessary to nd the resource allocation method to obtain the optimal system throughput, which has a linear relationship with the 2 Complexity number of D2D users.As shown in Figure 2, when the number of D2D users is dense, the throughput of D2D users is larger.Conversely, to guarantee the QoS of D2D users, the function of satisfaction is used [12][13][14]: where b DU j denotes the allocated resources of DU j and b DU,max j denotes the maximum value of b DU j .When b DU j b DU,max j , U DU j can achieve the maximum value, which means the customer's satisfaction of users reaches the maximum value; namely, the system QoS achieves the optimal value.

D2D User Density Identification
Based on IWOA Normally, when the number of D2D users is low, given the linear relationship between the number of D2D users and the throughput, it is possible to identify the area of D2D user density in a 5G network via the throughput estimation in each region.However, for many traditional resource allocation algorithms (e.g., cheat-proof pricing method [15], heuristic method [16], and GA-based method [17]), with the increasing D2D users, the relationship between the number of D2D users and the throughput estimated becomes nonlinear.us, the identi cation of the D2D user density region is more di cult.
In Figure 3, the points correspond to the actual collected data between the number of D2D users and the throughput and the line denotes the tting curve of the collected data.With increases in D2D users, the interference of D2D communication with cellular communication increases, and interference between D2D communications also increases.e increase of system throughput tends to be gentle.erefore, it is di cult to accurately estimate the number of D2D users via the traditional method.To solve this problem, an optimal resource allocation algorithm based on the IWOA is proposed.
Firstly, a multiobjective optimization function is established and contains the system throughput and QoS of D2D users.Subsequently, an improved whale optimization algorithm (IWOA) is provided to search for the optimal value of the objective function.Finally, the system throughput will increase linearly with the increasing number of D2D users.e basic principles of the improved algorithm are described as follows.

Multiobjective Optimization Function.
Based on equations (3), (5), and (7) the maximum system throughput of D2D users' objective optimization function is given as follows: Complexity 3 Equation ( 9) denotes the objective function, equation (10) denotes the minimum SINR threshold of CU i , equation (11) denotes the minimum SINR threshold of DU j , equation (12) denotes the transmitting power limitation of DU j , equation ( 13) denotes the transmitting power limitation of CU i , equation (14) means that each D2D user can only share resources with a cellular user, and equation (15) shows that the resource of each cellular user can be multiplexed via the K D2D users.
To guarantee the QoS of D2D users, the QoS objective optimization function is given as follows: Equation ( 16) denotes the objective function, equation ( 17) denotes the minimum value of the allocated resources DU j , and equation (18) denotes the total resources.erefore, the multiobjective optimization function is defined as follows: e constraint condition of equation ( 19) denotes equations ( 10)-( 15), (17), and (18).Specifically, α denotes a constant number within (0, 1).If the optimization objective focuses on optimizing the system throughput, then α > 0.5.If the optimization objective focuses on optimizing the QoS of D2D users, then α < 0.5.

Resource Allocation Mechanism Based on IWOA.
Evidently, the optimization problem of equation (19) corresponds to a nonlinear optimization problem, which belongs to the NP-hard problem.It is difficult to directly obtain the global optimal solution.For the problem, the IWOA is proposed in this study, and the IWOA corresponds to an improved form of the whale optimization algorithm (WOA) [17][18][19][20][21].
e IWOA is a bionic intelligent optimization algorithm that imitates the feeding behavior of humpback whales.Specifically, the IWOA includes the following three stages: the walking and foraging stage, the encircling and contracting stage, and the spiral predation stage.
(a) In the walking and foraging stage, humpback whales can recognize the location of the prey via the location of a random individual whale.e behavior is represented by the following equations: where A → and C → denote coefficient vectors, D → denotes the distance vector from an agent to target food, X → rand denotes the random position vector of the best solution, X t �→ denotes the current position vector, and X → t+1 denotes the next position vector.e vectors A → and C → are defined as follows: where r → denotes a random vector in [0,1], and a → linearly decreases from 2 to 0 in the WOA.When |A| ≥ 1, the whales are in the walking and foraging stage, and when |A| < 1, the whales go to the next stage.
In this study, the new resource allocation mechanism should satisfy the D2D user's throughput and QoS, and the QoS of cellular users must also be guaranteed.erefore, the whale population vector variable X t �→ is defined as follows: As shown in equation ( 21), the variables that should be optimized include the following: transmission power variables P DU j and P CU i , SINR variables r DU j and r CU i , allocated resources b DU j and b CU i , and the multiplex variable x i,j .(b) In the encircling and contracting stage, when the whales search for food, the other whales approach the optimal whale position and surround their food.e mathematical model is given as follows: where X * t � �→ denotes a random position vector selected from the current population.(c) In the spiral predation stage, the whales usually move in a spiral direction towards the optimum position of the whale and create bubble nets to surround the prey for predation.e mathematical model of whale spiral migration for predation is given as follows: where | denotes the distance of the whale to the best solution obtained, b denotes a 4 Complexity constant to define the shape of the logarithmic spiral, and l denotes a random number in (− 1, 1).
Additionally, we then define a random variable p to distinguish the contraction-bounding stage from the spiral predator, and the mathematical model is given as follows: However, the WOA exhibits the disadvantage of inadequate global search capability in the early stage and slow convergence speed in the later stage [19].To solve the issues, the IWOA is proposed, and the difference between the IWOA and the WOA is in the spiral predation stage.
e equation of spiral walking in the IWOA is defined as follows: where w denotes the updated weight and is given as follows: where β denotes the humpback whale aggregation factor, w min denotes the minimum weight value, w max denotes the maximum weight value, and std(f obj ) denotes the variance of the fitness value.In the initial stage of iteration, std(f obj ) is big, the value of arctan[std(f obj )] is close to pi/ 2, and the value of β is close to 0. At the end of the iteration, std(f obj ) is small, the value of arctan[std(f obj )] is close to 0, and the value of β is close to 1. erefore, with the continuous iteration, w will increase from w min to w max gradually.e optimal objective function f obj is given in equation (19).
In the initial iteration stage of the IWOA, β and w are higher, and this accelerates the convergence of the algorithm.In the late iteration stage of the IWOA, β and w are low, and this improves the accuracy of optimization.
Based on the aforementioned principle of the IWOA, the IWOA can be considered a global optimizer.It solves the NP-hard problem and obtains the global optimal solution of equation (19).

D2D User Density Identification.
After optimization by the IWOA, the optimal parameters after resource allocation are achieved as follows: We assume that the number of regions in a large region corresponds to S, and the optimal throughput of D2D users in each region by the IWOA is expressed as follows: Furthermore, we assume the number of D2D users in each region is e proposed method in this study considers the QoS of D2D users that decreases the interference of D2D communication with cellular communication and interference between D2D communications.erefore, the data distribution between the number of individuals and the throughput in different regions is shown in Figure 4.
As shown in Figure 4, the relationship between the number of D2D users and the system throughput in different regions by data fitting is defined as follows: where k 0 and k 1 denote the function fitting value, and N p and TPS satisfy a linear relationship.Although k 0 and k 1 are unknown, the D2D user density areas can be identified by the throughput value after the optimal resource allocation method provided that they satisfy the linear relationship.In summary, the flow chart of the proposed method in this study is shown in Figure 5.

Algorithmic Complexity Analysis.
e optimization algorithm proposed in this study consists of initializing the whale population, calculating the fitness function, and updating the whale location.When the whale population corresponds to N and the dimension of the optimization problem corresponds to D (D denotes the number of variables in equation ( 23)), the complexity of the proposed algorithm is analyzed as follows: the complexity of the initial whale population corresponds to O(ND), and the complexity of fitness calculation corresponds to O(NlogN).In the whaleposition-updating process, the computational complexity corresponds to O(ND).
erefore, in each iteration, the complexity of the algorithm corresponds to O(NlogN + 2ND).

Simulation and Analysis of the
Proposed Method e proposed algorithm is validated in a 5G network scenario of a large region, and many cells exist in the scenario.
e D2D users and cellular users are randomly distributed in the cells.e proposed algorithm is simulated through MATLAB to identify D2D user density.

Parameters of the Simulation Experiment.
e simulation parameters are shown in Table 1.e system performance of the algorithm proposed in this study is simulated and analyzed via MATLAB.

Simulation and Experimental Analysis.
e simulation scenario and D2D user scatter map are shown in Figure 6.

Complexity
In Figure 6, "+" denotes the D2D sender, " * " denotes the D2D receiver, and "o" denotes the cellular user.Figure 6 shows areas with di erent D2D user densities.Table 2 lists the system throughput and user satisfaction of di erent algorithms including the random distribution, heuristic distribution [16], and geometric programming resource allocation [22].
As shown in the simulation results in Table 2, increases in D2D users linearly increase the throughput from the proposed algorithm.When the number of D2D users exceeds 40, the throughput of other algorithms increases slowly.erefore, it is di cult to identify the density from the throughput indicators.Conversely, the QoS of the proposed algorithm also exceeds that of the other three algorithms.
To compare the advantages of the algorithm more clearly, we change the number of D2D user pairs from 10 to 80. en, the system throughput performance comparison is shown in Figure 7.
e system QoS performance comparison is shown in Figure 8.
As shown in Figure 7, increases in D2D users also increase the complete system throughput.Furthermore, the growth of the proposed algorithm exceeds that of the other three reference algorithms.e number of D2D users and throughput satisfy a linear relationship.is is because the proposed algorithm selects the optimal D2D users for cellular users to multiplex.However, the interference of D2D communication with cellular communication increases, and the interference between the D2D communications also increases through the other three algorithms.erefore, the performance of the proposed algorithm exceeds that of the other reference algorithms.
Based on the simulation result in Figure 6, the linear relationship between the number of D2D users and the system throughput satis es the following expression:

(33)
As shown in Figure 8, with increases in D2D users, the QoS of the proposed algorithm is maintained at approximately 80%. e QoS of the other three reference algorithms decreases.It is worth noting that there is a drop in the QoS at 20 D2D users for the proposed algorithm.is is because the number of simulation cycles is fewer, which may cause some drops at some points.
Finally, we analyze the D2D user density based on the conclusion of equation (33), and the accuracy of the proposed algorithm is listed in Table 3.
Table 4 lists the accuracy of different algorithms including the random distribution, heuristic distribution [16], and geometric programming resource allocation [22].
e simulation results show that D2D user density in different areas is accurately calculated by the algorithm proposed in this study.

Conclusion
In this study, a new resource allocation method is proposed for the problem of D2D user density identification in a 5G network.e method initially establishes an optimization function that contains the system throughput and QoS of D2D users.Additionally, the optimization function is solved via the IWOA.
e method obtains a linear relationship between the system throughput and the number of users.erefore, the D2D density is accurately identified by the system throughput.e experimental results indicate that the proposed algorithm obtains high-accuracy results for D2D user density identification.In the future work, we will research a more general model, which is suitable for various 5G communication scenarios.On the contrary, we may introduce some deep learning ideas to improve the algorithm to improve the accuracy.

Figure 1 :
Figure 1: D2D and cellular hybrid network system (CU cellular user and DU D2D user).

Figure 4 :
Figure 4: Data distribution between the number of individuals and the throughput.

Table 2 :
System throughput and user satisfaction of di erent algorithms.

Table 3 :
Accuracy of the proposed algorithm.

Table 4 :
Accuracy of different algorithms.