{'fraction_non_alphanumeric': 0.033437127750726214, 'fraction_numerical': 0.014503354161877495, 'mean_word_length': 4.739026145358599, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Device-to-Device Communications A Performance Analysis in the Context of Social Comparison Based Relaying

—Device-to-device (D2D) communications are recog- nized as a key enabler of future cellular networks, which will help to drive improvements in spectral efﬁciency and assist with the ofﬂoad of network trafﬁc. Relay-assisted D2D communications will be essential when there is an extended distance between the source and the destination or when the transmit power is constrained below a certain level. Although a number of works on relay-assisted D2D communications have been presented in the literature, most of those assume that relay nodes cooperate unequivocally. In reality, this cannot be assumed, since there is little incentive to cooperate without a guarantee of future reciprocal behavior. To incorporate the social behavior of D2D nodes, we consider the decision to relay using the donation game based on social comparison, characterize the probability of cooperation in an evolutionary context and then evaluate the network performance of relay-assisted D2D communications. Through numerical evaluations, we investigate the performance gap between the ideal case of 100% cooperation and practical scenarios with a lower cooperation probability. It shows that practical scenarios achieve lower transmission capacity and higher outage probability than idealistic network views, which assume full cooperation. After a sufﬁcient number of generations, however, the cooperation probability follows the natural rules of evolution and the transmission performance of practical scenarios approach that of the full cooperation case, indicating that all D2D relay nodes adapt the same dominant cooperative strategy based on social comparison, without the need for external enforcement.


I. INTRODUCTION
A. Related Work D EVICE-TO-DEVICE (D2D) communications are now regarded as a central component to the design and commission of future cellular networks [1]. In particular, this technology will facilitate direct communication between user equipments (UEs) without unnecessary routing through the network infrastructure [2]. The overall aim here is not only to achieve shorter transmission distances (and potentially save power) but more importantly to significantly increase the capacity of existing cellular network infrastructure. D2D communications can be utilized in the form of either a singlehop transmission or relay assisted multi-hop transmission, where the relay-assisted D2D communications can supplement the performance of a single-hop D2D transmission if the direct link fails to provide adequate communications performance [3]- [6].
Due to the many reported benefits associated with the implementation of D2D communications, their performance has been studied in many contexts. For example, in [7], the authors have proposed a multi-hop D2D scheme, while in [8] and [9], the authors proved that D2D communications can significantly improve spectral efficiency and the coverage of conventional cellular networks. Additionally, D2D has been applied to multi-cast scenarios [10], machine-to-machine (M2M) communications [11], cellular off-loading [12], while a game-theory based cross-layer optimization of the D2D communications has been investigated in [13] and [14]. Nonetheless, while D2D networks offer many advantages, they also come with numerous challenges that include the difficulties associated with the accurate modeling of random relay locations and the characterization of the interference.
Recently, stochastic geometry has received considerable attention as a useful mathematical tool for interference modeling. Specifically, stochastic geometry assumes that the locations of the wireless nodes can be modeled as a spatial point process [15]. Such an approach captures the topological randomness in the network, offers high analytical flexibility and achieves an accurate performance evaluation [16]- [20]. A common assumption made within this scheme is that the nodes are distributed according to a homogeneous Poisson point process (PPP) [17], [21]. In [22], the authors have compared two D2D spectrum sharing schemes (overlay and underlay) and evaluated the achievable rates for PPP distributed UEs over a Rayleigh fading channel. This was later extended to cover more general fading channels in [23]. Flexible mode selections have also received attention. For example, in [24] truncated channel inversion based power control has been proposed for underlay D2D networks.

B. Motivation and Contributions
While previous works have made significant advances from an analytical point of view, existing literature frequently assumes that relay nodes cooperate unequivocally for the good of others. This is obviously a condition which cannot be guaranteed in reality -indeed, without any intervention, the rational individual strategy is defection [25]- [29]. Centralized control by the network operator is one way in which this can be resolved, but this may cause other privacy issues since some external controls may conflict with the device owner's personal priorities for resource usage, e.g., battery conservation.
Therefore, it is necessary to consider models of cooperation that incentivize user participation. The current stateof-the-art for relaying in opportunistic and D2D scenarios focuses on creating virtual social networks [30]- [32], exploiting logical links between those devices that may frequently interact [33], [34] or trust each other [35], thereby identifying pairs of devices that can potentially cooperate to provide forwarding. While these are suited to scenarios where regular interactions are frequent [36], the form of cooperation which is most relevant to D2D relaying is indirect reciprocity, where individuals are required to donate resources without the guarantee of future interactions with the recipient. This captures the general cooperation issue for D2D relay scenarios because any D2D topology is potentially highly dynamic, being open to one-off interactions (i.e., not necessarily repeated), unlike other scenarios such as ad-hoc networks where topologies are stable and direct reciprocity is possible [37].
Indirect reciprocity is an established problem in biological and social sciences -with this form of cooperation being naturally sustained in human groups [28], [38], [39]. The donation game [40] and the related but lesser studied mutual aid game [41], [42] are commonly used to model indirect reciprocity because they frame the dilemma of acting, at a cost, for the benefit of a third party without necessarily being able to call upon the recipient in future. The appropriateness of indirect reciprocity based models for "one-shot" cooperation scenarios has been reaffirmed by their use in resource donation scenarios for cognitive networks [43] and dynamic spectrum access [44]. We adopt the donation game to model cooperation for indirect reciprocity, based on its prominence in the literature and because it tackles the fundamental case of donation from a single source.
Considerable research has been undertaken to establish the conditions where indirect reciprocity is sustained, which have generally used reputation as the currency through which individuals become motivated to engage in socially beneficial activities [28], [38]. In this work we implement a reputation scoring system based on social comparison [45] and adopt a fundamental model for the evolution of indirect reciprocity [46], where individual users compare the reputation of each other and use this to determine their donation strategy. This method has been found to unite a range of alternative explanations for the evolution of indirect reciprocity [46] and therefore it is a valuable approach through which to explore the emergence of cooperation in D2D scenarios.
We consider a relay assisted D2D network where each relay node has an associated cooperation probability that is determined by its reputation score. Based on the obtained cooperation probability, we evaluate the transmission capacity and outage probability of relay assisted D2D networks. We also compare the effects of the evolution of the probability of cooperation using the model developed in [46].
The main contributions of this paper may be summarized as follows.
1) Firstly, we implement a reputation scoring system based on social comparison that capitalizes on human behavior as seen in real world scenarios. Based on the social reputation score, we model the probability of cooperation as a donation game and characterize the cooperation probability in an evolutionary context. 2) Secondly, we incorporate the probability of cooperation into a relay selection scheme, evaluate the outage probability and transmission capacity of relay assisted D2D networks and provide the results in closed form. Based on the analytic results, we optimize the relay search range to maximize the transmission capacity of a relay assisted D2D transmission. 3) Finally, we present numerical simulation results which provide useful insights into the performance of relay assisted D2D communications for different system parameters. In particular, we observe the trade-off relation between the transmission capacity and signal-to-noiseplus-interference ratio (SINR) threshold based on the channel fading parameters. This information, especially the human behavior aspect which is often unaccounted for in network design, will be critical for designing and optimizing future D2D communications. The remainder of this paper is organized as follows. In Section II, we describe the system and channel models that will be used in this study. In Section III, we model the cooperation probability by using the social comparison model. Based on this model, we evaluate the outage probability and transmission capacity of relay assisted D2D networks in Section IV and present numerical results in Section V. Section VI concludes the paper.

A. Network Model
We consider a D2D network overlaid on a cellular network where D2D UEs can directly communicate with each other without routing through the cellular infrastructure. As illus-  Fig. 1, the overlaid scheme divides the licensed spectrum into two non-overlapping portions where the cellular and D2D transmitters utilize orthogonal resource without crossmode interference. We assume that β portion of the spectrum is assigned for D2D communications and the remaining 1 − β is allocated to cellular communications, where 0 ≤ β ≤ 1.
The locations of the nodes in the overlaid D2D network are modeled as spatial point process in R 2 . Specifically, the UEs are randomly deployed according to a homogeneous PPP = {X i } 1 with intensity λ and each UE {X i } has an associated parameter { i } to indicate the node type: X i may be a potential D2D UE with probability q = P( i = 1), or a cellular UE with probability 1 − q, where q ∈ [0, 1]. The cellular BSs and D2D relay nodes are respectively distributed as PPP with intensity λ b and r with intensity λ r that are independent to each other. For the D2D UE, we assume that there is a dedicated receiver at a fixed distance d. Without loss of generality, we consider the typical receiver located at the origin that is associated to the D2D transmitter X 0 .
In our model, we assume that the cellular BS is responsible for collating the connection information, position information, and performing resource management. Consequently, D2D mode can avail of either a single-hop or a dual-hop transmission, which is centrally managed by the cellular BS. Before data transmission, each D2D UE communicates with the BS through an access link and the base stations search for a relay that is located within the relay search range R. If there are a number of potential relays within the search range, the BS notifies the D2D UE to use a dualhop transmission. Otherwise, single-hop transmission will be selected and the source will transmit the data packet directly to the receiver. For two-hop transmission, the source transmits its data packet to the receiver during the first time slot and closely located relay nodes overhear this packet. If the received SINR at the i -th relay is larger than a predefined SINR threshold T , the i -th relay becomes a potential relay and the D2D receiver chooses the best relay from the potential relay set. The selected relay uses decode and forward cooperation and sends the original source packet to the D2D receiver during the second time 1 X i denotes both the node and the coordinates of the i-th UE.
slot. The source communicates directly with the receiver in a single-hop transmission, whereas for dual-hop transmission, the link between the source and destination is assumed to be unreliable and the transmission occurs only through the relay. The notations used in this paper are summarized in Table I.

B. D2D and Cellular Mode
Each UE X i ∈ chooses the operating mode based on two factors; 1) the node type parameter ( i ) and 2) the mode selection scheme. If i = 0, then X i chooses the cellular mode and associates to the closest cellular BS. If i = 1, then X i becomes a potential D2D UE that may use either cellular or D2D mode based on the adopted mode selection policy. In this paper, we assume a distance-based mode selection [22], where a potential D2D UE chooses D2D mode if D2D link length is not greater than a predefined threshold θ . Otherwise, cellular mode will be utilized. Therefore, the UEs can be divided into two non-overlapping spatial point processes as follows • UEs operating in cellular mode: • UEs operating in D2D mode: where P D2D = P(L d ≤ θ) represents the probability that the D2D link length L d is less than or equal to the threshold θ . Interested readers are advised to refer to [22] and [23] for more detailed discussion on the point processes in (1) and (2). For the cellular uplink, we utilize orthogonal multiple access where only one active transmitter can access the resource block at a given time. Due to the orthogonal multiple access, c becomes a Poisson-Voronoi perturbed lattice, not a PPP, which is generally intractable [47]. In [23], we used a non-homogeneous PPPˆ c with distance dependent intensity function to approximate c and provide an accurate representation of the interference in the cellular uplink. We adopt the same approach for the cellular mode in this paper.
For the D2D mode, we utilize ALOHA with transmit probability ε on each time slot, where 0 ≤ ε ≤ 1. In general, the D2D link length L d is a random variable. However, to focus on the effect of the relay, we fix the distance between the D2D source and receiver to L d = d and assume the mode selection threshold to be larger than θ > d, i.e., P D2D = P(L d ≤ θ) = 1. 2 Since the potential D2D UEs in D2D mode follow an independent thinning process [22], the set of UEs operating in the D2D mode are distributed according to a homogeneous PPP d with intensity λ d = qλ that is independent to the set of UEs in the cellular mode.

C. Channel Model
The channel model used in this study is composed of longterm path-loss and small scale fading, so that the received power between node i and j is given by W = P h i j d −α i j , where P, α, h i j and d i j respectively denote the transmit power, pathloss exponent (α > 2), fading coefficient and distance between node i and j . We denote the transmit power of the cellular mode as P = P c and that of the D2D mode by P = P d . Without loss of generality, we assumed unit power for both the D2D and cellular UEs.
To incorporate the small scale fading, we consider the widely accepted Nakagami-m fading model. This extremely versatile model includes Rayleigh fading (m = 1) and Onesided Gaussian (m = 0.5) fading as special cases and it can also be used to approximate Rician fading. It is well known that the squared signal envelope (i.e., signal power) of a Nakagami-m faded channel follows a Gamma distribution [48].
Following from this, the PDF, complementary CDF, and j -th moment of the fading coefficient h are respectively given as follows where we assumed a unit spread factor, i.e., = E [h] = 1, m is the shape factor, j is a positive real valued constant, Since the transmission capacity of the cellular mode is evaluated in [23] over generalized fading channels, in this contribution we will focus on the capacity of the D2D mode with realistic cooperation assumptions, which is extensively explained in Section III. Under these assumptions, the received SINR from D2D node i to j is given by where N 0 is the noise power spectral density.

III. MODELING THE COOPERATION PROBABILITY
Most of the existing work in relay assisted D2D networks has assumed that relay nodes cooperate spontaneously and unreservedly. In practice, there is no direct incentive for a user (or device) to volunteer resources to help another when there is no guarantee of a future reciprocal donation. As such, cooperation is a social behavior that depends on various factors, e.g., personal priorities for resource usage, peer comparison, and the cost to donate relative to the benefit to the recipient. In other words, user cooperation cannot always be guaranteed and the probability of cooperation needs to be considered while evaluating the performance of relay networks. In this section, we consider an evolutionary donation game [46] which models the distribution of cooperation amongst users, and determines the emergence (or not) of cooperative behavior at different stages of evolution.

A. Fundamental Evolutionary Principles
We address the sharing of resources by modeling the donation game, a generalization of the mutual aid game [41], where each user has to decide whether to cooperate to relay the other user's transmission without the guarantee of a future interaction [29], [39]. The evolutionary framework is defined by a population of N nodes which each start with a randomly assigned donation strategy. The game is played over a series of generations, each consisting of a number of rounds. In each round, two nodes are randomly selected and arbitrarily assigned the role of donor and recipient. Donation decisions are made in accordance with the donor's pre-assigned strategy, which is expressed in terms of selfcomparison by the donor with the recipient. 3 By sharing their resources, i.e., cooperation, the donor incurs a cost c, while the recipient receives a benefit b. Note that the cost is an abstract representation of the physical and temporal resources provided by a donor (e.g., energy, bandwidth). The costs incurred do not influence the reputation of the donorit is the choice of cooperative strategy through which this is affected.
After m games have been played, the system evolves to the next generation. Nodes select their strategy for the next generation of games in proportion to their fitness value, which is defined as the utility accumulated over all games within the previous generation, namely (b i − c i ) for node i . Mutation is applied to the strategy at this stage, with a small probability μ of randomly changing the strategy assigned to a node in the new population. During simulation, we set the fitness level of each node to zero at the beginning of each generation.
Indirect reciprocity captures scenarios where nodes can not track or exploit the history of their interaction with other nodes within the given network. To account for this, indicators of public reputation are conventionally used to judge others. Updating reputation in response to donation decisions affects evolution because reputation informs decision making [46]. In [29], a basic image scoring assessment was introduced in which reputation is proportional to the number of donations given, thus a user's image is incremented by one unit when a donation is made and decremented by one otherwise, while the reputation of the recipient remains unaffected. The potential problem with this approach is that defection may be legitimate and desirable, such as in response to a free-rider who chooses to receive but never donate. Therefore more sophisticated reputation assessments are desirable.
One important approach that has been shown to provide greater evolutionary stability is known as standing [39], [49]. 3 Social comparison strategies are described in more details in Section III-B. This justifies a donor defecting when the recipient has a lower reputation, and in these cases, the donor does not face a reduction in their own reputation. This was originally conceived in [41] using a binary representation of reputation.

B. Social Comparison Strategies
In the context of indirect reciprocity, a strategy represents the conditions under which an individual will choose to cooperate. Social comparison is a crucial element that affects this decision making process and provides a basis for the strategy. It originates from human evolution, as a means through which individuals learn about their social world by using self-comparison as a natural and persistent frame of reference to assess others [45]. It is known that for donation scenarios, social comparison presents a natural unifying concept to characterize the evolution of indirect reciprocity [46].
Beyond humans, the simplicity of self-comparison in a quantitative setting lends itself to node-based behavior (where we consider a node to be equivalent to a D2D user). In particular, self-comparison translates to a small number of possible strategies that a node can adopt when comparing their reputation with a potential donor. Given a donor i and recipient j with reputations r i and r j respectively, donor i assesses the reputation r j of j , relative to their own reputation, r i , with three possible outcomes, establishing either: The strategy for a node i is represented as a triple of binary variables (s i , u i , d i ) indicating whether or not i donates when similarity (s i ), upward comparison (u i ) or downward comparison (d i ) is observed by i in respect of j 's reputation. This leads to eight possible strategies.

C. Experimental Scenarios
To determine the probability of cooperation for relay selection, we adopt this model for 100 relay nodes. The number of generations is varied between 10 and 1000, with 5000 games per generation, resulting in each node participating in an average of 50 games per generation. Mutation is applied at a rate μ = 0.1.
We restrict our attention to cases where b > c. This models the scenario where donations are made at a smaller cost to the donor relative to a larger benefit for the recipient. Cooperation diminishes as c/b tends to 1 [39], [50] and we experiment with a range of c/b values in [0.1, 0.9] and otherwise assume a default ratio of c/b = 0.5.
These settings are consistent with those derived for previous experimentation [46]. To assess reputation based on an action, we have adapted the original standing assessment for a non-binary representation, employing a discrete range of {−5, −4, . . . , 4, 5} for reputation, with integer increment for donation and an integer decrement for an unjustified defection (where the recipient is a "node with equal or higher reputation than the donor"). We assume that the reputation levels are reset to zero at the beginning of each generation. In Fig. 2(a), the distribution of the cooperation probability is plotted for different generations that are empirically retrieved from a number of simulation runs with different random seeds. Here the abscissa represents the probability ξ i that the i -th relay node cooperates in a given round of generation.
At the beginning of the simulation all relay nodes act according to randomly assigned strategies, including full cooperation and defection. After around one hundred generations (but often requiring less), relay nodes converge to a configuration with all nodes adopting a dominant strategy of 'upward or similar comparison' (s i = 1, u i = 1, d i = 0), i.e., 'donating in light of a request from nodes of higher or similar reputation while defecting otherwise'. This has been identified in [46] as a fundamental strategy that is embedded in a wide-range of existing models. Nodes playing this type of strategy are often known as 'discriminators' [51], which characterizes how they make it harder for those with low reputation to prosper. This strategy promotes nearly full cooperation and remains stable in future generations.

IV. OUTAGE PROBABILITY AND CAPACITY EVALUATION
In this section, in order to evaluate D2D network performance while taking into considering the important aspect of social behavior, we incorporate the distribution of cooperation probability obtained in Section III. We use this to evaluate the outage probability and transmission capacity of the proposed system model using a stochastic geometric framework.

A. Main Results
First, let us review the notion of outage probability and capacity for the single-hop D2D transmissions. As defined in [17], an outage event occurs when the received SINR in (3) is less than or equal to a predefined threshold T , whereas the achievable transmission capacity is defined in [52] as the density of successful transmissions at the target spectrum utilization. Then, the outage probability and capacity of a single-hop D2D can be respectively expressed as below, Next, in a two-hop D2D transmission, the transmission occurs over two time slots and each hop is assumed to be independent to each other. Since the transmission occurs only through the relay, an end-to-end outage event occurs if either the transmission over the first or second hop suffers an outage. Then, the outage probability and capacity of a two-hop D2D transmission can be expressed as follows [52] where the term 1 2 indicates that a single packet is transmitted over two time slots. For a Nakagami-m fading channel, (5) and (6) can be evaluated as the following Theorem.
Theorem 1: Given a Nakagami-m fading channel, the outage probability and capacity of a single-hop D2D transmission are respectively given by whereas the outage probability and capacity of a two-hop D2D transmission are given by where m is the fading parameter, N 0 is the noise power spectral density, T is the SINR threshold, d is the distance between source and receiver, d i is the link length of the i-th hop the n-th order derivative of the following expression and the Laplace transform L I (s) is given by Proof: See Appendix I. Theorem 1 is the general result that evaluates outage probability and capacity considering both noise and interference. Theorem 1 can be further simplified for some special cases, such as an interference-limited scenario or low outage or high outage conditions as described below.
Corollary 1: Interference-limited scenario: If I N 0 , Theorem 1 can be simplified as follows for a single-hop D2D transmission and for a two-hop D2D transmission, where K qεc α (mT ) δ , r is the distance from the relay to the midpoint between the source and the receiver, ϕ(l) and β n,r denote the following expressions . (13) Proof: See Appendix II. The asymptotic behavior of Corollary 1 can be expressed in a succinct form based on the magnitude of the term λK l 2 . Two cases are considered in the following corollary: 1) Low outage; λK l 2 1 and 2) Large outage; λK l 2 1. Corollary 2: Asymptotic behavior of the interferencelimited scenario: The outage probability and capacity of (11) can be simplified as follows Proof: Given a low outage condition, i.e., λK l 2 1, ϕ(l) can be approximated as by omitting the higher order terms of λK l 2 in (13). For a large outage condition, i.e., λK l 2 1, the following approximation holds due to the L'Hôpital's rule [53]  By substituting (16) and (17) into Corollary 1, (14) and (15) can be readily obtained. Theorem 2 evaluated the conditional performance measures for a given relay location r . Thereby, the performance of the dual-hop D2D link depends on the utilized relay selection scheme and the probability of cooperation, which are described in the following subsection.

B. Relay Selection Scheme
In [52] and [54], the authors choose the relay that is closest to the middle point between the transmitter and the receiver. This method maximizes the capacity of a dual-hop transmission when the D2D relay nodes cooperate unconditionally and on demand, i.e., 100% of the time. However, in reality, the relay in a practical D2D network will cooperate with a finite probability ξ i (0 ≤ ξ i ≤ 1). We use a relay selection scheme that incorporates these realistic considerations into the optimal relay selection, which is expressed as below • D2D Relay node X * r cooperates during the second hop ↔ X * r = arg max where X c indicates the midpoint between the source and receiver and a change of variable, i.e., y = ξ , is applied to the second equality. Due to the displacement theorem [55, Lemma 1], the mapping between x and y converts a PPP r with density λ r into a new homogeneous PPP (e) r with density λ (e) r = λ r E ξ δ . Conceptually, the cooperation probability ξ can be interpreted as a random fluctuation around each D2D relay and the combined effect of relay location and cooperation probability are incorporated into the relay selection policy in (18). The fractional moment E ξ δ can be empirically calculated based on the probability of cooperation that we produced in Section III, Section V and Fig. 2.

C. Optimization of the Relay-Assisted D2D
Dual-hop D2D is utilized if there is a relay within the range R. Otherwise, single-hop D2D will be utilized. Hence, the average transmission capacity of relay assisted D2D is (19) where the PDF and CDF of Y i ∈ (e) r are given by [15] f ||Y ri || (r ) = 2πr λ r E ξ δ e −πr 2 λ r E ξ δ , P N (R) is the probability that a relay node does not exist within a range R, C 1-hop and C 2-hop (r ) are evaluated in Theorem 1. Given a low (or high) outage condition, (19) can be expressed in closed form by using Corollary 2 as follows , λ (e) r = λ r E ξ δ and G 1 , G 2 , K are defined in Corollary 1 and 2.
The relay search range R is a design parameter that determines the average transmission capacity. Specifically, for closely located D2D nodes, single-hop transmission achieves higher capacity than a two-hop transmission, which reduces the spectral efficiency by half. On the contrary, for remotely separated D2D nodes, two-hop transmission provides a higher capacity than a single-hop transmission due to the improved per link reliability. In the following Lemma, the optimum range R that maximizes the average capacity is derived.
Lemma 1: The optimum relay search range R = R * that maximizes (21) is given by Proof: As the relay search range R increases, the null probability P N (R) = exp −π R 2 λ (e) r decreases and more D2D nodes will utilize the dual-hop transmission than a singlehop transmission. In this case, the transmission capacity in (19) has a concave form which can be maximized by evaluating < 0. By assuming R 2 λ r E ξ δ 1 and using the Taylor series, i.e., e −π R 2 λ (e) r , with some algebraic manipulations, the following expression holds Since G 2 = G 2 1 , the optimal R = R * that achieves (23) is (22). This completes the proof.

V. NUMERICAL RESULTS
In this section, we numerically evaluated the transmission capacity of a relay assisted D2D network with Monte-Carlo simulation. We used Matlab and Python to generate the numerical results with the following parameters: λ r = 10 −2 , T = 3, α = 4, m = 4, d = 10, R = 20, q = 0.5, ε = 1, where the common system parameters used in this paper are summarized in Table I.

A. Effect of Generations
In Fig. 2(a), we obtained the distribution of cooperation probability ξ i using evolutionary simulation at different generations. The moment E ξ δ i for generation [0, 10, 100, 1000] is calculated as E ξ δ i = [0.5834, 0.7946, 0.9795, 0.9816], respectively. Then, we applied these moments into the relay selection procedure and evaluated the transmission capacity of a single-hop and dual-hop D2D mode over a range of UE intensity λ in Figs. 2(b)-(c). Particularly, we assumed a large outage probability (i.e., λK d 2 1) in Fig. 2(b) and a low outage probability condition (i.e., λK d 2 1) in Fig. 2(c). We observed that the relay assisted D2D transmission achieves a higher rate than the single hop D2D if the channel has large outage probability. If the channel is reliable with low outage probability, than there is no benefit in using dual-hop D2D over a single-hop transmission since it requires an additional time slot to transmit a source packet. We also note that the capacity increases for a small UE intensity λ, then decreases after a certain threshold. This effect is analogous to the asymptotic behavior of ultra-dense networks under a dual-slope path loss model, which have been investigated in [56] and [57]. Both works conclude that the SINR vanishes as the BS density grows asymptotically due to the severer mutual interference, which is similar to Figs. 2(b)-(c).
As the generation evolves, the probability of cooperation in Fig. 2(a) shifts toward ξ i = 1 and E ξ δ i approaches 1, indicating that after a sufficient number of generations, each node converges to a configuration in which cooperation is sustained in the population (and all nodes adopt the same dominant cooperative strategy based on social comparison) without the need to enforce any external mechanisms. The red curves in Figs. 2(b)-(c) represent the ideal case of 100% full cooperation, whereas the dotted curves correspond to the practical scenarios with a lower cooperation probability. Figs. 2(b)-(c) show that a notable performance gap exists between the ideal and practical relay assisted D2D networks, though the transmission capacity with social comparison approaches the ideal case of 100% full cooperation as the generation increases. Fig. 3 shows the outage probability of the two-hop D2D versus the threshold T for various UE densities λ, where the solid curves are analytically evaluated using (11) and the marked curves are obtained through Monte-Carlo simulation. We note that the analytical results perfectly match the simulated results, validating the analysis performed in this paper.

B. Impact of Errors
The probability of cooperation worsens when different types of errors are introduced, both in the execution of the Fig. 3.
Outage probability of two-hop D2D transmission versus the SIR threshold T for various UE density λ.
strategies and in the representation of the reputation of others [40], [51], [58]. We considered the following types of errors: • execution errors in the action performed by the donor, for example representing dropped connections due to interference. These assume that the execution of either a cooperative or defective action is subjected to error with a certain probability e, and then replaced by the opposing action [39], [51] • perception errors in the representation of other D2D nodes reputation, while the consequent actions are assumed to be performed correctly [38], [40]. These are implemented as in [39] by a small probability p of misrepresenting the reputation of the recipient with another one randomly chosen among all those available. Fig. 4(a) shows the distribution of cooperation probability at generation 100 for two different types of error and Fig. 4(d) plots the corresponding capacities for the given distribution. With the perception of reputation error, cooperation is achieved and sustained after a maximum of 100 generations, as in the case without any error. For execution errors, however, we need more generations (1000 in the example) to converge to high cooperation levels. While perception errors marginally affect the transmission capacity, the execution error significantly degrades the overall performance. Note that, in earlier stages with generations less than 100, the network can temporarily present intermediate configurations of low cooperation that could drop the capacity below the initial values. However, these low cooperation states are not stable and the D2D relay nodes are able to promptly recover towards the dominant strategy until this final configuration eventually stabilizes the performance towards high capacity levels, remaining close to the case of 100% cooperation.

C. Influence of the Cost to Benefit Ratio
The numerical results presented so far indicate that the cooperation can be achieved when the cost-to-benefit ratio is lower than one. Furthermore cooperation is successfully established and persists even without assuming direct reciprocation during an interaction.
When donating resources becomes too costly for the donor relative to the benefit that is created for the recipient, the act of giving becomes diminished in value and provides reduced social benefit for the wider population. This occurs as the cost-to-benefit ratio increases, and it impacts upon the evolution of cooperative strategies, which are less likely to emerge as their benefit is questionable. Fig. 4(b) shows the distribution of cooperation probability at generation 100 for a wide range of c/b ratios and Fig. 4(e) plots the corresponding capacities for the given distribution. We observe that as the c/b ratio grows above a certain threshold (e.g., c/b ≥ 0.8), the likelihood of cooperation falls to much lower values. This implies that the D2D relay nodes in the network are no longer adopting the discriminative (1, 1, 0) strategy but switch to intermediate configurations representing lower cooperation. For example, the (0, 1, 0) strategy is dominant for c/b = 0.8 and fully uncooperative strategies are evident for c/b = 0.9. In terms of capacity, the c/b ratio within the range of 0 < c/b ≤ 0.5 achieves similar performance. As the c/b ratio increases to a higher value, a notable performance degradation occurs. We note that for c/b > 0.9, most of the relay nodes will not collaborate, so that the transmission capacity of a dual-hop D2D becomes even worse than a single-hop D2D mode. Fig. 4(c) shows the distribution of cooperation probability for both 5% execution and perception error and Fig. 4(d) plots the corresponding capacities for the given distribution. We note that with execution errors, cooperation levels further decrease and are compounded by increases of the c/b ratio. In fact, high c/b ratios combined with errors cause cooperation to fail, at least for the first hundred generations. Fig. 5(a) shows the relative frequency of different strategies over a number of generations, when there are no errors in the reputation system with c/b = 0.5. We observe that cooperative strategies successfully occur and persist for generations larger than 20. For generations less than 20, configurations representing less cooperation can appear, such as the full defection strategy of (0, 0, 0). Nevertheless, these states appear to remain only on a temporary basis. Subsequently, the system recovers and after a relative low number of generations the dominant strategy (1, 1, 0) of discriminators emerges. Fig. 5(b) shows the proportion of different strategies over a longer period of time. We can observe that the (1, 1, 0) strategy appears dominant and resilient to the invasion of the less cooperative or totally uncooperative strategies. However partial state transitions can occur between the (1, 1, 0) and (1, 1, 1) strategy, which represents a full cooperator. This occurs because when all the D2D relay nodes are cooperative and settled on the highest possible reputational score (+5), these two strategies become indistinguishable, since there are no relay nodes with low reputation in the population any more. Fully cooperative strategies can temporarily increase the degree of cooperation in the system but they are vulnerable to attacks from defectors. This allows discriminators who apply the (1, 1, 0) strategy to increase in popularity again. More generally, the (1, 1, 0) strategy is important because it prevents exploitation from those who are less cooperative based on self-comparison, preventing potential exploitation.   Fig. 5(c) plots the transmission capacity of dual-hop D2D mode versus SIR threshold T for different m parameters. Note that the range with a low SIR threshold T 1 achieves a low outage probability (i.e., λK d 2 1) and vice versa. We observed that the fading parameter m affects the transmission capacity differently depending on the outage condition. Specifically, the transmission capacity increases as m increases given a low outage probability condition. As the m parameter increases, a Nakagami-m fading channel becomes increasingly deterministic. 4 If the channels are reliable with low outage probability, than the received signal power increases, which increases the SIR and the transmission capacity. If the channels are unreliable with large outage probability, than the aggregate interference increases with larger m, which decreases the SIR as well as the transmission capacity.

E. Effect of SIR Threshold and Fading Parameter
VI. CONCLUSION In this paper, we have considered a relay assisted D2D network, where the spatial locations of the D2D UEs are modeled as homogeneous PPP. We proposed a social comparison model in an evolutionary context to characterize the D2D relay cooperation probability. Using the proposed comparison model with stochastic geometry, we evaluated the outage probability and transmission capacity of a relay assisted D2D network.
Specifically, we observed that after a sufficient number of generations, the cooperation probability follows the natural rules of evolution and all D2D relay nodes adopt the same dominant cooperative strategy based on social comparison. This has consequences for the practical operation of networks with D2D capability, demonstrating that there are scenarios where cooperation naturally evolves without the need for enforcement by a central, trusted authority. Also, we observed that the benefit of relaying stands out in a dense network with unreliable channel conditions, i.e. large outage probability. Finally, we provided numerical results to demonstrate the performance gains of relay assisted D2D networks compared to single hop D2D networks taking into account cooperation.
APPENDIX I In this Appendix, we provide a proof of Theorem 1. By substituting (4) into (5), the outage probability of a singlehop D2D transmission can be evaluated as follows where I = k∈ d \{X 0 } h kj d −α kj , the distribution in (3) and a change of variable, i.e., t = c 0 (I + N 0 ), are applied to the last equality. The tern E[t n e −t ] in (24) can be evaluated as follows where L I (s) is derived as below by applying the well-known probability generating functional (PGFL) of a PPP [15] in the third equality and using a change of variable, i.e., shr −α = t, and integration by parts in the last equality. The term c α is determined by using (3) as follows The outage probability of a two-hop D2D transmission in (6) can be easily evaluated by using the following relation (24), and substituting (7) to (6). This completes the proof.

APPENDIX II
In this Appendix, we provide a proof of Corollary 1. Given an interference-limited condition, (7) reduces to where the n-th derivative term in (28)  By substituting (29) into (28) and (5), the outage probability and capacity of a single-hop D2D can be simplified as (11). For two-hop D2D, the outage probability can be written as where we applied (11) in the second equality and utilized the cosine rule between the link distance [52], i.e., d 2 2 + 2r 2 = d 2 1 + d 2 2 , in the last equality. This completes the proof. He has been a Researcher with Cardiff University since 2008. More recently his interests have focused on the modeling and simulation of evolutionary agent-based models of group behavior and cooperation for both humans and wireless networks. As a Researcher, he has made significant contributions to several U.K. (EPSRC, DH) and internationally (EU/EC) funded projects and research collaborations. He has published over ten scientific articles in high impact journals and about 30 conference or workshop papers. William G. Scanlon was born in 1969. He received the B.Eng. degree in electrical engineering and the Ph.D. degree in electronics (specializing in wearable and implanted antennas) from the University of Ulster, U.K., in 1994 and 1997, respectively. He was appointed a Lecturer with the University of Ulster in 1998 and a Senior Lecturer and a Full Professor with the Queen's University of Belfast, U.K., in 2002 and 2008, respectively. He held a parttime Chair in short range radio with the University of Twente, The Netherlands, from 2009 to 2014. Prior to starting his academic career, he had ten years of industrial experience, as a Senior RF Engineer for Nortel Networks, a Project Engineer with Siemens, and a Lighting Engineer with GEC-Osram. He is currently the Chair of wireless communications and the Director of the Centre for Wireless Innovation, Queen's University Belfast. He is also the Managing Director and the Co-Founder of ActivWireless Ltd, a Queens University spin-out company focused on real-time locating systems and student attendance monitoring using active RFID. He has published over 230 technical papers in major IEEE/IET journals and in refereed international conferences. His current research interests include mobile, personal and body-centric wireless communications, wearable antennas, RF and microwave propagation, channel modeling and characterization, wireless networking and protocols, and wireless networked control systems. He received the Young Scientist Award from URSI in 1999. He is currently the Dean of Research and Innovation of the College of Physical Sciences and Engineering and the Director of Supercomputing Wales, the national facility for high performance computing in Wales. He is also a Professor of social and mobile computing with Cardiff University, U.K., and the former Head of the School of Computer Science and Informatics. His work addresses social networks, smartphones, and human behavior, using a range of methodologies from participatory data collection through to simulation using high-performance computing. He has led a range of research projects in these areas, including the SOCIALNETS (217141) and RECOGNITION (257756) projects, funded by the European Commission under the FP7 the Future Emerging Technologies programme. Earlier in his career, he was involved in techniques for automated wireless network design and cell planning for 2G and 3G communications, developing heuristics and models to optimize infrastructure deployment and frequency assignment. He has published approximately 100 papers in these areas and acts as an Associate Editor/Editorial Board Member for journals, including Social Network Analysis and Mining, Telecommunication Systems, and Wireless Networks. Stuart M. Allen received the B.Sc. degree in mathematics from Nottingham University, U.K., in 1992, and the Ph.D. degree in graph theory from the University of Reading, U.K., in 1996. He joined Cardiff University, U.K., in 2000, where he is currently a Professor and the Head of the School of Computer Science and Informatics. He has over 100 publications in international journals and conferences. His research interests are in the area of mobile and social computing, including the development of mathematical models and optimization algorithms to plan and manage network infrastructure and resources, and the impact of human behavior and mobility on pervasive communication. A large portion of his work (funded through a number of EU and UK funded research programmes) has involved in developing automated cell and frequency planning software for 2G/3G/4G and fixed wireless networks, which has led to successful commercial tools and consultancy. He is currently on the editorial boards for Computer Communications and the Proceedings of the Royal Society A.