1 Introduction

There are numerous situations in which agents need to be assigned to activities, where the agents have differing preferences over the activities and each agent can be assigned to at most one activity. However, often the preferences of the agents do not depend only on the activity itself, but also on the number of participants in the activity [see also Darmann et al. (2017)]. For instance, consider the situation in which working tasks (that take place simultaneously) have to be split among agents, where the agents’ preferences are not only over the different working tasks but also over the number of agents working on the specific tasks. Additional examples include a company that wishes to set up free sports classes for its employees (Skowron et al. 2015) or the organizers of a workshop who have to organize social activities for the free afternoon. For example, these activities could include a bus trip, a table tennis tournament, or taking a sauna. Now, an agent might be willing to take part in a bus trip with many participants, but does not want to take a sauna in case it is too crowded or participate in a table tennis tournament with too many participants. Obviously, as this is quite natural for the different activities, also the opinions over the group size for a specific activity might vary from agent to agent. Of course, the possibility to abstain from any activity is a viable alternative as well. The goal now would be to assign agents to activities in a reasonable way, based on such preferences.Footnote 1 We are thus concerned with a setting in which agents have preferences over pairs “(activity, group size)”, including the possibility “do nothing” to which we refer as the void activity \(a_{\emptyset }\). A general model in which the agents’ preferences are weak orders over such pairs is introduced in Darmann et al. (2017) as the group activity selection problem (GASP). In this paper, we consider \(\mathsf{o\text {-}GASP}\), the variant of \(\mathsf{GASP}\) in which the agents’ preferences are strict orders.

Given the agents’ preferences, the aim is to assign agents to activities in a reasonable way. There are, of course, different approaches towards this task. One possibility would be to take a social choice perspective, aiming at assignments that maximize positional scores such as approval or Borda scores, or at a Condorcet winner among the assignments [see Darmann (2018)]. In this work, we take a more game-theoretical approach by aiming at stable assignments, i.e., assignments that do not admit an incentive to deviate from, for different notions of stability such as Nash, individual and core stability. In addition, we will consider Pareto optimal solutions for our problem. After considering the relations between these concepts in the setting of \(\mathsf{o\text {-}GASP}\), we take into account two natural special cases of agents’ preferences and we provide computational complexity results both for the decision version of the respective problems and for the related verification problems of deciding whether a given assignment is stable (and Pareto optimal, respectively).

As in Darmann et al. (2017) we require that no agent is assigned to an activity such that the agent would rather do nothing, i.e., prefers \(a_{\emptyset }\) to the pair “(assigned activity, group size)”; an assignment satisfying this property is called individually rational. Clearly, in an individually rational assignment no agent has an incentive to deviate to the void activity \(a_{\emptyset }\).

1.1 Relation to the literature

This work is closely related to Darmann et al. (2017), where the general model of the group activity selection problem \((\mathsf{GASP})\) is introduced; in \(\mathsf{GASP}\), the agents’ preferences are weak orders over the pairs “(activity, group size)”. The focus of Darmann et al. (2017), however, is laid on the variant \(\mathsf{a\text {-}GASP}\), where the agent’s preferences are trichotomous: each agent partitions the set of pairs “(activity, group size)” into approved ones (i.e., pairs that are preferred to the void activity), the void activity, and disapproved ones (pairs to which the void activity is preferred). In that paper, the main concepts considered are maximum individually rational assignments (i.e., individually rational assignments that assign the maximum number of agents to a non-void activity) and stable assignments respectively. The main objective of Darmann et al. (2017) is a computational complexity study of the problem of finding such assignments, which includes several special cases such as increasing and decreasing preferences.

In our work, we focus on the variant \(\mathsf{o\text {-}GASP}\) of the group activity selection problem in which the agents’ preferences are strict orders. While \(\mathsf{o\text {-}GASP}\) is approached from a social choice viewpoint in Darmann (2018), we apply the stability concepts of \(\mathsf{a\text {-}GASP}\) to strict orders and analyse the computational complexity involved in finding stable assignments, with respect to the two intuitive special cases of increasing and decreasing preferences. In addition, we include the concept of Pareto optimality (and weak Pareto optimality) in our analysis and provide an efficient algorithm to find a Pareto optimal (and thus also weakly Pareto optimal) assignment.

The model of \(\mathsf{GASP}\), and hence \(\mathsf{o\text {-}GASP}\), is closely related to the one of hedonic games [see Banerjee et al. (2001) and Bogomolnaia and Jackson (2002)], and in particular anonymous hedonic games (Banerjee et al. 2001). In hedonic games, agents have preferences over the possible coalitions (i.e., subgroups of agents) they are part of; in anonymous hedonic games, the agents’ preferences depend only on the size of that coalition. The goal would be a partition of the agents into subgroups in a reasonable manner. Note that \(\mathsf{GASP}\) can be embedded in the hedonic game framework [see Darmann et al. (2017) for details]. However, observe that \(\mathsf{o\text {-}GASP}\) (and \(\mathsf{GASP}\) in general) allows for a more compact representation of agents’ preferences and bears two natural special cases that, in some cases, allow for finding stable assignments efficiently.

Stable partitions have been studied by Ballester (2004) from a computational viewpoint, both for anonymous and non-anonymous hedonic games. In particular, Ballester (2004) shows that deciding whether there is an outcome that is core stable, Nash stable, individually stable or contractually individually stable is \(\mathsf{NP}\)-complete for both anonymous and non-anonymous hedonic games. While these results translate to the general group activity selection problem \(\mathsf{GASP}\), they do not directly imply similar hardness results for the setting of \(\mathsf{o\text {-}GASP}\) considered in this work. In addition, the computational complexity of stable partitions with respect to different notions of stability such as Nash stability, individual stability or core stability has also been considered in the context of additively separable hedonic games, e.g., in the works of Aziz et al. (2011) (where also the concept of Pareto optimality is considered), Dimitrov et al. (2006) and Olsen (2007).

Aziz et al. (2013) focus on the computational complexity involved in finding Pareto optimal solutions in hedonic games and variants thereof, including anonymous hedonic games and roommate games. They show that it is \(\mathsf NP\)-hard to find a Pareto optimal solution both in anonymous and non-anonymous hedonic games, and provide an algorithm which determines a Pareto optimal solution for some of its variants, including roommate games, in polynomial time. These results, however, do not immediately carry over to our setting. In particular, while \(\mathsf{o\text {-}GASP}\) can be embedded in the general (non-anonymous) hedonic game framework, for \(\mathsf{o\text {-}GASP}\) we provide an algorithm that computes a Pareto optimal assignment in polynomial time (see Sect. 3.4).

Further related work includes the works of Lee and Shoham (2015) and Spradling et al. (2013). In Lee and Shoham (2015), the stable invitation problem is introduced, both in an anonymous and non-anonymous version. In the stable invitation problem, the goal is to find a set of agents to be invited to an event. In the anonymous stable invitation problem, the agents have preferences over the number of invitees; in the non-anonymous version, the agents additionally specify a set of accepted agents and a set of rejected agents. Lee and Shoham (2015) provide a number of complexity results for finding stable invitations and also consider strategic behaviour of the agents.

In the work of Spradling et al. (2013), agents have preferences over pairs made up of a role and a coalition; the role refers to the actual role the agent takes in the coalition, and the coalition specifies the composition of roles that make up the coalition. Spradling et al. (2013) provide a number of computational complexity results for finding stable partitions of the agents, for different notions of stability.

Very recently, however, Igarashi et al. (2017a, b) expand the group activity selection problem \(\mathsf{GASP}\) by adding social networks to the setting, and agents can only take part in the same activity if they form a connected subgroup of the network. Finally, for a survey of group activity selection we refer to Darmann and Lang (2017).

The paper is organized as follows. The formal framework, including a presentation of the relationship between the concepts and an overview over the results, is presented in Sect. 2. In Sect. 3 we discuss the decision problem whether a stable assignment exists, and, given this decision problem can be solved efficiently, provide polynomial-time algorithms for finding such assignments. In that section, we also provide a polynomial-time algorithm for finding a Pareto optimal assignment. In Sect. 4 we consider the related decision problem whether a given assignment is stable respectively (weakly) Pareto optimal. Section 5 concludes the paper.

2 Formal framework

Before turning to stability concepts in Sect. 2.1, we formally present the considered model and provide some basic definitions [see also Darmann et al. (2017), Darmann (2018)].

Definition 1

An instance (NAP) of the Group activity selection problem with ordinal preferences \((\mathsf{o\text {-}GASP})\) is given as follows. N is a set of agents with \(n=|N|\); unless stated otherwise, the agents are denoted by \(N=\{1,\ldots ,n\}\). \(A=A^{*}\cup \{a_{\emptyset }\}\) is a set of activities, where \(A^{*}=\{a_{1},\ldots ,a_{m}\}\); \(X=(A^{*}\times \{1,\ldots ,n\})\cup \{a_{\emptyset }\}\) is the set of alternatives. Finally, the profile \(P=\langle V_{1},\ldots ,V_{n}\rangle \) consists of n votes, one for each agent. For agent i, a vote \(V_{i}\) (also denoted by \(\succ _{i}\)) is a strict order over X; the set \(S_{i}\subseteq X\) such that for each \(x\in S_{i}\) we have \(x\succ _{i}a_{\emptyset }\), is the induced approval vote of agent i. We say that agent i approves of the alternatives in \(S_{i}\).

The definition below considers the following special cases of agents’ preferences. If an agent wants to share the activities with as many other agents as possible, we say that the agent has increasing preferences. In contrast, if an agent would like as few other agents as possible to join, the agent’s preferences are called decreasing.

Definition 2

Given an instance (NAP) of \(\mathsf{o\text {-}GASP}\), we say that agent i has increasing preferences if for each \(a\in A^{*}\), \((a,k)\succ _{i}(a,k-1)\) holds for each \(k\in \{2,\ldots ,n\}\).

An agent i has decreasing preferences if for each \(a\in A^{*}\), \((a,k-1)\succ _{i}(a,k)\) holds for each \(k\in \{2,\ldots ,n\}\).

An instance (NAP) of \(\mathsf{o\text {-}GASP}\) has increasing (decreasing) preferences, if each agent \(i\in N\) has increasing (decreasing) preferences.

Definition 3

Given an instance (NAP) of \(\mathsf{o\text {-}GASP}\), a mapping \(\pi :N\rightarrow A\) is called assignment. The set \(\pi ^{a}:=\{i\in N \mid \pi (i)=a\}\) denotes the set of agents assigned to \(a\in A\). The set \(\pi _{i}:=\{j\in N \mid \pi (j)=\pi (i)\}\) denotes the set of agents assigned to the same activity as agent \(i\in N\).

An assignment is said to be individually rational if for every \(a \in A^*\) and every agent \(i\in \pi ^a\) it holds that \((a, |\pi ^a|)\succ _i a_{\emptyset }\).

Abusing notation, given assignment \(\pi \) with \(\pi (i)=a\) and \(k=|\pi ^a|\) we also say that \(\pi \) assigns agent i to alternative (ak). Note that if an assignment is not individually rational, then there exists an agent who prefers the void activity (i.e., do nothing) to the pair “(assigned activity, group size)”, and hence wishes to deviate from that activity to the void activity. Observe that an individually rational assignment exists in each instance of \(\mathsf{o\text {-}GASP}\): the assignment \(\pi \) with \(\pi (i)=a_{\emptyset }\) for all \(i\in N\) is always individually rational.

As done in Darmann et al. (2017), we consider individual rationality as a minimum requirement an assignment should satisfy, and focus on individually rational assignments only. As a consequence, in instances of \(\mathsf{o\text {-}GASP}\) we can restrict the attention to the part of the agents’ rankings which contains approved alternatives only. In what follows, we assume that each agent approves of at least one alternative, since otherwise in any individually rational assignment the respective agent can only participate in the void activity.

2.1 Stability concepts

In this paper, we focus on the following stability concepts. First, we consider concepts that capture the idea of stability against individual deviations. A Nash stable assignment requires that no single agent \(i\in N\) has the wish to deviate from the assignment, i.e., from the pair \((\pi (i),|\pi _{i}|)\). Abusing notation, for any \(k\in {\mathbb {N}}\), we associate \((a_{\emptyset },k)\) with \(a_{\emptyset }\), i.e., we define \((a_{\emptyset },k):=a_{\emptyset }\).

Definition 4

Given an instance (NAP) of \(\mathsf{o\text {-}GASP}\), an assignment \(\pi :N\rightarrow A\) is Nash stable if it is individually rational and there is no agent \(i\in N\) and no \(a \in A^*{\setminus }\{\pi (i)\}\) such that \((a,|\pi ^{a}|+1)\succ _{i}(\pi (i),|\pi _{i}|)\).

Note that in the above definition of Nash stability an agent is allowed to deviate in favour of activity a even if the agents currently assigned to a are opposed to this. In contrast, in the notion of individual stability an agent is allowed to join such a group of agents only if none of the group members objects. Contractual individual stability additionally requires that none of the agents assigned to the activity the agent leaves are worse off.

Definition 5

Given an instance (NAP) of \(\mathsf{o\text {-}GASP}\), an individually rational assignment \(\pi :N\rightarrow A\) is individually stable, if there is no agent \(i\in N\) and no \(a\in A^{*}{\setminus }\pi (i)\) such that \((a,|\pi ^{a}|+1)\succ _{i}(\pi (i),|\pi _{i}|)\), and for all \(i'\in \pi ^{a}\) it holds that \((a,|\pi ^{a}|+1)\succ _{i'}(a,|\pi ^{a}|)\).

Definition 6

Given an instance (NAP) of \(\mathsf{o\text {-}GASP}\), an individually rational assignment \(\pi :N\rightarrow A\) is contractually individually stable, if there is no agent \(i\in N\) and no \(a\in A^{*}{\setminus }\pi (i)\) such that (1) \((a,|\pi ^{a}|+1)\succ _{i}(\pi (i),|\pi _{i}|)\), (2) for all \(i'\in \pi ^{a}\) it holds that \((a,|\pi ^{a}|+1)\succ _{i'}(a,|\pi ^{a}|)\), and (3) there is no \(h\in \pi _{i}{\setminus }{\{i\}}\) with \((\pi (i),|\pi _{i}|-1)\prec _{h}(\pi (i),|\pi _{i}|)\).

In contrast to the stability concepts introduced so far, the concept of the core captures stability against group deviations. In a core stable assignment \(\pi \), there is no subset E of agents such that, by deviating from \(\pi \), all members of E can strictly improve their situation. In a strictly core stable assignment \(\pi \), there is no subset E of agents such that, by deviating from \(\pi \), at least one member of E can strictly benefit without harming any of the other members of E. Generalizing the notion of individual stability, both of these stability notions require the deviating group of agents to join a group of agents \(\pi ^a\) assigned to some activity a or to start a new activity.

Definition 7

Given an instance (NAP) of \(\mathsf{o\text {-}GASP}\), an individually rational assignment \(\pi :N\rightarrow A\) is core stable (or in the core) if there is no \(E\subseteq N\) and no \(a\in A^{*}\) with \(\pi ^{a}\subset E\) such that \((a,|E|)\succ _{i}(\pi (i),|\pi _{i}|)\) for all \(i\in E\).

Definition 8

Given an instance (NAP) of \(\mathsf{o\text {-}GASP}\), an individually rational assignment \(\pi :N\rightarrow A\) is strictly core stable (or in the strict core) if there is no \(E\subseteq N\) and no \(a\in A^{*}\) with \(\pi ^{a}\subset E\) such that \((a,|E|)\succ _{i}(\pi (i),|\pi _{i}|)\) holds for at least one \(i\in E\) while there is no \(i\in E\) with \((a,|E|)\prec _{i}(\pi (i),|\pi _{i}|)\).

Next, contractual core stability requires that a deviating subset of agents cannot make all its members benefit without making any agent worse off who is assigned to an activity to which some of the deviating agents are originally assigned. Formally, it is defined as follows.

Definition 9

Given an instance (NAP) of \(\mathsf{o\text {-}GASP}\), an individually rational assignment \(\pi :N\rightarrow A\) is contractually core stable if there is no \(E\subseteq N\) and no \(a\in A^{*}\) with \(\pi ^{a}\subset E\) such that \((a,|E|)\succ _{i}(\pi (i),|\pi _{i}|)\) holds for all \(i\in E\) while there is no \(i\in N{\setminus } E\) with \((\pi (i),|\pi _{i}{\setminus } E|)\prec _{i}(\pi (i),|\pi _{i}|)\).

Finally, we will consider Pareto optimality. A Pareto optimal assignment is an assignment that cannot be “globally improved upon” in the sense that there is no other assignment under which at least one agent benefits while no agent is worse off. In its weaker version, an assignment is weakly Pareto optimal if there is no other assignment under which each agent is better off.

Definition 10

Given an instance (NAP) of \(\mathsf{o\text {-}GASP}\), an individually rational assignment \(\pi :N\rightarrow A\) is Pareto optimal if there is no assignment \(\pi '\) such that there is no \(i\in N\) with \((\pi '(i),|\pi '_{i}|)\prec _{i}(\pi (i),|\pi _{i}|)\), and \((\pi '(i),|\pi '_{i}|)\succ _{i}(\pi (i),|\pi _{i}|)\) holds for at least one \(i\in N\). An individually rational assignment \(\pi :N\rightarrow A\) is is called weakly Pareto optimal if there is no assignment \(\pi '\) such that \((\pi '(i),|\pi '_{i}|)\succ _{i}(\pi (i),|\pi _{i}|)\) holds for all \(i\in N\).

2.2 Relations between the concepts

From their definitions it follows that a Nash stable assignment is also individually stable, and an individually stable assignment is also contractually individually stable. In addition, a core stable assignment is also contractually core stable, and a (contractually) core stable assignment is also (contractually) individually stable. Clearly, any Pareto optimal assignment is also weakly Pareto optimal.

Next, any strictly core stable assignment is core stable as well. In particular, we can observe that in our setting the concepts of core and strict core coincide.

Proposition 1

In \(\mathsf{o\text {-}GASP}\), an assignment \(\pi \) is core stable if and only if \(\pi \) is strictly core stable.

Proof

Clearly, the if-part holds. For the only-if-part, consider a core stable assignment \(\pi \). If \(\pi \) is not in the strict core, then there exist a subset \(E\subseteq N\) and an activity \(a\in A^{*}\) with \(\pi ^{a}\subset E\) such that

$$\begin{aligned} (a,|E|)\succ _{i}(\pi (i),|\pi _{i}|) \end{aligned}$$
(1)

for at least one agent \(i\in E\), while there is no \(h\in E\) with \((\pi (h),|\pi _{h}|)\succ _{h}(a,|E|)\), i.e., for each \(h\in E\) we have \((\pi (h),|\pi _{h}|)\not \succ _{h}(a,|E|)\). Because \(\pi \) is core stable, there must be an agent \(j\in E\) with \((a,|E|)\not \succ _{j}(\pi (j),|\pi _{j}|)\). However, with \((\pi (j),|\pi _{j}|)\not \succ _{j}(a,|E|)\) this means that \(\pi (j)=a\) (thus, \(\pi _{j}=\pi ^{a}\)) and \(|\pi _{j}|=|\pi ^{a}|=|E|\) hold. Now, Eq. (1) and \(|\pi ^{a}|=|E|\) imply that for agent i we get \(i\in E{\setminus }\pi ^{a}\). In turn, with \(|\pi ^{a}|=|E|\) this implies that \(\pi ^{a}{\setminus } E\not =\emptyset \) holds. This contradicts to \(\pi ^{a}\subset E\). \(\square \)

Finally, we can observe that Pareto optimality implies contractual core stability.

Proposition 2

In \(\mathsf{o\text {-}GASP}\), any Pareto optimal assignment is contractually core stable.

Proof

Consider a Pareto optimal assignment \(\pi \). If \(\pi \) is not contractually core stable, then there is a subset \(E\subseteq N\) and an activity \(a\in A^{*}\) with \(\pi ^{a}\subset E\) such that \((a,|E|)\succ _{i}(\pi (i),|\pi _{i}|)\) holds for all \(i\in E\) while there is no \(i\in N{\setminus } E\) with \((\pi (i),|\pi _{i}{\setminus } E|)\prec _{i}(\pi (i),|\pi _{i}|)\). Let the assignment \(\pi '\) be defined by \(\pi '(i)=a\) for all \(i\in E\) and \(\pi '(i)=\pi (i)\) for all \(i\in N{\setminus } E\). Then, for \(i\in N{\setminus } E\), \((\pi '(i),|\pi '_{i}|)=(\pi (i),|\pi _{i}{\setminus } E|)\) holds. Therewith, it holds that \((\pi '(i),|\pi '_{i}|)\succ _{i}(\pi (i),|\pi _{i}|)\) for all \(i\in E\) while no agent is worse off, i.e., there is no \(i\in N{\setminus } E\) with \((\pi '(i),|\pi '_{i}|)\prec _{i}(\pi (i),|\pi _{i}|)\). Hence, \(\pi \) is not Pareto optimal which contradicts with our assumption. \(\square \)

Summing up, we can state the following inclusion relations between the concepts for \(\mathsf{o\text {-}GASP}\) (here, “\(a\Rightarrow b\)” means if assignment \(\pi \) satisfies a, then it also satisfies b):

  • Nash stable \(\Rightarrow \) individually stable \(\Rightarrow \) contractually individually stable;

  • strict core stable \(\Leftrightarrow \) core stable (see Proposition 1);

  • core stable \(\Rightarrow \) contractually core stable \(\Rightarrow \) contractually individually stable;

  • core stable \(\Rightarrow \) individually stable;

  • Pareto optimal \(\Rightarrow \) weakly Pareto optimal;

  • Pareto optimal \(\Rightarrow \) contractually core stable (see Proposition 2).

Figure 1 summarizes these relations, where NS denotes Nash stable, IS individually stable, CIS contractually individually stable, CS core stable, CCS contractually core stable, PO Pareto optimal, and WPO weakly Pareto optimal.

Fig. 1
figure 1

Relationships between the stability concepts in \(\mathsf{o\text {-}GASP}\)

In addition, in the case of increasing preferences, we can observe that the concepts of Nash stability and individual stability coincide, since any agent prefers \((a,k+1)\) to (ak), for any choice of \(a\in A^{*}\) and \(k\in {\mathbb {N}}\).

In the case of decreasing preferences, it follows that contractual individual stability implies individual stability, since no agent assigned to an activity objects to another agent leaving the activity. For the same reason, contractual core stability implies core stability as well. Note that this also means that in the decreasing preferences case any Pareto optimal assignment is in the core. In addition, we can show that individual stability implies core stability in the case of decreasing preferences.

Proposition 3

In an instance of \(\mathsf{o\text {-}GASP}\) with decreasing preferences, any individually stable assignment is in the core.

Proof

In an instance of \(\mathsf{o\text {-}GASP}\) with decreasing preferences, each agent assigned to an activity objects to any positive number of other agents additionally joining the activity by the definition of decreasing preferences. Thus, given an assignment \(\pi \), any agent (or group of agents) can only deviate to an activity \(a\in A^{*}\) with \(\pi ^{a}=\emptyset \). By decreasing preferences, if there is no agent i and no activity \(a\in A^{*}\) with \(\pi ^{a}=\emptyset \) such that \((a,1)\succ _{i}(\pi (i),|\pi _{i}|)\) holds, there cannot exist a group of agents E such that \((a,|E|)\succ _{i}(\pi (i),|\pi _{i}|)\) holds for each of them, since \((a,k)\succ _{i}(a,k+1)\) holds for any choice of \(a\in A^{*}\) and \(k\in {\mathbb {N}}\). Thus, individual stability implies core stability. \(\square \)

Observe that Proposition 3 implies that in the decreasing preferences case, each Nash stable assignment is in the core.

Summarizing, in the case of decreasing preferences the following relations additionally hold (see also Fig. 2):

  • core stable \(\Leftrightarrow \) individually stable \(\Leftrightarrow \) contractually individually stable \(\Leftrightarrow \) contractually core stable (for the first equivalence, see Proposition 3);

  • Nash stable \(\Rightarrow \) core stable; Pareto optimal \(\Rightarrow \) core stable.

Fig. 2
figure 2

Relationships between the concepts in \(\mathsf{o\text {-}GASP}\) with decreasing preferences

2.3 Problem definitions and overview of results

Given an instance \({{\mathcal {I}}}\) of \(\mathsf{o\text {-}GASP}\), for each of the stabilityFootnote 2 concepts defined in Sect. 2.1 we are interested in the following two types of questions:

  • Does \({\mathcal {I}}\) admit a stable assignment? If so, can such an assignment be determined efficiently?

  • Given an assignment \(\pi \), is \(\pi \) stable w.r.t. the considered stability concepts?

Formally, we hence define the following decision problems, for each notion of stability defined in Sect. 2.1.

Stability-Existence

 

Given:

Instance \({\mathcal {I}}=(N,A,P)\) of \(\mathsf{o\text {-}GASP}\)

Question:

Does \({\mathcal {I}}\) admit a stable assignment?

Stability-Verification

Given:

Instance \({\mathcal {I}}=(N,A,P)\) of \(\mathsf{o\text {-}GASP}\) and an assignment \(\pi :N\rightarrow A\).

Question:

Is \(\pi \) a stable assignment?

An overview of the computational complexity results achieved in this paper is given in Table 1. There, “\(\mathsf{NP}\)-c” and “\(\mathsf{coNP}\)-c” stands for \(\mathsf{NP}\)-complete and \(\mathsf{coNP}\)-complete respectively; with respect to Stability-Existence, “in \(\mathsf{P}\)” means that a respective stable assignment always exists and can be found in polynomial time.

Table 1 Overview of the computational complexity results provided

3 Stable and Pareto optimal assignments: existence and determination

In this section, with respect to the different notions of stability defined in Sect. 2.1 we analyse the computational complexity of Stability-Existence, i.e., the decision problem whether a stable assignment exists. In the case this problem belongs to the class \(\mathsf{P}\) we give polynomial time algorithms for finding such a stable assignment.

3.1 Nash stability

The first stability concept we consider is Nash stability. In the setting of \(\mathsf{a\text {-}GASP}\), it is \(\mathsf{NP}\)-complete to decide whether a Nash stable assignment exists; however, in the case of increasing or decreasing preferences, a Nash stable assignment always exists and can be found in polynomial time (Darmann et al. 2017). In contrast, as Example 1 shows, in the setting of \(\mathsf{o\text {-}GASP}\) even when all agents have increasing preferences a Nash stable assignment does not necessarily exist. In particular, we show that in \(\mathsf{o\text {-}GASP}\) (1) it is \(\mathsf{NP}\)-complete to decide whether a Nash stable assignment exists even if all agents have increasing preferences, while (2) in the case of decreasing preferences, a Nash stable assignment always exists and can be found in polynomial time.

Example 1

Let \(N=\{1,2,3,4,5,6\}\) and \(A^{*}=\{a,b,c\}\). The (truncated) preference profile P made up of increasing preferences is given as follows:

1

2

3

4

5

6

(b,6)

(a,6)

(c,6)

(b,6)

(a,6)

(c,6)

(b,5)

(a,5)

(c,5)

(b,5)

(a,5)

(c,5)

(b,4)

(a,4)

(c,4)

(b,4)

(a,4)

(c,4)

(b,3)

(a,3)

(c,3)

(b,3)

(a,3)

(c,3)

(a,6)

(a,2)

(b,6)

(b,2)

(c,6)

(c,2)

(a,5)

\(a_{\emptyset }\)

(b,5)

\(a_{\emptyset }\)

(c,5)

\(a_{\emptyset }\)

(a,4)

 

(b,4)

 

(c,4)

 

(a,3)

 

(b,3)

 

(c,3)

 

(a,2)

 

(b,2)

 

(c,2)

 

(a,1)

 

(b,1)

 

(c,1)

 

\(a_{\emptyset }\)

 

\(a_{\emptyset }\)

 

\(a_{\emptyset }\)

 

Note that for each activity \(\alpha \in A^{*}\) there are exactly three agents who rank \((\alpha ,k)\) above \(a_{\emptyset }\) for some k.

Assume that there is a Nash stable assignment \(\pi \). Then, \(\pi \) must assign agent 1 to a non-void activity, because otherwise agent 1 would like to join a. Analogously, agents 3 and 5 must be assigned to a non-void activity.

Assume \(\pi (1)=a\). Then \(\pi (2)=a\) must hold since \(\pi \) is Nash-stable. For the same reason, \(\pi (5)=a\) must hold as well. Recall that also agent 3 has to be assigned to a non-void activity, i.e., \(\pi (3)\in \{b,c\}\) holds. \(\pi (3)=c\) would imply that three agents are assigned to c, which is impossible due to \(\pi (5)=a\) and the individual rationality of \(\pi \). Thus, \(\pi (3)=b\) holds. This, however, implies \(\pi (4)=b\) because otherwise agent 4 would like to join activity b in contradiction with Nash stability. But then agent 1 would like to join b, which violates Nash stability.

Therefore, \(\pi (1)=b\) must hold, implying \(\pi (3)=\pi (4)=b\). Since agent 5 must be assigned to a non-void activity, \(\pi (5)=c\) follows (\(\pi (5)=a\) is impossible because this would require \(\pi (1)=\pi (2)=a\)), which in turn implies \(\pi (6)=c\). But now agent 3 would like to join c which violates Nash stability.

Thus, a Nash stable assignment does not exist. Note that removing any agent from the above instance results in a new instance which admits a Nash stable assignment. E.g., if agent 6 is removed, then the assignment \(\pi '\) with \(\pi '(2)=a_{\emptyset }\), \(\pi '(1)=\pi '(3)=\pi '(4)=b\) and \(\pi '(5)=c\) is Nash stable.

We will make use of the above example in proving the following hardness result.

Theorem 1

It is \(\mathsf{NP}\)-complete to decide whether \(\mathsf{o\text {-}GASP}\) admits a Nash stable assignment, even when all agents have increasing preferences.

Proof

Given an assignment \(\pi \), for each \(i\in N\) it can be verified quickly whether i wants to deviate from \(\pi (i)\). Thus, membership in \(\mathsf{NP}\) follows.

We provide a reduction from Exact Cover by 3-Sets (X3C). In an instance of X3C, we are given a pair \(\langle F,\mathcal{Y}\rangle \), where \(F=\{1,\ldots ,3q\}\) and \(\mathcal{Y}=\{Y_{1},\ldots ,Y_{p}\}\) is a collection of 3-element subsets of F, and ask if F can be covered by exactly q sets from \(\mathcal{Y}\). It is known that X3C is \(\mathsf{NP}\)-complete even if each element of F appears in exactly three sets of \(\mathcal{Y}\) [see Hein et al. (1996) and Hickey et al. (2008)]; note that in such a case \(p=3q\) holds. For each \(i\in F\) let \(Y_{i_{1}},Y_{i_{2}},Y_{i_{3}}\) with \(i_{1}<i_{2}<i_{3}\) denote the sets that contain i.

Given such an instance \(\langle F,\mathcal{Y}\rangle \) of X3C, we construct an instance \({\mathcal {I}}\) of \(\mathsf{o\text {-}GASP}\) as follows. Let \(n:=3q\). Now, we set \(N:=\{\alpha _{i},\beta _{i},\gamma _{i},\delta _{i},\epsilon _{i},\lambda _{i} \mid 1\le i\le n\}\) and \(A^{*}:=\{y_{i},a_{i},b_{i},c_{i} \mid 1\le i\le n\}\). The preferences of the agents in N are, for \(1\le i\le n\), displayed in Table 2.

Table 2 Preferences of the agents in instance \({\mathcal {I}}\) used in the proof of Theorem 1

Note that for each \(a\in A^{*}\) there are exactly three agents who prefer (ak) to \(a_{\emptyset }\) for some choice of k.

In what follows, we argue that \(\langle F,\mathcal{Y}\rangle \) admits an exact cover if and only if \({\mathcal {I}}\) admits a Nash stable assignment.

Assume that there is an exact cover in \(\langle F,\mathcal{Y}\rangle \), i.e., there is a set of indices \(I\subseteq \{1,\ldots ,p\}\) such that \(|I|=q\) and \(\cup _{h\in I}Y_{h}=F\). Define the assignment \(\pi \) as follows: for \(1\le i\le n\),

  • \(\pi (\lambda _{i})=y_{j}\), with \(j\in \{i_{1},i_{2},i_{3}\}\cap I\)

  • \(\pi (\beta _{i})=a_{\emptyset }\), \(\pi (\alpha _{i})=\pi (\gamma _{i})=\pi (\delta _{i})=b_{i}\) and \(\pi (\epsilon _{i})=c_{i}\).

As \(\{Y_{h}\}_{h\in I}\) is a partition of F, for each i, \(|I\cap \{i_{1},i_{2},i_{3}\}|=1\) holds. Hence the assignment is well-defined. Since \(\{Y_{h} \mid h\in I\}\) is an exact cover for F and each set \(Y_{h}\in \mathcal {Y}\) contains exactly three elements, for any choice of \(y\in \{y_{i} \mid 1\le i\le n\}\) the number of agents assigned to y under \(\pi \) is either 0 or 3. Therefore, for each i

  • agent \(\lambda _{i}\) does not want to deviate from \(y_{j}\) in order to join another activity. To verify this, note that \(\lambda _{i}\) could only wish to deviate to an activity \(y\in \{y_{i} \mid 1\le i\le n\}\). On one hand, however, \(\lambda _{i}\) does not want to join such a y with \(\pi ^{y}=\emptyset \) since \((a,1)\notin S_{\lambda _{i}}\) holds for each \(a\in A^{*}\). On the other hand \(\lambda _{i}\) cannot want to join y with \(|\pi ^{y}|=3\) because for each \(a\in A^{*}\), there are only three agents that rank (ak) above \(a_{\emptyset }\) for some choice of k.

  • no agent \(g\in \{\alpha _{i},\beta _{i},\gamma _{i},\delta _{i},\epsilon _{i}\}\) wants to deviate from \(\pi (g)\) (see also Example 1)

Thus, \(\pi \) is Nash stable.

On the other hand, assume there is a Nash stable assignment \(\pi \) in instance \({\mathcal {I}}\). Suppose that for some \(i\in \{1,\ldots ,n\}\), agent \(\lambda {}_{i}\) is not assigned to an activity \(y\in \{y_{i_{1}},y_{i_{2}},y_{i_{3}}\}\). Analogously to Example 1 it then follows that \(\pi \) is not Nash stable. Hence, for each \(i\in \{1,\ldots ,n\}\) agent \(\lambda {}_{i}\) is assigned to an activity \(y\in \{y_{i_{1}},y_{i_{2}},y_{i_{3}}\}\). By construction, \(\pi (\lambda _{i})=y\) implies that exactly three agents are assigned to y. I.e., the collection \(\{Y_{j}\mid \exists i\in \{1,\ldots ,n\}:\pi (\lambda _{i})=y_{j}\}\) is an exact cover for F. \(\square \)

On the positive side, for the case of decreasing preferences, we propose a polynomial-time algorithm that computes a Nash stable assignment. Given an individually rational assignment \(\pi \), if i wants to deviate from \(\pi (i)\) we denote by \( fc (i,\pi )\) agent i’s favourite choice, i.e., the activity \(a\in A^{*}{\setminus }\{\pi (i)\}\) such that \((a,|\pi ^{a}|+1)\) is the best-ranked among all alternatives in the ranking \(\succ _{i}\) that satisfy \((a',|\pi ^{a'}|+1)\succ _{i}(\pi (i),|\pi _{i}|)\).

Now, the algorithmic idea is as follows. Assume some agent i wishes to deviate from activity a assigned to the agent by an individually rational assignment \(\pi \). Then we assign agent i to her favourite choice, say b, which increases the number of agents assigned to b by exactly 1. If, as a consequence of the increased group size, one of the agents originally assigned to b now may prefer to join the void activity or another activity of \(A^*\), such an agent is (after being assigned to \(a_{\emptyset }\) in an intermediate step) chosen as the next agent whose wish to deviate is considered.

figure a

Theorem 2

Given an instance of \(\mathsf{o\text {-}GASP}\) with decreasing preferences, a Nash stable assignment always exists and can be determined in polynomial time.

Proof

We show that Algorithm 1 terminates in polynomial time, with the resulting assignment \(\pi \) being Nash stable. Note that for each \(b\in A^{*}\), during the execution of Algorithm 1 the number of agents assigned to b, i.e., \(|\pi ^{b}|\), is non-decreasing in the sense that, for loops \(\ell , \ell '\) with \(\ell < \ell '\), the number of agents assigned to b at the beginning of loop \(\ell '\) is at least as high as at the beginning of loop \(\ell \).

Complexity First, we show that in the execution of Algorithm 1, for any \(i\in N\), \(b\in A^{*}\) and \(1\le k\le n\), b is at most once i’s favourite choice with currently \(k-1\) agents assigned to b, i.e., at most once we have \(\pi (i)=a_{\emptyset }\), \( fc (i,\pi )=b\), and \(|\pi ^{b}|=k-1\). Assume the opposite. That means, during one loop of the algorithm i is assigned to b (let loop \(\ell \) denote the first such loop), and in a later loop i is assigned to \(a_{\emptyset }\) again. Note that we must have

$$\begin{aligned} (b,k)\succ _{i}a_{\emptyset } \end{aligned}$$
(2)

and

$$\begin{aligned} (b,k)\succ _{j}(d,|\pi ^{d}|+1) \end{aligned}$$
(3)

for all \(d\in A^{*}{\setminus }\{b\}\) after loop \(\ell \). Clearly, directly after execution of loop \(\ell \), \(|\pi ^{b}|\in \{k-1,k\}\) holds, depending on whether or not there was an agent j satisfying one of the conditions in line 10. In the latter case \(|\pi ^{b}|=k\) holds. Thus, b with \(|\pi ^{b}|=k-1\) cannot be any agent’s favourite choice in a later stage because the number of agents assigned to b is non-decreasing.

Hence, we must have \(|\pi ^{b}|=k-1\) after loop \(\ell \). To enable that in a loop \(g>\ell \), b is again i’s favourite choice, i must be assigned to \(a_{\emptyset }\) in a loop \(\ell '\) with \(\ell<\ell '<g\). This is only possible if i wishes to deviate in loop \(\ell '\) as a consequence of the increased size of the group of agents assigned to b due to an agent joining b in loop \(\ell '\) (line 9). I.e., when executing loop \(\ell '\), in line 10 condition (1) \(a_{\emptyset }\succ _{i}(b,|\pi ^{b}|)\), or (2) \((d,|\pi ^{d}|+1)\succ _{i}(b,|\pi ^{b}|)\) for some \(d\in A^{*}{\setminus }\{b\}\), must be satisfied. Since for each activity the number of agents assigned in loop \(\ell '\) is at least as high as in loop \(\ell \), there are at least \(k-1\) agents assigned to b when entering loop \(\ell '\). Assume we have \(|\pi ^{b}|=k-1\) at the beginning of loop \(\ell '\). Then, (1) corresponds to \(a_{\emptyset }\succ _{i}(b,k)\) in contradiction with Eq. (2). Analogously, (2) corresponds to \((d,|\pi ^{d}|+1)\succ _{i}(b,k)\) in contradiction with Eq. (3), because the agents have decreasing preferences and the number of agents assigned to d is at least as high at the beginning of loop \(\ell '\) as after loop \(\ell \).

As a consequence, at the beginning of loop \(\ell '\) we must have \(|\pi ^{b}|\ge k\). This, however, contradicts with the fact that, in loop g, b with \(|\pi ^{b}|=k-1\) is i’s favourite choice, because the number of agents assigned to b at the beginning of loop g is at least as high as at the beginning of loop \(\ell '\).

Hence, for each \(i\in N\), \(b\in A^{*}\) and \(1\le k\le n, b\) is at most once i’s favourite choice with currently \(k-1\) agents assigned to b. With \(m=|A^{*}|\) that means that the algorithm terminates after at most \(n\cdot mn=mn^{2}\) loops. In each loop, the highest computational effort is the execution of line 10, which, in the worst case, requires checking \((d,|\pi ^{d}|+1)\succ _{j}(b,|\pi ^{b}|)\) for all agents j and activities \(d\in A^{*}{\setminus }\{b\}\); this can roughly be bounded by \(\mathcal {O}(m^{2}n^{2})\). Thus, the running time of the algorithm can be bounded by \(\mathcal {O}(mn^{2}\cdot m^{2}n^{2})\), i.e., by \(\mathcal {O}(m^{3}n^{4})\).

Correctness After termination of the algorithm, we have \(C=N\); let \(\pi ^{*}\) denote the final assignment, i.e., the assignment \(\pi \) after the final loop. It is easy to verify that \(\pi ^{*}\) is individually rational. Let \(i\in N\), with \(\pi ^{*}(i)=a\in A^{*}\cup \{a_{\emptyset }\}\). Let \(\ell \) denote the loop in which i was put into set C for the last time. By construction, right after loop \(\ell \) agent i did not want to deviate from \(\pi (i)\) in order to join another activity \(b\in A^{*}\cup \{a_{\emptyset }\}\). Since the number of agents assigned to an activity is non-decreasing and each agent has decreasing preferences, i does not want to deviate from \(\pi ^{*}(i)\) and join an activity to which agents are assigned by \(\pi ^{*}\). \(\square \)

3.2 Individual stability

In the case of increasing preferences individual stability coincides with Nash stability. Theorem 1 hence implies the following corollary.

Corollary 1

It is \(\mathsf{NP}\)-complete to decide whether \(\mathsf{o\text {-}GASP}\) admits an individually stable assignment, even when all agents have increasing preferences.

In contrast, for the case of decreasing preferences we already know that a Nash stable assignment can be found in polynomial time by use of Algorithm 1 (see Theorem 2). Since Nash stability implies individual stability, we can conclude that in case of decreasing preferences an individually stable assignment can be determined in polynomial time.

Corollary 2

Given an instance of \(\mathsf{o\text {-}GASP}\) with decreasing preferences, an individually stable assignment always exists and can be determined in polynomial time.

On the other hand, a contractually individually stable assignment exists and can be found efficiently in any instance of \(\mathsf{o\text {-}GASP}\). While there is a natural greedy algorithm to determine such an assignment (which in general is not Pareto optimal) we can conclude this also from the fact that a Pareto optimal assignment can be found in polynomial time (Theorem 4 in Sect. 3.4; see also Fig. 1).

Corollary 3

Given an instance of \(\mathsf{o\text {-}GASP}\), a contractually individually stable assignment always exists and can be determined in polynomial time.

3.3 Core stability

For the setting of \(\mathsf{a\text {-}GASP}\), a core stable assignment always exists and can be determined efficiently (Darmann et al. 2017). While in \(\mathsf{o\text {-}GASP}\) an analogous result holds for decreasing preferences as well (see Corollary 4), in general this is not the case. As Example 2 shows, even in the special case of increasing preferences a core stable assignment does not always exist. In particular, it turns out that deciding whether \(\mathsf{o\text {-}GASP}\) admits a core stable assignment is computationally hard even in the case of increasing preferences.

Example 2

Let us again consider instance (NAP) of Example 1. Assume that there is a core stable assignment \(\pi \). Suppose \(\pi (1)=a_{\emptyset }\). Then \(\pi ^{a}=\emptyset \) follows, and the set \(E=\{1\}\) would prefer joining a, which violates core stability. Thus, agent 1 must be assigned to a non-void activity; analogously, agents 3 and 5 must be assigned to a non-void activity.

If \(\pi (1)=a\), then \(\pi (2)=\pi (5)=a\) follows (otherwise \(|\pi ^{a}|\le 2\) holds and hence each member of \(E=\{1,2,5\}\supset \pi ^{a}\) would be better off with all members of E being assigned to a). Recall that agent 3 is assigned to a non-void activity. By individual rationality of \(\pi \), \(\pi (5)\not =c\) hence implies that \(\pi (3)=b\) holds. However, by \(\pi (1)=a\) it follows that \(|\pi ^{b}|\le 2\) holds; but then each member of \(E=\{1,3,4\}\supset \pi ^{b}\) would be better off with all members of E being assigned to b. This violates core stability.

Therewith, \(\pi (1)=b\) holds, which means \(\pi (3)=\pi (4)=b\). Since agent 5 is assigned to a non-void activity, \(\pi (5)=c\) must hold due to \(\pi (1)\not =a\). By \(\pi (3)\not =c\) we can conclude that \(|\pi ^{c}|\le 2\) holds. But then each member of \(E=\{3,5,6\}\supset \pi ^{c}\) is better off with all members of E being assigned to c, which violates core stability.

Thus, a core stable assignment does not exist. However, note that if agent 6 is removed, then the assignment \(\pi '(1)=\pi '(3)=\pi '(4)=b\) and \(\pi '(5)=c\) is core stable.

Theorem 3

It is \(\mathsf{NP}\)-complete to decide whether \(\mathsf{o\text {-}GASP}\) admits a core stable assignment, even when all agents have increasing preferences.

Proof

For membership in \(\mathsf{NP}\), observe that a core stable assignment \(\pi \) serves as certificate: For each \(a\in A^{*}\), by scanning the whole profile for each value \(k>|\pi ^{a}|\) in polynomial time we can check if there exists a set \(E\supset \pi ^{a}\) of size \(|E|=k\) such that \((a,|E|)\succ _{i}(\pi (i),|\pi _{i}|)\) for all \(i\in E\). Thus, overall in polynomial time we can verify if \(\pi \) is indeed core stable.

The hardness-proof follows a pattern similar to the proof of Theorem 1, now making use of Example 2. We reduce from Exact Cover by 3-Sets (X3C). In an instance of X3C, we are given a pair \(\langle F,\mathcal{Y}\rangle \), where \(F=\{1,\ldots ,3q\}\) and \(\mathcal{Y}=\{Y_{1},\ldots ,Y_{p}\}\) is a collection of 3-element subsets of F, and ask if F can be covered by exactly q sets from \(\mathcal{Y}\). Again, we restrict to instances of X3C in which each element of F appears in exactly three sets of \(\mathcal{Y}\); recall that in such a case \(p=3q\) holds. For each \(i\in F\) let \(Y_{i_{1}},Y_{i_{2}},Y_{i_{3}}\) with \(i_{1}<i_{2}<i_{3}\) denote the sets that contain i.

Given such an instance \(\langle F,\mathcal{Y}\rangle \) of X3C, we construct an instance \({\mathcal {I}}'\) of \(\mathsf{o\text {-}GASP}\) as follows. Let \(n:=3q\). Now, we set \(N:=\{\alpha _{i},\beta _{i},\gamma _{i},\delta _{i},\epsilon _{i},\lambda _{i},W_{i}, Z_{i} \mid 1\le i\le n\}\) and \(A^{*}:=\{y_{i},a_{i},b_{i},c_{i} \mid 1\le i\le n\}\). The preferences of the agents in N are, for \(1\le i\le n\), displayed in Table 3.

Table 3 Preferences of the agents in instance \(\mathcal {I}'\) used in the proof of Theorem 3

Note that for each \(a\in \{a_{i},b_{i},c_{i} \mid 1\le i\le n\}\) there are exactly 3 agents who prefer (ak) to \(a_{\emptyset }\) for some \(k\in {\mathbb {N}}\), and for each \(a\in \{y_{i} \mid 1\le i\le n\}\) exactly 9 agents prefer (ak) to \(a_{\emptyset }\) for some choice of k.

Now we show that \(\langle F,\mathcal{Y}\rangle \) admits an exact cover if and only if \({\mathcal {I}}'\) admits a core stable assignment.

\(\Rightarrow \)”. Assume there is an exact cover in \(\langle F,\mathcal{Y}\rangle \), i.e., there is a set of indices \(I\subseteq \{1,\ldots ,p\}\) such that \(|I|=q\) and \(\cup _{h\in I}Y_{h}=F\). For \(1\le i\le n\), let

  • \(\pi (\lambda _{i})=\pi (W_{i})=\pi (Z_{i})=y_{j}\), with \(j\in \{i_{1},i_{2},i_{3}\}\cap I\)

  • \(\pi (\beta _{i})=a_{\emptyset }\), \(\pi (\alpha _{i})=\pi (\gamma _{i})=\pi '(\delta _{i})=b_{i}\) and \(\pi '(\epsilon _{i})=c_{i}\).

Note that for \(j\in \{i_{1},i_{2},i_{3}\}\cap I\) exactly 9 agents are assigned to \(y_{j}\). Next, observe that there is no group of agents G with \(G\cap \{\lambda _{i},W_{i},Z_{i} \mid 1\le i\le n\}=\emptyset \) that wants to deviate from their activities assigned by \(\pi \) (see also Example 2). Assume there is a subset of agents \(G'\) with \(G'\cap \{\lambda _{i},W_{i},Z_{i}\}\not =\emptyset \) for some i that wants to deviate. By construction, \(g\in \{\lambda _{i},W_{i},Z_{i}\}\) can only beneficially deviate to some \(y_{j'}\in \{y_{j_{1}},y_{j_{2}},y_{j_{3}}\}{\setminus }\{y_{j}\}\). Recall that exactly nine agents prefer \((y_{j'},k)\) to \(a_{\emptyset }\) for some choice of k, including the agents \(\lambda _{i},W_{i},Z_{i}\). Hence, g can only deviate if all of the three agents \(\lambda _{i},W_{i},Z_{i}\) want to deviate, which is impossible because \((y_{j},9)\succ (y_{j'},9)\) holds for at least one of these agents. Thus, \(\pi \) is core stable.

\(\Leftarrow \)”. On the other hand, assume there is a core stable assignment \(\pi \) in instance \({\mathcal {I}}\). Example 2 implies that for each \(i\in \{1,\ldots ,n\}\) agent \(\lambda {}_{i}\) is assigned to an activity \(y\in \{y_{i_{1}},y_{i_{2}},y_{i_{3}}\}\). By construction, \(\pi (\alpha _{i})=y\) implies that exactly nine agents are assigned to y, namely the agents \(\lambda _{i'}W_{i'},Z_{i'}\) for exactly three indices \(i'\in \{1,\ldots ,n\}\). It is not hard to verify that this means that the collection \(\{Y_{j}\mid \exists i\in \{1,\ldots ,n\}:\pi (\lambda _{i})=y_{j}\}\) is an exact cover for F. \(\square \)

In contrast, in the case of decreasing preferences a core stable assignment always exists and can be determined in polynomial time. This is a consequence of Theorem 2 and the fact that in the case of decreasing preferences any Nash stable assignment is also core stable (see also Fig. 2).

Corollary 4

Given an instance of \(\mathsf{o\text {-}GASP}\) with decreasing preferences, a core stable assignment always exists and can be found in polynomial time.

In contrast to core stability we have a positive result for contractual core stability in the general setting of \(\mathsf{o\text {-}GASP}\): an assignment meeting that requirement is guaranteed to exist and can even be computed in polynomial time. Again, this follows from the result that a Pareto optimal assignment can be found in polynomial time (Theorem 4 in Sect. 3.4).

Corollary 5

In \(\mathsf{o\text {-}GASP}\), a contractually core stable assignment always exists and can be found in polynomial time.

3.4 Pareto optimality

Finally, we tackle the problem of finding a Pareto optimal assignment. Given an instance of \(\mathsf{o\text {-}GASP}\), consider the partial order \(\triangleright _P\) of Pareto-improvement defined over the set of individually rational assignments as follows: \(\pi ' \triangleright _P \pi \) if there is no \(i\in N\) with \((\pi '(i),|\pi '_{i}|)\prec _{i}(\pi (i),|\pi _{i}|)\) and for at least one \(i\in N\) we have \((\pi '(i),|\pi '_{i}|)\succ _{i}(\pi (i),|\pi _{i}|)\). Clearly, since \(\triangleright _P\) is a partial order over the non-empty finite set of individually rational assignments, in an instance of \(\mathsf{o\text {-}GASP}\) a Pareto optimal assignment (i.e., a maximal element w.r.t. \(\triangleright _P\)) always exists. Now, consider an agent i with top-ranked alternative (ak). Assume it is possible to assign i and \(k-1\) other agents to a while respecting individual rationality. Since agent i’s top-ranked alternative is (ak) it follows that there is a Pareto optimal assignment (i.e., a maximal element w.r.t. \(\triangleright _P\)) \(\pi \) with \(\pi (i)=a\) and \(|\pi ^{a}|=k\). Thus, for determining a specific Pareto optimal assignment \(\pi \) we can already fix \(\pi (i)=a\) and \(|\pi ^{a}|=k\).

Now, the basic algorithmic idea is as follows. Consider an individually rational assignment in which (1) for some agents the activities they are assigned to and (2) for some activities the number of agents assigned to the activity have already been fixed. Pareto-improve the assignment, i.e., find an assignment that respects (1) and (2) and is better for at least one agent while making no agent worse off. In fact, applying this idea we can find a Pareto optimal assignment in an instance \({\mathcal {I}}=(N,A,P)\) of \(\mathsf{o\text {-}GASP}\) in polynomial time by means of procedure Pareto and its subroutines test and improve described below.

3.4.1 Procedure Pareto

Let \(r_{\ell }(i)\) denote agent i’s \(\ell \)-th ranked alternative. We assume that the profile P contains only alternatives (ak) which are approved by at least k agents. The idea of procedure Pareto (Algorithm 2) is as follows. Start with the void assignment, i.e., with the assignment \(\pi (i)=a_{\emptyset }\) for all \(i\in N\).

Pick an agent, say agent 1. For her top-ranked alternative (ak), assign agent 1 to a together with \(k-1\) arbitrarily chosen other agents approving of (ak). Clearly, for agent 1 there can be no assignment she prefers to the actual assignment. I.e., there is a Pareto optimal assignment \(\pi \) that assigns 1 to a such that \(|\pi ^{a}|=k\). Hence, we add 1 to the (initially empty) set \(N'\) of agents for which the finally assigned activity is determined already and also fix the number of agents assigned to a to be k in the finally determined assignment. Thus, if \(|\{h\in N:(a,k)\in S_{h}\}|=k\), then we can add all these agents in \(\pi ^{a}\) to \(N'\) and proceed with the reduced instance in which a and \(\pi ^{a}\) are removed from the original instance.

However, some of the agents of \(\pi ^{a}{\setminus }\{1\}\) might be better off with an alternative different from (ak). Hence, if \(|\{h\in N:(a,k)\in S_{h}\}|>k\), then it might be possible to assign some agent of \(\pi ^{a}{\setminus }\{1\}\) to an alternative she prefers to (ak) without making any agent worse off. So, for each of these agents j, we verify, for alternatives (bx) with \((b,x)\succ _{j}(a,k)\), if there is an assignment \(\pi '\) such that a total of x agents (including j) is assigned to b without making any agent worse off (note that in this first step, from the possible choices we must exclude \((b,x)=(a,\ell )\) for any choice of \(\ell \) since it is already fixed that exactly k agents including agent 1 must be assigned to a). In general, in procedure Pareto the set S denotes the set of agents j for which we check if such an assignment \(\pi '\) exists.

For a given agent j, procedure test checks if there is such an assignment \(\pi '\), for each alternative (bx) which j prefers to \((\pi (j),|\pi _{j}|)\) (the alternatives are considered in increasing order of the rank in \(\succ _{j}\)). If a respective assignment exists or all alternatives are exhausted, j is added to \(N'\); in the former case, \(\pi \) is replaced by \(\pi '\) and the set S of agents is updated accordingly (now, some agents might want to “deviate” from (bx)).

Finally, if such a Pareto-improvement is not possible anymore, we remove all agents of \(N'\) and all activities to which an agent of \(N'\) is assigned from the instance, and iterate Pareto with the resulting reduced instance.

figure b

3.4.2 Procedures test and improve

Given instance \({\mathcal {I}}\), agent j, assignment \(\pi \) and agent set \(N'\), the goal of procedure test is an individually rational assignment \(\pi '\) which assigns j to the best-ranked among the alternatives (bx) that j prefers to \((\pi (j),|\pi _{j}|)\) such that for each agent of \(N'\) the assignment remains unchanged, i.e., for all \(i\in N'\) \((\pi '(i),|\pi '_{i}|)=(\pi (i),|\pi {}_{i}|)\) holds. Procedure test considers the alternatives (bx) in increasing order of their rank in \(\succ _{j}\), checks if such an assignment exists and terminates if such an assignment is found or all alternatives (bx) which j prefers to \((\pi (j),|\pi _{j}|)\) are exhausted. Note that agent j cannot be assigned to (bx) if the total number of agents assigned to b is already fixed to a number different from x (line 5 of procedure test).

figure c

Summing up, for considered alternative (bx) assignment \(\pi '\) must satisfy the following properties:

$$\begin{aligned}&1.\hbox { for all}\,i\in N' \hbox {we have}\,{(\pi '(i),|\pi '_{i}|)=(\pi (i),|\pi _{i}|)} \nonumber \\&2.{ {(\pi '(j),|\pi '_{j}|)=(b,x)} } \\&3.\hbox { for all}\, {h\in N}:{(\pi '(h),|\pi '_{h}|)=(\pi (h),|\pi {}_{h}|)} \,\hbox {or}\, {(\pi '(h),|\pi '_{h}|)\succ _{h}(\pi (h),|\pi {}_{h}|)}\nonumber \end{aligned}$$
(4)

In order to check whether such an assignment exists for a given alternative (bx), test executes the subroutine improve described below.

Procedure improve works as follows. Given as input an instance \({\mathcal {I}}=(N,A,P)\), a subset \(N'\subset N\), dedicated agent j and alternative (bx), and assignment \(\pi \), improve checks if there is an assignment \(\pi '\) such that Eq. (4) is satisfied.

This is done by solving a feasible flow problem with lower and upper bounds on the edge capacities in the following directed graph \(G=(V,E)\), with \(V:=\{s,t,b\}\cup N\cup \{a \mid \pi ^{a}\not =\emptyset ,a\in A^{*}\}\). The edge set E is constructed as follows:

  • introduce the edges (sj) and (jb) of lower and upper capacity bound 1

  • for each \(i\in N{\setminus }\{j\}\),

    • introduce the edges (si)

      • of upper capacity bound 1 if \(\pi (i)=a_{\emptyset }\)

      • of lower and upper capacity bound 1 if \(\pi (i)\not =a_{\emptyset }\).

    • for each \(a\in A^{*}\) with \(\pi ^{a}\not =\emptyset \), introduce

      • the edge (ia) of lower and upper capacity bound 1 if \(\pi (i)=a\) and \(i\in N'\)

      • the edge (ia) of upper capacity bound 1 if \(\pi (i)=a\) and \(i\notin N'\)

      • the edge (ia) of upper capacity bound 1 if \((a,|\pi ^{a}|)\succ _{i}(\pi _{i},|\pi _{i}|).\)

    • introduce the edge (ib) of upper capacity bound 1 if \((b,x)\succ _{i}(\pi _{i},|\pi _{i}|).\)

  • for each \(a\in A^{*}\) with \(\pi ^{a}\not =\emptyset \) introduce edge (at) of lower and upper capacity bound \(|\pi ^{a}|\).

  • introduce the edge (bt) of lower and upper capacity bound x.

Unless otherwise specified above, the lower capacity bound of an edge is 0. An example of the graph is given in Fig. 3, where lu denote the lower and upper edge capacity bounds. In Fig. 3, agents 1 and j are as described above; for agent i we have \(\pi (i)=b\) and \((d,|\pi ^{d}|)\succ _{i}(b,x)\); agent n is currently not assigned to any activity but approves of \((d,|\pi ^{d}|)\) and \((r,|\pi ^{r}|)\).

Let f denote a feasible integer flow in the above graph (if such a flow exists). Now, improve\(({\mathcal {I}},N',j,(b,x),\pi )\) outputs

  • \(\pi \) if there is no feasible flow

  • the assignment \(\pi '\) defined by, for \(i\in N\) and \(a\in A^{*}\), \(\pi '(i)=a\) if and only f sends flow along the edge (ia), and \(\pi '(i)=a_{\emptyset }\) if there is no flow sent through vertex i.

Fig. 3
figure 3

Graph G used in procedure improve

Lemma 1

In polynomial time, procedure improve\(({\mathcal {I}},N',j,(b,x),\pi )\) outputs either an assignment \(\pi '\) that satisfies the conditions stated in Eq. (4) or \(\pi \) in the case that such an assignment \(\pi '\) does not exist.

Proof

The polynomial running time of improve follows from the facts that the size of graph G is polynomial in n and m and an integer feasible flow can be computed in polynomial time [see, e.g., Ahuja et al. (1993)].

Assume the procedure outputs an assignment \(\pi '\not =\pi \). By construction of graph G, conditions (1) and (2) of Eq. (4) are satisfied by \(\pi '\). In order to verify that (3) is satisfied as well, it is sufficient to see that an agent i with \(\pi (i)\not =a_{\emptyset }\) by construction cannot be assigned to a worse-ranked non-void alternative; in addition, by the fact that the lower and upper capacity of (si) is 1, i cannot be assigned to the void activity either. Thus, for i with \(\pi (i)\not =a_{\emptyset }\) either \(\pi '(i)=b\) or \(\pi '(i)=\pi (i)\) holds. The first case, by construction implies \((\pi '_{i},|\pi '_{i}|)=(b,x)\succ _{i}(\pi _{i},|\pi _{i}|)\); in the second case, we have \((\pi '(i),|\pi '_{i}|)=(\pi (i),|\pi _{i}|)\).

On the other hand, it is not hard to see that in the case that an assignment satisfying Eq. (4) exists, procedure improve finds one. \(\square \)

As a consequence, in polynomial time procedure test\(({\mathcal {I}},N',j,\pi )\) checks if there is an assignment \(\pi '\) such that Eq. (4) holds for some \((b,x)\succ _{j}(\pi (j),|\pi {}_{j}|)\); in case of existence, \(\pi \) is updated to coincide with an assignment \(\pi '\) that assigns j to her best-ranked such alternative. Given the fact that for all \(i\in N'\), the pair \((\pi (i),|\pi (i)|)\) is already the respective alternative of the finally computed assignment, test\(({\mathcal {I}},N',j,\pi )\) hence determines the activity (and corresponding group size) to which agent j is finally assigned; therewith, after executing test\(({\mathcal {I}},N',j,\pi )\) agent j is added to the set \(N'\).

Procedure Pareto executes procedure test at most once for each agent, and the latter evokes improve for a given agent at most once for each alternative (bx), hence procedure improve is executed at most \(mn^{2}\) times. Thus, with Lemma 1 we can conclude the following theorem.

Theorem 4

In \(\mathsf{o\text {-}GASP}\), a Pareto optimal assignment can be found in polynomial time.

Since any Pareto optimal assignment is also weakly Pareto optimal, Theorem 4 implies that a weakly Pareto optimal assignment can be found in polynomial time as well (Corollary 6 below). However, in fact a weakly Pareto optimal assignment can be determined very efficiently: any individually rational assignment that—in a reduced instance containing only alternatives (ak) approved by at least k agents—assigns some agent with top-ranked alternative (ak) together with \(k-1\) other agents approving of (ak) to a must be weakly Pareto optimal.

Corollary 6

In \(\mathsf{o\text {-}GASP}\), a weakly Pareto optimal assignment can be found in polynomial time.

4 Verification of stability and Pareto optimality

Given an instance of \(\mathsf{o\text {-}GASP}\) and an individually rational assignment, another interesting task is to check if the assignment is stable with respect to the considered stability notions (Stability-Verification).

Clearly, we can decide in polynomial time whether a given assignment is Nash stable, individually stable or contractually individually stable. In addition, it can also be checked in polynomial time whether a given assignment \(\pi \) is core stable: For each alternative (ak) with \(k>|\pi ^a|\) that is preferred to \((\pi (i),|\pi _i|)\) by some agent i, we need to check whether a total of k agents (including the agents in \(\pi ^a\), if \(\pi ^a\) is non-empty) prefer (ak) to the alternative assigned under \(\pi \); if and only if this is not the case for any such alternative the assignment is core stable. The worst case scenario for checking whether or not an assignment is core stable can hence be bounded by scanning the whole profile for each alternative, which can be done in polynomial time.

However, the computational complexity of deciding whether a given assignment is contractually core stable or Pareto optimal does not seem obvious. Our results show that the above decision problem is in \(\mathsf{P}\) for contractual core stability, whereas it is \(\mathsf{coNP}\)-complete for Pareto optimality even in the case of increasing preferences. While in the case of decreasing preferences the computational complexity status of checking for Pareto optimality is open, deciding whether or not an assignment is weakly Pareto optimal turns out to be \(\mathsf{coNP}\)-complete in both special cases of increasing and decreasing preferences.

For checking whether a given assignment \(\pi \) is contractually core stable (Algorithm 4), the basic idea is as follows. For each agent i and each alternative (bk) which i prefers to \((\pi (i),|\pi _{i}|)\) we check whether a total of k agents (including i) can be taken from N to form the subset E such that \(\pi ^{b}\subset E\) and, for all \(j\in E\), \((b,k)\succ _{j}(\pi (j),|\pi _{j}|)\) holds while there is no \(j\in N{\setminus } E\) with \((\pi (j),|\pi _{j}{\setminus } E|)\prec _{j}(\pi (j),|\pi _{j}|)\). So, since we include i and all agents of \(\pi ^{b}\) in E, that means we need to take a total of \(k-|\pi ^{b}|-1\) of the remaining agents, i.e., agents different from i from the sets \(\pi ^{c}\), \(c\in A{\setminus }\{b\}\), to form E. In order to check if this is possible, for each such set \(\pi ^{c}\) we compute all possible numbers of agents that can be taken from \(\pi ^{c}\) such that no member of \(\pi ^{c}\) objects. Having all of these numbers, we need to decide if these add up to \(k-|\pi ^{b}|-1\) by taking exactly one number from each activity (note that 0 is a possible choice for \(c\in A{\setminus }\{b,\pi (i)\}\)). The problem of taking exactly one number of each member of a given family of subsets of non-negative integers such that these add up to a given number corresponds to the Multiple-Choice Subset-Sum problem [see Pisinger (1995)], for which an algorithm is known which, in our case, allows for a polynomial running time.

figure d

Theorem 5

In \(\mathsf{o\text {-}GASP}\) we can decide in polynomial time whether a given assignment is contractually core stable.

Proof

Given an instance (NAP) of \(\mathsf{o\text {-}GASP}\) and assignment \(\pi \), in a pre-processing step we check if \(\pi \) is individually rational (which clearly can be done in polynomial time). Next, we argue that by means of Algorithm 4 it can be verified in polynomial time if an individually rational assignment \(\pi \) is contractually core stable.

Correctness As mentioned above, the algorithm checks for each agent i and each alternative (bk) which i prefers to \((\pi (i),|\pi _{i}|)\) whether k agents (including i and all the agents in \(\pi ^{b}\)) can be taken from N to form the subset E such that \((b,k)\succ _{j}(\pi (j),|\pi _{j}|)\) for all \(j\in E\) holds and there is no \(j\in N{\setminus } E\) with \((\pi (j),|\pi _{j}{\setminus } E|)\prec _{j}(\pi (j),|\pi _{j}|)\). For each agent i and such alternative (bk), Algorithm 4 proceeds as follows. B denotes the set of agents that prefer (bk) to the assigned alternative under \(\pi \). For each \(c\in A{\setminus }\{b\}\), it is verified whether, for each possible choice of \(\ell \), exactly \(\ell \) agents can be taken from \(\pi ^{c}\) and included in E such that no member of \(\pi ^{c}\) objects to this. Clearly, the members of \(\pi ^{c}\) that are meant to be included in E must prefer (bk) to the current assignment. In other words, only members of \(\pi ^{c}\cap B\) can be included in E.

Clearly, for \(a_{\emptyset }\) we can include any subset of \(\pi ^{a_{\emptyset }}\cap B\) in E (line 24 of Algorithm 4). For \(c\in A^{*}{\setminus }\{b\}\) (lines 17–24 and lines 11–15 respectively), \(\ell \) agents of \(\pi ^{c}\cap B\) can be included in E if and only if (1) all agents in \(\pi ^{c}{\setminus } B\) prefer \((c,|\pi ^{c}|-\ell )\) to \((c,|\pi ^{c}|)\) (line 21), and (2) the members in \(\pi ^{c}\cap B\) that are not meant to be assigned to (bk) - that means at least \((|B\cap \pi ^{c}|-\ell )\) agents of \(B\cap \pi ^{c}\) - also prefer \((c,|\pi ^{c}|-\ell )\) to \((c,|\pi ^{c}|)\) (line 22). For activity \(a:=\pi (i)\), note that we need to take into account that i is included in E (lines 11–15).

For each activity \(a'\in A{\setminus }\{b\}\), we collect the numbers of agents which can be removed from \(\pi ^{a'}\) (including the number 0 for \(c\in A{\setminus }\{a,b\}\)) in order to be included in E by means of the set \(R^{a'}\). Finally, Algorithm 4 checks if we can make up E with a total of exactly k agents including i and all agents of \(\pi ^{b}\) by verifying whether it is possible to take exactly one number from each of the sets \(R^{a'}\) such that these add up to \(k-|\pi ^{b}|-1\) (line 25).

Running time The bottleneck of the algorithm is deciding whether an above-mentioned selection of numbers adds up to \(k-|\pi ^{b}|-1\). Since \(k\le m\) holds, applying, e.g., Pisinger’s algorithm (Pisinger 1995) for the Multiple-Choice Subset-Sum problem requires a running time of \(\mathcal {O}(m^{2})\) per execution. Hence, the overall running time of our algorithm is in \(\mathcal {O}(n^{2}m^{3})\), because in the worst case it executes Pisinger’s algorithm at most once for each agent and each alternative, i.e., \(n^{2}m\) times. \(\square \)

Theorem 6

In \(\mathsf{o\text {-}GASP}\) it is \(\mathsf{coNP}\)-complete to decide whether a given assignment \(\pi \) is Pareto optimal, even in the case of increasing preferences.

Proof

Membership in \(\mathsf{coNP}\) follows from the fact that, for given \(\pi \), a respective assignment \(\pi '\) such that there is no \(i\in N\) with \((\pi '(i),|\pi '_{i}|)\prec _{i}(\pi (i),|\pi _{i}|)\) while for at least one \(j\in N\) we have \((\pi '(j),|\pi '_{j}|)\succ _{j}(\pi (j),|\pi _{j}|)\) serves as certificate.

We derive \(\mathsf{coNP}\)-hardness by a reduction from Perfect Assignment which is the following decision problem: Given an instance \({\mathcal {I}}\) of \(\mathsf{o\text {-}GASP}\), is there an individually rational assignment such that all agents are assigned to a non-void activity? From Darmann et al. (2017) it follows that Perfect Assignment is \(\mathsf{NP}\)-complete even in the case of increasing preferences. Given such an instance \({\mathcal {I}}=(N,A,P)\) of \(\mathsf{o\text {-}GASP}\) with \(|N|=n\), construct instance \({\mathcal {I}}'\) of \(\mathsf{o\text {-}GASP}\) with increasing preferences by introducing a dummy activity d and adding (dn) to the ranking of each agent \(i\in N\) such that (dn) is the worst-ranked among all alternatives i approves of. Note that there is no agent who approves of (dk) for any \(k<n\). Hence, it immediately follows that \(\pi \) with \(\pi (i)=d\) for all \(i\in N\) is Pareto optimal in \({\mathcal {I}}'\) if and only if there is no perfect assignment in \({\mathcal {I}}\). \(\square \)

Observe that from the above proof an analogous \(\mathsf{coNP}\)-completeness result for weak Pareto optimality follows in the case of increasing preferences, since, in the constructed instance \({\mathcal {I}}'\), the assignment \(\pi \) with \(\pi (i)=d\) for all \(i\in N\) is Pareto optimal if and only if it is weakly Pareto optimal. However, \(\mathsf{coNP}\)-completeness of deciding whether an assignment is weakly Pareto optimal also holds in the special case of decreasing preferences, as the following theorem shows.

Theorem 7

In \(\mathsf{o\text {-}GASP}\) it is \(\mathsf{coNP}\)-complete to decide whether a given assignment \(\pi \) is weakly Pareto optimal, even in each of the special cases of increasing and decreasing preferences.

Proof

Membership in \(\mathsf{coNP}\) follows because for a given assignment \(\pi \), an assignment \(\pi '\) such that for all \(j\in N\) we have \((\pi '(j),|\pi '_{j}|)\succ _{j}(\pi (j),|\pi _{j}|)\) serves as certificate. Again we derive \(\mathsf{coNP}\)-hardness by reducing from Perfect Assignment. Given an instance \({\mathcal {I}}=(N,A,P)\) of \(\mathsf{o\text {-}GASP}\), observe that \(\pi \) with \(\pi (i)=a_{\emptyset }\) for all \(i\in N\) is weakly Pareto optimal if and only if there is no perfect assignment. Since the latter problem is known to be \(\mathsf{NP}\)-complete even in both special cases of increasing and decreasing preferences [as a consequence of Darmann et al. (2017)], the theorem follows. \(\square \)

5 Conclusion

In this paper, we have analysed the computational complexity involved in finding (and verifying) reasonable assignments of agents to activities, on the basis of their preferences over pairs made up of an activity and the size of the group of agents participating in that activity. Given that the agents’ preferences are strict orders, results have been provided for the concept of (weak) Pareto optimality and for different stability notions such as Nash stability, individual stability and core stability, with focus on the two natural special cases of decreasing and increasing preferences.

In particular, while our results show that for several stability concepts we can efficiently verify whether or not an assignment is stable, checking whether or not an assignment is Pareto optimal or weakly Pareto optimal turns out to be computationally hard even in restricted instances. While a single Pareto optimal (or weakly Pareto optimal) assignment can be found efficiently, this might indicate computational hardness of finding Pareto optimal (or weakly Pareto optimal) assignments satisfying certain pre-defined criteria (e.g., criteria of fairness or equitability). However, in case each agent’s preferences are decreasing, deciding whether or not a given assignment is Pareto optimal remains an interesting open question for future research.