1 Introduction
A number of French exchange students at a Spanish university have signed up for a game theory class. All students taking the class are advised to form study groups to discuss the material and to work on problem sheets. Now, some French students see this as an excellent opportunity to improve their Spanish and would like to join study groups where no one else speaks French. Other students have less confidence in their ability to communicate in Spanish and therefore want to be in a group where at least a few other students speak French; in fact, some of the students prefer to be in an exclusively Frenchspeaking group. Spanish students, too, have different preferences over the fraction of French students in their groups: some are eager to meet new friends, while others are worried that language issues will affect their learning.
Many important aspects of the setting described in the previous paragraph can be captured by the recently introduced framework of hedonic diversity games (HDG) (Bredereck, Elkind, and Igarashi, 2019). In these games agents can be split into two classes (say, red and blue), and each agent has preferences over the fraction of red agents in their group. The outcome of a game is a partition of agents into groups. This model is relevant for analyzing a variety of application scenarios, ranging from interdisciplinary collaborations to racial segregation.
In their work, Bredereck et al. aim to understand whether HDGs admit stable outcomes, for several common notions of stability for hedonic games, such as Nash stability, individual stability and core stability; the first two concepts are based on deviations by individual agents, while the third concept captures resilience against group deviations. Bredereck et al. show that an HDG may fail to have a Nash stable outcome or a core stable outcome and that deciding if an HDG has a core stable outcome is NPcomplete. For individual stability, they get a positive result under the additional assumption that agents’ preferences are singlepeaked, i.e., each agent has a preferred ratio of red agents in her group (say, ), and for any two ratios such that or she prefers a group with ratio to a group with ratio . Specifically, Bredereck et al. show that every HDG with singlepeaked preferences admits an individually stable outcome and describe a polynomialtime algorithm for finding some such outcome. Their work leaves open the question whether HDGs with nonsinglepeaked preferences always have an individually stable outcome.
Our Contribution In this paper, we answer two open questions from the paper of Bredereck et al., as well as extend their model to an arbitrary number of agent classes.
First (Section 3), we show that deciding if an HDG has a Nash stable outcome is NPcomplete. Our hardness result holds even if agents have dichotomous preferences, i.e., approve some ratios and disapprove the remaining ratios; in fact, it remains true if each agent approves at most ratios. On the other hand, we show that the existence of a Nash stable outcome can be decided in polynomial time if the size of one of the classes can be bounded by a constant.
We then turn our attention to individual stability (Section 4). We describe a polynomialtime algorithm that finds an individually stable outcome of any HDG; our algorithm is significantly simpler than that of Bredereck et al. However, we show that neither algorithm Paretodominates the other: there are settings where the algorithm of Bredereck et al. produces a much better partition than our algorithm, and there are settings where the converse is true.
In Section 5, we consider two different ways of extending HDGs to settings with agent classes, . First, we consider a very general model, where each agent may have arbitrary preferences over the ratios of different classes in her group. We show that our positive result for individual stability does not extend to this model: we describe a game with that has no individually stable outcomes and prove that deciding the existence of such outcomes is NPcomplete if . We then propose a more restrictive model, where an agent only cares about the fraction of agents that belong to her class. We show that this model encompasses both HDGs and another wellknown class of hedonic games, namely, anonymous games, i.e., games where agents have preferences over the size of their group.
In Section 6, we empirically compare the outcomes produced (1) by our algorithm for finding individually stable outcomes, (2) by the algorithm of Bredereck et al. and (3) by a natural betterresponse dynamics, with respect to several measures, such as the average social welfare and the diversity of resulting groups. We summarize our findings in Section 7.
Related Work Hedonic games were introduced by Drèze and Greenberg (1980) and have received a lot of attention in the computational social choice literature, as they offer a simple, but powerful formalism to study group formation in strategic settings; see, e.g., the survey by Aziz and Savani (2016). Hedonic diversity games share common features with two other wellstudied classes of hedonic games, namely, anonymous games (Bogomolnaia and Jackson, 2002) and fractional hedonic games (Aziz et al., 2019).
In anonymous games, agents cannot distinguish among other agents, and therefore the only feature of a group that matters to them is its size. HDGs may appear to be more general than anonymous games, since in HDGs each agent can distinguish between two classes of agents. Indeed, many proof techniques developed for anonymous games turn out to be relevant for HDGs. However, in a technical sense, anonymous games are not a subclass of HDGs, and some of the positive results for HDGs do not hold for anonymous games. In particular, while we prove that every HDG has an individually stable outcome, Bogomolnaia and Jackson (2002) show that this is not the case for anonymous games. Throughout the paper, we compare our results for HDGs to relevant results for anonymous games, and in Section 5 we propose a succinct representation formalism for hedonic games that captures both HDGs and anonymous games.
In fractional hedonic games, every agent assigns a numerical value to every other agent, and an agent’s value for a group of size that includes her is equal to the sum of the values she assigns to the group members, divided by . Now, if agents are divided into two classes, so that each agent assigns the same value to all agents in each class, the resulting game is a hedonic diversity game. However, not all hedonic diversity games can be obtained in this fashion; in particular, an HDG where each agent prefers groups that have the same number of agents from each class cannot be represented in this way. Conversely, there are fractional hedonic games that cannot be represented as HDGs.
2 Preliminaries
For every positive integer , we write to denote the set .
A hedonic game is a pair , where is the set of agents, and for each the relation is a weak order over all subsets of that contain . The subsets of are called coalitions; the set of all coalitions containing agent is denoted by . We refer to the set as the grand coalition.
Given two coalitions , we write if and ; we write if and . We say that weakly prefers to if ; if , we say that strictly prefers to , and if , we say that is indifferent between and . For succinctness, when describing agents’ preferences, we often omit coalitions with .
An outcome of a hedonic game with the set of agents is a partition of ; we write to denote the coalition in that contains agent . An agent has an NSdeviation from an outcome if there exists a coalition such that ; has an ISdeviation from an outcome if there exists a coalition such that and, additionally, for each . An outcome is Nash stable (NS) (respectively, individually stable (IS)) if no agent has an NSdeviation (respectively, an ISdeviation). An outcome Pareto dominates an outcome if for each and for some ; an outcome is Pareto optimal if it is not Paretodominated by another outcome.
Consider a hedonic game . We say that is dichotomous if for every agent there exist disjoint sets and such that , and for every pair of coalitions , we have if or and if , ; we say that approves coalitions in and disapproves coalitions in . We say that is anonymous if for every agent there exists a weak order on such that for every pair of coalitions we have if and only if .
In a hedonic diversity game (HDG), the set of agents is partitioned as , and each agent is indifferent between any two coalitions that have the same fraction of agents in ; we refer to agents in and as red and blue agents, respectively. In such games, the preferences of every agent can be described by a weak order over the set : for all we have if and only if . We say that a coalition is homogeneous if or .
An anonymous game is said to be singlepeaked if for every agent there exists a preferred size such that for every pair of coalitions with or it holds that . Similarly, a hedonic diversity game is said to be singlepeaked if for every agent there exists a preferred value such that for every such that or it holds that .
In what follows, we use the fact that the problem Exact Cover By 3Sets (X3C) is NPcomplete (Garey and Johnson, 1979). An instance of this problem is given by a set and a collection of 3element subsets of . It is a yesinstance if there exists a subset such that is a partition of ; otherwise it is a noinstance. For each , let be the set of all indices of sets in to which belongs, i.e., if and only if .
3 Nash Stability
Bredereck, Elkind, and Igarashi (2019) show that a hedonic diversity game may fail to have a Nash stable outcome, even if agents’ preferences are singlepeaked: indeed, it is easy to see that an HDG with where the red agent prefers to be alone and the blue agent prefers to be with the red agent has no NS outcome. However, Bredereck et al. do not consider the complexity of checking whether a given HDG admits a Nash stable outcome. We will now establish that this problem is NPcomplete. We note that deciding whether an anonymous game has a Nash stable outcome is known to be NPcomplete as well (Ballester, 2004); Peters (2016) shows that the hardness result holds even for anonymous games with dichotomous preferences.
Theorem 3.1.
Given an HDG , it is NPcomplete to decide whether has a Nash stable outcome. The hardness result holds even if is dichotomous or if each relation is a strict order over .
Proof.
To see that this problem is in NP, note that it is possible to check in polynomial time whether an outcome is Nash stable by iterating over all agents and all coalitions in and checking whether the agent prefers joining this coalition to her current coalition.
We start by proving hardness for the case where the agents have unrestricted preferences. To this end, we construct a reduction from X3C. To begin with, we define , which is a bijection from the natural numbers to all numbers not divisible by three. Due to reasons that will become apparent in the proof of correctness, it will be convenient to use instead of in the construction.
In the following, given and , we construct the respective hedonic diversity game. Intuitively, for each element we introduce a blue set agent as well as some red agents so as to map each set to a unique coalition with ratio consisting of the three relevant set agents and designated red agents. The game is constructed so that in every Nash stable outcome each set agent needs to be in a coalition corresponding to a set with .
Construction: For each element , we introduce one blue set agent with the following preference relation:
Moreover, for each let us introduce red filling agents with the following preference relation:
In addition, for each , we insert a red stalking agent with the following preference relation:
Correctness: Assume that there exists a partition of . We transform into a Nash stable outcome of the respective hedonic diversity game. For each the outcome contains a coalition . All remaining agents are put into singleton coalitions and are added to .
We claim that is Nash stable: By construction, no blue agent has an NSdeviation in , as all blue agents are in one of their most preferred coalitions. Moreover, no filling agent , , has an NSdeviation, as is either in his most preferred coalition or in a singleton coalition. In the latter case, can only deviate to red singleton coalitions or to coalitions with ratio for some . However, deviating to a red singleton coalition does not make a difference for her and deviating to a coalition with ratio for some is never individually rational, as for every we have . Furthermore, applying the same reasoning, no stalking agent has an NSdeviation, as for every we have .
Let us assume that there exists a Nash stable outcome of the hedonic diversity game. Then, no coalition of fraction for some can be part of , as such a coalition is not individually rational for any blue agent. Consequently, all stalking agents need to be in homogeneous coalitions in . Thereby, contains no homogeneous blue coalitions of size , as would have an NSdeviation to it. Therefore, all blue agents need to be in one of their most preferred coalitions in .
Let be the set of all coalitions containing at least one set agent. Then, the reasoning above shows that for all we have for some . As for all , at least three blue and red agents are part of coalition . Since there only exist three blue agents for which this ratio is individually rational, it follows that all three blue set agents who belong to (and no other blue agent) are part of . Consequently, by removing all red agents from the coalitions in we obtain a cover of by sets in .
Note that the reduction still works if no indifferences in the preferences are allowed. In this case, it is possible to replace the indifferences in the set agents’ preference relations by strict preferences in an arbitrary way without affecting the correctness of the proof: the first direction still holds, as no blue agent can deviate to a different coalition such that the resulting coalition is individually rational for her, since for all . The second direction remains unaffected by this change.
Furthermore, note that it is also possible to adapt the reduction so that the resulting game is dichotomous and every agent approves at most four ratios: each agent approves the individually rational part of her preference relation, while she disapproves all other fractions. As X3C remains NPcomplete if we require that every element appears in at most three sets (Garey and Johnson, 1979), our problem remains hard if each agent approves at most four fractions. The proof of correctness still goes through in this case, as its first part remains unaffected, while in the second part one only has to add the observation that all blue agents need to be in one of their approved coalitions in every Nash stable outcome, as is among their approved fractions. ∎
To complement the hardness result of Theorem 3.1, we show that deciding the existence of a Nash stable outcome is in P if is bounded by a constant.
Theorem 3.2.
Given an HDG with , , we can decide if has a Nash stable outcome in time .
Proof.
Assume without loss of generality that , so . Our algorithm proceeds in three stages.
In the first stage, we guess a partition of , together with positive integers such that and ; let and . We will try to construct an NS partition for some so that , for each , and for . Note that we can enumerate all possible guesses in time .
In the second stage, given a guess , , we construct an instance of the network flow problem as follows. We create a source, a sink, a node for each and a node for each . The source is connected to all nodes , , by an edge of capacity , and each node , , is connected to the sink by an edge of capacity . Further, there is an edge of capacity from to , , if and only if for each and, moreover, . Finally, there is an edge of capacity from to if for all .
Intuitively, an edge from to , , indicates that weakly prefers being in a coalition of size with blue agents to deviating to a coalition of size with blue agents, for , or to a homogeneous red coalition; an edge from to indicates that weakly prefers a homogeneous red coalition to other available options. By construction, there is a flow of size in this network if and only if there is a partition of such that , for and no red agent has an NSdeviation from this partition. Thus, if this instance of network flow does not admit a flow of size , we reject the current guess, and otherwise we proceed to the next stage.
In the third stage, we split into for some . Note that, no matter how we do this, if no red agent had an NSdeviation in , this will also be the case for the new partition. Thus, we can focus on the blue agents. Given a , we say that is safe for an agent if weakly prefers her current coalition in to a coalition consisting of herself and red agents; we say that is safe if it is safe for each . Let be a collection of all safe integers. Then, we can subdivide so that in the resulting partition no blue agent has an NSdeviation if and only if can be represented as a sum of integers from ; the latter problem is a variant of Knapsack, and can be solved by dynamic programming in time . ∎
Theorem 3.2 puts the problem of finding a Nash stable outcome in the complexity class XP with respect to the parameter ; however, we do not know if this problem is fixedparameter tractable (FPT) with respect to this parameter.
For HDGs with dichotomous preferences, another natural parameter is the number of ratios approved by each agent. However, our problem turns out to be paraNPhard with respect to this parameter: the hardness proof in Theorem 3.1 goes through even if each agent only approves at most four ratios in . Similarly, Peters (2016) shows that finding a Nash stable outcome in dichotomous anonymous games remains NPhard if each agent approves at most four coalition sizes. Interestingly, we can prove that the latter problem becomes polynomialtime solvable if each agent approves at most one coalition size, but it is not clear how to extend this proof to dichotomous HDGs.
Theorem 3.3.
Given a dichotomous anonymous game where for each agent the set is of the form for some , we can decide in polynomial time whether admits a Nash stable outcome.
Proof.
If there does not exist an agent with , it follows that the grand coalition is Nash stable. Thus, in the following, we assume that there exists at least one agent approving a singleton coalition. For each , let be the set of all agents with . Moreover, let .
We claim that for each all agents in need to be in coalitions of size in every Nash stable outcome. This follows easily by induction on . Indeed, if an agent in is not in a singleton coalition, she can always deviate to being in a singleton coalition. Further, if and for each all agents in are in coalitions of size , it follows by definition of that there needs to exist a coalition of size for all . Now, assuming that an agent in is not in a coalition of size , she can always deviate to a coalition of size .
For each , let . Intuitively, agents in need additional agents to split into coalitions of size . Let and set .
If , we can construct a Nash stable outcome as follows: we put the agents from into pairwise disjoint sets so that for each . Then, by construction, is divisible by for each . Hence, we can split agents in into coalitions of size . The remaining agents in are placed in singleton coalitions. This partition is Nash stable, since all agents in approve their coalition sizes and none of the agents in approves coalition sizes or .
On the other hand, if , it follows that there cannot exist a Nash stable outcome: indeed, in this case, there are not enough agents in to construct an outcome in which each agent in is in a coalition of her approved size, and we have argued that this is necessary for stability. ∎
4 Individual Stability
Bredereck, Elkind, and Igarashi (2019) describe an algorithm that, given an HDG with singlepeaked preferences, outputs an individually stable outcome in polynomial time. This algorithm is fairly complex: its description and analysis take up almost four pages of the AAMAS’19 paper. It is similar in spirit to the algorithm of Bogomolnaia and Jackson (2002) that finds an IS outcome of an anonymous game with singlepeaked preferences in polynomial time. The main contribution of this section is a much simpler polynomialtime algorithm that can find an individually stable outcome of any HDG; this result is particularly surprising, because it is known that not every anonymous game admits an IS outcome (Bogomolnaia and Jackson, 2002).
Theorem 4.1.
Given an HDG , we can compute an individually stable outcome of in polynomial time.
Proof.
In what follows, we say that a coalition is balanced if .
We claim that Algorithm 1 outputs an IS outcome of . The first phase of this algorithm creates a maximumsize balanced coalition such that all agents in prefer to being alone; all other agents are placed in singleton coalitions. In the second phase, the algorithm checks if any of the remaining agents has an ISdeviation to ; if yes, some such agent is invited to join . This step is repeated until none of the remaining agents has an ISdeviation to . To avoid ambiguity, we use and to denote the ‘large’ coalition obtained at the end of the first phase and at the end of the second phase, respectively.
Consider the sets and defined by our algorithm, and assume without loss of generality that . By construction, contains all red agents who weakly prefer being in a balanced coalition to being in a homogeneous coalition. In particular, this means that no red agent in would allow a blue agent to join her singleton coalition.
To prove that the partition computed by our algorithm is individually stable, we consider three classes of agents:
 Agents in :

By deviating, these agents can form a homogeneous coalition or a balanced coalition. They weakly prefer to a homogeneous coalition, and, since they approve all subsequent changes to , they weakly prefer to (which is balanced). Thus, they have no ISdeviation.
 Agents in :

By construction, these agents do not have an ISdeviation to , and they are indifferent between being alone and joining another agent of the same color. Further, a deviation that results in a twoagent balanced coalition is not an ISdeviation: all red agents in strictly prefer being alone to being in a balanced coalition. Thus, agents in have no ISdeviation.
 Agents in :

Joining , these agents strictly preferred to being in a homogeneous coalition, and they have approved all changes to since then. Thus, they strictly prefer being in to being in a homogeneous coalition. Further, a blue agent in cannot join a singleton red coalition, since the red agent strictly prefers to be left alone. On the other hand, every red agent in strictly prefers being alone to being in a balanced coalition, so by transitivity she strictly prefers staying in to joining a singleton blue coalition.
∎
The following example illustrates the execution of our algorithm.
Example 4.2.
Consider an HDG with , . The agents’ preferences over are given by
The algorithm sets , , and . Then, in the second phase agent has an ISdeviation to : we have , and . Since agents and do not have an ISdeviation to , the algorithm stops and outputs .
In Example 4.2, our algorithm outputs a Pareto optimal outcome; however, our next example shows that this is not always the case.
Example 4.3.
Consider an HDG with , , where for each , and the red agent’s most preferred ratio is . Then, for every agent the formation of the grand coalition is the most preferred outcome. However, as , the algorithm sets and hence outputs the partition consisting of five singletons.
Interestingly, the algorithm of Bredereck et al. would output the grand coalition on the instance from Example 4.3. However, it is not the case that on any singlepeaked instance the output of Bredereck et al.’s algorithm Paretodominates the output of Algorithm 1; there exists an example where the converse is true. This means, in particular, that neither of these algorithms is guaranteed to output a Paretooptimal outcome on singlepeaked instances; this is in contrast with the algorithm of Bogomolnaia and Jackson (2002), which, given a singlepeaked anonymous game, always outputs an IS outcome that is also Pareto optimal.
BetterResponse Dynamics
We note that one can also attempt to reach an IS outcome by a sequence of IS deviations: starting from an arbitrary partition, we check if the current partition is individually stable, and if not, we pick an agent who has an ISdeviation and allow her to perform it. We will refer to this procedure as the betterresponse dynamics (ISBRD). While ISBRD is a very general algorithm that can be used for arbitrary hedonic games, it may fail to converge even if an IS outcome exists, and it may need a superpolynomial number of iterations to converge (Gairing and Savani, 2010); however, no results concerning its convergence are known for hedonic diversity games or for anonymous games.
The following proposition, which applies to arbitrary dichotomous hedonic games, makes partial progress towards the understanding of the performance of ISBRD: it shows that for such games ISBRD always converges as long as in the initial partition all agents belong to the grand coalition. We note that existence of IS outcomes in dichotomous games has been established by Peters (2016); his proof provides a polynomialtime algorithm for finding an IS outcome, but this algorithm differs from ISBRD.
Proposition 4.4.
For every dichotomous hedonic game with a set of agents , any sequence of IS deviations starting from the grand coalition converges to an IS outcome after at most iterations.
Proof.
If the grand coalition is individually stable, we are done. Otherwise, let be the partition that forms after a sequence of deviations, , and let be the set of all agents that have not deviated during this process.
We claim that the agents in form a coalition in , and all agents in approve their coalitions in (and hence only agents in can perform IS deviations).
This follows by induction on . Indeed, if , then the first agent who deviates forms a singleton coalition she approves, and all remaining agents stay together in one coalition. Now, suppose our statement is true for ; we will argue that it is true for . Consider the agent who performs the st deviation. By the inductive hypothesis, we have , so , i.e., agents in form a coalition in . Now, consider a coalition in formed by agents in . By the inductive hypothesis, all agents in approve . If is unaffected by the deviation, this remains to be the case. On the other hand, if joins , approves ; since all agents in do not object to joining them, it follows that they, too, approve . This establishes our claim.
It follows that every agent can deviate at most once: after her first deviation, she approves the coalition she is in and does not want to move again. Hence, there can be at most deviations. ∎
We will revisit ISBRD in Section 6, where we compare different approaches to finding IS outcomes in HDGs.
5 Diversity Games With Classes
Bredereck, Elkind, and Igarashi (2019) define hedonic diversity games for two agent classes. However, diversityrelated considerations remain relevant in the presence of three or more classes: for instance, in the example discussed in the beginning of the paper, the visiting students may come from several different countries. To capture such settings, we need to reason about games with agent classes for : e.g., for we may have red, blue, and green agents. A direct generalization of the model of Bredereck et al. is to allow a red agent to base her preferences on both the ratio of red and blue agents and the ratio of red and green agents; a more restrictive approach is to assume that a red agent only cares about the fraction of red agents in her coalition. We will now explore both of these approaches; as we feel that the latter approach is closer in spirit to the original HDG model, we reserve the term HDG to refer to the more restrictive model and refer to games where agents can have arbitrary preferences over ratios as tuple HDGs.
Definition 5.1.
A tuple hedonic diversity game is a hedonic game where can be partitioned into pairwise disjoint sets so that for each , each agent , and every pair of coalitions with for each we have .
Given an agent tuple HDG and an agent , we can map a coalition to a tuple of fractions : is indifferent between two coalitions that map to the same tuple. Hence, ’s preferences can be described by a partial order over such tuples. As the number of tuples of this form is bounded by , if is bounded by a constant, the size of this representation is polynomial in . On the other hand, every hedonic game with agents is an tuple HDG, as we can simply place each agent in a separate class.
Our XP result for Nash stability extends to this more general setting: if the total size of the smallest classes can be bounded by a constant, a Nash stable outcome can be found in time polynomial in the input representation size, which, in turn, can be bounded as in this case. The proof (omitted) is a simple generalization of the proof of Theorem 3.1.
Theorem 5.2.
Given a tuple HDG with classes where and , we can decide whether has a Nash stable outcome in time .
In contrast, the following example shows that Theorem 4.1 does not extend to , i.e., tuple HDGs may fail to have an individually stable outcome if .
Example 5.3.
Consider a tuple HDG with , , , , where the agents have the following preferences:
It is immediate that this game has no IS outcome. Indeed, every agent has an ISdeviation from the grand coalition, and if each agent is in a singleton coalition, has an ISdeviation to . Further, if an outcome consists of a coalition of size and a singleton coalition, for one of the agents in the coalition of size joining the singleton agent is an ISdeviation. To extend this example to classes, we can simply add agents who prefer to be in homogeneous coalitions.
Moreover, for every fixed , deciding the existence of an IS outcome in a tuple HDG is NPcomplete.
Theorem 5.4.
Given a tuple HDG with , it is NPcomplete to decide whether has an individually stable outcome.
Proof.
To prove membership, note that it is possible to check in polynomial time whether an outcome is individually stable by iterating over all agentcoalition pairs and checking whether the agent has an ISdeviation to the coalition.
To prove hardness, we construct a reduction from X3C. We map a pair to a diversity game with 5 classes of agents (red, blue, green, yellow, white).
The general idea of the construction is to map each element to a blue set agent such that in an individually stable outcome needs to be in a coalition with ratio for some such that . This is ensured by an ISpenalizing component ‘destabilizing’ every outcome for which this is not the case. This enables us to map each set to a unique coalition with ratio .
Construction: For each element , we introduce one blue set agent with the following preference relation over tuples of fractions:
Moreover, for each we introduce a red fraction agent with the following preference relation :
Additionally, for each , we introduce redundant blue agents with the following preference relations:
Finally, we insert an ISpenalizing component consisting of one green, one yellow, and one white agent:
Correctness: Assume that there exists a partition of . We will transform into an individually stable outcome of the respective tuple hedonic diversity game. For each the partition contains a coalition . We refer to these coalitions as the first part of . Further, we put all remaining red and blue agents in singleton coalitions, add them to , and refer to them as the second part of . Finally, we add the coalitions and to .
In the following, we prove that no agent has an ISdeviation in by iterating over all coalitions and arguing that no agent has an ISdeviation to this coalition. First, every coalition in the first part of is the unique most preferred coalition of its fraction agent. Thereby, no fraction agent accepts a deviation to her coalition. Second, no agent has an ISdeviation to a coalition from the second part, as for no agent in the second part being in a coalition where players of her class account for is individually rational. Third, no agent has an ISdeviation to , as this is ’s most preferred coalition. Fourth, no agent wants to deviate to , as all set agents and are in one of their most preferred coalitions. Fifth, no agent has an ISdeviation to being in a singleton coalition, as is individually rational. Consequently, is individually stable.
Let us assume that there exists an individually stable outcome of the hedonic diversity game. We claim that every blue set agent is in one of her most preferred coalitions in . For the sake of contradiction, assume that there exists some set agent who is not in one of her most preferred coalitions. In the following, we iterate over all possible individually rational coalitions that can be part of, and show that cannot be individually stable if it contains this coalition.
If , needs to be in a homogeneous coalition, as this is her only remaining individually rational coalition. Thereby, has an ISdeviation to . If , agent has an ISdeviation to this coalition. If then needs to be in a singleton coalition, as this is her only remaining individually rational coalition. Thereby, has an ISdeviation to . If , has an ISdeviation to the coalition , as is the only remaining individually rational coalition for .
Consequently, there is no individually stable outcome where a set agent is not in one of her most preferred coalitions. Let be the set of all coalitions containing at least one set agent. Then, for all it holds that for some . As is only individually rational for exactly one red agent, needs to consist of one red and blue agents. Now, recall that this tuple is individually rational for exactly blue agents including the three corresponding set agents. It follows that all three blue set agents who belong to and no other set agents are part of . Consequently, by removing all nonblue agents from the coalitions in we obtain a cover of by sets in .
Note that the proof also goes through if no indifferences in the agents’ preferences are allowed, as it is possible to replace the indifferences in the set agents’ preferences by strict preferences in an arbitrary way without affecting the validity of the proof. ∎
Now, in tuple HDGs, an agent may have very complex preferences over ratios of agents from different classes. In our second model, an agent does not distinguish among classes other than her own and hence only cares about the fraction of members of her class in her coalition; we will refer to these games as HDGs. We note that a similar approach has been used recently to provide a gametheoretic model of Schelling segregation with agent classes (Elkind et al., 2019; Echzell et al., 2019); this line of work, while similar in spirit to hedonic diversity games, is, however, very different from a technical perspective.
Definition 5.5.
A hedonic diversity game with classes (HDG) is a hedonic game where can be partitioned into pairwise disjoint sets so that for each , each agent , and every pair of coalitions we have as long as .
By definition, every HDG is a tuple HDG, but the converse is not true, e.g., the game in Example 5.3 is not a HDG for any value of . Further, a HDG is simply an HDG as defined by Bredereck et al. Unlike tuple HDGs, HDGs admit a succinct representation even if is not bounded by a constant: for each agent , her preferences over coalitions in can be described by her preferences over fractions of the form , where , .
Remarkably, this formalism captures anonymous games.
Proposition 5.6.
Every anonymous game can be represented as a HDG.
Proof.
Recall that an anonymous game with can be equivalently represented by a collection of weak orders over : if and only if . It follows that can be viewed as an HDG with partition , so that for each . Indeed, for each and each coalition , the fraction of agents from class in is exactly , so two coalitions have the same fraction of agents from if and only if they have the same size. ∎
It follows that HDGs inherit negative results for anonymous games, such as nonexistence of IS outcomes (Bogomolnaia and Jackson, 2002) and hardness of deciding whether a given game has an IS outcome (Ballester, 2004).
Corollary 5.7.
There exists a HDG that has no individually stable outcome. Moreover, deciding if a given HDG has an individually stable outcome is NPcomplete.
Now, Bogomolnaia and Jackson (2002) show that every singlepeaked anonymous game has an IS outcome. The definition of singlepeaked preferences extends naturally to HDGs, e.g., we can use essentially the same definition as for HDGs. However, it is not clear if the algorithm of Bogomolnaia and Jackson (2002) for finding an IS outcome in singlepeaked anonymous games can be extended to singlepeaked HDGs; this is an interesting question for future work. Note also that the hardness result of Corollary 5.7 only holds for ; it is not clear if the problem of finding an IS outcome in HDGs remains hard for small values of (e.g., ). Further, the anonymous game with no IS outcomes constructed by Bogomolnaia and Jackson (2002) has 63 agents and therefore translates into a HDG; it remains an open problem whether HDGs with are guaranteed to have an ISoutcome.
6 Empirical Analysis
The algorithm for computing individually stable outcomes described in Section 4 has two substantial advantages over the algorithm of Bredereck et al.: first, it works for general preferences, and second, it is much simpler. However, as illustrated by Example 4.3, Bredereck et al.’s algorithm may result in higher agents’ satisfaction. The ISBRD algorithm is even simpler, but we do not know if it always converges to an IS outcome. To better understand the performance of these three algorithms, in this section, we empirically compare them with respect to three measures: the average social welfare, the average coalition size and the average diversity.
Preference Models As Bredereck et al.’s algorithm is only defined for singlepeaked HDGs, we only use singlepeaked instances in our analysis. We consider three intuitively appealing ways of sampling preferences over ratios that are singlepeaked on .

Uniformpeak singlepeaked preferences (upSP). To generate , we first select ’s most preferred ratio by choosing a point in uniformly at random. We then continue to place elements of in positions of one by one; when elements have been ranked, there are at most two elements of that can be placed in position so that the resulting ranking is singlepeaked on
, and we choose between them with equal probability. This approach to sampling singlepeaked preferences was popularized by
Conitzer (2009). 
Symmetric singlepeaked preferences (symSP). For each agent , we choose her preferred point
from the uniform distribution on
and define the relation so that if and only if . While theoretically the resulting relation may have ties, in our experiments this approach always generated strict orders.
The first two distributions are quite different from each other, e.g., in the uSP model a ranking where appears first is exponentially less likely than a ranking where appears first, while in the upSP model we are equally likely to see and ranked first. On the other hand, upSP and symSP appear to be fairly similar, but our experiments show that our algorithms behave differently on them.
Performance measures The primary measure we are interested in is the social welfare, i.e., the sum of agents’ utilities. However, in general, this measure is difficult to define, since in HDGs agents’ preferences over coalitions are given by weak orders rather than numerical values. For symmetric singlepeaked preferences, we can circumvent this difficulty by defining an agent’s disutility as the difference between the fraction of red agents in her coalition and her ideal ratio, so, given a partition , for each we set
For uniform and uniformpeak singlepeaked preferences, we identify the utility of agent in partition with the Borda score of in : for each , we set
In both cases, we define the average welfare as
To gain additional insight into the behavior of our algorithms, we also consider two other measures, namely, the average coalition size and the average diversity. We measure the diversity of a coalition as ; note that if is homogeneous and if is balanced. Both for the average size and for the average diversity, we average over all agents in the partition rather than all coalitions, as we focus on the experience of an individual agent. That is, the average coalition size and the average diversity are defined, respectively, as
Results The results of our experiments are shown in Figures 1–3. In all graphs, BEI19 refers to the algorithm of Bredereck et al., Alg1 refers to our Algorithm 1 and ISBRD refers to the ISBRD algorithm that starts with a uniformly random partition of agents and at each iteration chooses the deviation uniformly at random from among all available deviations. Remarkably, on every instance we have generated, ISBRD converges in iterations.
We first consider HDGs with the same number of red and blue agents. For each , we generate 1000 HDGs with red and blue agents; thus, takes even values from 4 to 100.
Our results for social welfare are shown in Figure 1. For uSP, all algorithms perform similarly and provide fairly high social welfare. Intuitively, this is because under this preference model the agents are likely to rank the ratio highly, and therefore they are quite happy to be in a coalition with an approximately equal number of red and blue agents. Fortunately, all of our algorithms are good at partitioning the agents into such coalitions. In particular, under this distribution it is likely that each agent weakly prefers a balanced coalition to a homogeneous coalition, so Algorithm 1 will be able to stop after setting , and the grand coalition will be wellliked by most agents. However, the other two distributions tell a different story: under these distributions the algorithm of Bredereck et al. substantially outperforms the other two algorithms, with ISBRD being consistently better than Algorithm 1. Thus, if the distribution of agents’ top choices is close to uniform and the numbers of red and blue agents are equal, the more complex algorithm of Bredereck et al. has an advantage over our approach.
Figure 2 shows that the three algorithms are very different in terms of the sizes of coalitions they produce: Algorithm 1 tends to produce the largest coalitions, and the algorithm of Bredereck et al. tends to produce the smallest coalitions; this holds irrespective of how we sample the agents’ preferences.
Figure 3 shows that all three algorithms achieve almost perfect diversity under the uSP distribution; we have suggested possible reasons for this when discussing the social welfare. For the other two distributions, Algorithm 1 and the algorithm of Bredereck et al. perform similarly, while ISBRD results in somewhat less diverse partitions.
We also investigate what happens if the two agent classes have different sizes.
In Figure 4, we graph the average social welfare of the individually stable outcomes obtained by the three algorithms we consider, as the number of agents is fixed to and the fraction of red agents in the game (denoted by ) changes from to . In this setting, too, the algorithm of Bredereck et al. outperforms the other two algorithms with respect to the social welfare, for almost all values of
Comments
There are no comments yet.