Matched Queues with Flexible Customers and Impatient Customers

This paper studies a double-ended queue with four Poisson inputs and flexible customers, and its stability is guaranteed by customers’ impatient behavior. We show that such a queue can be expressed as a quasi birth-and-death (QBD) process with infinitely many phases. For this purpose, we provide a detailed analysis for the QBD process, including the system stability, the stationary probability vector, the sojourn time, and so forth. Finally, numerical examples are employed to verify the correctness of our theoretical results, and demonstrate how the performance measures of this queue are influenced by key system parameters. We believe that the methodology and results described in this paper can be applied to analyze many practical issues, such as those encountered in sharing economy, organ transplantation, employee recruitment, online dating, and so on.


Introduction
We consider a double-ended queueing system with flexible customers and impatient customers. There are two classes of customers, A-customers and B-customers. A-customers are divided into flexible customers and inflexible customers, denoted by Type 1 and Type by Class 2 and Class 1. The A-customers of Type 1 and Type 2 enter the system, and queue up in their own order of arrival. When a B-customer of Class 1 arrives, she will match with an A-customers of Type 1. If the queue of A-customers of Type 1 is empty, the B-customer of Class 1 leaves. When a B-customer of Class 2 arrives, she will match with an A-customers of Type 1 or Type 2. The probability that a B-customer of Class 2 match with an A-customers of Type 1 is assumed to depend both on the number of A-customers of Type 1 and on the number of A-customers of Type 2. If both queues of A-customers of Zenios [48], Boxma et al. [6], Stanford et al. [43], and Elalouf et al. [18]; taxi services by Giveen [20,21], Kashyap [24,25,26], Bhat [5], Baik et al. [3], Shi and Lian [41], and Zhang et al. [49]; sharing economy by Cheng [16], Sutherland and Jarrahi [45], and Benjaafar and Hu [4]; transportation by Browne et al. [9] and Baik et al. [3]; assembly systems by Hopp and Simon [22], Som et al. [42], and Ramachandran and Delen [39]; inventory management by Sasieni [40], Porteus [38], and Axsäter [2]; health care by Pandey and Gangeshwer [34]; multimedia synchronization by Steinmetz [44] and Parthasarathy et al. [35]; housing allocations systems by Talreja and Whitt [46] and Johnson [23]; online dating by Chen et al. [15], Pizzato et al. [37] and Epstein and Robert [19], and so on.
In recent years, academic research related to double-ended queue has grown rapidly. In these queueing system, matching process is aimed at two classes of users: customers and servers. Kashyap [25] considers the system in which there is limited waiting space both for customers and for taxis, and that the taxis 'serve' the customers in bulk. Conolly et al. [17] studied the effect of impatience behavior of customers and taxis primarily in the context of double-ended queues under the common setting of Poisson arrivals and exponential impatience times. Liu et al. [31] considered some diffusion models for double-ended queues where the sellers and buyers arrive according to independent renewal processes.
Liu et al. [29] studied the double-ended queue under the assumption that A-customers and B-customers arrive with Markovian arrival processes (MAPs) and exponential impatience times. Liu et al. [30] analyzed a more general matched queue with matching batch pair (m, n) and impatient customers, where the arrivals of A-and B-customers are both Poisson processes. Büke and Chen [10,11] studied stabilizing policies for probabilistic matching systems and used fluid and diffusion approximations to analyze the system which considering impatient behavior.
What's more, according to different properties, these two classes are further divided into several different types. Caldentey et al. [13] considered a bipartite matching of multitype customers to multi-type servers. Adan and Weiss [1] described multi-type customers to multi-type servers by a multi-dimensional countable Markov chain, obtained ergodicity condition, and derived its stationary distribution of product-form for matching rate. Bušić et al. [12] studied the stability of the associated discrete time Markov chain under various admissible matching policies for systems where customers and servers form a bipartite graph. Gurvich and Ward [47] considered optimal control of the matching of different classes of items that arrive randomly over time. Mairesse and Moyal [32] generalized the bipartite matching model and developed necessary conditions for matching networks with general topology. Perlman et al. [36] provided and analyzed a general model of the flexible-resource queueing system, and then focused on its application in the context of live kidney transplantation. Castro et al. [14] studied a parallel matching queue with reneging, and derived explicit product forms of the steady state distributions of this system.
In this paper, we studied a parallel matching queue where A-customers and B-customers arrive randomly over time. A-customers queue up in the system, and may abandon the system as time goes by. But B-customers arrival have zero patience and leave the system if they cannot be matched immediately. This queueing system is expressed as a leveldependent QBD process with infinitely many phases in which its analysis is extremelly challenging. We via RG-factorization to obtain stationary probability distribution which can be the basis of stationary queue length and sojourn time. Readers may refer to Li [27], Li and Cao [28] about the RG-factorizations.
We summarize the main contributions of this paper as follows: (1) We describe a more general matched queue with with flexible customers and impatient customers, and also the customers' impatient behavior is to guatantee the stability of the system.
(2) We express the matched queue with flexible customers as a level-dependent QBD process with infinitely many phases, and apply the RG-factorizations by Li [27] to obtain the stationary probability vector, which is used for analyzing the average stationary queue lengths of the A-customers of Type 1 and Type 2.
(3) We study the average sojourn time of any A-customer of Type 1 and Type 2 by using a phase-type distribution, whose computation is established in terms of the RG-factorizations given in Li [27].
(4) We use some numerical examples to verify the correctness of our theoretical results, and indicate how the performance measures of the double-ended queue with flexible customers are influenced by key system parameters. In addition, the numerical results are also given a simple but interesting discussion by means of the coupling method of Markov processes.
The structure of this paper is organized as follows. Section 2 describes a double-ended queue with flexible customers, four Poisson inputs and customers' impatient behaviors. Section 3 shows that the double-ended queue can be expressed as a new QBD process with infinitely many phases. By using the QBD process with infinitely many phases, we obtain some stable conditions for the double-ended queues with flexible customers. Section 4 studies the stationary probability vector of the QBD process, so that we can compute the average stationary queue lengths of the A-customers of Type 1 and Type 2.
Section 5 discusses the sojourn time of each arriving A-customer of Type 1 and Type 2 respectively, and provides a computational method of PH distribution of infinite sizes to deal with the average sojourn time. Section 6 uses some numerical examples to indicate how the performance measures of the double-ended queue are influenced by key system parameters. Finally, Section 7 gives some concluding remarks.

Model Description
In this section, we describe a more general double-ended queue with flexible customers, four Poisson inputs and customers' impatient behaviors, and also introduce operational mechanism, system parameters and basic notation.
In the proposed queue, there are two kinds of customers, called A-customers and B-customers. A-customers are divided into flexible customers and inflexible customers, denoted by Type 1 and Type 2. And B-customers are divided into flexible customers and inflexible customers, denoted by Class 2 and Class 1. If an arriving A-customer and an arriving B-customer match, they will constitute a group and leave the queueing system immediately. Figure 1 provides a physical illustration for such a double-ended queue with flexible customers.

A-customers B-customers
Once an A-customer is matched by a B-customer both of them immediately leave this system (1) Arrival processes. The A-customers of Type 1 and Type 2 arrive at the queueing system according to a Poisson process with rate λ 1 and λ 2 , respectively. Similarly, the B-customers of Class 1 and Class 2 arrive at the queueing system according to a Poisson process with rate µ 1 and µ 2 , respectively.
(2) Matched processes. The A-customers of Type 1 and Type 2 enter the system, and queue up in their own order of arrival. When a B-customer of Class 1 arrives, she will match with an A-customers of Type 1. If the queue of A-customers of Type (3) Impatient behavior. If an A-customer of Type 1 (resp. an A-customer of Type 2) stays in the queueing system for a long time, then she will show some impatience.
To capture this phenomenon, we assume that the impatient time, which is defined as the longest time that a customer stays in the buffer before leaving, of an A-customer of Type 1 (resp. an A-customer of Type 2) is exponentially distributed with rate θ 1 (resp. θ 2 ), which is hereafter called impatient rate, θ 1 , θ 2 > 0.
We assume that all the random variables defined above are independent of each other.

Remark 1. (a)
The matching discipline given in Assumption (2) indicates that the Bcustomers are zero impatience. (3) is used to ensure stability of the matched queue.

A QBD Process with Infinitely Many Phases
In this section, we show that the double-ended queue with flexible customers can be expressed as a new QBD process with infinitely many phases. By using the QBD process, we obtain some stable conditions of the double-ended queue with flexible customers.
We denote by N 1 (t) and N 2 (t) the numbers of the A-customers of Type 1 and Type 2 in the double-ended queue at time t ≥ 0, respectively. Let d ij be the probability that an arriving B-customer of Class 2 match with an A-customer of Type 1 when the system is in . We assume that d 0j = 0 for all j ≥ 1, since when N 1 (t) = 0, an arriving B-customer of Class 2 only matches with an A-customer of Type 2. And we assume that d i0 = 1 for all i ≥ 1, since when N 2 (t) = 0, an arriving B-customer of Class 2 matches with probability 1 with an A-customer of Type 1. Moreover, we assume that The double-ended queue with flexible customers can be modeled as a two-dimensional is given by The states of this space are arranged in the following order: For convenience, the state transition relations of the Markov process is depicted in Figure 2. It is easy to see from Figure 2 that the Markov process t ≥ 0} is a new QBD process with infinitely many phases.  Figure 2, the infinitesimal generator of the QBD process {(N 1 (t) , N 2 (t)), t ≥ 0} is given by where The following theorem provides a necessary and sufficient condition for the stability of the double-ended queue with (θ 1 , θ 2 ) > 0. Proof. It is easy to see the irreducibility of the QBD process Q through observing Figure   2, and using the four Poisson inputs, matching probability d ij and the two exponential impatient times with (θ 1 , θ 2 ) > 0.
At the same time, it is not difficult to find that the QBD process Q is bidirectional infinite in both level and phase. Thus, we need to prove the QBD process Q in both level and phase are positive recurrent.
In order to prove the QBD process Q in overall level is positive recurrent, it is key to find some necessary and sufficient condition for the stability of the QBD process Q by means of the mean drift technique by Neuts [33].
Once the stationary probability vector β is obtained, we can compute the (upward and downward) mean drift rates of the QBD process Q. From level j to level j + 1, the upward mean drift rate is given by Similarly, from level j to level j − 1, the downward mean drift rate is given by Note that j is a positive integer, λ 2 > 0, µ 2 > 0 and θ 2 > 0, it is easy to check that if 2 e. Therefore, the QBD process Q in overall level is positive recurrent due to the fact that the mean drift rates: βA  Moreover, in order to prove the QBD process Q in phase at a certain level (that is, A j with the fixed level j) is positive recurrent, it is key to find some necessary and sufficient condition for the stability of the QBD process A j by means of Neuts' method (i.e., the mean drift technique). Now, we can compute the (upward and downward) mean drift rates of the QBD process A j . For i ≥ 1, from phase i to phase i + 1, the upward mean drift rate is given by Similarly, from phase i to i − 1, the downward mean drift rate is given by Note that i is a positive integer, λ 1 > 0, µ 1 > 0, µ 2 > 0 and θ 2 > 0, it is easy to check that . Therefore, the QBD process Q in phase is positive recurrent due to the fact that a i,i−1 > a i,i+1 for a bigger positive integer i, this can hold because i goes to infinity.
Combining with above proof of positive recurrent for QBD process Q in both level and phase, the double-ended queue is stable. This completes the proof.

The Stationary Queue Length
In this section, we first provide a matrix-product expression for the stationary probability vector of the QBD process by means of the RG-factorization. Then we compute two average stationary queue lengths for the A-customers of Type 1 and Type 2, respectively.
Note that the QBD process Q is level-dependent, thus we need to apply the RGfactorization given in Li [27] to calculate their stationary probability vectors. To this end, we need to introduce the U -, R-and G-measures for the QBD process Q.
For the QBD process Q, we define the U L-type U -, R-and G-measures as On the other hand, it is well-known that the matrix sequence {R k , k ≥ 0} is the minimal nonnegative solution to the system of nonlinear matrix equations and the matrix sequence {G k , k ≥ 1} is the minimal nonnegative solution to the system of nonlinear matrix equations Once the matrix sequence {R k , k ≥ 0} or {G k , k ≥ 1} is given, for k ≥ 0 For the QBD process Q, by following Chapters 1 and 2 of Li [27] or Li and Cao [28], the U L-type RG-factorization is given by where The following theorem expresses the stationary probability vector π = (π 0 , π 1 , π 2 , . . .) of the QBD process Q.
Theorem 2. The stationary probability vector π of the level-dependent QBD process Q is given by and where the boundary vector π 0 is uniquely determined by the system of linear equation ) and the positive constant c is uniquely given by Proof. The proof is easy through checking that π satisfies the system of linear equations πQ = 0 and πe = 1. To this end, we consider the following two different cases: Case one: k = 0. In this case, we need to check that by means of π 0 = c π 0 , π 1 = c π 0 R 0 .
Case two: k ≥ 1. In this case, we need to check that by means of π 0 = c π 0 , π k = c π 0 R 0 R 1 · · · R k−1 for k ≥ 1. Thus we have which gives the positive constant c in (9). This completes the proof.
In the remainder of this section, we provide average stationary queue lengths of the double-ended queue by means of the stationary probability vector of the QBD process.
Note that the double-ended queue must be stable for (θ 1 , θ 2 ) > 0. Thus, we denote by Q (1) and Q (2) the stationary queue lengths of the A-customers of Type 1 and Type 2, respectively.
By using Theorem 2, we can obtain the average stationary queue length of the Acustomers of Type 1 is and the average stationary queue length of the A-customers of Type 2 is

The Sojourn Time
In this section, we analyze two expected sojourn time of each arriving A-customer of Type 1 and Type 2 in the double-ended queue, respectively.

Sojourn Time of the A-customers of Type 2
When the double-ended queue is stable, we denote by W where Then (12) can be rewritten as Here, T e + T 0 = 0. The following theorem uses the phase-type distribution of infinite size to provide expression for the probability distribution of the sojourn time W (2) .
For the probability vector q (t), it follows from the Chapman-Kolmogorov forward equation with the initial condition It follows from (14) and (15) that Thus, we obtain This completes the proof.
In the remainder of this section, we compute the mean E [ W (2) ] of the sojourn time W (2) of each arriving A-customer of Type 2 by means of the Laplace-Stieltjes transform and the RG-factorization.
We denote by f (s) the Laplace-Stieltjes transform of the distribution function F W (2) (t) or the random variable W (2) . Thus, we have where I denotes an identity matrix of infinite size, and (sI − T ) −1 min is the minimal nonnegative inverse of the matrix sI − T of infinite size. See Li and Cao [28] and Li [27] for more details. It is easy to see that For the QBD process T , we define the U L-type U-, R-and G-measures as and On the other hand, note that the matrix sequence {R j , j ≥ 1} is the minimal nonnegative solution to the system of nonlinear matrix equations and the matrix sequence {G j , j ≥ 2} is the minimal nonnegative solution to the system of nonlinear matrix equations Once the matrix sequence {R j , j ≥ 1} or {G j , j ≥ 2} is given, then for j ≥ 1 Based on this, we can provide the U L-type RG-factorization of the matrix T of infinite size as follows: where By using the R-measure {R j : j ≥ 1} and the G-measure {G l : l ≥ 2}, we write The By using the RG-factorization given by (24), we obtain Then it follows from Lemma 1 that Thus it follows from (19) that

Sojourn Time of A-customers of Type 1
When the double-ended queue is stable, we denote by W (1) the sojourn time of any arriving A-customer of Type 1.
Here, the state space of the Markov process are arranged in the following order: Based on Figure 2, the infinitesimal generator of the QBD process {(N 1 (t) , N 2 (t)) , t ≥ 0} is given by Since the level-dependent QBD process is stable, we have For k ≥ 0, we write Then we apply the RG-factorization given in Li [27] to calculate the stationary probability vector where the detailed analysis process is similar to section 4. where Then (32) can be rewritten as Here, Te + T 0 = 0.
For the probability vector q (t), it follows from the Chapman-Kolmogorov forward equation with the initial condition It follows from (34) and (35) that Thus, we obtain This completes the proof.
In the remainder of this section, we compute the mean E We denote by f (s) the Laplace-Stieltjes transform of the distribution function F W (1) (t) or the random variable W (1) . Thus, we have where I denotes an identity matrix of infinite size, and (sI − T) −1 min is the minimal nonnegative inverse of the matrix sI − T of infinite size. See Li and Cao [28] and Li [27] for more details. It is easy to see that For the QBD process T, we define the U L-type U-, R-and G-measures as and On the other hand, note that the matrix sequence {R k , k ≥ 1} is the minimal nonnegative solution to the system of nonlinear matrix equations and the matrix sequence {G k , k ≥ 2} is the minimal nonnegative solution to the system of nonlinear matrix equations Once the matrix sequence {R k , k ≥ 1} or {G k , k ≥ 2} is given, then for k ≥ 1 Based on this, we can provide the U L-type RG-factorization of the matrix T of infinite size as follows: where By using the R-measure {R k : k ≥ 1} and the G-measure {G l : l ≥ 2}, we write The following lemma provides the inverses of the three matrices I − R U , U D and I − G L , while their proofs are easy by means of ( rates of A-customers of Type 1 and Type 2), respectively. At the same time, we also apply the coupling method to provide some interesting interpretations on the numerical analysis.
And we assume that the waiting spaces for A-customers and B-customers are M 1 and M 2 , and we respectively take M 1 and M 2 as follows: We discuss that how E [ and E [ W (2) ] depend on the two impatient rates θ 1 and θ 2 when θ 2 = 2, 4, 5, θ 1 ∈ [2, 5] and θ 1 = 3, 4, 5, θ 2 ∈ [2, 4], respectively. Figure 5 shows that the average stationary queue length E [ Q (1) ] decreases as θ 1 and θ 2 increase. From Figure 6, we observe that the average stationary queue length E [ Q (2) ] decreases as θ 1 and θ 2 increase. The four numerical results are intuitive. As θ 1 increases, more and more A-customers of Type 1 are quickly leaving the system so that the chance that an A-customer of Type 2 can match a B-customer of type 2 will become bigger. Thus, E [ Q (2) ] decreases as θ 1 increases. On the other hand, as θ 2 increases, more and more A-customers of Type 2 are

Concluding Remarks
In this paper, we describe a double-ended queue with flexible customers, four Poisson inputs, and customers' impatient behaviors, and show that such a queue can be expressed as a QBD process with infinitely many phases. Based on this finding, we provide a detailed analysis for the double-ended queue, including the system stability, the stationary probability vector, the sojourn time, and so forth. Finally, some numerical examples are given to verify the correctness of our theoretical results, and demonstrate how the performance measures of this queue are influenced by key system parameters. We believe that the methodology and results proposed in this paper can be applicable to deal with more general matching queues.
Along these lines, we will continue our future research on the following directions: -Introduce fluid and diffusion limits to study the system of this paper.
-Develop stochastic optimization and control, Markov decision processes and stochastic game theory in the study of double-ended queues with flexible customers.
-Consider an extension of the system in which the B-customers can queue.
Author Contributions: Conceptualization, methodology, software, validation, formal analysis, investigation, resources, writing-original draft preparation, writing-review and editing, visualization, supervision, H.L.Liu. All authors have read and agreed to the published version of the manuscript.
Funding: This research received no external funding.