{'fraction_non_alphanumeric': 0.031274176532645644, 'fraction_numerical': 0.00635329973039503, 'mean_word_length': 4.7666621603352715, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Heterogeneous Resource Allocation Algorithm for Ad Hoc Networks with Utility Fairness

Resource allocation is expected to be a most important factor especially for heterogeneous applications in wireless ad hoc networks. In this paper, a novel heterogeneous resource allocation algorithm (HRA) is presented for ad hoc networks, supporting both elastic and inelastic traffic. First, by combining the first order Lagrangian method with pseudo utility, the original nonconvex problem is converted into a new convex one. Then, we successfully solve the heterogeneous problem with the dual-based decomposition approach. In addition, we integrate utility fairness into the resource allocation framework, which can adaptively manage the tradeoff between elastic and inelastic flows. Simulations show and prove that HRA converges fast and can achieve the global optimum starting from many different network conditions, such as elastic, inelastic, and hybrid scenario. With both considerations of flow rate and utility fairness, HRA improves the overall network utility and system throughput greatly.


Introduction
With the rapid progress of mobile ad hoc networks (MANETs), the nature of the network is gradually evolving from homogeneous toward heterogeneous [1,2]. In a heterogeneous ad hoc network, the devices differ in their communicational aspects such as transmission rate, energy consumption, and modes of communication. Compared with a homogeneous network, heterogeneous network imposes additional requirements. For example, it may contain special mobile nodes which consist of both smart and omnidirectional antennas, which can integrate all the physical information available to provide rich and versatile services. In addition, heterogeneous ad hoc network opens up new opportunities in multimedia systems, especially for those operating in real time such as video and voice transmission over wireless channels.
However, due to the heterogeneity in wireless networks such as ad hoc networks and wireless sensor networks (WSN), communication in heterogeneous networks is relatively more complicated than in homogeneous networks. For ad hoc networks, one important research problem is how to allocate resources to the heterogeneous nodes effectively and fairly.
For sensor networks, people are usually more concerned with system throughput and performance at the sink node. In the context of sensor networks, nodes are composed of different sensor types which can execute diverse data aggregation tasks. Regardless of the types of wireless networks, ad hoc networks and sensor networks have much in common, such as constrained resource, limited battery capacity, and fully distributed manner. One major challenge for the wide deployment of ad hoc networks and sensor networks is to provide quality-of-service (QoS) support and fair resource allocation.
Since heterogeneous network may contain many different applications associated with particular nodes, flows within it are generally classified as elastic and inelastic [3]. In the case of elastic traffic, the flows can adjust their transmission rate gradually such as file transfer, email, and remote terminal applications. Elastic flows are suitable for variable data rate and non-real-time services. Another class is inelastic traffic, such as video and audio applications. Different from the elastic flow, inelastic flow is very sensitive to latency and jitter and generally has an intrinsic bandwidth requirement. It makes sense only when the transmission rate exceeds a threshold. 2 International Journal of Distributed Sensor Networks From the system perspective, it is very important to emphasize the channel efficiency because the available radio resources are very scarce and the aggregate network utility must be maximized. From the users' point of view, it is more important to guarantee the fairness of resource allocation, such that they will not be in starvation state and their QoS demands can be met. Thus, the resource allocation problem may encounter conflicting goals. The objective of heterogeneous resource allocation is no longer to solely maximize the sum-rate of network. Instead, it is expected to find the optimal tradeoff strategy between resource efficiency and user fairness for a variety of applications associated with different services.
In this paper, we not only focus on the heterogeneity of ad hoc networks, but also emphasize the tradeoff between system efficiency and user fairness of resource allocation. First, we present our resource allocation framework by integrating utility fairness into the objective function. Second, we transform the original nonconvex problem into a new convex optimization problem, which is equivalent to the original one. Then, we extend our resource allocation algorithm to the heterogeneous environment, mixed with elastic and inelastic flows. Finally, we present the heterogeneous resource allocation algorithm to achieve the global fair allocation of bandwidth among contending flows.
The major contribution of our paper is twofold: (1) consider the heterogeneity in ad hoc networks, that is, supporting both elastic and inelastic traffic, and (2) provide feasible balance between user fairness and network efficiency.

Related Works
The resource allocation problem has been extensively studied in wireline and wireless networks. As early as 1998, Kelly et al. [4] proposed the network utility maximization (NUM) model, which provides a powerful framework for network resource allocation. In 1999, Low and Lapsley [5] realized the basic version of NUM framework by using a fixed set of source nodes to predict path. However, due to the assumption of strictly concave utilities, the NUM model merely addresses the elastic traffic which is only suitable for non-real-time applications, thus failing to capture the temporal dynamics in heterogeneous networks. Following the NUM model, various resource allocation schemes have been proposed in typical wireless networks [6,7], ad hoc networks [8,9], and wireless sensor networks [10,11]. Liu et al. [7] extend the basic NUM model into the fading channel. By jointly taking into account power interference and statistical signal variations, two types of nondeterministic fading channels are integrated into the NUM framework. The primary objective of resource allocation is to maximize the network performance [8], which is usually associated with channel capacity, end-to-end delay, system throughput, and so forth. In [10], the authors proposed a middleware platform, which can control running application as well as sensing tasks in heterogeneous wireless sensor networks.
Recently, several novel algorithms [12][13][14] were presented to support inelastic traffic in wireless networks. In [12], a random access algorithm based on dual decomposition method was proposed in wireless networks, which can allocate the rate and the persistent probability of inelastic flows. In [13], the authors design the queue-based rate control protocol to handle the inelastic traffic in wireless sensor networks. In [14], a new method for spectrum allocation is presented, which can accommodate applications with fixed data rate. However, these algorithms only consider the homogenous link capacities in their schemes. In other words, they are based on either the fixed channel capacity or the assumption that the channel is estimated before allocation. In fact, the channel capacity of heterogeneous networks cannot be estimated in advance, since they are changing with time and depend on the conditions of other links.
User fairness is a critical performance metric in ad hoc networks and should be involved when a resource allocation scheme is designed. A well-known fairness criterion is called max-min fairness (MMF) [15,16], which tries to allocate bandwidth equally. That is, a resource allocation is said to be max-min fair, if it is impossible to increase the bandwidth of any flow A without decreasing the bandwidth of another flow B where B's allocation was less than or equal to A's allocation. On the other hand, proportional fairness (PF) [4,17] is an opportunistic algorithm that allocates bandwidth to users in proportion to their data rates. It exploits the users' diversity and provides a good tradeoff between fairness and network throughput. For example, PF primarily allocates resources to users with good channel conditions. These users can finish their data transfers quickly since they can take full advantage of network resources. Then, the remaining resources can be allocated to other users with worse radio conditions. Very recently, a system for a family of fairness models has been proposed, including -proportional fairness [18,19]. In fact, -proportional fairness already contains all the previous allocation models such as max-min fairness and proportional fairness. For instance, the system can achieve maximum throughput ( = 0), proportional fairness ( = 1), minimum potential delay ( = 2), and max-min fairness ( = ∞). Thus, -proportional fairness provides a convenient way to achieve different allocation balance between efficiency and fairness by varying the values of parameter . A more general class of wireless allocation is based on utility fairness [20,21]. Utility fairness is usually defined with a utility function that composes the optimization problem of wireless resource allocation. Among them, the resource allocation objective is to find a feasible solution to maximize the utility function specific to the fairness concept used.
However, previous work [22][23][24] normally focuses on either the rate allocation of elastic flows or QoS demands of real-time services. They do not consider the two issues as a whole. These schemes cannot be directly applied in a heterogeneous ad hoc network which usually contains both elastic and inelastic traffic. To the best of our knowledge, it is still a challenging and open issue to attain the utility fairness in ad hoc networks, especially considering the heterogeneous nature of elastic and inelastic flows.
International Journal of Distributed Sensor Networks

Network Model.
A wireless ad hoc network is modeled as a directed graph G = (N, L), where N is the set of nodes and L is the set of wireless links. Each node ∈ N has transmission range and interference range int . For any two nodes , ∈ N, if node is in the transmission range of node , then node can communicate to node with a transmission link ( , ) ∈ L. We define to be the set of network flows, where each flow ∈ can span multiple hops. These links are shared by a set of flows, where flow uses the set of L ⊂ L of links ( = 1, 2, . . . , ). Then we can derive the × routing matrix (link-flow incidence matrix) For interference we need to convert the connectivity graph into the corresponding contention graph = (N , L ). is an undirected graph (similar concepts are also used in [25][26][27]). If the source or destination of one link flow is within the interference range of the source or destination of another one, the two flows are said to contend with each other. The vertex set N contains all the link flows in the network. For instance, the vertices of correspond to the edge set of the connectivity graph ; that is, N = L. An edge in set L indicates that two link flows in the connectivity graph contend with each other and cannot transmit simultaneously.
The contention graph captures the interference among various link flows. Another important concept called maximal clique is usually associated with the contention graph. In a graph, a clique is defined as a subgraph whose vertices are adjacent to each other. A maximal clique is referred to as a clique that is not contained in any other clique [28]. In fact, a maximal clique represents a collision region where all link flows interfere with each other such that only one of them can transmit at any time. A maximal clique can also be interpreted as a limited resource contended and shared by different flows. So, maximal cliques are widely used to capture the schedulability. For instance, they can schedule network flows efficiently.
We then denote the set of maximal cliques of a contention graph by Q. In the contention graph, each maximal clique Q ( = 1, 2, . . . , ) may consist of several links in the connectivity graph and each link in graph may belong to several maximal cliques. According to the relationship between links and maximal cliques, we define a Q×L cliquelink incidence matrix Q = { } as 3.2. Utility Function. Utility function is widely used to measure user satisfaction in the optimal flow control literature. The utility function of an application is a quantitative measure of its QoS performance. In this paper, we characterize utility in terms of resource allocation, which emphasizes the important relationship between QoS performance and resource allocation. Moreover, the utility has similar characteristics as the perceived quality of a data flow in ad hoc networks. We denote the utility function of each user ∈ N by ( ), which is a nondecreasing function in . Hence, we can control the level of user satisfaction by varying . Each user may have either elastic or inelastic traffic. Let N and N denote the set of users with elastic and inelastic traffic, respectively.
For elastic flows, we introduce a new concept of elastic utility function as ( ), which means the utility function of user with elastic applications. These applications are rather tolerant of throughput and time-delays. We can use a concave and nondecreasing function to model the utility. A typical utility for such elastic traffic is ( ) = log( +1). As shown in Figure 1, the utility increases as the bandwidth increases, but the marginal improvement is reduced. The total utility for elastic flows can be expressed as On the other hand, the total utility of the whole class of inelastic flows can be defined as where ( ) represents the inelastic utility function of user . Unlike the elastic traffic, inelastic traffic depends on the QoS requirements of real-time applications, which have an intrinsic bandwidth threshold. In a heterogeneous network, the elastic flows will try to reduce their rate when the network is congested, but the inelastic flows always keep sending at their rates without considering the yield of successful transmission. So in the long run, the degradation in bandwidth may cause serious packet drop and the resources are dominated by the users of inelastic flows. Thus, we can choose a sigmoidal utility function to model these real-time applications as shown in Figure 2. Compared with the elastic utility function, the inelastic function is convex instead of concave at lower bandwidth.
There exists another class of real-time application, which is called hard real-time traffic. Generally, hard real-time applications have strict bandwidth requirements and do not show any adaptive properties. If the system does not meet the minimum requirements, the real-time applications are not allowed to access the network. Examples include audio/video phone, video conference, and remote medical treatment. We can use the following utility function to model the hard realtime traffic: where min is the minimum bandwidth requirement. Such hard real-time applications can be described in Figure 2 (dash line). It is important to choose an appropriate utility function. For instance, if the network utility is to be maximized, we   can select the corresponding utility function as ( ) = log( ). On the other hand, if the network throughput is be maximized, we can choose the utility function as ( ) = . However, system efficiency is always in conflict with fairness. A higher efficient system (i.e., higher network throughput) always means a less fair policy. Therefore, it is necessary to find a tradeoff between fairness and efficiency.

Resource Allocation Model.
Consider a wireless ad hoc network which has resource B. Let be a set of users who will compete for the resource. And we define as the cardinality of user set . Let be the shared resource which is allocated to user ∈ . Then the resource allocation vector is denoted by = ( 1 , 2 , . . . , ), where 0 < < ∞, ∈ .
As mentioned above, elastic traffic and inelastic traffic have significantly different utility functions. In a heterogeneous ad hoc network, various applications with different traffic types can provide different services. Resource allocation algorithm, therefore, should have the ability to provide a good performance balance among various applications.

Resource Allocation with Utility Fairness
When considering different performance of various applications, it may be impossible to assign resources simply based on the traditional criteria such as proportional fairness [17] and max-min fairness [15]. Therefore, we design a new resource allocation framework based on utility fairness [29,30], which can adaptively allocate resources to the users according to their utility requirements. This has inspired two new concepts associated with utility fairness: one is utility max-min fairness [31] and the other is utility proportional fairness [32,33].

Utility Fairness Criteria.
Utility fairness is defined with a utility function that composes the resource allocation problem, where the objective is to maximize the utility function specific to the fairness concept used.
and if, for each node , the utility ( * ) cannot be increased while still maintaining feasibility, without decreasing the utility for any other node with a lower utility ( * ) ≤ ( * ).
Another newly proposed criterion of utility fairness is utility proportional fairness.

Definition 2.
A source rate allocation x * = ( * 1 , * 2 , . . . , * ) is utility proportionally fair (UPF), if it is feasible, that is, x * ∈ C, and if, for any other feasible allocation x, the following condition is satisfied: where ( ) indicates the utility value to source with the rate , and it is an increasing, strictly concave function for all ∈ N. The utility proportional fairness (UPF) is tremendously different from traditional proportional fairness (PF). The difference between them is that PF tries to achieve fairness in terms of rate, while UPF strives to achieve fairness in terms of utility. Since the utility can reflect user satisfaction, the utility, rather than rate, is a more meaningful metric of QoS for fair resource allocation in heterogeneous ad hoc networks.
In the following section, we will study the utility proportional fairness (UPF) in detail and propose a new resource allocation algorithm to support utility fairness.

Problem Formulation.
We first define a clique-flow incidence matrix A as Q × R matrix, where Q = { } is the clique-link matrix described in (2) and R = { } denotes the link-flow matrix incorporating the routing information as described in (1). In fact, each element in A, that is, = × , represents the number of subflows within a maximal International Journal of Distributed Sensor Networks 5 clique . Then, the fair resource allocation problem can be formulated as the following optimization problem: subject to Ax ≤ C, where is the source rate of flow and ( ) is the associated utility as a user satisfaction measurement. The constraint in (8) reflects the wireless resource constraint in ad hoc networks. For each clique, A = {A } denotes the resource usage pattern of each flow and C represents the feasible capacity region.
Since the objective function in (7) is strictly concave and continuously differentiable, there exists an optimal solution to the above problem P1 if the feasible region given in (8) is compact and convex. The objective function in (7) is referred to as the utility function which can reflect utility fairness.

Resource Allocation Algorithm.
To solve the primal problem P1, we turn our attention to the dual problem and use the Lagrange duality [5]. The first step is to define the Lagrangian function ( , ) for the optimization problem as follows: where = ( , ∈ ) is a vector of Lagrange multipliers. The dual problem D for the primal problem P1 can be defined as follows: The objective function of the dual problem then becomes Let us also define In fact, the Lagrange multiplier may be interpreted as the price per unit bandwidth consumed at maximal clique (the shadow price of clique ). Accordingly, represents the price of flow which has to pay for transmitting at rate .
Since the objective function U ( ) is increasing and is strictly concave over the range ≤ ≤ , the dual function ( ) is continuously differentiable. Thus, we can use the gradient projection method [7] to solve the dual problem D.
The Lagrange multiplier is adjusted in the opposite direction to the gradient ∇ ( ) as follows: where is the iteration number and > 0 is the step size. Based on (11), the gradient of ( ) with respect to is Therefore, we have The above equation can reflect the law of supply and demand. When the bandwidth demand in the maximal clique exceeds its supply , the price for accessing the clique is increased (i.e., to raise the clique price). On the other hand, if the rate demand is less than the effective capacity of clique , the clique price will be decreased.
Let ( ) be the demand of flow when the flow price is ; that is, Here, ( ) = −1 ( ) is the inverse function of ( ), which is the derivative function of ( ). In fact, ( ) reflects the optimal rate for flow , where the network utility will be maximized with a flow price of .
For each elastic flow , the source node receives shadow price information from all maximal cliques. Then it updates the transmission rate according to (16). Meanwhile, the link updates the clique price according to (15). This is an iterative procedure, where the new transmission rate of flow is reported to all maximal cliques every time. It can be shown that, starting from any initial rate, this iterative algorithm will converge to the optimal solution ( * , * ) by choosing a proper step size . Moreover, since the solution is primal-dual optimal, * is also the optimal rate for the primal problem. In this way, the network utility can be maximized in a distributed manner.

Heterogeneous Resource Allocation Algorithm
In this section, we extend our resource allocation algorithm to the heterogeneous environment. Particularly, we present a distributed resource allocation algorithm to achieve utility fairness, with consideration of both elastic and inelastic traffic.

Notations and Definitions.
In order to handle heterogeneous flows (i.e., elastic and inelastic), we develop a new flow control strategy to ensure utility fairness during the process of resource allocation. This new resource allocation mechanism, which integrates utility fairness, can not only support elastic traffic, but also be suitable for inelastic traffic. First, we define a "pseudo utility" function for user : International Journal of Distributed Sensor Networks where < ∞ and ≥ 0 are the maximum and minimum transmission rates needed by user , respectively.
By substituting the "pseudo utility" U ( ) into the original optimization problem P1, we can derive a new optimization problem P2 as follows: subject to Ax ≤ C.
Since the original utility function ( ) is continuous, is strictly increasing, and is nonnegative, the pseudo utility U ( ) must be increasing and be strictly concave over the range ≤ ≤ . After the transformation, the new problem P2 stays as a convex optimization problem and is capable of handling both elastic and inelastic flows.

Heterogeneous Allocation Problem Formulation.
Since the flows in heterogeneous ad hoc networks are composed of elastic and inelastic traffic, we can divide the utility function into two parts. One is the utility function ( ) for elastic flow and the other is the utility function ( ) for inelastic flow . Then, the heterogeneous resource allocation problem (HP) in ad hoc networks can be formulated as follows: subject to ≤ , Here, and denote the effective capacity of clique for elastic flow and inelastic flow , respectively. Inelastic traffic can be further classified into two subclasses: hard realtime traffic and soft QoS traffic. For inelastic real-time traffic with discontinuous utility, is the threshold rate. When the source rate exceeds the threshold, that is, ≥ , the network maintains a constant performance ( ) = 0 . Otherwise, the utility drops to zero when it is below the threshold. For inelastic soft traffic with sigmoidal utility, is the minimum transmission rate with certain QoS guarantee. The utility function is convex at low transmission rates and becomes concave when ≥ .
The formulation of (20) is an extension of the resource allocation problem described in (7). The main advantage of the new formulation is that it supports both elastic and inelastic traffic.
Since the constraints are linear and the objective function is concave over the range ≤ ≤ , we can solve the heterogeneous resource allocation problem by convex programming.
The Lagrangian of the regularized primal problem HP can be written as where and are the Lagrangian multipliers with the interpretation of shadow price for elastic and inelastic flows, respectively. Then we can decompose the maximization problem into the following two subproblems: The first subproblem 1 ( ) can be regarded as the bandwidth allocation for elastic flows and the second subproblem 2 ( ) may be interpreted as the rate control for inelastic flows. Thus, by solving the two subproblems, we can obtain the optimal resource allocation in heterogeneous ad hoc networks with consideration of both elastic and inelastic traffic.
According to (24), the subgradient of ( , ) at point is given by The subgradient for ( , ) at can be obtained in a similar way. Thus, we can obtain the price adjustment scheme with step sizes and at iteration time :

Elastic Rate
Allocation. The subproblem 1 ( ) represents an optimal resource allocation problem for elastic flows. The gradient of 1 ( , ) with respect to is as follows: Thus, we can derive the following algorithm of source rate adjustment for elastic flow : where > 0 is a constant step size and [ ] + = max{ , 0}.

Inelastic Rate Allocation.
The objective of the subproblem 2 ( ) is to obtain the optimal rate allocation for inelastic flows, such that their QoS demands can be met. We define the objective function of subproblem 2 ( ) as Note that the objective function 2 ( , ) is differential with respect to variable over the range ≤ ≤ . According to (31), we have Thus, the inelastic rate allocation algorithm can be derived as follows: where is a positive scale step size and [ ] denote the projection onto the range [ , ].

Algorithm for Heterogeneous Resource Allocation.
To sum up the above analysis, we present the heterogeneous resource allocation algorithm (HRA) as follows.
For each elastic flow , may be interpreted as the shadow price of flow . First, the source node receives shadow price information from all elastic flows. Then, it calculates the shadow price according to (27) and updates the source rate for elastic flow according to (30). Finally, it reports the new transmission rate to all links on its path.
For inelastic flows, source rates are allocated according to different types of traffic. If the traffic is hard real-time, each clique reserves necessary bandwidth ∑ to support real-time service. Note that hard real-time flows do not change their rates during the iteration, so the bandwidth reservation process will not be affected by elastic flows. On the other hand, if the traffic has sigmoidal utility, the source node calculates the effective capacity for inelastic flow . Then it updates the new transmission rate and broadcasts this message to all the neighboring nodes.

Inelastic Rate Allocation
(1) For inelastic flows with hard real-time traffic, each clique first reserves necessary bandwidth ∑ and then allocates the remaining bandwidth.
(2) Loop until the bandwidth allocation of all the hard real-time traffic is completed.
(3) For inelastic flows with sigmoidal utility, the source nodes of clique calculate the effective capacity for inelastic flow and then broadcast this message to all the neighboring cliques.
(4) Update the shadow price of inelastic flows according to (28). The HRA algorithm will proceed with a two-stage iteration. First, the inelastic rate allocation process is executed since the QoS requirements for real-time applications should be met in advance. Then, the elastic flow allocation is executed based on the remaining bandwidth for non-real-time service. Furthermore, if we choose appropriate utility functions and for elastic and inelastic flows, respectively, different utility fairness models-such as utility proportional fairness and utility max-min fairness-can be achieved.

Performance Evaluation
In this section, we present the simulation results for HRA algorithm in heterogeneous ad hoc networks consisting of both elastic and inelastic flows.

Case 1: Elastic Network Scenario.
In Figure 3, we set up the elastic network scenario composed of six users, where each user's utility function is set to ( ) = log( ) ( > 0) for imposing utility proportional fairness. In this case, we can study the optimal utility fairness among the users. As shown in Figure 3, the network consists of six nodes and three unidirectional links through 3 → 4, 2 → 3 → 4 → 5, and 1 → 2 → 3 → 4 → 5 → 6, with the link capacity equal to 1 Mbps. In the simulation, we choose the step size = 0.1 and the simulation time is set to 200 seconds. Figure 4 shows the calculated rates of the elastic flows change with time. We observe that the date rates of all flows change sharply at the beginning of the iteration. In a sense, flow 1 and flow 3 are relatively stable, while flow 2 is much more intense than the other flows. Because flow 2 goes across the four nodes (i.e., nodes 2, 3, 4, and 5) and they are all in the middle of the network, the wireless channel competition will be more intense, which causes bigger fluctuations of flow 2. After a period of fluctuation, the algorithm converges to the optimal solution quickly, which shows the effectiveness of our algorithm.
In addition, we can find something interesting from  the elastic flows, the three flows need to adjust their data rate according to the network utility. Finally, they all converge to the optimal value with satisfactory speed, which further verify the convergence of the HRA algorithm.

Case 2: Inelastic Network Scenario.
In Case 2, for comparison purpose, we set the inelastic network scenario which is composed of seven nodes and four flows. As shown in Figure 5, the network consists of four unidirectional data flows A → C → D, G → E → D, F → E, and B → C → D → E → F with capacities fixed, respectively, at 2 MB/s, 1 MB/s, 3 MB/s, and 1 MB/s. There are four sources A , B , F , and G with a sigmoidal utility function, which represents an inelastic data flow typically associated with the real-time application.
In the simulation, we run the HRA algorithm with = 0.2 and the results are given in Figure 6. It can be seen that the network utility varies over time. At the beginning, the initial utility of each user is set to a lower value, respectively. Later, each source user gradually increases their utility to improve the network throughput. However, the source rate of each user should be also controlled well due to the link capacity limitation. Moreover, the utilities allocated to four sources A , B , F , and G are different. At first, the utilities of all sources are almost the same. Then, the source node F rapidly improves its data rate, thereby increasing the utility and surpassing the other nodes quickly. In the whole simulation, the data rates of flow GED and flow BCDEF are very close, overlapping constantly. This is determined by the network topology and user utility. As we can see, flow BCDEF travels across multiple nodes and flow GED is in the middle of the network. In this way, each node can adjust its data transfer rate according to the network topology and location automatically, which ensures the overall optimization of network utility and the user fairness. As expected, the oscillation is observed until the flows all converge to the optimal solution. Therefore, this confirms that the HRA algorithm given in this paper can provide an efficient resource allocation scheme with both considerations of network utility and fairness for heterogeneous ad hoc networks.

Case 3: Mixed Network with Elastic and Inelastic Flows.
In Case 3, we evaluate the dynamic performance of our heterogeneous resource allocation algorithm (HRA) in largescale networks and compare our solution with two other algorithms. As shown in Figure 7, we designed a hybrid wireless ad hoc network scenario, including 60 nodes randomly generated in the area of size 1000 m * 1000 m. The network is composed of three parts, with an isolated node in the middle. Nodes of different colors represent different applications, which belong to the heterogeneous network and can provide versatile services. The transmission range and interference range of all nodes are 250 m and 550 m, respectively.
To test the performance of HRA algorithm under elastic and inelastic conditions, we ran different types of traffic generators over the wireless ad hoc scenario. There are various  4) ), and 4 ( 4 ) = 1/(1 + −2( 4 −7) ). Each utility function is multiplied by a nonnegative weighting factor , to adjust the utility ratio of elastic and inelastic flows. The first two functions, which are logarithmic utility functions, represent elastic applications, whereas the last two sigmoidal utility functions approximate real-time applications. All the sources have their maximum data transfer rate at 10 Mbps. Figure 8 shows how the average transfer rates for inelastic and elastic flows converge when HRA algorithm is used, where the rates are allocated to two elastic and two inelastic flows. From this figure, we can see that the QoS requirements of all flows are satisfied. The average service rate of the inelastic flow on each link is larger than the minimum threshold, which equals 350 Kbps. Moreover, for each link of the elastic flow, its average service rate is larger than the minimum transmission rate request. Therefore, HRA algorithm not only can allocate elastic flow effectively, but also can be used in the inelastic flow, which guarantees the transmission of real-time applications.

Comparison between HRA and Other Algorithms.
As utility is our main performance metric, we will compare our solution HRA with two other nonheterogeneous allocation schemes. One is a simple resource allocation algorithm called SRA, in which the heterogeneous characteristics are not exploited for rate allocation. SRA always handles elastic and inelastic flows in the same way. Therefore, it cannot distinguish elastic and inelastic flows well. The other is similar to the "Utility-Based Adaptive Resource Allocation" algorithm proposed by Rodrigues and Casadevall [34]. We make some modifications and call it UBARA. It manages the tradeoff between system resource efficiency and user fairness and can be applied to wireless network scenarios. Since the original algorithm cannot deal with hybrid network scenario, we take the following changes to handle both elastic and inelastic traffic. For inelastic flows, each link transmits at the same rate level in all network conditions. For elastic flows, it allocates flow rate based on the user utility.
In this part, we will verify the impact of node mobility on the performance of HRA. The mobility model is as follows: a node randomly selects a destination within the network limits and then moves towards it at a speed of 4, 8, 12, 16, and 20 m/s. The simulation lasts 150 seconds and the delay limit is set to 5. The network topology and other parameters are the same as Case 3. Figure 9 shows how the utility of elastic flow changes with the node mobility. We can derive the following observations. First, when the mobility speed is low, the utility of three algorithms is very close. Among them, HRA performs best. Second, as the node mobility speed increases, UBARA and SRA decrease very quickly. At last, when the node speed increases up to 20 m/s, HRA can still keep a high system utility, while SRA and UBARA fall to less than 3.
In Figure 10, we can find something interesting. For inelastic flows, HRA exhibits averagely twice higher utility than UBARA and SRA. When the node speed increases more than 12 m/s, the utility of SRA and UBARA declines less than 1, which means they cannot meet the rate demand of inelastic flows. On the contrary, HRA still keeps a higher utility more than 2. That means HRA can completely meet the demand of real-time applications, which are composed of inelastic flows. In all experiments, HRA performs best among the three algorithms. Specifically in inelastic network scenarios, HRA performs much better than SRA and UBARA.
These results are due to the following reasons. One is that HRA tries to allocate resources to the urgent inelastic flow with higher priority, since inelastic flow is delay-sensitive and elastic flow is delay-tolerant. When the channel is in good condition, HRA tries to allocate a high rate to elastic and inelastic flows according to the user utility. If the channel is in poor condition, HRA decreases the service rate of elastic flows to guarantee the transmission demand of inelastic flows. In this way, the service rate of inelastic flow can exceed the threshold. Thus, the aggregate utility of inelastic flows is always maintained at a high level (i.e., greater than two), which fully meet the demand of real-time applications. However, SRA and UBARA always try to allocate equal bandwidth to elastic and inelastic flows, no matter how poor the network state is. This greatly affects the transmission of inelastic flows, leading to the overall inelastic utility less than 1. Therefore, the demand of real-time applications cannot be met by SRA and UBARA. The other reason is that when nodes move at a high speed, the network topology is changing dramatically. Since SRA and UBARA do not distinguish between elastic and inelastic flows, they may not find the global optimum. In all experiments, UBARA performs slightly better than SRA, because UBARA is a utility-based resource allocation scheme, considering the user fairness. However, UBARA cannot satisfy the QoS requirement of real-time applications, as it cannot distinguish the two types of traffic.
On the other hand, HRA can find the optimal tradeoff strategy between resource efficiency and user fairness for elastic and inelastic flows, although the network states are changing very fast. With both considerations of flow rate and utility fairness, HRA performs much better than SRA and UBARA especially in highly dynamic and mobile networks. In contrast, SRA and UBARA neither exploit the heterogeneous characteristic nor optimize the service rates of inelastic flows, which lead to the low accumulated system utility in hybrid network scenario mixed with elastic and inelastic flows.
To further show the performance of HRA, we evaluate the throughput of HRA and compare it with the other two algorithms. The simulation results are shown in Figure 11. When the number of users is less than 8, SRA and UBARA are very close and their throughput is higher than 2 Mbps. However, when the number of users is larger than 10, the throughput of SRA and UBARA declines quickly because of the absence of fairness consideration. When the user number reaches 18, the throughput of SRA is below 1 Mbps. In all experiments, HRA achieves the highest aggregate throughput among the three algorithms. The explanation for the above results is straightforward: HRA can guarantee the utility fairness among elastic and inelastic flows, while the other two algorithms cannot.
Finally, we evaluate the fairness index of HRA, which is a particularization of the well-known Jain fairness index proposed by Jain et al. in [35]. The difference is that the fairness index here considers both elastic and inelastic flows, and we call it mixed fairness index (MFI). From Figure 12, we observe that HRA has a better fairness index than both SRA and UBARA. When the user number is equal to 1, the three algorithms all achieve the same fairness index close to 1. They do not need to allocate rate among different users if the user is only one; therefore, the fairness index must be 1. On the other hand, if users increase, they need to allocate extra bandwidth to other users, so the fairness index will be reduced. When the number of users exceeds 9, the gap between HRA and the other two algorithms becomes larger.
The above simulation results indicate that, compared with SRA and UBARA, HRA can allocate resources more fairly and more efficiently in a distributed manner, while maintaining a higher system throughput for real-time flows. In fact, HRA can manage the tradeoff between elastic and inelastic flows, which guarantees the utility fairness among various applications. More importantly, the simulation confirms that the flow control algorithm proposed in this paper can provide an efficient utility fair resource allocation in heterogeneous  networks, not only suitable for common elastic data traffic but also applicable to inelastic real-time applications.

Conclusions
In this paper, we have developed a heterogeneous resource allocation algorithm (HRA) for wireless ad hoc networks, supporting both elastic and inelastic traffic. The proposed algorithm can allocate resource for heterogeneous ad hoc networks, which may contain diverse node types and execute various tasks. Besides rate allocation, utility fairness is also integrated into the framework to provide a good performance balance among various applications. We have shown that HRA algorithm converges fast and can achieve the global optimum starting from many different network conditions, such as elastic network scenario, inelastic network scenario, and hybrid network scenario. As highlighted, HRA can manage the tradeoff between elastic and inelastic traffic, which guarantees the utility fairness among competing flows. Compared with the other two algorithms, HRA can allocate resource more fairly and more efficiently, while maintaining a higher network throughput for the system. Therefore, our algorithm is well suited for heterogeneous ad hoc networks. Moreover, even though the development of this research is in the ad hoc network environment, our algorithm can be generally extended and applied to wireless sensor networks due to the good scalability of the framework.