We will now consider the computational complexity of \({\textsf {s{-}GASP}}\) for the various solution concepts presented in the previous section. An overview of our results is given in Table 1. For each of the considered solution concepts, we first deal with the question of finding assignments with the desired properties or verifying them; then, we turn to an optimization variant.
Table 1 Overview of complexity results obtained for constraints \(|\pi ^{a}|\in \{0\}\cup [\ell (a),u(a)]\), \(a\in A^{*}\). Naturally, the first interesting question is whether “good” assignments exist and how to find them. In this section, we either provide hardness results for the first question (implying hardness of finding a respective assignment) or we provide a polynomial-time algorithm for finding a respective assignment (except for Pareto optimal assignments, which always exist but in general turn out to be computationally hard to determine). For each of the considered concepts, we then turn to an optimization problem: among all feasible assignments that feature a certain property, one is usually interested in finding one that maximizes the number of agents that are assigned to a non-void activity, thus keeping the number of agents who cannot be enrolled in any activity low. The decision version of this problem asks the question whether, for some given k, at least k agents can be assigned to non-void activities. In this section, we either provide a polynomial-time algorithm that determines a “good” assignment maximizing the number of agents assigned to non-void activities (implying that the corresponding decision problem is in P), or provide hardness results for the above stated decision problem (which in turn implies hardness of finding a corresponding assignment).
This section is structured as follows. We begin with the two most basic concepts of feasibility and individual rationality in Sect. 3.1. Section 3.2 is dedicated to Pareto optimal assignments. Then, we consider the stability notionsFootnote 4 of (virtual) individual stability, (virtual) core stability, and (virtual) strict core stability in Sect. 3.3. We conclude the section with envy-free assignments in Sect. 3.4.
Feasible and individually rational assignments
Obviously, assigning the void activity to every agent results in a feasible, individually rational and also envy-free assignment. In addition, it can be checked in polynomial time whether a given assignment is feasible or individually rational.
The task of maximizing the number of agents assigned to a non-void activity in a feasible or individually rational assignment, however, is more challenging. On the positive side, if we are only interested in a feasible assignment maximizing the number of agents assigned to a non-void activity, we can find such an assignment in polynomial time.
Proposition 2
In s-GASP, in polynomial time we can find a feasible assignment that maximizes the number of agents assigned to a non-void activity.
Proof
We need to find the maximum number \(k\le n\) such that taking, for each \(a\in A^*\), exactly one number of \(\{0\}\cup [\ell (a),u(a)]\), adds up to k. This problem corresponds to the Multiple-Choice Subset-Sum problem (Pisinger 1995); in our case, the latter allows for an overall polynomial-time algorithm since u(a) is bounded by n. \(\square \)
But already for individually rational assignments it is NP-complete to decide whether all agents can be assigned to a non-void activity (stated in Theorem 2 below). We note that Theorem 2, where we consider the decision for an assignment of all agents, is stronger than the result implied by Arulselvan et al. (2018, Theorem 1), namely that the decision problem whether it is possible to assign \(\ge k\) agents to non-void activities such that the assignment is individually rational is NP-complete.
Theorem 2
It is NP-complete to decide whether s-GASP admits an individually rational assignment that assigns each agent to some \(a\in A^{*}\), even when each agent has strict preferences and for each activity \(a\in A^{*}\) we have \(\ell (a)=3\) and \(u(a)=n\).
Proof
This is shown by a reduction from Exact Cover by 3-Sets (see Appendix). \(\square \)
However, if we have \(\ell (a)=1\) for each \(a \in A^*\), then we can find a maximum individually rational assignment—i.e., an individually rational assignment which maximizes the number of agents assigned to a non-void activity—efficiently, since it is straightforward to translate this task to a (many-to-one) simple b-matching problem, which can be solved in polynomial time (see, e.g., the textbook by Korte and Vygen 2012, Chapter 12). In a simple b-matching problem, we are given an undirected graph \(G=(V,E)\) and a mapping \(b:V\rightarrow \mathbb {N}_0\); a b-matching is a subset \(T\subseteq E\) such that for each vertex v there are at most b(v) edges in T that have v as an endpoint; the goal is to find a b-matching of maximum cardinality. In this kind of matching problems, the vertices of an undirected graph come with a bound b on the number of vertices they can be matched with (the case \(b=1\) for all vertices corresponds to the ordinary matching problem).
Proposition 3
In s-GASP, if for each activity \(a\in A^{*}\) we have \(\ell (a)=1\), then in polynomial time we can find a maximum individually rational assignment.
Pareto optimal assignments
We now turn our attention to Pareto optimal assignments. Our first result shows that finding a Pareto optimal assignment in \({\textsf {s{-}GASP}}\) is NP-hard even for the case \(u(a)=n\) for each activity a.
Theorem 3
In s-GASP, it is NP-hard to find a Pareto optimal assignment, even when for each activity \(a\in A^*\) we have \(\ell (a)=3\) and \(u(a)=n\).
Proof
This is shown by a reduction from Exact Cover by 3-Sets (see Appendix). \(\square \)
However, in the case of \(\ell (a)=1\) for each \(a\in A^{*}\), we can even find a Pareto optimal assignment that maximizes the number of agents assigned to a non-void activity in polynomial time (see Corollary 1 at the end of Sect. 3.2).
Next, we turn to the question of verification of Pareto optimality. In particular, checking whether a given assignment is Pareto optimal is coNP-complete as the following theorem shows.
Theorem 4
In s-GASP, it is coNP-complete to decide if a given assignment is Pareto optimal, even when each agent has strict preferences and for each activity \(a\in A^{*}\) we have \(u(a)=n\).
Proof
This is shown by a reduction from Exact Cover by 3-Sets (see Appendix). \(\square \)
We remark that if there are no restrictions on the minimum number of participants of each activity, the latter problem can be modeled as a minimum cost flow problem and hence becomes tractable.
Theorem 5
In s-GASP, if for each activity \(a\in A^{*}\), we have \(\ell (a)=1\), then in polynomial time we can decide if a given assignment is Pareto optimal.
Proof
Given instance \(\mathcal {I}=(N,A,P,R)\) of \({\textsf {s{-}GASP}}\) with \(\ell (a)=1\) for all \(a\in A^{*}\) and assignment \(\pi \), we construct instance \(\mathcal {C}\) of the minimum cost flow problem with lower bounds (see, e.g., Ahuja et al. 1993, Chapter 2.4). Note that \(\pi \) must be individually rational. In instance \(\mathcal {C}\), the directed graph \(G=(V,E)\) along with edge costs, lower bounds (i.e., the minimum amount that must flow on an edge) and capacities (i.e., the maximum amount that can flow on an edge) of the edges are given as follows (see also Fig. 2 for an illustration). \(G=(V,E)\) has vertex set \(V=\{s,t\}\cup N\cup A^{*}\), the edge set E consists of the following edges:
-
for \(i\in N\), edge (s, i) of zero cost, and, for \(a\in A^{*}\) with \(a\succsim _{i}\pi (i)\), edge (i, a) of cost \(-1\) if \(a\succ _{i}\pi (i)\) and of cost 0 if \(a\sim _{i}\pi (i)\)
-
for \(a\in A^{*}\) edge (a, t) of capacity u(a)
Both lower bound and capacity of edge (s, i) are equal to 1 iff \(\pi (i)\succ _ia_{\emptyset }\) holds. Unless otherwise specified above, the lower bound of edge \(e\in E\) is 0, its capacity is 1, and its cost is 0.
Assume there is an integer flow f of negative total cost. Consider the assignment \(\pi '\) defined by \(\pi '(i)=a\) iff f sends flow through edge (i, a). Then, by construction we must have \(\pi '(i)\sim _i \pi (i)\) or \(\pi '(i)\succ _{i}\pi (i)\) for each \(i\in N\), where the latter holds for at least one agent \(i\in N\) by the negative total cost of f. Thus, \(\pi \) is not Pareto optimal.
If, on the other hand, \(\pi \) is not Pareto optimal, then there is an assignment \(\pi '\) with \(\pi '(i)\sim _i \pi (i)\) or \(\pi '(i)\succ _{i}\pi (i)\) for each \(i\in N\), where the latter holds for at least one \(i\in N\). The integer flow \(f'\) that, for each \(i \in N\) and \(a \in A\) with \(\pi '(i)=a\), sends one unit along the edges (s, i), (i, a), (a, t) has negative total cost.
Therewith, for verifying if \(\pi \) is Pareto optimal it is sufficient to find an integer minimum cost flow in instance \(\mathcal {C}\). Under the use of a standard transformation to remove non-zero lower bounds (see Ahuja et al. 1993, Chapter 2.4), such an integer minimum cost flow can be determined in polynomial time by applying, e.g., a network simplex algorithm (see Ahuja et al. 1993, Chapter 11); for instance, with \(|V|\in \mathcal {O}(n+m)\), \(|E|\in \mathcal {O}(m+n+mn)\) and maximum cardinality edge cost of 1, the algorithm of Tarjan (1997) runs in \(\mathcal {O}((n+m)(m+n+mn)(\log (n+m))^2)\) and hence in \(\mathcal {O}((m^2n+mn^2)(\log (n+m))^2)\) time. \(\square \)
In the remainder of Sect. 3.2, we consider the computational complexity involved in maximizing the number of agents assigned to non-void activities in Pareto optimal assignments. In the framework of course allocation, if all agents have strict preferences, it is known that a Pareto optimal matching—that assigns an agent to an activity (course) only if the activity is acceptable for the agent—can be found in polynomial time (Cechlárová and Fleiner (2017); Kamiyama (2013)). Since in our setting (1) the agents’ preferences are represented by weak orders and (2) Pareto optimality does not require individual rationality, these results do not immediately translate. For the latter reason, the computational intractability result by Cechlárová and Fleiner (2017) (for finding a Pareto optimal matching maximizing the number of agents assigned to a non-void activity if each agent can be assigned to at most one activity) does not immediately translate to our setting either.
By Theorem 3 we know that finding a Pareto optimal assignment that maximizes the number of agents assigned to non-void activities is NP-hard even for the case \(u(a)=n\) for each activity a.
The general problem of deciding if there exists a Pareto optimal assignment that assigns each agent to a non-void activity turns out to be computationally hard.
Theorem 6
It is NP-hard to decide whether s-GASP admits a Pareto optimal assignment that assigns each agent to a non-void activity.
Proof
This is shown by a reduction from Exact Cover by 3-Sets (see Appendix). \(\square \)
However, as the following theorem shows, if we relax the constraints on the lower bound of the group sizes, the problem becomes computationally tractable.
Theorem 7
In s-GASP, if for each activity \(a\in A^{*}\) we have \(\ell (a)=1\) then in polynomial time we can find a Pareto optimal assignment that maximizes the number of agents assigned to a non-void activity.
Proof
Recall that in the case \(\ell (a)=1\) for all \(a\in A^{*}\) a Pareto optimal assignment is also individually rational (see Proposition 1 and Fig. 1). Let k be the maximum number of agents assigned to non-void activities by an individually rational assignment (recall that, due to Proposition 3, such an assignment can be found in polynomial time). Hence, it is sufficient to find a Pareto optimal assignment \(\pi \) with \(\#(\pi )=k\).
Given an instance \(\mathcal {I}=(N,A,P,R)\) of \({\textsf {s{-}GASP}}\) with \(\ell (a)=1\) for all \(a\in A^{*}\), we construct an instance \(\mathcal {F}\) of the min cost flow problem with directed graph \(G=(V,E)\). Set \({V=\{s,t\}\cup N\cup A^{*}}\), and let the edges and their capacities be given as follows: for each \(i\in N\), introduce edge (s, i) with capacity 1; for each \(a\in A^{*}\) and \(i\in N\) introduce an edge (i, a) of capacity 1 if \(a\succsim _{i}a_{\emptyset }\) holds; for each \(a\in A^{*}\), introduce edge (a, t) of capacity u(a).
We introduce non-zero costs on some edges of the graph: for each \(a\in A^{*}\) and \(i\in N\), edge (i, a) has cost \(-(1+|\{b\in A^{*}\mid a\succ _{i}b,\,b\succ _{i}a_{\emptyset }\}|)\) if \(a\succ _i a_{\emptyset }\) and cost 0 if \(a\sim _i a_{\emptyset }\); all remaining edges have zero cost.
Observe that there is a one-to-one correspondence between a feasible assignment \(\pi \) with \(\#(\pi )=k\) and a (feasible) flow of size k. First, given \(\pi \), sending a unit of flow along the sequence of edges (path) (s, i), (i, a), (a, t) iff i is assigned to activity a yields a flow of size k from s to t meeting all the edge capacity constraints. Second, a flow of size k from s to t must send a total of k units through edges (i, a) with \(i \in N\) and \(a \in A^{*}\) such that at most one unit is sent through (s, i) for any \(i \in N\); since the capacity constraints of the edges (a, t) correspond to u(a) for \(a \in A^{*}\), the assignment \(\pi \) defined by setting \(\pi (i)=a\) iff f sends a unit of flow through edge (i, a) is feasible.
Now, let f be a minimum integer cost flow of size k in instance \(\mathcal {F}\). Then f induces the assignment \(\pi \) by setting \(\pi (i)=a\) iff f sends a unit of flow through edge (i, a). Assignment \(\pi \) is Pareto optimal since otherwise a flow \(f'\) of lower total cost than the total cost of f could be induced. \(\square \)
Recall that due to Proposition 1 in the case \(\ell (a)=1\) for each \(a\in A^{*}\), also any strictly core stable, core stable, or individually stable assignment is individually rational. In addition, in this case virtual (strict) core stability coincides with (strict) core stability, and virtual individual stability coincides with individual stability. Hence we can state the following corollary.
Corollary 1
In s-GASP, if for each activity \(a\in A^{*}\) we have \(\ell (a)=1\), then in polynomial time we can find a maximum individually rational assignment that is Pareto optimal, (virtually) individually stable, (virtually) core stable and (virtually) strictly core stable.
Stable assignments
The good news is that for several stability concepts, a corresponding assignment always exists and can efficiently be found, as, for instance, the following theorem shows.
Theorem 8
In s-GASP, a strictly core stable assignment always exists and can be found in polynomial time.
Proof
We present in Algorithm 1 a polynomial-time algorithm for finding a strictly core stable assignment.
Outline The basic idea behind Algorithm 1 is as follows. Starting with a feasible assignment \(\pi \), for each agent i and each activity b which i prefers to \(a=\pi (i)\), we check whether there is a subset of agents including agent i that want to deviate to b such that the resulting assignment is feasible. That is, we check whether there is a set of agents \(E\supset \pi ^{b}\) such that (1) for all \(j\in E\) we have that \(b\succsim _{j}\pi (j)\) holds (recall that for agent i it holds that \(b\succ _{i}\pi (i)\)) and (2) \(\pi '\) with \(\pi '(i)=b\) for \(i\in E\) and \(\pi '(j)=\pi (j)\) for \(j\in N\setminus E\) is a feasible assignment. In order to do so, we store all activities agent i prefers over \(a=\pi (i)\) into set D (lines 5-6). While D is non-empty (line 7), we take an activity \(b \in D\) and compute the set of agents B which are not worse off by deviating to b (lines 8-9). Then, for each activity \(c\in A\setminus \{b\}\), we compute the possible numbers of agents in the set \(\pi ^{c}\) that agree with joining b and can be removed from \(\pi ^{c}\) while still enabling a feasible assignment—these numbers are stored in the set \(R^{c}\) (lines \(10-17\)). Note that 0 must be removed from \(R^{a}\) since we need to include agent i (line 18). Given these numbers, we then verify if—including i and the agents in \(\pi ^{b}\)—these add up to an integer contained in \([\ell (b),u(b)]\) by taking exactly one number from each activity (note that for activity b we need to include the whole amount \(|\pi ^b|\) of agents assigned to b under \(\pi \); line 20). If this is the case we can assign a subset of agents including \(\{i\}\cup \pi ^b\) to B, and we update our assignment accordingly (lines \(21-29\)). Finally, we update D to the set of activities different from b that agent i prefers over the activity she is currently assigned to (line 30).
Termination and correctness Each for-loop in the algorithm iterates over at most \(\max \{m,n\}\) elements. For the inner while-loop starting in line 7 (“while \(D\not =\emptyset \)”), note that the last line of the loop (line 30) implies that the set D in the statement of the loop is updated to a proper subset of itself. Next, observe that during execution of the algorithm, an agent either remains assigned to the originally assigned activity, say a, or is assigned to some activity that does not make her worse off than a (in lines 21, 22, 24 or 26); in addition, whenever some agent is assigned to a new activity, at least one agent is better off than before. Hence, at most mn times some agents can be assigned to a new activity. Now, for the outer while-loop starting in line 3 (“while \(N\setminus N'\not =\emptyset \)”), consider lines 32–35. If agent i is not assigned to a new activity, the set \(N'\) is augmented by the singleton set \(\{i\}\) in line 33. If she is assigned to a new activity, \(N'\) is set to the empty set in line 35, and the loop in line 3 (“while \(N\setminus N'\not =\emptyset \)”) re-starts with the whole set \(N\setminus N'=N\). However, at the end of the loop, we either augment the set \(N'\) or set \(N'=\emptyset \), and the latter can happen at most mn times. Thus, the algorithm terminates. For correctness, observe that the algorithm terminates when each agent i is contained in \(N'\). By construction, the algorithm sets \(N'=\emptyset \) whenever it is possible to assign some agent i to an activity b with \(b\succ _i \pi (i)\), such that for some set \(E\supset \pi ^b\) it holds that (1) each agent \(j \in E\setminus \{i\}\) is not worse off with a deviation towards b, and (2) the resulting assignment is feasible. Therefore, the assignment \(\pi \) which is finally determined by the algorithm is strictly core stable.
Running time As far as the running time of Algorithm 1 is concerned, its bottleneck is to decide whether we can add up the above-mentioned numbers to be in the interval \([\ell (b),u(b)]\). That problem reduces to the Multiple-Choice Subset-Sum problem (Pisinger 1995), which can be stated as follows: Given k classes \(N_1, \ldots , N_k\), each class \(N_i\) containing non-negative integer weights \(w_{1i}, \ldots , w_{n_i i}\), and a capacity bound c, we ask whether we can select exactly one element from each class such that the total weight sum adds up to c. For our problem, the weights in class \(N_i\) correspond to the possible numbers of agents in the set \(R^{a_i}\) for activity \(a_i\). We can now apply Pisinger’s algorithm (Pisinger 1995)Footnote 5, which has a complexity in \(\mathcal {O}(ab)\), where a is the largest weight—hence bounded by the number n of agents in our case—and b is the number of all weights, which is bounded by \(m(n+1)\) in our case since there are at most as many weights per activity as the number of agents plus 1 (for weight 0). We hence have a running time of \(\mathcal {O}(mn^{2})\) per execution of line 20. For each agent, we need to execute line 20 of our algorithm at most \(m\cdot mn\) times. Thus, the overall running time of Algorithm 1 can roughly be bounded by \(\mathcal {O}(m^{3}n^4)\). \(\square \)
Recall that a strictly core stable assignment is also core stable and individually stable. Hence, as a consequence of the above theorem, also a core stable and individually stable assignment always exists and can efficiently be found. As it turns out, an analogous result holds for virtually individually stable assignments.
Theorem 9
In s-GASP, a virtually individually stable assignment always exists and can be found in polynomial time.
Proof
In an instance (N, A, P, R) of \({\textsf {s{-}GASP}}\), we initially assign each agent to \(a_{\emptyset }\), i.e., set \(\pi (i)=a_{\emptyset }\) for \(i\in N\). For \(a\in A^{*}\) with \(\ell (a)\ge 2\), if no agent is assigned to such a, then \(\ell (a)\le |\pi ^{a}|+1\) cannot hold. Hence, in what follows, we only consider activities \(a\in A^{*}\) with \(\ell (a)=1\). For \(1\le i\le n\), assign agent i to the best ranked such activity \(a\succ _{i}a_{\emptyset }\) with \(|\pi ^{a}|<u(a)\) and update \(\pi \) (i.e., set \(\pi (i)=a\) while \(\pi (j)\) remains unchanged for \(j\in N\setminus \{i\}\)). The resulting assignment \(\pi \) is virtually individually stable: for each agent i, by construction, each activity a with \(a\succ _{i} \pi (i)\) has (1) no agent assigned to and \(\ell (a)\ge 2\)—which implies that the agent alone cannot deviate to a without violating the lower bound on a—or (2) already u(a) agents assigned to, and thus the agent cannot join a without violating the upper bound on a.\(\square \)
In contrast, a virtually core stable (and thus a virtually strictly core stable) assignment does not always exist, as the following example shows. It corresponds to the phenomenon referred to as Condorcet’s voting paradox (Marquis de Condorcet 1785) which reappears in many settings dealing with preferences.
Example 5
Let \(N=\{1,2,3\}\) and \(A^{*}=\{a,b,c\}\), with \(a\succ _{1}b\succ _{1}c\succ _{1}a_{\emptyset }\), \(b\succ _{2}c\succ _{2}a\succ _{2}a_{\emptyset }\), and \(c\succ _{3}a\succ _{3}b\succ _{3}a_{\emptyset }\). The restrictions on the activities are given by \(\ell (x)=2\) and \(u(x)=3\) for each \(x\in A^{*}\). By the restrictions given, there is at most one non-void activity to which agents can be assigned. Clearly, for any activity \(z\in A\), there is an activity \(y\in A^{*}\) such that two agents prefer y to z. As a consequence, there can be no virtually core stable assignment.
In addition, the problem to decide whether or not a virtually strictly core stable assignment exists turns out to be computationally hard.
Theorem 10
It is NP-complete to decide whether s-GASP admits a virtually strictly core stable assignment, even when each agent has strict preferences and for each activity \(a\in A^{*}\) we have \(u(a)=n\).
Proof
For membership in NP, we check if assignment \(\pi \) is virtually strictly core stable as follows. For each agent i and each activity \(a\succ _{i}\pi (i)\) such that \(|\pi ^{a}|<u(a)\) (otherwise, a deviation towards a would violate its capacity constraint), determine the set \(E(i,a)=\{j\in N\setminus \{i\}\mid a\succsim _{j}\pi (j)\}\). Observe that \(E(i,a)\supset \pi ^{a}\) holds. Now, it remains to check if \(|E(i,a)\cup \{i\}|\ge \ell (a)\) holds, because then—with \(\pi ^{a}<u(a)\)—it follows that there is a set E with \(i\in E\), \(E\supset \pi ^{a}\) such that \(a\succ _{i}\pi (i)\) and \(a\succsim _{j}\pi (j)\) for each \(j\in E\) (e.g., take set E made up of \(\pi ^{a}\cup \{i\}\) together with \(\max \{0,\ell (a)-|\pi ^{a}|-1\}\) agents of \(E(i,a)\setminus \pi ^{a}\)). Determining the set E(i, a) and checking whether \(|E(i,a)\cup \{i\}|\ge \ell (a)\) holds can be done in polynomial time for each agent i and activity a, and hence we can check whether \(\pi \) is virtually strictly core stable in polynomial time.
For NP-hardness we provide a reduction from Exact Cover by 3-Sets , making use of Example 5 as a gadget. Given an instance \(\langle X,\mathcal{Z}\rangle \) of X3C, we define the instance \(\mathcal {I}=(N,A,P,R)\) of \({\textsf {s{-}GASP}}\) as follows. Let \(N=\{v_{i,1}, v_{i,2}, v_{i,3} \mid 1\le i\le p\}\) and \(A^{*}=\{y_{i},a_{i},b_{i},c_{i}\mid 1\le i\le p\}\). For \(1\le i\le p\), let \(\ell (a_{i})=\ell (b_{i})=\ell (c_{i})=2\), and \(\ell (y_{i})=9\). For each \(a\in A^{*}\), let \(u(a)=|N|\). For each \(i\in \{1,\ldots ,p\}\), the agents \(v_{i,1},v_{i,2},v_{i,3}\) represent element \(i\in X\); the set \(Y=\{y_1,\ldots , y_p\}\) represents the set \(\mathcal {Z}\), where, for \(i \in X\) and \(j\in \{1,2,3\}\), we denote by \(y_{i_j}\) the activity in Y that refers to the set \(Z_{i_j}\). Since any virtually strictly core stable assignment is individually rational, in the profile P we omit the activities ranked below \(a_{\emptyset }\); the rankings of the agents \(v_{i,1},v_{i,2},v_{i,3}\) are given as follows (for the sake of readability, we omit subscripts in the rankings):
$$\begin{aligned} \begin{array}{c} v_{i,1}:\,\,y_{i_{1}}\succ y_{i_{2}}\succ y_{i_{3}}\succ a_{i}\succ b_{i}\succ c_{i}\succ a_{\emptyset }\\ v_{i,2}:\,\,y_{i_{2}}\succ y_{i_{3}}\succ y_{i_{1}}\succ b_{i}\succ c_{i}\succ a_{i}\succ a_{\emptyset }\\ v_{i,3}:\,\,y_{i_{3}}\succ y_{i_{1}}\succ y_{i_{2}}\succ c_{i}\succ a_{i}\succ b_{i}\succ a_{\emptyset }\end{array} \end{aligned}$$
Note that each set Z contains three elements, and hence each \(y_{i}\), \(1\le i \le p\), is preferred to \(a_{\emptyset }\) by exactly 9 agents. We show that there is an exact cover in instance \(\langle X,\mathcal{Z}\rangle \) if and only if there is a virtually strictly core stable assignment in instance \(\mathcal {I}\).
Assume there is an exact cover C. Consider the assignment \(\pi \) defined by \(\pi (v_{i,h})=y_{j}\) if \(i\in Z_{j}\) and \(Z_{j}\in C\), for \(i\in \{1, \dots , p\}\) and \(h\in \{1,2,3\}\). Since C is an exact cover, assignment \(\pi \) is well-defined and feasible; note that each agent is assigned to an activity she ranks first, second or third. In addition, note that for \(Z_{j}\in C\), each agent that prefers \(y_{j}\) to \(a_{\emptyset }\) is assigned to \(y_{j}\). Assume a set of agents E wishes to deviate to another activity d, such that at least one member \(i\in E\) prefers d over \(\pi (i)\) while there is no \(j\in E\) with \(\pi (j)\succ _{j}d\). By the definition of \(\pi \), \(d\in \{y_{i}\mid 1\le i\le p\}\) holds. Observe that \(\pi ^{d}=\emptyset \) holds because C is an exact cover: for each i, exactly one of \(Z_{i,1},Z_{i,2},Z_{i,3}\) is in C, and therefore to exactly one of \(y_{i,1},y_{i,2},y_{i,3}\) some agents are assigned. Due to \(\ell (d)=9\), it hence follows that each agent of those who prefer d to \(a_{\emptyset }\) must prefer d to the assigned activity, which is impossible since, by construction of the instance, for at least one of these agents j the assigned activity is top-ranked, i.e., \(\pi (j)\succ _{j}d\) holds. Therewith, \(\pi \) is virtually strictly core stable.
Conversely, assume there is a virtually strictly core stable assignment \(\pi \). Assume that there is an agent \(v_{i,h}\) who is not assigned to one of the activities \(y_{i_{1}},y_{i_{2}},y_{i_{3}}\). Then, by \(\ell (y_{i})=9\) and the fact that exactly 9 agents prefer \(y_{i}\) to \(a_{\emptyset }\) for each \(i\in \{1,\ldots ,p\}\), it follows that no agent is assigned to one of \(y_{i_{1}},y_{i_{2}},y_{i_{3}}\); in particular none of \(v_{i,1},v_{i,2},v_{i,3}\) is assigned to one of these activities. Analogously to Example 5 it then follows that there is no virtually strictly core stable assignment, in contradiction with our assumption.
Thus, \(\pi \) assigns each agent \(v_{i,h}\) to one of the activities \(y_{i_{1}},y_{i_{2}},y_{i_{3}}\). For each \(i\in \{1,\ldots ,p\}\), by \(\ell (y_{i})=9\) and the fact that exactly 9 agents prefer \(y_{i}\) to \(a_{\emptyset }\) it follows that to exactly one of \(y_{i_{1}},y_{i_{2}},y_{i_{3}}\) exactly 9 agents are assigned, while no agent is assigned to the remaining two activities. As a consequence, the set \(C=\{Z_{i}\mid |\pi ^{y_{i}}|=9,1\le i\le p\}\) is an exact cover in instance \(\langle X,\mathcal{Z}\rangle \). \(\square \)
As a consequence of the above theorem, we obtain the following corollary.
Corollary 2
It is NP-complete to decide whether s-GASP admits a virtually core stable assignment, even when each agent has strict preferences and for each activity \(a\in A^{*}\) we have \(u(a)=n\).
Proof
In the instance considered in the proof of Theorem 10, an assignment is virtually strictly core stable if and only if it is virtually core stable. More precisely, analogously to the second part of that proof, it follows that in a virtually core stable assignment for each i the following holds: to exactly one of \(y_{i_{1}},y_{i_{2}},y_{i_{3}}\), exactly 9 agents are assigned, while no agent is assigned to the remaining two activities. Therewith, any group deviation would require an unused activity, and by the agents’ strict orders over their three top choices, the two solution concepts coincide. \(\square \)
However, recall that for the case of \(\ell (a)=1\) for each \(a\in A^{*}\), we get a positive complexity result (see Corollary 1 in Sect. 3.2). In particular, in this case a virtually strictly core stable assignment that maximizes the number of agents assigned to a non-void activity can be found in polynomial time.
Finally, we point out that in polynomial time we can verify whether a given assignment is stable, for each of the stability concepts considered in this section. While for (virtual) individual stability this is rather straightforward, checking for strict core stability and virtual strict core stability is less obvious: Algorithm 1 checks for the former (as a part of the algorithm) as described in the proof of Theorem 8; for the latter, we refer to the first lines of the proof of Theorem 10. Note that the respective notions of (virtual) core stability can be verified in a similar manner, with the difference that each member of the deviating group must prefer the new activity to the assigned one (and hence that activity is either \(a_{\emptyset }\) or currently unused).
Let us now turn to stable assignments that maximize the number of agents assigned to non-void activities. Concerning stable assignments, we have already seen (stated in Theorem 10, Corollary 2) that it is NP-complete to decide whether a virtually (strictly, respectively) core stable assignment exists, even if the upper bound of each activity equals n. This implies hardness for the corresponding optimization problems. In contrast, recall that a strictly core stable assignment and a virtually individually stable assignment always exist (stated in Theorems 8 and 9). However, deciding whether or not there is a strictly core stable or a virtually individually stable assignment that assigns each agent to a non-void activity—and thus the corresponding optimization problem of maximizing the number of agents assigned to a non-void activity—turns out to be computationally hard even if the upper bound of each activity equals n, as we will show in the following theorems. The complexity of the optimization problem remains open for individual stability and for core stability (unless \(\ell (a)=1\), for which it is solvable in polynomial time as shown by Corollary 1 in Sect. 3.2).
Theorem 11
It is NP-complete to decide whether s-GASP admits a virtually individually stable assignment that assigns each agent to some \(a\in A^{*}\), even when each agent has strict preferences and for each activity \(a\in A^{*}\) we have \(\ell (a)=3\) and \(u(a)=n\).
Proof
The proof follows analogously to the proof of Theorem 2. \(\square \)
In a similar manner as Theorem 2, we can prove the following theorem.
Theorem 12
It is NP-complete to decide whether s-GASP admits a strictly core stable assignment that assigns each agent to some \(a\in A^{*}\), even when for each activity \(a\in A^{*}\) we have \(\ell (a)=3\) and \(u(a)=n\).
Proof
This is shown by a reduction from Exact Cover by 3-\(\textsc {Sets}\) (see Appendix). \(\square \)
Envy-free assignments
As already mentioned, assigning each agent to the void activity \(a_{\emptyset }\) results in an envy-free assignment. In addition, in polynomial time it can be verified whether a given assignment is envy-free by simply checking, for each agent, if she prefers to the activity she is assigned to one of the activities to which some other agent is assigned. On the other hand, for envy-freeness maximizing the number of “active” agents turns again out to be hard, even in a restricted setting.
Theorem 13
It is NP-complete to decide whether s-GASP admits an envy-free assignment that assigns each agent to some \(a\in A^{*}\), even when each agent has strict preferences and for each activity \(a\in A^*\) we have \(\ell (a)=u(a)=3\).
Proof
This is shown by a reduction from Exact Cover by 3-\(\textsc {Sets}\) (see Appendix). \(\square \)
However, we obtain tractability for envy-freeness if we loosen the constraints on the upper bounds of the group sizes: Clearly, if there is an activity with “unlimited” capacity (i.e., its upper bound equals n), we can assign all agents to it and obtain envy-freeness. It is not clear yet whether the problem becomes tractable if \(\ell (a)=1\) holds for all \(a\in A^*\). This is the case though if all preference orders are strict, as the following proposition shows.
Proposition 4
In s-GASP, if all agents have strict preferences and we have \(\ell (a) =1\) for all \(a\in A^*\), then it can be decided in polynomial time if there exists an envy-free assignment which assigns all agents to a non-void activity.
Proof
A simple greedy algorithm can determine if there exists such an envy-free assignment. The first step is to assign each agent to her most preferred non-void activity; this meets the lower bound of each activity because of \(\ell (a)=1\) for all \(a\in A^*\). If the resulting (provisional) assignment \(\pi \) is feasible, i.e., for all activities \(a\in A^*\) the statement \(u(a)\ge |\pi ^{a}|\) holds true, we are done. If this is not the case, we remove all activities a with \(u(a) < |\pi ^{a}|\) from the set of activities (envy-freeness will only be accomplished if no agent is assigned to any of these activities) and start over with the first step. This algorithm either stops because all activities have been removed, or it produces an envy-free assignment which assigns all agents to a non-void activity. \(\square \)