arXiv:2007.08045v5 [cs.GT] 5 May 2021 tde nacasclmdlo the of model classical a in studied then how is and fee. It coalitions the form divide to into cost. fairly how split to the problems: and two sharing ride ask a from to share natural benefit may to they students groups or of Each alone, multiple taxi friends. prefers with a Bob meet example, ride while to For may downtown home the back destination. to go go own directly to her/his to to want may taxi would Alice a whom of take each to students, like university of group a Imagine Introduction 1 e,aet r ieryodrdb hi ead o fa- a for demands their prob- by airport ordered the linearly In are [1973]. agents Owen lem, and Littlechild by duced { ayrlvn set ftescn rbe aebeen have problem second the of aspects relevant Many kaao makino ukiamano, h arcs-hrn ftearotgm;w alour call we model game; model Our airport on the based of game cost-sharing on. fair formation the so coalition a and as line, regarded is a on among differ- destinations possibly desks ent of office customers for among fees taxis econ- workers, sharing sharing in as seen agents. such often other omy, be the can with situation cost a the Such shares and facil- use a to chooses agent ity multi- to each for facility agents, it and is, facilities extends that single ple setting, paper a assignment This so-called for well-known the agents. and cost-sharing multiple classical fair among a of is model game airport The oainudrtorlxdev-reconcepts. envy-free the relaxed al- show two an under of we location existence front, the negative determining of the NP-hardness On poly- in time. computed nomial be consecu- can a allocation agent that envy-free show of tive the we number Moreover, (2) the small. facilities, is (3) of types, and number facilities, the of (1) capacity of when one allocation least envy-free at an al- finding efficient for design we gorithms envy-free these, on of Based properties allocations. we structural envy-freeness, several For provide if exists. efficiently allocation computed feasible be a can agents the of minimizes cost social a that that allocation show feasible We Nash-stable setting. our into stability envy-freeness Nash and incorporate we concepts, solution of uiAmano Yuki arrd loaino line a on allocation ride fair a 1 , Abstract ym Igarashi Ayumi } krm.yt-.cj,ayumi @kurims.kyoto-u.ac.jp, ipr problem airport arRd loaino Line a on Allocation Ride Fair 2 scriteria As . ainlIsiueo Informatics of Institute National 2 , auh Kawase Yasushi 3 4 nvriyo Tokyo of University aoaUniversity Nagoya 1 [email protected] yt University Kyoto intro- , grsinia.p [email protected], [email protected], est fSldi GlmnadPoaca 2015]. Procaccia, and [Goldman Spliddit of website iswe gnshv ifrn ed.Aohrrlvn cri relevant Another utili needs. of different The have comparison agents cost. interpersonal when her/his enables ties no reduce envies envy-free, to is of else that notion someone outcome replace an can select agent we if 1967]: [Foley, criterion guarantee? Which we fairly? can taxis justice to passengers allocate we can stability Nash t ento.Ide,LtlcidadOe 17]showed [1973] Owen and the Littlechild that Indeed, nature exponential the definition. despite its sim expression a explicit has which and value, ple Shapley celebrated the of application asnesi h nqe“ar ouin hc side tr indeed is to 2 One which have respect solution, taxis with “fair” destination. both unique which the same in is the ca- passengers allocation with the with that taxis passengers consider pay. 2 4 might to of and has scenario 3 agent simple pacity a each consider money form example, of agents For amount way the re- the affects the ride-sharing, groups the in that Indeed, of so groups. example groups different preceding across into fair cost, themselves is the split outcome divide sulting to to how how only capac not also have decide but shared to be need agents to so facilities shoul ties; agents practice, how In is, that groups. problem, form first the account into take o rpryi hi iersrcueo h gns demand agents’ com- the the of examples, structure linear these their all is irrigation In property an mon and [2007]. time Thomson over see room ditch; the meeting e.g., shared examples, di a real-life cost of of runway sharing variety the a of prob- covers the application it While an vision, taxi. to the refers from determin originally off is drops taxi lem who shared agent a last to charged the th cost by shar total by of the context determined taxi, the In is a ing demand. facility largest the the requires using who of agent cost the and cility, hywl a h aeaon fmoney. of amount contribution, same same the the pay exactly if will have they group e.g., same properties, the in desirable equal agents other of that several treatment solution with ‘equal efficient of together unique desideratum the basic the is satisfies thus t and with coincides value, separately, Shapley segment each to division equal nyfens soeo h otntrlntoso fairness of notions natural most the of one is Envy-freeness h ipr rbe skont etevr rtsuccessful first very the be to known is problem airport The h ai oe ftearotpolm oee,de not does however, problem, airport the of model basic The 1 hsrl si atue oslttefr napplrfi div fair popular a in fare the split to used fact in is rule This 3 , auiaMakino Kazuhisa eunileulcnrbtosrule contributions equal sequential sse ae.I oecmlxseai,how scenario, complex more a In later. seen as envy-freeness huhi sntwt epc to respect with not is it though , 1 , ioaaOno Hirotaka 1 hc applies which , 4 cost- ision two the ue he ed of of s’ s. i- d e - - - - - terion of justice is the notion of stability (e.g., Nash stabil- taxi, or (c) the number of agent types, is small. More pre- ity and swap-stability), capturing resistance to agents’ devi- cisely, in case (a), we show that the locality provides a greedy ations. No user will justifiably complain if there is no bene- algorithm for finding an envy-free feasible allocation under ficial way of allocating her to another facility or swapping a a certain condition, which implies that an envy-free feasible pair of agents [Foley, 1967; Bogomolnaia and Jackson, 2002; allocation can be computed in O(n3k+2) time, where k is the Aziz and Savani, 2016; Bouveret et al., 2016]. Social opti- number of taxis. In case (b), we focus on the setting when mality and Pareto optimality are also fundamental notions re- the capacity of each taxi is bounded by four, where we utilize lated to efficiency. Social optimality means that there is no an enhanced version of split property. By combining it with alternative allocation that decreases the total cost paid by the the locality, we construct an O(n6)-time greedy algorithm for agents, whereas Pareto optimaility means that there is no al- envy-free feasible allocations. In case (c), that is, when the ternative allocation that makes some agent better off without number p of types is small, by utilizing the monotonicity and making any agent worse off. By definition, social optimality the split property, we first enumerate all possible ‘shapes’ of implies Pareto optimality. envy-free allocations, and then compute an envy-free feasible Our contribution In this paper, we extend the classical allocation in O(ppn4) time by exploring semi-lattice struc- model of airport problems to the so-called assignment setting, ture of size vectors consistent with a given shape; a similar that is, for multiple taxis and agents, each agentchooses a taxi phenomenon has been observed in many other contexts of re- to ride and shares the fee with the other agents riding the taxi source allocation (see, e.g. Sun and Yang [2003]). Note that together. In our setting, agents would like to travel from a the algorithm is FPT with respect to p. common starting point to their own destinations, represented We also show that one can compute an envy-free alloca- by points on a line, by multiple taxis, and have to share the tion that is consecutive with respect to agents’ destinations cost of the travel. The total cost charged to passengers for by only looking at the envy between consecutive agents in each taxi is determined by the distance between the starting O(kn3) time. As a negative side, we show that it is NP-hard point and the furthest dropping point, and is shared by the to determine the existence of an allocation under two relaxed agents taking it based on the Shapley value. Since our model envy-free concepts. is a natural generalization of the airport game, it has poten- tial applications such as shared office rooms; see Thomson 1.1 Related Work [2007]. If we restrict our attention to fair ride allocation, the The problem of fairly dividing the cost among multiple setting “on a line” appears a bit restrictive, and it is desirable agents has been long studied in the context of cooperative to generalize it to more general metric cases. However, we games with transferable utilities; we refer the reader to the would like to mention that our setting is the most fundamen- book of Chalkiadakis et al. [2011] for an overview. Fol- tal case study of fair ride allocation to be investigated, and lowing the seminal work of Shapley [1953], a number of can be applied in various situations such as traveling to the researchers have investigated the axiomatic property of the destinations along a highway and boat travelings on a river. Shapley value as well as its applications to real-life prob- We formulate the notions of stability and fairness includ- lems. Littlechild and Owen [1973] analyzed the property of ing envy-freeness and Nash stability, inspired from hedonic the Shapley value when the cost of each subset of agents is coalition formation games and resource allocation problems, given by the maximum cost associated with the agents in and study the existence and complexity of allocations satisfy- that subset. The work of Chun et al. [2017] further studied ing such properties. the strategic process in which agents divide the cost of the We first present basic relationships among the solution con- resource, showing that the division by the Shapley value is cepts. Concerning stability and efficiency, we show that there indeed a unique subgame perfect Nash equilibrium under a always exists a feasible allocation that simultaneously sat- natural three-stage protocol. isfies Nash stability, swap-stability, and social optimality, if Our work is similar in spirit to the complexity study of a given instance contains a feasible allocation. Moreover, congestion games [Rosenthal, 1973; Monderer and Shapley, such an allocation can be computed in linear time by a sim- 1996]. In fact, without capacity constraints, it is not difficult ple backward greedy strategy. This contrasts to the stan- to see that the fair ride-sharing problem can be formulated dard results of hedonic games in two respects. First, a sta- as a congestion game. The fairness notions, including envy- ble outcome does not necessarily exist in the general setting freeness in particular, have been well-exploredin the fair divi- [Aziz and Savani, 2016]. Second, efficiency and stability are sion literature. Although much of the focus is on the resource in general incompatible except for some restricted classes of allocation among individuals, several recent papers study games [Bogomolnaia and Jackson, 2002; Barrot and Yokoo, the fair division problem among groups [Kyropoulou et al., 2019]. 2019; Segal-Halevi and Nitzan, 2019]. Our work is different For envy-freeness, there is a simple example with no envy- from theirs in that agents’ utilities depend not only on allo- free feasible allocation: when 3 agents with the same desti- cated resources, but also on the group structure. nation split into 2 taxis with capacity 1 and 2 each, the agent In the context of hedonic coalition formation games, e.g., who becomes alone will envy others. We provide three struc- Bogomolnaia and Jackson [2002]; Aziz and Savani [2016]; tural properties of envy-free allocations: monotonicity, split Barrot and Yokoo [2019]; Bodlaender et al. [2020], there ex- property and locality. Based on these, we design efficient al- ists a rich body of literature studying fairness and stability. gorithms for finding an envy-free feasible allocation when at In hedonic games, agents have preferences over coalitions to least one of (a) the number of taxis, (b) the capacity of each which they belong, and the goal is to find a partition of agents into disjoint coalitions. While the standard model of hedo- defined as ΦT (a) := ϕi(Ti, xa) where nic games is too general to accommodate positive results (see ϕ(Ti, x) if |Ti|≤ qi, Peters and Elkind [2015]), much of the literature considers ϕi(Ti, x)= subclasses of hedonic games where desirable outcomes can ∞ if |Ti| > qi. be achieved. For example, Barrot and Yokoo [2019] stud- It is not difficult to verify that the sum of the payments in ied the compatibility between fairness and stability require- Ti is equal to the cost of taxi i. Namely, if |Ti| ≤ qi, we ments, showing that top responsive games always admit an have b∈T ϕi(Ti, xb) = maxa∈Ti xa. On the other hand, envy-free, individually stable, and Pareto optimal partition. i if |Ti|P> qi, all agents in Ti pay ∞ whose sum is equal to Finally, our work is related to the growing literature ∞ (i.e., the cost of taxi i). The following proposition for- on ride-sharing problem [Santi et al., 2014; Ashlagi et al., mally states that the payment rule for each taxi coincides with 2019; Pavone et al., 2012; ZhangandPavone, 2016; the Shapley value. We note that while Littlechild and Owen Banerjee et al., 2018; Alonso-Mora et al., 2017; Chun et al., [1973] presented a similar formulation of the Shapley value 2017; Goldman and Procaccia, 2015]. Santi et al. [2014] for airport games, our model is slightly different from theirs empirically showed a large portion of taxi trips in New with the presence of capacity constraints. York City can be shared while keeping passengers’ pro- Proposition 2.1. The payment rule ϕ is the Shapley value. longed travel time low. Motivated by an application to the i ride-sharing platform, Ashlagi et al. [2019] considered the Proof. For a given positive integer q, let c :2A → R be a cost problem of matching passengers for sharing rides in an function defined by c(T )=0 if T = ∅, maxa∈T xa if 1 ≤ online fashion. They did not, however, study the fairness |T |≤ q, and ∞ if |T | > q. Here we regard c as a monotone perspective of the resulting matching. nondecreasing function, i.e., c(T ) ≥ c(S) for T ⊇ S. Let

T = {a1,...,at} such that xa1 ≤ xa2 ≤···≤ xat , and let a = ai. We denote by Π the set of permutations π : T → [t]. 2 Model For a permutation π ∈ Π, we denote S (a)= { b ∈ T | π(b) ≤ π(a)}. For a positive integer s ∈ Z>0, we write [s]= {1, 2,...,s}. π For a set T and an element a, we may write T + a = T ∪{a} Recall the definition of the Shapley value, i.e., the amount and T − a = T \{a}. In our setting, there are a finite set of agent a has to pay in the game (T,c) is given by agents, denoted by A = [n], and a finite set of k taxis. The 1 nonempty subsets of agents are referred to as coalitions. Each c(S (a)) − c(S (a) − a) . (1) t! π π agent a ∈ A is endowed with a destination xa ∈ R>0, which πX∈Π  is called the destination type (or shortly type) of agent a. We If t > q, then there exists a permutation π such that |Sπ(a)| = assume that the agentsride a taxi at the same initial locationof q +1 and |Sπ(a) − a| = q. This implies that (1) is equal to the point 0 and they are sorted in nondecreasing order of their ∞, which shows that our payment rule is the Shapley value. destinations, i.e., x1 ≤ x2 ≤···≤ xn. Each taxi i ∈ [k] has On the other hand, if t ≤ q, then by introducing xa0 =0, we a quota qi representing its capacity, where q1 ≥ q2 ≥···≥ have qk (> 0) is assumed. An allocation T = (T1,...,Tℓ) is an ordered partition of A, and is called feasible if ℓ ≤ k and c(Sπ(a)) − c(Sπ(a) − a) πX∈Π |Ti| ≤ qi for all i ∈ [ℓ]. Given a monotone nondecreasing  i function f : R>0 → R>0, the cost charged to agents Ti is 1 the value of f in the furthest destination maxa∈Ti f(xa) if = (xaj − xaj−1 ) Sπ(a)∩{aj ,...,at}={a} |Ti|≤ qi, and ∞ otherwise. The cost has to be dividedamong πX∈Π Xj=1 the agents in Ti. Without loss of generality, we assume that i the cost charged to Ti is simply the distance of the furthest 1 = (xaj − xaj−1 ) Sπ(a)∩{aj ,...,at}={a} destination if |Ti| ≤ qi, i.e., f is the identity function. In Xj=1 πX∈Π other words, we may regard that is the cost itself instead xa i of the distance. Among several payment rules of cooperative t! = (x − x − ) , games, we consider a scenario where agents divide the cost aj aj 1 t − j +1 using the well-known Shapley value [Shapley, 1953], which, Xj=1 1 in our setting, coincides with the following specific function. Here Sπ(a)∩{aj ,...,at}={a} denotes the 0-1 function that takes oneif and only if agent a appears first at π among agents For each subset T of agents and s ∈ R>0, we denote by in {a ,...,a }. Thus, we have nT (s) the number of agents a in T whose destinations xa is j t at least s, i.e., nT (s) := {a ∈ T | xa ≥ s} . For each 1 c(Sπ(a)) − c(Sπ(a) − a) coalition T ⊆ A and positive real x ∈ R>0, we define t! πX∈Π  x i dr xa − xa − ϕ(T, x)= , = j j 1 Z0 nT (r) t − j +1 Xj=1 xa where we define ϕ(T, x) = ∞ if nT (x)=0. For an allo- dr cation T and a coalition T ∈ T , the cost of agent a ∈ T is = = ϕ(T,a). i i Z0 nT (r) a b c d • strongly swap-stable (SSS) if there is no pair of agents a T and b such that a envies b and b can replace a. 12 24 36 40

Figure 1: The allocation in Example 2.2 Efficiency: Besides fairness and stability, another impor- tant property of allocation is efficiency. The total cost of an allocation T is defined as T ∈T a∈T ϕ(T, xa). Note Example 2.2. Consider a taxi that forms a coalition T in that the total cost of a feasibleP allocationP T is equal to Fig. 1, i.e., agents a, b, c, and d take one taxi together from T ∈T : T 6=∅ maxa∈T xa. A feasible allocation T is social a starting point to the points of 12, 24, 36, and 40 on a line, optimalP (SO) if it minimizes the total cost over all feasible respectively. The total cost is 40, which corresponds to the allocations. drop-off point of d. According to the payment rule, agents a, In our game, we have the following containment relations b, c, and d pay 3, 7, 13, and 17, respectively. In fact, from the among these classes of outcomes: starting point to the drop-off point of a, all the agents are in the taxi, so they equally divide the cost of 12, which means EF ( SSS ( WSS. (2) that a should pay 3. Then, between the dropping points of a EF and b, three agents are in the taxi, so they equally divide the Here, is defined to be the set of envy-free feasible allo- cost of 24−12 = 12, which results in the cost of 4 for each of cations, and the other symbols are defined analogously. It is the three agents. Thus agent b pays 3+4=7. By repeating not difficult to see that the relationships with equality hold by similar arguments, c pays 7+(36 − 24)/2=13, and d pays the definitions of the concepts. To show proper inclusion, we 13+ (40 − 36) = 17. give some examples. Moreover, we show below that any two concepts with no containment relationships in (2) are incom- parable. Namely, there are instances with feasible allocations 3 Solution concepts that are (i) SO and NS, but not WSS, (ii) NS and EF but not Agents split into coalitions and use the Shapley value SO, and (iii) SO and EF but not NS, where they are respec- to divide the cost of each coalition. Our goal is to tively given in Examples 3.1, 3.2, and 3.3. In addition, we find a partition of agents that satisfies natural desider- show that all the inclusions in (2) are proper by providing the ata. We introduce several desirable criteria that are in- examples with feasible allocations that are (a) SSS but not EF spired from coalition formation games and resource alloca- and (b) WSS but not SSS, where they are respectively given tion problems [Foley, 1967; Bogomolnaia and Jackson, 2002; in Examples 3.4 and 3.5. Aziz and Savani, 2016; Bouveret et al., 2016]. Example 3.1. Consider an instance where n = 9, k = 2, Fairness: Envy-freeness requires that no agent prefers an- q1 =5, q2 =4, x1 =1, x2 = x3 =2, and x4 = ··· = x9 = 4. A feasible allocation T = ({2, 3, 7, 8, 9}, {1, 4, 5, 6}) in other agent. Formally, for an allocation T , agent a ∈ Ti Fig. 2 is socially optimal and Nash stable. However, agents 1 envies b ∈ Tj if a can be made better off by replacing herself and 9 envy each other, which implies that T is not WSS. by b, i.e., i 6= j and ϕj (Tj − b + a, xa) < ϕi(Ti, xa). An al- location T is envy-free (EF) if no agent envies another agent. Example 3.2. Consider an instance where n = 4, k = 3, Without capacity constraints, e.g., q1 ≥ n, envy-freeness can q1 = q2 = 2, q3 = 4, and x1 = x2 = x3 = x4 = 1. Then a be trivially achieved by allocating all agents to a single coali- feasible allocation T = ({1, 2}, {3, 4}, ∅) is Nash stable and tion T1. Also, when the number of taxis is at least the number envy-free. However, it is not socially optimal, since its total of agents, i.e., k ≥ n, an allocation that partitions the agents cost is larger than that of another feasible allocation T ′ = into the singletons is envy-free. (∅, ∅, {1, 2, 3, 4}). Stability: We adapt the following three definitions of sta- Example 3.3. Consider a feasible instance where n = 5, bility concepts of hedonic games [Bogomolnaia and Jackson, k =2, q1 = q2 =3, x1 =1, x2 = x3 =2, and x4 = x5 =4. 2002; Aziz and Savani, 2016; Bodlaender et al., 2020] to our Then a feasible allocation T = ({1, 2, 3}, {4, 5}) in Fig. 3 setting. The first stability concepts we introduce are those is socially optimal. However, agents 2 and 3 have a Nash that are immune to individual deviations. For an allocation deviation to T2, and thus T is not Nash stable. T and two distinct taxis i, j ∈ [k], agent a ∈ Ti has a Nash- Example 3.4. Consider an instance where n = 3, k = 2, deviation to Tj if ϕj (Tj +a, xa) < ϕi(Ti, xa). By the defini- q1 = 2, q2 = 1, x1 = 1, and x2 = x3 = 2. Then a feasible tion of function ϕj , no agent a has a Nash-deviation to Tj if allocation T = ({1, 2}, {3}) in Fig. 4 is strongly swap-stable adding a to Tj violates the capacity constraint, i.e., |Tj|≥ qj . but not envy-free, since agent 3 envies 1. An allocation T is called Nash stable (NS) if no agent has a Example 3.5. Consider an instance where , , Nash deviation. n = 4 k = 2 q = q = 2, x = x = 1, and x = x = 2. Then a We also consider stability notions that capture resistance 1 2 1 2 3 4 feasible allocation T = ({1, 3}, {2, 4}) in Fig. 5 is weakly to swap deviations. For an allocation T , agent a ∈ T can i swap-stable but not strongly swap-stable. replace b ∈ Tj if i = j or ϕj (Tj − b + a, xa) ≤ ϕi(Ti, xa) [Barrot and Yokoo, 2019; Nguyen and Rothe, 2016]. An al- location T is 4 Envy-free allocations • weakly swap-stable (WSS) if there is no pair of agents a In this section, we consider envy-free feasible allocations for and b such that a and b envy each other; our model. Note that no envy-free feasible allocation exists 2,3 7,8,9 1 2 T1 T1 2 4 2 4 1 4,5,6 3,4 T2 T2 1 4 4

Figure 2: A feasible allocation that is SO and NS but not WSS Figure 6: An instance with no envy-free feasible allocation 1 2,3 T1 drop-off point, which is formalized as follows. 1 2 4,5 Example 4.1. Consider an instance where n = 4, k = 2, T2 q1 = q2 = 2, x1 = 2, and x2 = x3 = x4 = 4. We show 4 that no feasible allocation is envy-free. To see this, let T = be a feasible allocation. By feasibility, the capacity Figure 3: A feasible allocation that is SO and EF but not NS (T1,T2) of each taxi must be full, i.e., |T1| = |T2| = 2. Suppose 1 2 without loss of generality that T1 = {1, 2} and T2 = {3, 4} T1 1 2 in Fig. 6. Then agent 2 envies the agents of the same type. 3 Indeed, she needs to pay the cost of 3 at the current coalition T2 while she would only pay 2 if she were replaced by 3 (or 4). 2 Hence this instance has no envy-free feasible allocation. Figure 4: A feasible allocation that is SSS but not EF Lemma 4.2 (Monotonicity lemma). For an envy-free feasible ′ 1 3 allocation T and non-empty coalitions T,T ∈ T , we have T1 the following implications: 1 2 ′ 2 4 min xa < min xa′ implies |T | ≥ |T |, (3) a∈T a′∈T ′ T2 ′ 1 2 min xa = min xa′ implies |T | = |T |. (4) a∈T a′∈T ′ Figure 5: A feasible allocation that is WSS but not SSS ′ ′ Proof. Let b ∈ arg mina∈T xa and b ∈ arg mina′∈T ′ xa . Suppose that b ≤ b′ and |T | < |T ′|. Then b envies b′, because even when a feasible allocation exists as we mentioned in xb xb ′ ′ Section 1. We thus study the problem of deciding the exis- ϕ(T, xb)= > = ϕ(T − b + b, xb). |T | |T ′| tence of an envy-free feasible allocation and finding one if it exists. We identify several scenarios where an envy-free Thus b ≤ b′ implies |T | ≥ |T ′|, which proves(3) and (4). feasible allocation can be computed in polynomial time. We show that the problem is FPT with respect to the number of We next show the split property of envy-free feasible allo- destinations, and is XP with respect to the number of taxis cations. For a coalition T and a real s, we use notations Ts to denote the set of agents with type smaller relevant in many real-life scenarios. For example, a taxi com- than s, equal to s, and larger than s, respectively. We say that pany may have a limited resource, in terms of both quantity agents of type x are split in an allocation T if T contains two ′ ′ and capacity. It is also relevant to consider a setting where the distinct T and T with T=x,T=x 6= ∅. The next lemma states number of destinations is small; for instance, a workshop or- that, the agents of type x can be split in an envy-free feasible ganizer may offer a few excursion opportunitiesto the partici- allocation only if they are the first passengers to drop off in pants of the workshop. Furthermore, we consider consecutive their coalitions, and such coalitions are of the same size; fur- envy-free feasible allocations, and show that it can be found ther, if two taxis have an equal number of agents of split type, in polynomial time. Such restrictions are intuitive to the users then no other agent rides these taxis. and hence important in practical implementation. As a neg- An implication of the lemma is critical: we do not have ative remark, we show that two decision problems related to to consider how to split agents of non-first drop-off points in envy-free allocations are intractable. order to see envy-free feasible allocations. We start with three basic properties on envy-free alloca- Lemma 4.3 (Split lemma). If agents of type x are split in tions that will play key roles in designing efficient algorithms ′ an envy-free feasible allocation T , i.e., T=x,T=x 6= ∅ for for the scenarios discussed in this paper. The first one is some distinct T,T ′ ∈ T , then we have the following three monotonicity of the size of coalitions in terms of the first statements: 2A problem is said to be fixed parameter tractable (FPT) with (i) The agents of type x are the first passengers to drop off ′ ′ respect to a parameter p if each instance I of this problem can be in both T and T , i.e., T ϕ(T − aˆ + b, x). where µ ≥ |S| is assumed. Then we have ′ Hence, T mina′∈T ′ xa′ . x (xa∗ − x) ′ ∗ ∗ By Lemma 4.5, the coalition of each agent can be deter- ϕ(T − b + a , xa )= ′ + ′ ′ |T | |T | − |T=x| +1 mined in a greedy manner from an agent with the nearest des- x (xa∗ − x) tination, if we fix the following three parameters for each taxi < + = ϕ(T, xa∗ ), i ∈ [k]: |T | |T | − |T=x| ′ (I) the number µi of agents who take taxi i, yielding a contradiction. Hence, |T=x| = |T=x| implies T = ′ ′ (II) the first drop-off point si, T=x and T = T=x. (III) the number r of agents who drop off at the first point. The last property on envy-free allocations is locality, i.e., i every agent a is allocated to a taxi T with minimum cost Here we define si = ∞ if ri = µi = 0. A vector [k] ϕ(T, xa). (µi,si, ri)i∈[k] in (Z≥0 × (R>0 ∪ {∞}) × Z≥0) is called a configuration if the following four conditions hold: Lemma 4.4 (Locality lemma). For any envy-free allocation T , coalition T ∈ T , and agent a ∈ T , we have 1. either (µi,si, ri) = (0, ∞, 0) or si ∈ {xa | a ∈ A} and 1 ≤ r ≤ µ ≤ q for each i ∈ [k], ϕ(T, x ) ≤ ϕ(T ′, x ) i i i a a  2. µi = n, for all T ′ ∈ T . Furthermore, the strict inequality holds if i∈[k] ′ 3. P r ≤ |A | for each i ∈ [k], and xa is larger than the first drop off point of T , i.e., xa > j∈[k]:sj =si i =si ′ ′ ′ . mina ∈T xa 4. P µ + r for each a ∈ A. a ≤ i∈[k]:si ϕ(T , xa) =R ϕ(T − a + a, xa), which con- that satisfies (I), (II), and (III), where such a T is called con- 3k tradicts envy-freeness of T . sistent with (µi,si, ri)i∈[k]. By definition, there exist O(n ) To show the second statement, assume towards a contradic- many configurations, which is polynomial when k is a con- ′ tion that T contains a coalition T such that mina′∈T ′ xa′ < stant. ′ ′ ′ xa and ϕ(T , xa) = ϕ(T, xa). Let a be an agent in T such ′ Theorem 4.6. When the number k of taxis is a constant, an that xa′ < xa. Then we have ϕ(T, xa) = ϕ(T , xa) > ′ ′ envy-free feasible allocation can be found in polynomial time, ϕ(T − a + a, xa), which again contradicts envy-freeness if it exists. of T . Since all configurations can be enumerated in polynomial 4.1 Constant number of taxis time if the number k of taxis is a constant, it is sufficient to We start by showing that Locality lemma provides a greedy prove the following lemma. algorithm for finding an envy-free feasible allocation if Lemma 4.7. Given a configuration (µi,si, ri)i∈[k], Algo- arg mina∈T xa is known in advance for each taxi T . Es- rithm 1 computes in polynomial time an envy-free feasible pecially, it implies that all envy-free feasible allocations can allocation consistent with (µi,si, ri)i∈[k] if it exists. Algorithm 1: Theorem 4.8. If qi ≤ 4 for all i ∈ [k], then an envy-free feasible allocation can be computed in polynomial time if it 1 Initialize Si ←∅ for each i ∈ [k]; exists. 2 for a ← 1, 2,...,n do We first review a few properties of envy-free feasible 3 if xa = si and |Si| < ri for some i then Take such an i arbitrarily ; allocations T = (T1,...,Tk). By the monotonicity in Lemma 4.2 and the assumption of capacity q ≥ ··· ≥ q , 4 else Pick i from arg min ψ(Sj , xa,µj ) ; 1 k j∈[k]: sj

5 Set Si ← Si + a; min xa ≤···≤ min xa (5) a∈T1 a∈Tk 6 if (S ,...,S ) is envy-free then return (S ,...,S ); 1 k 1 k (6) 7 else return “No envy-free feasible allocation |T1| ≥ · · · ≥ |Tk|. consistent with (µi,si, ri)i∈[k]”; For a , let Tx denote the family of taxis with an agent of type x, i.e., Tx = {i ∈ [k] | (Ti)=x 6= ∅}. By (5) together with Split property, we can see that Tx consists of Proof. We prove that Algorithm 1 computes in polyno- consecutive taxis with the same number of agents. Namely, mial time an envy-free feasible allocation consistent with Tx can be represented by (µi,si, ri)i∈[k] if it exists. Tx = {Ts,...,Tt} for some s and t in [k], Let us first show that line 5 is executed for each agent a, ′ and |T | = |T | holds for any T,T ∈ Tx. Thus we further i.e, it is allocated to some taxi i. If xa = si holds for some assume that for any type x, taxis are arranged in the nonde- taxi i, then by Condition 3, the if-statement in line 3 must creasing order in terms of the number of agents of type x, hold, implying that i is chosen in the line. Otherwise, by i.e., Conditions 2 and 4, at least one taxi j satisfies sj < xa and (7) |Sj | < µj , which implies that i is chosen in line 4. Thus the |(Ts)=x| ≥ · · · ≥ |(Tt)=x|. algorithm allocates all the agents. For a type x, the sequence (|(Ts)=x|,..., |(Tt)=x|) is called Let S denote (S1,...,Sk) checked in line 6. It is not dif- a split pattern of x. ficult to see that Conditions 1 and 2 imply that S is a feasible Let us start by proving the following auxiliary lemma to allocation satisfying (I). Moreover, Conditions 3 and 4, to- derive properties of split patterns. gether with the discussion above, imply that S satisfies (II), Lemma 4.9. For an envy-free feasible allocation T , let T be (III) and Lemma 4.3 (i). Therefore S is a feasible allocation a coalition in T such that |T |− 1 agents in T drop off at the that satisfies (I), (II), (III) and Lemma 4.3 (i). first destination, i.e., |T=x| = |T |− 1 for x = mina∈T xa. We finally show that each agent a is properly allocated. Then for any T ′ ∈ T with T ′ 6= T and |T ′| = |T |, either the Since any agent a who drops off at the first drop-off point first destinationx′ of T ′ is smaller than x (i.e., x′ < x), or all (i.e., x = s holds for some taxi i) is properly allocated, we ′ ′ a i agents in T drop off at x (i.e., T ⊆ A=x). only consider agents a of the other kind. If there is an envy- free feasible allocation consistent with a given configuration Proof. Let T be a coalition in T such that |T=x| = |T |− 1 ∗ (µi,si, ri)i∈[k], by Lemma 4.5, there exists a unique taxi i for x = mina∈T xa, and let a be the unique agent in T>x. ′ ′ ′ that minimizes ψ(Si, xa,µi) among agents i with si < xa Take any T ∈ T \{T } with |T | = |T | and let x = ′ ′ and |Si| <µi. This implies that i is properly chosen in line 4. mina∈T xa. Assume towards a contradiction that x ≥ x ′′ Therefore, it is enough to check if S is envy-free, since (I), and maxa∈T ′ xa > x. Define x = min{xa∗ , maxa∈T ′ xa}. ′′ ∗ (II), (III) and Lemma 4.3 (i) are all necessary conditions of By definition, we have x < x ≤ xa∗ . We can see that a ′ envy-free feasible allocations. This completes the proof. envies every agent a in T=x′ , because x ϕ(T, x ∗ )= + (x ∗ − x) 4.2 Constant capacity a |T | a ′′ We now move on to the case when the capacity of each taxi x x − x ′′ > + + (x ∗ − x ) is at most four. We design a greedy algorithm based on local- |T ′| 2 a ity property in Lemma 4.5. Recall that the greedy algorithm ′ ∗ works, once we fix (I), (II), and (III) in Section 4.1. If the ≥ ϕ(T − a + a , xa∗ ), capacity of each taxi is bounded by a constant, (I) the num- a contradiction. ber µ of agents in taxi i can be easily treated, since we have i The next lemma states that Table 1 represents possible split polynomially many candidates µ = (µ1,...,µk). However, it is not immediateto handle(II)and (III),i.e., howto split the patterns of type x, where the first column represents the size agents with the first drop-off points in taxis, even if the capac- of Ts for the first taxi s with an agent of type x, the second ity of each taxi is bounded by four. In this section, we have column represents the size of A=x, and the last column rep- a more detailed analysis of split property. More precisely, we resents possible split patterns of the corresponding cases. For provide all possible split patterns of agents with same des- example, the first row in the table says that |Ts| = 4 and tination which are uniquely determined in the way given in |A=x| =0 mod4 imply that (4, 4,..., 4) is the unique split Fig. 1.Based on this, we design a polynomial time algorithm pattern of x. Thus Lemma 4.10 implies that possible split for computing an envy-free feasible allocation in the case. patterns of x are uniquely determined by |Ts|, |A=x|, and |Ts+⌈|A=x|/4⌉|. Table 1: Split patterns of type x, where s denotes the first taxi with i ∈ [k]. If k ≥ n, it always has an envy-free feasible alloca- an agent of type x tion, by allocating each agent to each taxi. Thus we assume 4 that k

Lemma 4.10. Suppose that qi ≤ 4 for i ∈ [k]. Let T be an Algorithm 2: Polynomial-time algorithm for taxis envy-free feasible allocation satisfying (5), (6), and (7). Then with capacity at most 4 for any type , split patterns of type have the form shown in x x 1 foreach (µ ,...,µ ) ∈M do Table 1. 1 k 2 Let Ti ←∅ for each i ∈ [k]; 3 for a ← 1, 2,...,n do // from nearest to farthest Proof. Recall that by Lemma 4.3 (ii) all the taxis with an ∗ agent of type x contain the same number of agents, i.e., 4 Let i be the smallest index i that minimizes ψ(Ti, xa,µi) among taxis i with |Ti| <µi; |T | = |Ts| for all T ∈ Tx. (8) 5 if µi∗ = µi∗+1 =4, Ti∗ = {b,c}, and ′ xa = xb = xc < xa+1 then Moreover, by Lemma 4.3 (iii), for any two taxis T,T ∈ Tx, ∗ ∗ ′ 6 Set Ti +1 ← Ti +1 + a ; |T=x|, |T=x| < |Ts| implies |T=x| 6= |T=x|, and by Lemma 7 else Set T ∗ ← T ∗ + a; 4.9, if a taxi T ∈ Tx has |T=x| = |Ts|− 1, then we have i i ′ ′ |T=x| = |Ts| for any T ∈ Tx other than T . These prove 8 if (T1,...,Tk) is envy-free then return that all the rows in Table 1 are correct, except for the fourth (T1,...,Tk); row, i.e., the case in which |Ts| =4 and |A=x| =3 mod4. 9 return “No envy-free feasible allocation”; For example, patterns (4, 4,..., 4, 2, 2) and (4, 4,..., 4, 3, 1) are not allowed in the first row, since the first one contains 2 twice by Lemma 4.3 (iii), while the second one contains We formally show that Algorithm 2 computes an envy-free 3 and 1 by Lemma 4.9. We thus remain to show the case in feasible allocation in polynomial time if a given instance con- which |Ts| =4 and |A=x| =3 mod4. tains such an allocation. In this case, by Lemmas 4.3 (iii) and 4.9, we have two possible patterns Proof of Theorem 4.8. It is not difficult see that Algorithm 2 returns an envy-free feasible allocation if it returns an alloca- (4,..., 4, 2, 1) and (4,..., 4, 3). tion. Suppose that there exists an envy-freefeasible allocation ∗ ∗ ∗ T with µi = |Ti | for all i ∈ [k]. Without loss of generality, Let |A=x| = 4d + 3 for some nonnegative integer d, and we assume that T ∗ satisfies (5), (6), and (7). We show that assume towards a contradiction that |Ts+d+1| = 4 and the algorithm computes an envy-free allocation isomorphic (4,..., 4, 3) is a split pattern. In this case s + d is the last taxi ∗ ∗ ∗ to T if the for-loop of (µ1,...,µk) is applied, which proves with an agent of type x, and we have |Ts+d| = |Ts+d+1| =4, the correctness of the algorithm. We thus restrict our atten- |(Ts+d)=x| = 3, and (|Ts+d+1)=x| = 0. This contradicts tion to the for-loop of (µ∗,...,µ∗), and inductively prove Lemma 4.9, since all the agents in taxi s + d +1 have types 1 k that the partial allocation T (j) after the j-th iteration of a is larger than x. Thus (4,..., 4, 2, 1) is a possible split pat- extendable to an envy-free feasible (complete) allocation iso- tern if |T | = 4. On the other hand, if |T | < 4, s+d+1 s+d+1 morphic to T ∗. Before the induction, we note that allocation (4,..., 4, 3) is a possible split pattern, since otherwise, taxi (n) ∗ s + d + 1 contains an agent of type x, which contradicts T is feasible and satisfies (6) by the assumption on T . (8). Moreover, at any iteration of a, agent a is allocated to the taxi which already has an agent or the first taxi with no agent, i.e., In outline, our algorithm guesses the size of each coali- for any j ∈ [n] and for any i,ℓ ∈ [k] with i ≤ ℓ, we have tion T (i ∈ [k]) and greedily allocates each agent from the i (j) (j) (9) smallest type x to the largest one. The formal description of Ti = ∅ =⇒ Tℓ = ∅ , the algorithm is given by Algorithm 2. More precisely, let which implies M be the set of k-tuples of integers (µ ,...,µ ) such that 1 k min xa ≤···≤ min xa for any j ∈ [n]. (10) , , and for all (j) (j) µ1 ≥ ··· ≥ µk ≥ 0 i∈[k] µi = n µi ≤ qi a∈T1 a∈Tk P By substituting j by n, we have (5), and (7) is satisfied by (i) in Split lemma implies that GT is a star-forest. See the al- (10), together with the choice of i∗ in line 4 of the algorithm. location graph for an envy-free feasible allocation is depicted Let us now apply the induction. By Lemma 4.5, it is clear in Fig. 7. that T (1) is extendable to a desired allocation. Assuming that Now, we will explore the relationship between T and GT , T (j) is extendable to a desired allocation, we consider the implied by Split lemma. Formally, let C = {C1,...,Ct} (j + 1)-th iteration of a. Let be the family of the vertex sets of connected components in T G . Let rj be the root of Cj , i.e., rj = minx∈Cj x, and (j) (j) Q = arg min{ψ(Ti , xj+1,µi) | |Ti | <µi}. let dj be out-degree of rj . We assume that the components are arranged in ascending order of the root, i.e., r1 < ··· < (j) If Q contains a taxi i such that Ti has an agent of type rt. Let Tj be the family of coalitions T ∈ T in which all smaller than xj+1, no other taxi in Q has such a property, members have types in Cj . To see this, we write T∈C to since otherwise Lemma 4.5 provides a contradiction. More- denote T∈C = {a ∈ T | xa ∈ C} for a coalition T and over, j +1 must be contained in such a taxi i again by Lemma a set of types C; then Tj = {T ∈ T | T = T∈Cj }. By (j+1) T 4.5. Since the algorithm chooses such a taxi i by (10), T definition of G , {T1,..., Tt} is a partition of T . is extendable to a desired allocation. On the other hand, If Q By star-tree property of Cj , vertices Cj \{rj } forms dj (j) T ℓ contains no such taxi, i.e., a taxi i in Q satisfies either (i) Ti paths in G . Let Cj (ℓ = 1,...,dj ) be the vertex sets of is empty or (2) it consists of agents of type xj+1, then the al- such paths. Then by Split lemma, we have the following three gorithm again chooses a correct i∗, since it fits with possible conditions: split patterns in Lemma 4.10. Thus T (j+1) is extendable to a each satisfies either desired allocation. This completes the induction. T ∈ Tj ∅= 6 T ⊆ A=rj

It remains to show the time complexity of the algorithm. or A∈Cℓ ( T ⊆ A∈Cℓ ∪ A=rj for some ℓ. (11) 4 j j Note that |M| = O(n ) and M is constructed in the same ′ ′ |T | = |T | holds for any T,T ∈ Tj ,and (12) amount of time. For each (µ1,...,µk) ∈ M, the for-loop 2 |A ℓ | 6= |A h | for any distinct ℓ,h ∈ [dj ]. (13) is executed in O(n ) time. Therefore, in total, the algorithm ∈Cj ∈Cj requires O(n4 × n2)= O(n6) time. By (11), some agents of type rj form a coalition T or some By the proof above, if there exist an envy-free feasible al- ℓ agents of type rj together with the agents of types in Cj form location consistent with (µ1,...,µk) ∈M, then it is unique a coalition. It follows from (12) that each coalition in T has up to isomorphism. We also remark that the greedy algorithm j the same size λ . Let us call λT = (λT ,...,λT ) the size above cannot be directly extended to the case of constant ca- j 1 t vector of T . In summary, we have the following result as pacity, since split patterns are not uniquely determined, even stated in Lemma 4.11, where isomorphism ≃ of two alloca- when the maximum capacity is at most 5. ′ ′ ′ tions T = (T1,...,Tα) and T = (T1,...,Tβ) is defined 4.3 Small number of types as follows: for two coalitions T and T ′, we write T ≃ T ′ to mean that T and T ′ contains the same number of agents for In this section, we focus on Split lemma of envy-free alloca- ′ each type, i.e., |T=y| = |T=y| for all y ∈ V ; for two alloca- tions. We represent envy-free allocations by directed graphs ′ ′ ′ G together with size vectors λ. We provide several structural tions T and T , we write T ≃ T if |T | = |T | and there exists a permutation such that ′ for all properties of G and λ. Especially, we show that G and λ de- σ :[α] → [α] Ti ≃ Tσ(i) fine a unique envy-free allocation (up to isomorphism), G is i ∈ [α]. a star-forest, and λ forms semi-lattice. Based on their prop- Lemma 4.11. Suppose that an allocation T satisfies the con- erties, we show that an envy-free feasible allocation can be ditions in Lemma 4.3. Then G = GT and λ = λT satisfy the computed in FPT time with respect to the number of destina- following conditions: tion types. Let V = {xa | a ∈ A} be the set of destination types, and G is a star-forest with (13) for any j in [t], and (14) let p = |V |. For an allocation T = (T ,...,T ), we define 1 k for any j in [t], λj is a divisor of |A∈C | its allocation (di)graph GT = (V, E) by j such that max |A∈Cℓ |≤ λj ≤ |A∈Cj |/dj . (15) ℓ∈[d ] j y,z ∈ {x | a ∈ T }, y

Namely, the allocation graph GT contains an directed edge GT = G, λT = λ, and the conditions in Lemma 4.3. (y,z) if and only if an agent of type y drops off just after an agent of type z in some coalition T ∈ T . By definition, GT Proof. Suppose that an allocation T satisfies the conditions is acyclic because every edge is oriented from a smaller type in Lemma 4.3. It is not difficult to see that (14) follows from to a larger type, i.e., (y,z) ∈ E implies y

r2

1 2 1 2 b1, b1 b2, b2 1 2 3 e1, e1, e1 r1,...,r7 1 1 1 2 3 1 10 r4,r4 ,r4 r3,...,r3 1 1 r1 f1 f2 1 1 r4 c1 c2 r3

1 1 2 3 4 5 Figure 7: An example of the allocation graph for an envy-free feasible allocation T =(T1,T2,...,T9) where T1 = {r1 ,a1,a1,a1,a1,a1}, 2 3 1 2 1 2 4 5 6 7 1 1 1 2 1 1 1 3 4 5 6 7 1 2 3 4 5 T2 = {r1,r1 ,b1,b1,b2,b2}, T3 = {r1,r1,r1,r1, c1, c2}, T4 = {r2 ,r2,d1,d2,d3}, T5 = {r2 ,r2,r2,r2,r2}, T6 = {r3 ,r3,r3,r3,r3}, 6 7 8 9 10 1 1 2 3 2 3 1 1 1 7 T7 = {r3 ,r3 ,r3,r3 ,r3 }, T8 = {r4 ,e1,e1,e1}, T9 = {r4 ,r4 , f1 , f2 }. There are seven agents of type r1 (r1,...,r1 ), seven agents of 1 7 1 10 1 2 3 type r2 (r2 ,...,r2 ), ten agents of type r3 (r3,...,r3 ), and three agents of type r4 (r4,r4 ,r4).

We note that a unique allocation T in the converse state- following conditions. ment can be computed in polynomial time if G and λ are given. Thus, a naive approach to find an envy-freefeasible al- λ1 ≥ λ2 ≥···≥ λt (17) location is to enumerate all possible G and λ, and then check j∈[t] |A∈Cj |/λj ≤ k, and (18) if they provide a envy-free feasible allocation. Note that the λP ≤ q for all j ∈ [t]. (19) number of star-forests is at most pp, because the in-degree of j η(j) everynodeis at mostone. However,we may have Ω(p) many n where η(j) = r≤j |A∈Cr |/λr. Conversely, if G and λ candidates of λ, even if a star-forest G is fixed in advance. To satisfy (14), (15),P (17), (18), and (19), then there exists a overcome this difficulty, we show that for a given star-forest unique feasible allocation T (up to isomorphism) satisfying G, the size vectors λ such that G and λ provide envy-free GT = G, λT = λ, and the conditions in Lemmas 4.2 and feasible allocations form a semi-lattice. More precisely, for 4.3. a star-forest G, let ΛG denote the set of size vectors λ such that G and λ provide envy-free feasible allocations. Then we Proof. Suppose that T is a feasible allocation satisfying the have the following structural property of ΛG conditions in Lemmas 4.2 and 4.3. By our assumption r1 < ...r , (3) implies (17). Note that the feasibility of T is equiv- Lemma 4.12. For any star-forest G, Λ is an upper semilat- t G alent to two conditions (i) |T | ≤ k and (ii) capacity condition tice with respect to the componentwise max operation ∨, i.e., ′ ′ (i.e., |Ti| ≤ qi). Since Tj uses |A∈Cj |/λj many taxis, (i) is λ, λ ∈ ΛG implies λ ∨ λ ∈ ΛG equivalent to (18). By (17) and the assumption q1 ≥ ...qk, in In this section, we show the following lemma, which is order to check capacity condition, it is enough to consider an stronger than both Lemmas 4.12 and 4.15. allocation T = (T1,...,Tα) in such a way that T1 is assigned to the first η(1) taxis, T2 is assigned to next η(2) − η(1) taxis, Lemma 4.13. Let G be a star-forest, and let Λ = j∈[t] Λj t and so on. More precisely, we have be a non-empty set in Z>0. If the maximum vectorQ λ = does not belong to , then there exists an (max Λj)j∈[t] ΛG Tj = {Tη(j−1)+1,...,Tη(j)} for all j ∈ [t], index ℓ ∈ [t] such that where η(0) is defined by 0. Thus the capacity condition im- (Λℓ − maxΛℓ) × Λj ∩ ΛG =Λ ∩ ΛG. (16) plies (19). Conversely, if G and λ satisfy (14) and (15), then  j∈Y[t]−ℓ  then by Lemma 4.2, there exists a unique allocation T (up to isomorphism) satisfying GT = G, λT = λ, and the con- In addition, such an index ℓ can be computed in polynomial ditions in Lemma 4.3. Moreover, since (17), (18), and (19) time. hold for λ, T is feasible and the conditions in Lemma 4.2 are We note that Lemma 4.13 implies semilattice property of satisfied. ΛG. To see this, suppose that ΛG is not a semilattice, i.e., ′ ′ We are now ready to prove Lemma 4.13. there exists two size vectors λ, λ ∈ ΛG such that λ ∨ λ 6∈ ′ ΛG. Then we define Λ by Λi = [(λ ∨ λ )i] for i ∈ [t]. By Proof of Lemma 4.13. Let us separately consider the cases in ′ ′ definition, λ, λ ∈ Λ and λ ∨ λ is the maximum vector in Λ which G and λ = (max Λ ) violate (14), (15), (17), (18), ′ j j∈[t] such that λ ∨ λ 6∈ ΛG. However, no index ℓ satisfies (16), (19), and envy-freeness of the allocation provided by them. since the right-hand side of (16) contains both λ, λ′, while the left-hand side of (16) contains at most one of them. Further- • If (14) or (18) is violated, then by Lemmas 4.11 and more, if a set Λ in Lemma 4.13 is chosen in such a way that 4.14, we have ΛG = ∅. This implies that any index ℓ satisfies (16). Thus it is polynomially computable. Λ ⊇ ΛG, we obtain Lemma 4.15. In order to show Lemma 4.13, let us consider feasibility • If (15) is violated for an index j, then ℓ = j satisfies and monotonicity of allocations in addition to split property. (16). Thus it is polynomially computable.

Lemma 4.14. An allocation T is feasible and satisfies the • If (17) is violated for an index j, i.e., λj−1 < λj , then conditions in Lemmas 4.2 and 4.3. Then λ = λT satisfy the ℓ = j satisfies (16). Thus it is polynomially computable. • If (19) is violated for an index j, i.e., λj > qη(j), then Algorithm 3: FPT w.r.t. the number of types we claim that ℓ = j satisfies (16), which completes the 1 foreach star-forest do proof of this case, since such an ℓ can be computed in G ′ 2 Let ; polynomial time. Let λ be a size vector in Λ such that Λ= j∈[t] |A∈Cj | ′ ′ ′ 3 while Λ 6=Q∅ do  λℓ = λℓ, and let η (h) = r≤h |A∈Cr |/λr for h ∈ [t]. ′ ′ ′ 4 Let λ = (max Λj )j∈[t]; Since λ ≤ λ and λℓ = λℓP, we have λℓ = λℓ > η(ℓ) ≥ η′(ℓ), which implies the claim. 5 if (14) or (18) is violated then 6 Set Λ ←∅; • Suppose that G and λ fulfill all the conditions above, i.e., G and λ provide a feasible allocation T that satisfies the 7 else if (15), (17), or (19) is violated for an index conditions in Lemmas 4.2 and 4.3. Let further assume j then ′ ′ that a ∈ T (∈ Th) envies a ∈ T (∈ Tj ) for some j, h ∈ 8 Set Λj ← Λj − maxΛj ; [t]. If j = h, then it is clear that ℓ = j (= h) satisfies 9 else if an allocation T provided by G and λ is not ′ (16). On the other hand, if j 6= h, Let λ be a size vector envy-free, i.e., an agent in some coalition in T is ′ j in Λ such that λℓ = λℓ and satisfies (15), (17), (18), and envied then (19). Then still envies ′ in the allocation provided a a 10 Set Λj ← Λj − maxΛj ; by G and λ′. Thus ℓ = j again satisfies (16). Since envy-freeness can be checked in polynomial time, this 11 else completes the proof. 12 return an allocation T provided by G and λ;

We here remark that ΛG may be empty. Based on this semi- 13 return “No envy-free feasible allocation”; lattice structure, we construct a polynomial time algorithm to compute an envy-free feasible allocation consistent witha given star-forest G. Since there exists at most pp many star- 1,2,3,4 9,10 forests, this implies an FPT algorithm (with respect to p) for T1 computing an envy-free feasible allocation. 1 20 5,6,7,8 For a given star-forest G, our algorithm computes the max- T2 imum vector in ΛG or conclude that ΛG = ∅, where the max- 10 imum vector exists due to semi-lattice property of ΛG. The lemma below ensures that it is possible in polynomial time. Figure 8: An allocation that is envy-free but not consecutive

Lemma 4.15. For a star-forest G, let Λ = j∈[t] Λj be a non-empty set such that Λ ⊇ ΛG. If the maximumQ vector 4.4 Consecutive envy-free allocations λ = (max Λj)j∈[t] does not belong to ΛG, then an index ℓ ∈ [t] with (Λ − maxΛ ) × Λ ⊇ Λ can be One desirable property of an allocation is consecutiveness, ℓ ℓ j∈[t]−ℓ j G i.e., coalitions are formed by consecutive agents according to computed in polynomial time. Q their destinations. The property is intuitive to the users and Let us note that an index ℓ in the lemma must exist again hence important in practical implementation. Formally, an by the semi-lattice property of Λ . Let Λ = Λ de- G j∈[t] j allocation T is consecutive if maxa∈T xa ≤ mina∈T ′ xa or ′ note a set of candidate size vectors. By LemmaQ 4.11, we mina∈T xa ≥ maxa∈T ′ xa holds for all distinct T,T ∈ T . have ΛG ⊆ j∈[t] |A∈Cj | . Our algorithm initializes Λ by However, there exists an instance with no consecutive envy-   free feasible allocation as illulstrated in Example 4.17. Λ = j∈[t] Q|A∈Cj | , and iteratively check if Λ = ∅ or the maximumQ vector in Λ provides an envy-freeallocation; If not, Example 4.17. Consider an instance where n = 10, k = 2, it updates Λ by making use of indices ℓ in Lemma 4.15, where q1 = 6, q2 = 4, x1 = ··· = x4 = 1, x5 = ··· = x8 = 10, the formal description of the algorithm can be found in Algo- and x9 = x10 = 20. Then, it can be easily checked that rithm 3. allocation T ∗ = ({1, 2, 3, 4, 9, 10}, {5, 6, 7, 8}) in Fig. 8 is Theorem 4.16. We can check the existence of an envy-free envy-free and feasible but not consecutive. Moreover, this feasible allocation, and find one if it exists in FPT with re- is a unique allocation that is envy-free and feasible. To see spect to the number of types of agents. this, let T = (T1,T2) be an envy-free feasible allocation. By feasibility, we have |T1| = 6 and |T2| = 4. We also Proof. We show that Algorithm 3 can check the existence have {1, 2, 3, 4}⊆ T , i.e., all agents of type x = 1 must be of an envy-free feasible allocation and find one if it exists 1 allocated to T1 since the cost they have to pay at T1 and T2 in FPT time. The correctness follows from Lemmas 4.11, are respectively 1 and 1 . Finally, all agents of type x = 10 4.14, and 4.15. To analyze the running time, observe that the 6 4 must be allocated to T2, which completes the uniqueness of number of iterations of the while loop is at most n because T ∗. Note that feasibility implies at least two agents of type |Λj | = n at the beginning of the loop and it is decre- j∈[t] x = 10 allocated to T2. Ifanagentoftype x = 10 is allocated Pmented by at least one in each iteration. The running time to T , then she would envyan agentof the sametypeallocated 3 1 of each iteration of the while loop is O(n ) because we can to T since the cost she has to pay at T is 1 + 9 , which is 3 2 1 6 2 check the existence of envy in O(n ) time. Thus, the total greater than the cost of 10 at T . running time of the algorithm is O(pp ·n4), which is FPT. 4 2 Nevertheless, we show next that a consecutive envy-free feasible allocation can be found in polynomial time if it ex- Case of i > j. As ai envies aj , we have ists. The key observation here is that envy-freeness (between all agents) is equivalent to envy-freeness between two con- ϕ(Ti, xai ) > ϕ(Tj − aj + ai, xai ) secutive agents, which enables us to design a dynamic pro- = ϕ(Tj − aj + ti−1, xti−1 ) + (xai − xti−1 ) gramming approach for finding a desired allocation. ≥ ϕ(Ti−1, xti−1 ) + (xai − xti−1 ) Theorem 4.18. A consecutive envy-free feasible allocation = ϕ(Ti−1 − ti−1 + ai, xti−1 ) + (xai − xti−1 ) can be computed in polynomial time if it exists. = ϕ(Ti−1 − ti−1 + ai, xai ), By the feasibility of allocations, monotonicity property where the second inequality holds since ti−1 never envies aj of envy-freeness, and the assumption that q1 ≥ ··· ≥ by the minimality of ai. Hence, we have qk, it is sufficient to consider consecutive allocations T = x (T1,...,Th) with h ≤ k such that ai dr ϕ(Ti, xsi )= ϕ(Ti, xai ) − Zx nTi (r) Ti = {si,si +1,...,ti} for all i ∈ [h], (20) si x ai dr where si and ti are positive integers with > ϕ(Ti−1 − ti−1 + ai, xai ) − Z nT (r) xsi i s =1 j. ℓ ≤ ℓ ≤ qκ−1, z(µ − ℓ,κ − 1,ℓ′)=1, Case of i < j. As ai envies aj , we have ′ ϕ(T , xµ−ℓ) ≤ ϕ(T \{µ − ℓ +1}∪{µ − ℓ}, xµ−ℓ), and xa i dr ′ ϕ(Ti, xai )= ϕ(T, xµ−ℓ+1) ≤ ϕ(T \{µ − ℓ}∪{µ − ℓ +1}, xµ−ℓ+1), Z0 nTi (r) x x where T ′ = {µ − ℓ − ℓ′ + 1,...,µ − ℓ} and T = > ϕ(T − a + a , x )= ai ≥ ai , j j i ai |T | |T | {µ − ℓ + 1,...,µ}. Therefore, the original instance con- j i+1 tains a consecutive envy-free feasible allocation if and only where the last inequality follows from the monotonicity. if maxℓ∈[n] z(n,k,ℓ)=1. If this is the case, such an allo- 1 x dr cation can be found using a standard dynamic programming Note that x 0 n (r) is monotone nondecreasing in x, since Ti approach, which requires O(kn3) time. nTi (r) is monotoneR nonincreasing in r. Hence, we have

xt xa 4.5 Hardness results 1 i dr 1 i dr 1 ≥ > . Having established polynomial-time algorithms for several x Z n (r) x Z n (r) |T | ti 0 Ti ai 0 Ti i+1 cases, we turn our attention to the general problem of com- Thus, we obtain puting an envy-free feasible allocation. Unfortunately, it re- mains an open question whether the problem of deciding the x ti dr existence of an envy-free feasible allocation is NP-hard or ϕ(Ti, xti )= Z0 nTi (r) polynomial-time solvable. We instead consider two natural

xti relaxations of envy-freeness and prove the NP-hardness of > = ϕ(Ti+1 − si+1 + ti, xti ), deciding the existence of such allocations. |Ti+1| The first one relaxes the envy-free requirement, by impos- meaning that ti envies si+1. ing the necessary conditions in Split Lemma. More precisely, β · ai1 β · ai1 β · ai1 is not difficult to see that is feasible and satisfies the split 1 1 2 3 (S + 1)β − 1 T T1 conditions (see Fig. 9). 3m + 2 Conversely, suppose that there exists a feasible allocation β · ai2 β · ai2β · ai2 2 1 2 3 (S + 1)β − 2 T that satisfies the split conditions. We first show that there T 2 is at least one agent of type 1 in every taxi, i.e., Ti ∩A=1 6= ∅. 3m + 3 Let J be the set of taxis which contains some agent of type 1, . i.e., J = {i ∈ [k] | Ti ∩ A=1 6= ∅}. Then, by the condition . (i), A=x ⊆ Ti or A=x ∩ Ti = ∅ for any x> 1 and i ∈ J. Let β · aim β · aim β · aim m 1 2 3 (S + 1)β − m Q be the set of types of which the agents ride a taxi in J, i.e., Tm Q = {x> 1 | A=x ⊆ Ti (∃i ∈ J)}. Since q is a multiple of 1 4m + 1 β, the number of agents who ride a taxi in J is also a multiple of β. By counting the number of agents modulo β, we obtain Figure 9: A feasible allocation that satisfies the split conditions 0 ≡ |A=1| + |A=x| (mod β) xX∈Q we consider the conditions (i)–(iii) in Lemma 4.3. We say that a feasible allocation T satisfies the split conditions if the m(m + 1) ≡ + |A=x| (mod β) conditions (i)–(iii) in Lemma 4.3 are satisfied for any x and 2 ′ ′ i∈[m]: 3Xm+1+i∈Q distinct T,T ∈ T such that T=x and T are non-empty. =x m(m + 1) Computing such an allocation turns out to be NP-hard. ≡ − i (mod β) 2 Theorem 4.20. It is NP-complete to decide whether there i∈[m]: 3Xm+1+i∈Q exists a feasible allocation that satisfies the split conditions. Thus, Q must contain all the types in the dummy types D m(m+1) (recall that β > 2 ). Here, each taxi in J cannot carry Proof. We provide a reduction from the 3-partition two type in D because the number of agents of each type in problem, which is a strongly NP-complete prob- D is larger than the half of the capacity of each taxi q. Hence, lem [GareyandJohnson, 1979]. In the problem, we are we conclude that there is at least one agent of type 1 in every given 3m +1 positive integers a1,a2,...,a3m,S satisfying taxi, i.e., J = [k]. S/4 < ai < S/2 (∀i ∈ [3m]) and i∈[3m] ai = mS. Our Now, we prove that there exists a desired partition of [3m]. task is to decide whether there existsP a partition (I1,...,Im) Without loss of generality, we may assume that Ti contains the agents of type for each . Since is of the index set [3m] such that i∈I ai = S for any j ∈ [m]. 3m +1+ i i ∈ [m] q j a multiple of β and the number of agents of type x ∈ P is a Note that, by the condition S/P4 < ai < S/2 (∀i ∈ [3m]), multiple of β, the number of agents of type 1 in the ith taxi every such Ij must contain exactly three elements from [3m]. must be i, i.e., |Ti ∩ A=1| = i. Let Qi be the set of types of Let a1,a2,...,a3m,S be an instance of the 3-partition problem. We construct a ride allocation instance which the agents ride ith taxi, i.e., Qi = {x ∈ P | A=x ⊆ Ti}. Then, we have |A=x| = q − ((S + 1)β − i) − (A, [k], (xa)a∈A, (qi)i∈[k]) which has a feasible allocation x∈Qi that satisfies the split conditions if and only if the given 3- i = S · β, and henceP the partition (I1,...,Ik) of [3m] with I = {i ∈ [3m] | i +1 ∈ Q } satisfies a = S for any partition instance is a Yes-instance. Let β = m(m + 1). We j j i∈Ij i set the number of taxis k to be m and the capacity of each j ∈ [m]. P taxi to be q = (2S + 1)β. The agents A are partitioned into 4m +1 groups by the destination types {1, 2,..., 4m +1}. The second relaxation generalizes the notion of envy- We set the number of agents of type 1 to be m(m + 1)/2 (= freeness, by only looking into envies within particular groups. 1+2+ ··· + m). We will see that the agents of type 1 For multiple sets of agents S = {S1,S2,...,Sq}, we say that must be the first passengers to drop off in every taxi. The an allocation is envy-free in S if for each S ∈ S, the agents following 3m types P := {1+ i | i ∈ [3m]} are associ- in S do not envy each other. The notion of envy-freeness in ated with the index set [3m]. For each i ∈ [3m], we set the S is a generalized envy-freeness in the sense that S = {A} coincides with the normal envy-freeness. Such a generalized number of agents of type i +1 to be β · ai. The remaining types D := {3m +1+ i | i ∈ [m]} are dummy to ensure envy-freeness is useful to control the rank-wise service qual- that the agents of type 1 are split into all the taxis. For each ity. For example, in a frequent flyer program of a airline com- i ∈ [m], we set the number of agents of type 3m +1+ i to be pany, agents in an identical status are supposed to receive a (S + 1)β − i. Note that the total capacity of the taxis and the similar quality of services. In the context of our problem, it number of agents are both (2S + 1)mβ, and hence we must is desirable that agents in S, a set of frequent flyers in a sta- allocate q agents for each taxi. tus, never envies another agent in S. Unfortunately, it is also NP-hard to find an allocation that is envy-free in a given . Suppose that the given 3-partition instance is a Yes- S instance, i.e., there exists a partition (I1,...,Im) of the in- Theorem 4.21. Given a partition S of A, it is NP-complete to dex set [3m] such that ai = S for any j ∈ [m]. Let decide whether there exists a feasible allocation that is envy- i∈Ij free in . j j j P S Ij = {i1,i2,i3} and let (H1,...,Hm) be a partition of A=1 such that |Hj | = j for each j ∈ [m]. Let T be an alloca- Proof. We provide a reduction from the Numerical 4- tion with . Then, it dimensional matching (N4DM) problem, which is a vari- Tj = Hj ∪ i∈Ij A=1+i ∪ A=3m+1+j S ant of 4-partition. In an N4DM instance, we are given and similar arguments imply that every taxi has one agent a positive integer p and four sets of k positive integers from each of S1, S2, S3, S4 and S5 in an envy-free feasible Sa = {a1,a2,...,ak}, Sb = {b1,b2,...,bk}, Sc = allocation. By the argument of if-direction, if a taxi has agent {c1,c2 ...,ck} and Sd = {d1, d2 ...,dk}. Here, we can im- a from S1, agent b from S2, agent c from S3, and agent d from pose another condition that all the numbersin Sa∪Sb∪Sc∪Sd S4, the payment of the remaining e is 60p − (a + b + c + d). are distinct. Our task is to decide whether there exists a sub- This implies that such an allocation of agents corresponds to set M of Sa × Sb × Sc × Sd such that every integer in Sa, an N4DM solution. Sb, Sc and Sd occurs exactly once and that for every quadru- ple (a,b,c,d) ∈ M a + b + c + d = p holds. The hardness We note that, the above proof implies the NP-hardness for of 4-partition is shown in Garey and Johnson [1979, Theorem another relaxed variant: that is, given a subset S of A, it is 4.3]. It actually proves N4DM with the distinct condition. We NP-complete to decide whether there is a feasible allocation can further assume without loss of generality that 3max Sa < that is envy-free in S. min Sb, 2max Sb < min Sc and 2max Sc < min Sd, be- ′ α cause otherwise we can use Sb = {b + n | b ∈ Sb} with a large constant α instead of Sb, for example. Thus, 5 Stable and socially optimal allocations min S < max S ≪ min S < max S ≪ min S < a a b b c We have seen that the set of envy-free allocations may be max Sc ≪ min Sd < max Sd holds roughly. Furthermore, ′ empty even when a feasible outcome exists. In contrast, we we assume that k ≡120 1, that is, k = 120k +1 for some positive integer k′. will show in this section that, stability as well as social opti- mality are possible to achieve simultaneously: a feasible allo- The reduction is as follows: We prepare 4k agents for S ∪ a cation that greedily groups agents from the furthest destina- S ∪ S ∪ S together with extra k agents, called S . Thus b c d e tions together satisfies Nash stability, strong swap-stability, we have 5k agents in total. For a ∈ S , b ∈ S , c ∈ S and a b c and social optimality. Specifically, we design the following d ∈ S , the destinations of the corresponding agents a,b,c d backward greedy algorithm which constructs coalitions T in and d are respectively x = 20a, x = 12b, x = 6c and i a b c the increasing order of i by greedily adding agents j in the de- xd =2d. The destination of every extra agents ei ∈ Se is all creasing order until Ti exceeds the capacity, where the formal xei = 60p. The capacities of the k taxis are also same 5, and thus all the taxis should be full in a feasible allocation. The description can be found in Algorithm 4. partition is defined by the types, that is, S = {Sx | x ∈ R>0}, where S(x)= {a ∈ A | xa = x}. Algorithm 4: Backward greedy We claim that the instance has an envy-free allocation in 1 Initialize T ←∅ for each i ∈ [k] and let κ ← 1; S if and only if the distinct N4DM instance is a yes-instance. i 2 for a ← n to 1 do We first show the if direction. We assume M is a yes-solution, 3 if |T | = q then that is, any triple (a,b,c,d) ∈ M, a + b + c + d = p holds. κ κ 4 κ ← κ +1; For a triple (a,b,c,d) ∈ E, we let a,b,c,d and an e ∈ Se 5 if κ > k then return “No feasible allocation”; take a taxi. Note that xa < xb < xc < xd < xe. Then their 6 payments are as follows: xa/5=4a for agent a, xa/5+(xb− Set Tκ ← Tκ + a; xa)4=3b−a for agent b, xa/5+(xb−xa)/4+(xc−Xb)/3= 7 return (T1,T2,...,Tk); 2c − b − a for agent c, xa/5 + (xb − xa)/4 + (xc − xb)/3+ (xd − xc)/2 = 60p − c − b − a = 99p for agent d ∈ Sd. Since every agent in Sd(= S(60p)) pays exactly 99p, agents The following theorem states that Algorithm 4 computes a in S(60p) never envy each other. We then check the envy- desired outcome in polynomial time. freeness of the agents in S(x ). As seen above, the payment c Theorem 5.1. If a given instance has a feasible allocation, of an agent in S(xc) is c − (a + b)=2c − p, which does not depend on which taxi c takes. the backward greedy computes in polynomial time a feasible We next consider only-if direction. Assume that there allocation that is socially optimal, Nash stable, and strongly swap stable. exists a feasible allocation in which any di ∈ S does not envy another dj ∈ S. In a feasible allocation, each taxi has exactly one agent in S; otherwise, there are two taxis Proof. It is not difficult to see that the backward greedy with capacity 4 that deliver different numbers of agents in S given in Algorithm 4 requires O(n + k) time, and computes due to k ≡24=≡2·3·4 1, which makes an envy. For exam- a feasible allocation if there exists such an allocation. Let ple, suppose that a taxi has 3 agents in S and a taxi has 4 T = (T1,...,Tk) be a feasible allocation constructed by agents in S. Then, an agent in the former taxi envies one the algorithm, and let Th be the last nonempty coalition in in the latter taxi, because an agent in the former taxi pays T , i.e., Tκ = ∅ for κ>h. We first that allocation T is 60p/3 − max S3/4 > 30p and an agent in the latter taxi pays Nash stable. Note that coalitions T1,...,Th−1 have no seat 60p/4=15p. available, and empty taxis κ (> h) are not profitable to de- Thus, each taxi has exactly one agent in S, whose payment viate. Thus it is enough to consider deviations to the last is determined by the other members in the taxi. If some taxi coalition Th. Moreover, if agent a ∈ Ti wants to deviate has two or more agents from S2 and another taxi has at most to Th, then she would become the last passenger to drop off one S1, the former taxi is cheaper for the agent in S. This but |Th| + 1 ≤ qh ≤ qi = |Ti| holds. Thus, by letting xb = maxt∈Th xt, we have As a corollary of the above theorem, we can see that there exists a feasible allocation that satisfies all the notions de- ϕ(Th + a, xa) − ϕ(Ti, xa) fined in Section 3, except for envy-freeness, whenever a fea- ≥ (ϕ(Th + a, xb) + (xa − xb)) − (ϕ(Ti, xb) + (xa − xb)), sible allocation exists. We remark that the backward greedy = ϕ(Th + a, xb) − ϕ(Ti, xb) algorithm fails to find an envy-free feasible allocation even xb xb when it exists, since there is an instance that has an envy-free ≥ − ≥ 0, feasible allocation but no consecutive envy-free feasible allo- |T | +1 |T | h i cation, which can be found in Example 4.17. which yields a contradiction. Thus T is Nash stable. We next show that T is strongly swap-stable. Since swap- 6 Conclusion ping a pair of agents in the same taxi has no effecton the cost, it suffices to show that there is no beneficial swap of agents in In this paper, we introduced a new model of the fair ride allo- cation problem on a line with an initial point. We proved that different taxis. More precisely, let a ∈ Ti and b ∈ Tj be two agents with i < j. We show that if agent a can replace b, i.e., the backward greedy allocation satisfies Nash stability, strong swap-stability, and social optimality. We designed several ef- ϕ(Tj − b + a, xa) ≤ ϕ(Ti, xa), (22) ficient algorithms to compute an envy-free feasible allocation when some parameter of our input is small. The obviousopen then swapping a and b have no effect on their costs, i.e., problem is the complexity of finding an envy-free allocation ϕ(Tj − b + a, xa)= ϕ(Ti, xa), and for the general case. We expect that the problem becomes ϕ(T − a + b, x )= ϕ(T , x ). NP-hard even when the maximum capacity is a constant. i b j b There are several possible extensions of our model. First, To see this, we first observe that by construction of T , while we have assumed that agents ride at the same starting |Ti| ≥ |Tj | and xa ≥ xt for all t ∈ Tj . Thus, we have point, it would be very natural to consider a setting where the riding locations may be different. Indeed, passengers ride at

nTj −b+a(x) ≤ nTi (x) for all x ∈ R≥0, (23) different points in most of private carpooling services. Ex- meaning that at any x> 0, the number of agents in taxi i is at tending our results to this setting would be a promising re- least the number of agents in taxi j with a and b swapped. On search direction. Further, besides the class of path graphs, the other hand, by the definition of ϕ, (22) is equivalent to there are other underlying structures of destinations, such as grids and planar graphs. Although we expect that the Shapley xa dr xa dr value of a cost allocation problem on a more general graph ≤ , structure may become necessarily complex, it would be inter- Z0 nTj −b+a(r) Z0 nTi (r) esting to analyze the properties of fair and stable outcomes in which together with (23) implies that nTj −b+a(x) = nTi (x) such scenarios. for all x ∈ R≥0 with x ≤ xa. Hence we have |Ti| = |Tj | and xt = xa for all t ∈ Tj. This implies that xa = xb, References nTi = nTi−a+b, nTj = nTj −b+a, and nTi (x) = nTj (x) for all x ∈ R≥0 with x ≤ xa, which proves the claim. Javier Alonso-Mora, Samitha Samaranayake, Alex Wallar, It remains to show that T = (T1,...,Tk) is socially op- Emilio Frazzoli, and Daniela Rus. On-demand high- timal i.e., T is a feasible allocation that minimizes the to- capacity ride-sharing via dynamic trip-vehicle assign- tal cost among feasible allocations. For i ∈ [k], let yi de- ment. Proceedings of the National Academy of Sciences, note the furthest destination of Ti, i.e., yi = maxa∈Ti xa if 114(3):462–467, 2017. Ti 6= ∅, and 0 otherwise. Then the total cost of T is given by Itai Ashlagi, Maximilien Burq, Chinmoy Dutta, Patrick Jail- k i=1 yi. Since the capacities satisfy q1 ≥···≥ qk, we have let, Amin Saberi, and Chris Sholley. Edge weighted on- yP1 ≥ ··· ≥ yk. We claim that the nonincreasing sequence line windowed matching. In Proceedings of the 20th ACM of the last drop-off points in socially optimal allocations is Conference on Economics and Computation (EC), pages unique and identical to that of the allocation obtained by the 729–742, 2019. backward greedy algorithm. This implies that T is socially optimal. H. Aziz and R. Savani. Hedonic games. In F. Brandt, ′ ′ ′ V. Conitzer, U. Endriss, J. Lang, and A.D. Procaccia, ed- Let T = (T1,...,Tk) be a socially optimal feasible allo- ′ itors, Handbook of Computational Social Choice, chap- cation, and for i ∈ [k], let yi denote the furthest destination of ′ ′ ter 15. Cambridge University Press, 2016. Ti . Let z1,...,zk be a sequence obtained from yi (i ∈ [k]) by sorting them in the nonincreasing order. Then our claim Siddhartha Banerjee, Yash Kanoria, and Pengyu Qian. State is equivalent to the condition that zi = yi for all i ∈ [k]. For dependent control of closed queueing networks. In Ab- ′ an index i, let Ui be the coalition in T corresponding to zi. stracts of the 2018 ACM International Conference on Mea- Then we note that zi is the maximum xa among agents a in surement and Modeling of Computer Systems, SIGMET- A \ ( ℓ∈[i−1] Uℓ). Since ℓ∈[i−1] |Uℓ| ≤ ℓ∈[i−1] qℓ, the RICS ’18, pages 2–4, New York, NY, USA, 2018. Associ- ′ backwardS greedy constructionP implies zi ≥Pyi. Since T is ation for Computing Machinery. socially optimal, i.e., i∈[k] zi = i∈[k] yi, we have zi = yi Nathana el Barrot and Makoto Yokoo. Stable and envy-free for all i ∈ [k], which completesP theP proof. partitions in hedonic games. In Proceedings of the 28th In- ternational Joint Conference on Artificial Intelligence (IJ- Robert W. Rosenthal. A class of games possessing pure- CAI), pages 67–73, 2019. strategy nash equilibria. International Journal of Game Hans L. Bodlaender, Tesshu Hanaka, Lars Jaffke, Hirotaka Theory, 2(1):65–67, 1973. Ono, Yota Otachi, and Tom C. van der Zanden. Hedonic Paolo Santi, Giovanni Resta, Michael Szell, Stanislav seat arrangement problems. In Proceedings of the 19th In- Sobolevsky, Steven H. Strogatz, and Carlo Ratti. Quanti- ternational Conference on Autonomous Agents and Multi- fying the benefits of vehicle pooling with shareability net- Agent Systems (AAMAS), pages 1777–1779, 2020. works. Proceedings of the National Academy of Sciences, A. Bogomolnaia and M.O. Jackson. The stability of hedo- 111(37):13290–13294, 2014. nic coalition structures. Games and Economic Behavior, Erel Segal-Halevi and Shmuel Nitzan. Fair cake-cutting 38(2):201–230, 2002. among families. Social Choice and Welfare, 53:709–740, S. Bouveret, Y. Chevaleyre, and N. Maudet. Fair allocation 2019. of indivisible goods. In F. Brandt, V. Conitzer, U. Endriss, L. S. Shapley. A value for n-person games. In In H.W. Kuhn J. Lang, and A. D. Procaccia, editors, Handbookof Compu- and A.W. Tucker (eds.): Contributions to the Theory of tational Social Choice, chapter 12. Cambridge University Games II, pages 307–317. Princeton: Princeton University Press, 2016. Press, 1953. Georgios Chalkiadakis, Edith Elkind, and Michael Ning Sun and Zaifu Yang. A general strategy proof fair allo- Wooldridge. Computational aspects of cooperative cation mechanism. Economics Letters, 81(1):73–79, 2003. game theory. Synthesis Lectures on Artificial Intelligence William Thomson. Cost allocation and airport problems. and Machine Learning, 5(6):1–168, 2011. RCER Working Papers 537, University of Rochester - Cen- Youngsub Chun, Cheng-Cheng Hu, and Chun-Hsien Yeh. A ter for Economic Research (RCER), 2007. strategic implementation of the shapley value for the nested Rick Zhang and Marco Pavone. Control of robotic mobility- cost-sharing problem. Journal of Public Economic Theory, on-demand systems: A queueing-theoretical perspective. 19(1):219–233, 2017. The International Journal of Robotics Research, 35(1– Duncan K. Foley. Resource allocation and the public sector. 3):186–203, 2016. Yale Economic Essays, 7:45–98, 1967. Michael R. Garey and David S. Johnson. Computers and In- tractability: A Guide to the Theory of NP-Completeness. Freeman New York, 1979. Jonathan Goldman and Ariel D. Procaccia. Spliddit: Un- leashing fair division algorithms. SIGecom Exchange, 13(2):41–46, 2015. Maria Kyropoulou, Warut Suksompong, and Alexandros A. Voudouris. Almost envy-freeness in group resource allo- cation. In Proceedings of the 28th International Joint Con- ference on Artificial Intelligence (IJCAI), pages 400–406, 2019. S. C. Littlechild and G. Owen. A simple expression for the shapley value in a special case. Management Science, 20(3):370–372, 1973. Dov Monderer and Lloyd S. Shapley. Potential games. Games and Economic Behavior, 14(1):124–143, 1996. Nhan-Tam Nguyen and J¨org Rothe. Local fairness in hedo- nic games via individual threshold coalitions. In Proceed- ings of the 15th International Conference on Autonomous Agents and Multi-Agent Systems (AAMAS), pages 232– 241, 2016. Marco Pavone, Stephen L Smith, Emilio Frazzoli, and Daniela Rus. Robotic load balancing for mobility-on- demand systems. The International Journal of Robotics Research, 31(7):839–854, 2012. Dominik Peters and Edith Elkind. Simple causes of complex- ity in hedonic games. In Proceedings of the 24th Interna- tional Joint Conference on Artificial Intelligence (IJCAI), page 617–623, 2015.