{'fraction_non_alphanumeric': 0.032154855223164296, 'fraction_numerical': 0.007598784194528876, 'mean_word_length': 4.273091522564319, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Access-Network Association Policies for Media Streaming in Heterogeneous Environments

We study the design of media streaming applications in the presence of multiple heterogeneous wireless access methods with different throughputs and costs. Our objective is to analytically characterize the trade-off between the usage cost and the Quality of user Experience (QoE), which is represented by the probability of interruption in media playback and the initial waiting time. We model each access network as a server that provides packets to the user according to a Poisson process with a certain rate and cost. Blocks are coded using random linear codes to alleviate the duplicate packet reception problem. Users must take decisions on how many packets to buffer before playout, and which networks to access during playout. We design, analyze and compare several control policies with a threshold structure. We formulate the problem of finding the optimal control policy as an MDP with a probabilistic constraint. We present the HJB equation for this problem by expanding the state space, and exploit it as a verification method for optimality of the proposed control law.


I. INTRODUCTION
Media streaming is fast becoming the dominant application on the Internet [1]. The popularity of such media transfers has been accompanied by the growing usage of wireless handheld devices as the preferred means of media access. It is expected that such media streaming would happen in both a device to device (D2D) as well as in a base-station to device fashion, and both the hardware and applications needed for such communication schemes are already making an appearance [2].
Media streaming is achieved by dividing a file into blocks, which are then further divided into packets for transmission. After each complete block is received, it can be decoded and played out. Since we consider a streaming application, blocks inherently have a sequence associated with them, and each block must be received by the time the previous one has been played out. The absence of a block at the time of playout would cause a frame freeze, which is to be avoided if possible. When there are multiple networks that can be used to access a particular piece of content (e.g. from a base station or a peer device) each device must take decisions on associating with one or more such access networks. However, the costs of different access methods might be different. For example, accessing the base station of a cellular network can result in additional charges per packet, while it might be possible to receive the same packets from the access point of a local WLAN or another device with a lower cost or possibly for free. Further, the cost of communication might be mitigated by the initial amount of buffering before playout. Hence, there are trade-offs between the probability of frame skipping, the initial waiting time, and the cost of different access methods available.
The objective of this paper is to understand the trade-off between initial buffering, and the usage of low and costly communication methods for attaining a target probability of skip-free playout. We consider a system wherein network coding is used to ensure that packet identities can be ignored, and packets may potentially be obtained from two sources (servers) that have different rates of transmission. The wireless channel is unreliable, and we assume that each server can deliver packets according to a Poisson process with a known rate. Further, the costs of accessing the two servers are different; for simplicity we assume that one of the servers is free. Thus, our goal is to develop an algorithm that switches between the free and the costly servers in order to attain a target probability of skipping at lowest cost.
Our contributions are as follows. We first develop an analytical characterization of the interruption probability for the single server case. Using this result, we obtain a lower bound on the cost of offline policies that do not observe the trajectory of packets received. We show that such policies have a threshold form in terms of the time of association with the costly server. Using the offline algorithm as a starting point, we develop an online algorithm with lower cost that has a threshold form -both free and costly servers are used until the queue length reaches a threshold, followed by only free server usage. We then develop an online algorithm in which the risk of interruption is spread out across the trajectory. Here, only the free server is used whenever the queue length is above a certain threshold, while both servers are used when the queue length is below the threshold. The threshold is designed as a function of the initial buffer size and the desired interruption probability.
We formulate the problem of finding the optimal network association policy as a Markov Decision Process with a probabilistic constraint. Similarly to the Bellman equation proposed by Chen [3] for a discrete time MDP with prob-abilistic constraints, we write the Hamilton-Jacobi-Bellman equation for the problem. Using a guess and check approach, we derive an approximate solution of the HJB equation, and show that the optimal policy given by the approximate value function takes a threshold form.
Media streaming, particularly in the area of P2P networks has attracted significant recent interest. For example, work such as [4], [5], [6] develop analytical models on the trade-off between the steady state probability of missing a block and buffer size under different block selection policies. Unlike our model, they consider live streaming with deterministic channels. The use of random linear codes considerably simplifies packet selection [7], [8], [9], [10], and we can use the same idea to ensure that packets can be received from multiple sources without the need to coordinate the exact identities of the packets from each. However, we focus on content that is already cached at multiple locations, and must be streamed over one or more unreliable channels. Related to our work is [11], which considers two possible wireless access methods (WiFi and UMTS) for file delivery, assuming particular throughput models for each access method. In contrast to this work, packet arrivals are stochastic in our model, and our streaming application requires hard constraints on quality of user experience.

II. SYSTEM MODEL AND QOE METRICS
We consider a media streaming system as follows. A single user is receiving a media file of size F from various servers it is connected to. Each server could be a wireless access point or another wireless user operating as a server. The receiver first buffers D packets from the beginning of the file, and then starts the playback.
We assume that time is continuous, and the arrival process of packets from each server is a Poisson process independent of other arrival processes. Further, we assume that no redundant packet is delivered from different servers. This assumption can be justified if there is no delay in the feedback to the servers, or by sending random linear combination of the packets in the server (see [12] and [13] for more details). Therefore, we can combine the arrival processes of any subset S of the servers into one Poisson process of rate R S equal to the summation of the rates from the corresponding servers.
There are two types of servers in the system: free servers and the costly ones. There is no cost associated with receiving packets from a free server, but a unit cost is incurred for each (coded) packet delivered by any costly server. As described above, we can combine all the free servers into one free server from which packets arrive according to a Poisson process of rate R 0 . Similarly, we can merge all of the costly servers into one costly server with effective rate of R c . At any time t, the user has the option to use packets only from the free server or from both the free and the costly servers. In the latter case, the packets arrive according to a Poisson process of rate R 1 = R 0 + R c . The user's action at time t is denoted by u t ∈ {0, 1}, where u t = 0 if only the free server is used at time t, while u t = 1 if both free and costly servers are used. We normalize the playback rate to one, i.e., it takes one unit of time to play a single packet. We also assume that the parameters R 0 and R 1 are known at the receiver.
The dynamics of the receiver's buffer size (queue-length) x t can be described as follows where D is the initial buffer size, N t Poisson processes of rate R 0 and N c t is a Poisson counter of rate R c which is independent of the process N t . The last term correspond to the unit rate of media playback.
The user's association (control) policy is formally defined below. Denote by Π the set of all such control policies.
We can declare an interruption in playback when the buffer size decreases to zero before reaching the end of the file, i.e., when there is no packet at the receiver to be played but the file is not completely downloaded. More precisely, let where τ f corresponds to time of completing the file download, because we have already played τ f packets and the buffer contains the remaining F − τ f packets to be played. The video streaming is interrupted if and only if τ e < τ f . We consider the following metrics to quantify Quality of user Experience (QoE). The first metric is the initial waiting time before the playback starts. This is directly captured by the initial buffer size D. Another metric that affects QoE is the probability of interruption during the playback for a particular control policy π denoted by where τ e and τ f are defined in (2).
The set of all such feasible policies is denoted by Π(D, ǫ).
The third metric that we consider in this work is the expected cost of using the costly server which is proportional to the expected usage time of the costly server. For any (D, ǫ), the usage cost of a (D, ǫ)-feasible policy π is given by 1 The value function or optimal cost function V is defined as and the optimal policy π * is defined as the optimal solution of the minimization problem in (5). In our model, the user expects to have an interruptionfree experience with probability higher than a desired level 1 − ǫ. Note that there is a fundamental trade-off between the interruption probability ǫ, the initial buffer size D, and the usage cost. These trade-offs depend on the association policy as well as the system parameters R 0 , R c and F .
We first characterize the trade-offs between the QoE metrics for degenerate control policies. Next, we use these results to design association policies.

III. QOE TRADE-OFFS FOR THE SINGLE-SERVER PROBLEM
Consider a single-server problem where the receiver receives the packets according to a Poisson process of rate R. The user's only decision in this case is the initial buffer size D. We would like to characterize the optimal trade-off between the initial buffer size and the interruption probability p(D) by providing bounds on the interruption probability as a function of the system parameters R and F . An upper bound (achievability) on p(D) is particularly useful, since it provides a sufficient condition for desirable user experience. A lower bound (converse) on p(D) demonstrates how tight the upper bound is. Theorem 1. For the initial buffer size D, let p(D) be the interruption probability of a single-server system defined as in (3). Define γ(r) as andr(R) as the largest root of γ(r), i.e., r(R) = sup{r : γ(r) = 0}.
Then for all R > 1, Proof: We do not include the proof owing to space limitations. See [13] for a complete proof.
Note that the upper bounds and lower bounds of p(D) given by Theorem 1 are asymptotically tight as F goes to infinity. Therefore, for F = ∞, by continuity of the probability measure we get Using this characterization, we can identify the ranges of the QoE metrics for which there exists no feasible policy or the costly server is not required. Proof: Consider the degenerate policy π 0 ≡ 0. This policy is equivalent to a single-server system with arrival rate R = R 0 . By Definition 2, and (9), the policy π 0 is (D, ǫ)-feasible for all D ≥ 1 r(R0) log 1 ǫ . Note that by (4) this policy does not incur any cost, which results in part (a).
Moreover, for all (D, ǫ) with D < 1 r(R1) log 1 ǫ , there is no (D, ǫ)-feasible policy. This is so since the buffer size under any policy π is stochastically dominated by the one governed by the degenerate policy π 1 ≡ 1. Hence, Using the convention of infinite cost for infeasible policies, we obtain the result in part (b).
For simplicity of notation, let α 0 =r(R 0 ), and α 1 = r(R 1 ). Throughout the rest of this paper, we study the case that the file size F is infinite, since the control policies in this case take simpler forms and the cost of such control policies provide an upper bound for the finite file size case. Further, by Corollary 1 we focus on the region to analyze the expected cost of various classes of control policies.

IV. DESIGN AND ANALYSIS OF ASSOCIATION POLICIES
In this section, we propose several classes of parameterized control policies. We first characterize the range of the parameters for which the association policy is feasible for a given initial buffer size D and the desired level of interruption probability ǫ. Then, we try to choose the parameters such that the expected cost of the policy is minimized. Owing to space limitation, we omit all of the proofs of the main theorems in this section. The complete proofs can be found in the full version of this paper [14].

A. Off-line Policy
Consider the class of policies where the decisions are made off-line before starting media streaming. In this case, the arrival process is not observable by the decision maker. Therefore, the user's decision space reduces to the set of deterministic functions u : R → {0, 1}, that maps time into the action space.
Theorem 2. Let the cost of a control policy be defined as in (4). In order to find a minimum-cost off-line policy, it is sufficient to consider policies of the following form: Theorem 3. Consider the class of off-lines policies of the form (11). For any (D, ǫ) ∈ R, the policy π defined in (11) is feasible if (12) Note that obtaining the optimal off-line policy is equivalent to finding the smallest t s for which the policy is still feasible. Therefore, t * s given in (12) provides an upper bound on the minimum cost of an off-line policy. Observe that t * s is almost linear in D for all (D, ǫ) that is not too close to the lower boundary of region R. As (D, ǫ) gets closer to the boundary, t * s and the expected cost grows to infinity, which is in agreement with Corollary 1. In this work we pick t * s as a benchmark for comparison to other policies that we present next.

B. Online Safe Policy
Let us now consider the class of online policies where the decision maker can observe the buffer size history. Inspired by the structure of the optimal off-line policies, we first focus on a safe control policy in which in order to avoid interruptions, the costly server is used at the beginning until the buffer size reaches a certain threshold after which the costly server is never used. This policy is formally defined below.
Definition 3. The online safe policy π S parameterized by the threshold value S is given by where τ S = inf{t ≥ 0 : x t ≥ S}. Moreover, Let us now compare the online safe policy π S * with the off-line policy defined in (11) with parameter t * s as in (12). We observe that the cost of the online safe policy is almost proportional to that of the off-line policy, where the cost ratio of the off-line policy to that of the online safe policy is given by Note that the structure of both policies is the same, i.e, both policies use the costly server for a certain period of time and then switch back to the free server. As suggested here, the advantage of observing the buffer size allows the online policies to avoid excessive use of the costly server when there are sufficiently large number of arrivals from the free server.
In the following, we present another class of online policies.

C. Online Risky Policy
In this part, we study a class of online policies where the costly server is used only if the buffer size is below a certain threshold. We call such policies "risky" as the risk of interruption is spread out across the whole trajectory unlike the "safe" policies. Further, we constrain risky policies to possess the property that the action at a particular time should only depend on the buffer size at that time, i.e., such policies are stationary Markov with respect to buffer size as the state of the system. The risky policy is formally defined below.
Definition 4. The online risky policy π T parameterized by the threshold value T is given by Theorem 5. Let π T be the risky policy defined in Definition 4. For any (D, ǫ) ∈ R, the policy π T is feasible if the threshold T satisfies α1 log β ǫ . Theorem 5 facilitates the design of risky policies with a single-threshold structure, for any desired initial buffer size D and interruption probability ǫ. For a fixed ǫ, when D increases, T * (the design given by Theorem 5) decreases to zero. On the other hand, if D decreases to 1 α1 log 1 ǫ (the boundary of R), the threshold T * quickly increases to infinity, i.e., the policy does not switch back to the free server unless a sufficiently large number of packets is buffered. Figure 1 plots T * and D as a function of D for a fixed ǫ. Observe that for large range of D, T * ≤ D, i.e., the costly server is not initially used. In this range, owing to the positive drift of Q t , the probability of ever using the costly server exponentially decreases in (D − T * ). Next we compute relatively tight bounds on the expected cost of the online risky policy and compare with the previously proposed policies. Theorem 6. For any (D, ǫ) ∈ R, consider an online risky policy π T * defined in Definition 4, where the threshold T * is given by (16) as function of D and ǫ. If D ≥D then and if D ≤D In the following, we compare the expected cost of the presented policies using numerical methods, and illustrate that the bounds derived in Theorems 3, 4 and 6 on the expected cost function are close to the exact value. Figure 2 compares the expected cost functions of the offline, online safe and online risky policies as a function of the initial buffer size D, when the interruption probability is fixed to ǫ = 10 −3 , the arrival rate from the free server is R 0 = 1.05, and the arrival rate from the costly server is R c = R 1 − R 0 = 0.15. We plot the bounds on the expected cost given by Theorems 3, 4 and 6 as well as the expected cost function numerically computed by the Monte-Carlo method.

D. Performance Comparison
Observe that the expected cost of the risky policy is significantly smaller that both online safe and off-line policies. For example, the risky policy allows us to decrease the initial buffer size from 70 to 20 with an average of 70 × 0.15 ≈ 10 extra packets from the costly server. The expected cost in terms of the number packets received from the costly server is 43 and 61 for the online safe and off-line policy, respectively.
Moreover, note that it is merely the existence of the costly server as a backup that allows us to improve the user's quality of experience without actually using too many packets from the costly server. For example, observe that the risky policy satisfies QoE metrics of D = 35 and ǫ = 10 −3 , by only using on average about one extra packet from the costly server.
However, without the costly server, in order to decrease the initial buffer size from 70 to 35, the interruption probability has to increase from 10 −3 to about 0.03 (see Theorem 1).

V. DYNAMIC PROGRAMMING APPROACH
In this section, we present a characterization of the optimal association policy in terms of the Hamilton-Jacobi-Bellman (HJB) equation. Note that because of the probabilistic constraint over the space of sample paths of the buffer size, the optimal policy is not necessarily Markov with respect to the buffer size as the state of the system. We take a similar approach as in [3] where by expanding the state space, a Bellman equation is provided as the optimality condition of an MDP with probabilistic constraint. In particular, consider the pair (x, p) as the state variable, where x denotes the buffer size and p represents the desired level of interruption probability. The evolution of x is governed by the following stochastic differential equation where N u is a Poisson counter with rate R u = R 0 + u · R c . For any (D, ǫ) ∈ R and any optimal policy π, the constraint p π (D) ≤ ǫ is active. Hence, we consider the sample paths of p such that p 0 = ǫ and E[p t ] = ǫ for all t, where the expectation is with respect to the Poisson jumps. Letp = p + dp if a Poisson jump occurs in an infinitesimal interval of length dt. Also, let dp 0 be the change in state p is no jump occurs. Therefore, 0 = E[dp] = R u dt(p − p) + (1 − R u dt)dp 0 .
By solving the above equation for dp 0 , we obtain the evolution of p as Similarly to the arguments of Theorem 2 of [3], by principle of optimality we can write the following dynamic programming equation If V is continuously differentiable, by Itō's Lemma for jump processes, we have which implies the following HJB equation The optimal policy π is obtained by characterizing the optimal solution of the partial differential equation in (22) together with the boundary condition V (x, 1) = 0. Since such equations are in general difficult to solve analytically, we use the guess and check approach, where we propose a candidate for the value function and verify that it nearly satisfies the HJB equation almost everywhere. Moreover, we show that the trajectories of (x t , p t ) steered by the optimal actions (u * ,p * ) lie in a one-dimensional invariant manifold, leading to the risky policy defined in Definition 4.
For any (x, p) ∈ R define when x ≥ 1 a1 log θ p , and when x < 1 a1 log θ p . Note that the candidate solution is derived from the structure if the expected cost of the risky policy (cf. Theorem 6). We may verify thatV satisfies the HJB equation (22) for all (x, p) such that x ≥ 1 a1 log θ p or x ≥ 1 a1 log θ p − 1, but for other (x, p) the HJB equation is only approximately satisfied. This is due to bounding the overshoots, when computing the expected cost of the risky policy. The verification of HJB equation for our candidate solution is tedious but straightforward. We do not include it owing to space limitation. Theorem 7. Let π * be the optimal association policy obtained from minimizing the right hand side of the HJB equation in (22) for the value function given by (24) and (25). Then π * is a risky policy defined in Definition 4 with a threshold level T (D, ǫ), where D is the initial buffer size and ǫ is the desired interruption probability.
Proof: We sketch the proof owing to space limitation. First, we can show that the optimal action u * (x, p) takes the following form Moreover, we may verify that for the initial condition (x 0 , p 0 ) = (D, ǫ), the trajectory of (x t , p t ) steered by the optimal actions (u * ,p * ) is limited to a one- where T (D, ǫ) is given by (23). Therefore, by plugging the above relation back into (26), we can show that the optimal action u * = 0 if and only if x ≥ T (D, ǫ), i.e., the optimal policy given by the HJB equation is of the form of the risky policy in Definition 4 with threshold T = T (D, ǫ).

VI. CONCLUSIONS AND FUTURE WORK
In this paper we studied the problem of selecting the access-networks in a heterogeneous wireless environment for media streaming applications. Our objective was to investigate the trade-offs between the network usage cost and the user's QoE requirements parameterized by initial waiting time and allowable probability of interruption in media playback. We analytically characterized and compared the expected cost of both off-line and online policies, finally showing that a threshold-based onilne risky policy achieves the lowest cost. Moreover, we derived an HJB equation for the problem of finding the optimal deterministic policy formulated as an MDP with a probabilistic constraint, and verified that the the online risky policy nearly satisfies the HJB equation. Numerical analysis also confirmed our analytical results showing that merely the availability of a costly server used as a back-up significantly improves QoE of media streaming without incurring a significant usage cost.
In the future, we would like to study more accurate models of channel variations such as the two-state Markov model due to Gillbert and Elliot. In this work we focused on deterministic network association policies. Another extension of this work would consist of studying randomized control policies. Finally, we would like to study more of the peer-topeer aspect of the system to understand the decision making at the system level.