Matchings with Lower Quotas: Algorithms and Complexity

We study a natural generalization of the maximum weight many-to-one matching problem. We are given an undirected bipartite graph G=(A∪˙P,E)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$G= (A\, \dot{\cup }\, P, E)$$\end{document} with weights on the edges in E, and with lower and upper quotas on the vertices in P. We seek a maximum weight many-to-one matching satisfying two sets of constraints: vertices in A are incident to at most one matching edge, while vertices in P are either unmatched or they are incident to a number of matching edges between their lower and upper quota. This problem, which we call maximum weight many-to-one matching with lower and upper quotas (WMLQ), has applications to the assignment of students to projects within university courses, where there are constraints on the minimum and maximum numbers of students that must be assigned to each project. In this paper, we provide a comprehensive analysis of the complexity of WMLQ from the viewpoints of classical polynomial time algorithms, fixed-parameter tractability, as well as approximability. We draw the line between NP\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textsf {NP}$$\end{document}-hard and polynomially tractable instances in terms of degree and quota constraints and provide efficient algorithms to solve the tractable ones. We further show that the problem can be solved in polynomial time for instances with bounded treewidth; however, the corresponding runtime is exponential in the treewidth with the maximum upper quota umax\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$u_{\max }$$\end{document} as basis, and we prove that this dependence is necessary unless FPT=W[1]\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textsf {FPT}= \textsf {W}[1]$$\end{document}. The approximability of WMLQ is also discussed: we present an approximation algorithm for the general case with performance guarantee umax+1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$u_{\max }+1$$\end{document}, which is asymptotically best possible unless P=NP\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textsf {P}= \textsf {NP}$$\end{document}. Finally, we elaborate on how most of our positive results carry over to matchings in arbitrary graphs with lower quotas.


Introduction
Many university courses involve some element of team-based project work.A set of projects is available for a course and each student submits a subset of projects as acceptable.For each acceptable student-project pair (s, p), there is a weight w(s, p) denoting the utility of assigning s to p.The question of whether a given project can run is often contingent on the number of students assigned to it.Such quota constraints also arise in various other contexts involving the centralized formation of groups, including organizing team-based activities at a leisure center, opening facilities to serve a community and coordinating rides within car-sharing systems.In these and similar applications, the goal is to maximize the utility of the assigned agents under the assumption that the number of participants for each open activity is within the activity's prescribed limits.
We model this problem using a weighted bipartite graph G = (A ∪ P, E), where the vertices in A represent applicants, while the vertices in P are posts they are applying to.So in the above student-project allocation example, A and P represent the students and projects respectively, and E represents the set of acceptable student-project pairs.The edge weights capture the cardinal utilities of an assigned applicant-post pair.Each post has a lower and an upper quota on the number of applicants to be assigned to it, while each applicant can be assigned to at most one post.In a feasible assignment, a post is either open or closed: the number of applicants assigned to an open post must lie between its lower and upper quota, whilst a closed post has no assigned applicant.
The objective is to find a maximum weight many-to-one matching satisfying all lower and upper quotas.We denote this problem by WMLQ.
In this paper, we study the computational complexity of WMLQ from various perspectives.We begin by defining the problem formally in Sect. 2. Then in Sect.3, we show that WMLQ can be solved efficiently if the degree of every post is at most 2, whereas the problem becomes hard as soon as posts with degree 3 are permitted, even when lower and upper quotas are all equal to the degree, and every applicant has a degree of 2. Furthermore, we show the tractability of the case of pair projects, i.e., when all upper quotas are at most 2. In Sect.4, we study the fixed parameter tractability of WMLQ.To this end, we generalize the known dynamic program for maximum independent set with bounded treewidth to WMLQ.The running time of our algorithm is exponential in the treewidth of the graph, with u max , the maximum upper quota of any vertex, as the basis.This yields a fixed-parameter algorithm when parameterized by both the treewidth and u max .We show that this exponential dependence on the treewidth cannot be completely separated from the remaining input by establishing a W [1]-hardness result for WMLQ parameterized by treewidth.Finally, in Sect.5, we discuss the approximability of the problem.We show that a simple greedy algorithm yields an approximation guarantee of u max + 1 for WMLQ and √ |A| + 1 in the case of unit edge weights.We complement these results by showing that these approximation factors are asymptotically best possible, unless P = NP.We briefly comment on the generalizability our aforementioned results in Sect.6 for matchings in arbitrary graphs with lower quotas.

Related Work
Among various applications of centralized group formation, perhaps the assignment of medical students to hospitals has received the most attention.In this context, as well as others, the underlying model is a bipartite matching problem involving lower and upper quotas.The Hospitals/Residents problem with Lower Quotas (HRLQ) [4,14] is a variant of WMLQ where applicants and posts have ordinal preferences over one another, and we seek a stable matching of residents to hospitals.Hamada et al. [14] considered a version of HRLQ where hospitals cannot be closed, whereas the model of Biró et al. [4] permitted hospital closures.Strategyproof mechanisms have also been studied in instances with ordinal preferences and no hospital closures [9,12,13].
The Student/Project Allocation problem [24,Section 5.6] models the assignment of students to projects offered by lecturers subject to upper and lower quota restrictions on projects and lecturers.Several previous papers have considered the case of ordinal preferences involving students and lecturers [1,16,25] but without allowing lower quotas.However two recent papers [18,26] do permit lower quotas together with project closures, both in the absence of lecturer preferences.Monte and Tumennasan [26] considered the case where each student finds every project acceptable, and showed how to modify the classical "serial dictatorship" mechanism to find a Pareto optimal matching.Kamiyama [18] generalized this mechanism to the case where students need not find all projects acceptable, and where there may be additional restrictions on the sets of students that can be matched to certain projects.This paper also permits lower quotas and project closures, but our focus is on cardinal utilities rather than ordinal preferences.Cardinal utilities can facilitate a more flexible representation of preferences and they occur naturally in various matching problems, such as the solution of symmetric indefinite systems [31], the organization of Chess tournaments [28] or car sharing [15].Moreover, various methods for converting ordinal preferences into cardinal utilities are known, such as the normalized Borda score [30].
The unit-weight version of WMLQ is also closely related to the D-matching problem [8,23,33], a variant of graph factor problems [29].In an instance of the D-matching problem, we are given a graph G, and a domain of integers is assigned to each vertex.The goal is to find a subgraph G of G such that every vertex has a degree in G that is contained in its domain.Lovász [22] showed that the problem of deciding whether such a subgraph exists is NP-complete, even if each domain is either {1} or {0, 3}.On the other hand, some cases are tractable.For example, if for each domain D, the complement of D contains no consecutive integers, the problem is polynomially solvable [33].As observed in [32], D-matchings are closely related to extended global cardinality constraints and the authors provided an analysis of the fixed-parameter tractability of a special case of the D-matching problem; see Sect. 4 for details.
The problem that we study in this paper corresponds to an optimization version of the D-matching problem.We consider the special case where G is bipartite and the domain of each applicant vertex is {0, 1}, whilst the domain of each post vertex p is {0} ∪ { ( p), . . ., u( p)}, where ( p) and u( p) denote the lower and upper quotas of p respectively.Since the empty matching is always feasible in our case, our aim is to find a domain-compatible subgraph G such that the total weight of the edges in G is maximum.

Problem Definition
In this section we provide a formal definition of the maximum weight many-to-one matching problem with lower quotas (WMLQ).
Basic Notation Let G = (V, E) be a graph.For a subset of vertices U ⊆ V we denote by δ(U ) = {{v, w} ∈ E : v ∈ U, w ∈ V \ U } the set of edges incident to exactly one vertex in U .For a vertex v ∈ V , we write δ(v) = δ({v}), and for a subset of edges , the set of vertices that are adjacent to v.
In our problem, a set of applicants A and a set of posts P are given.A and P constitute the two vertex sets of an undirected bipartite graph G = (V, E) with V = A ∪ P and E represents the set of acceptable applicant-post pairs.Each edge carries a weight w : E → R ≥0 , representing the utility of the corresponding assignment.The set of posts is equipped with functions : P → Z ≥0 and u : P → Z ≥0 such that ( p) ≤ u( p) for every p ∈ P.Here ( p) is called the lower quota of p and u( p) is called the upper quota of p.These functions bound the number of admissible applicants for the post (independent of the weight of the corresponding edges).Furthermore, every applicant can be assigned to at most one post.Thus, an assignment is a subset M ⊆ E of the edges such that |δ(a) ∩ M| ≤ 1 for every applicant a ∈ A and |δ( p) ∩ M| ∈ {0, (p), ( p) + 1, . . ., u( p)} for every p ∈ P. With respect to an assignment M, a post is said to be open if the number of applicants assigned to it is greater than 0, and closed otherwise.The size of an assignment M, denoted |M|, is the number of assigned applicants, while the weight of M, denoted w(M), is the total weight of the edges in M, i.e., w(M) = e∈M w(e).The goal is to find an assignment of maximum weight.Formally, we define the WMLQ problem as follows.
Problem 1 WMLQ Input: I = (G, w, , u); a bipartite graph G = (A ∪ P, E) with edge weights w, lower quotas and upper quotas u.Task: Find an assignment of maximum weight.If w(e) = 1 for all e ∈ E, we refer to the problem as mlq.
Remark 1 Note that when lower quotas are present but posts cannot be closed, we obtain the Degree Constrained Subgraph Problem (DCS); a maximum weight matching in an instance of DCS can be found in polynomial time [10].In the special case that lower quotas are absent, DCS is referred to as the Upper Degree Constrained Subgraph Problem (UDCS) [10].Some trivial simplification of the instance can be executed right at the start.If u( p) > |Γ (p)| for a post p, then u( p) can be replaced by |Γ (p)|.On the other hand, if ( p) > |Γ (p)|, then post p can immediately be deleted, since no feasible solution can satisfy the lower quota condition.Moreover, a post p with ( p) = 1 behaves identically to the case that ( p) = 0, so we assume that no post p has ( p) = 1.From now on we assume that the instances have already been simplified this way.

Degree-and Quota-Restricted Cases
In this section we characterize the complexity of WMLQ in the presence of upper bounds placed on vertex degrees or the posts' upper quotas.Section 3.1 deals with degree-restricted cases, whilst Sect.3.2 studies cases involving bounded upper quotas.

Degree-Restricted Cases
In this subsection we will consider WMLQ (i, j), the special case of WMLQ in which |Γ (a)| ≤ i for all a ∈ A, and |Γ (p)| ≤ j for all p ∈ P. That is, every applicant submits at most i applications and every post receives at most j applications.In order to establish our first result, we reduce the maximum independent set problem (mis) to mlq.In mis, a graph with n vertices and m edges is given and the task is to find an independent vertex set of maximum size.mis is not approximable within a factor of n 1−ε for any ε > 0, unless P = NP [35].The problem remains APX-complete even for cubic (3-regular) graphs [2].
Proof First of all, mlq(2,3) is in APX because the problem has a 4-approximation that can be found in polynomial time (see Theorem 7).
To each instance I of mis on cubic graphs we create an instance I of mlq such that there is an independent vertex set of size at least K in I if and only if I admits an assignment of size at least 3K , yielding an approximation-preserving reduction.The construction is as follows.To each of the n vertices of graph G in I, a post with upper and lower quota of 3 is created.The m edges of G are represented as m applicants in I .For each applicant a ∈ A, |Γ (a)| = 2 and Γ (a) comprises the two posts representing the two end vertices of the corresponding edge.Since we work on cubic graphs, |Γ (p)| = 3 for every post p ∈ P.
First we show that an independent vertex set of size K can be transformed into an assignment of at least 3K applicants.All we need to do is to open a post with its entire neighborhood assigned to it if and only if the vertex representing that post is in the independent set.Since no two posts stand for adjacent vertices in G, their neighborhoods do not intersect.Moreover, the assignment assigns exactly three applicants to each of the K open posts.
To establish the opposite direction, let us assume that an assignment of cardinality at least 3K is given.The posts' upper and lower quota are both set to 3, therefore, the assignment involves at least K open posts.No two of them can represent adjacent vertices in G, because then the applicant standing for the edge connecting them would be assigned to both posts at the same time.
Note that every solution of the constructed instance of mlq serves an integer multiple of 3 applicants.In particular, the mlq instance has a solution serving 3K applicants if and only if there is an independent set of size K in the mis instance.Hence, this reduction preserves the approximation factors.Since mlq(2,3) belongs to APX and mis is APX-complete in cubic graphs, it follows that mlq(2,3) is APX-complete.
So far we have established that if |Γ (a)| ≤ 2 for every applicant a ∈ A and |Γ (p)| ≤ 3 for every post p ∈ P, then mlq is NP-hard.In the following, we also show that these restrictions are the tightest possible.If |Γ (p)| ≤ 2 for every post p ∈ P, then a maximum weight matching can be found efficiently, regardless of |Γ (a)|.Note that the case WMLQ(1,∞) is trivially solvable.
Proof After executing the simplification steps described at the end of Sect.2, we apply two more changes to derive our helper graph H . Firstly, if ( p) = 0, u( p) = 2 and |Γ (p)| = 2, we separate p's two edges, splitting p into two posts with upper quota 1.After this step, all posts with u( p) = 2 also have ( p) = 2.All remaining vertices are of upper quota 1.Then, we substitute all edge pairs of posts with ( p) = u( p) = 2 with a single edge connecting the two applicants.This edge will carry the weight equal to the sum of the weights of the two deleted edges.
Clearly, any matching in H translates into an assignment of the same weight in G and vice versa.Finding a maximum weight matching in a general graph [11], which reduces to O(|V | 2 log |V |) in our case.

Quota-Restricted Cases
In this section, we consider restrictions of WMLQ with bounded upper quotas.Note that Theorem 1 already tells us that the case of u( p) ≤ 3 for all posts p ∈ P is NPhard to solve.We will now settle the complexity of the only remaining case, where we have instances with every post p ∈ P having an arbitrary degree and u( p) ≤ 2. This setting models posts that need to be assigned to none, one or pairs of applicants.
Here we present a solution for WMLQ with u( p) ≤ 2. Our algorithm is based on f -factors of graphs.In the f -factor problem, a graph G and a function f : where deg F (v), as per our earlier definition, is the degree of v in the graph (V, F).Constructing an f -factor of maximum weight in a graph with n vertices and m edges or proving that none exists can be done in O(φ(m + n log n)) time, where φ is the sum of all f -values in the graph [10,11].Proof We partition P into P 1 and P \ P 1 , where P 1 denotes the set of posts with u( p) = 1.For posts in P \ P 1 we can assume that ( p) = u( p) = 2 for every post p. For, a post p with ( p) = 0 and u( p) = 2 can be transformed into a post with ( p) = u( p) = 2 by giving it two dummy edges with zero weight, allowing us to pick the dummy edges in order to make up for the raised lower quota.
The graph G = (V , E ) of the constructed f -factor instance contains the graph G = (V, E) of our WMLQ instance, as shown in Fig. 1.We add a dummy post p d to V and connect it to every applicant in A. We connect every post p i ∈ P 1 to p d .For every post p i ∈ P\P 1 we add two dummy vertices q 1 i and q 2 i and a triangle on the vertices p i , q 1 i and q 2 i .All new edges in E \ E carry zero weight.We set f ( p d ) = K , f ( p) = u( p) for every p ∈ P and f (v) = 1 for the rest of the vertices.In the initial version of our algorithm, we solve a weighted f -factor problem for every K ∈ {0, 1, . . ., |A|+|P 1 |}, and later we will show a slightly modified version of the f -factor instance so that it is sufficient to construct only two instances.
First we show that if there is a feasible assignment M in G so that the number of unmatched applicants and the number of closed posts in P 1 add up to K , then it can be extended to an f -factor M of the same weight in G .We construct M starting with M and then adding the following edges to it: For all vertices v = p d , it immediately follows from the construction that deg M (v) = f (v).The same holds for p d as well, because an edge is assigned to it either because an applicant is unmatched or because a post in P 1 is closed and we assumed that these add up to K .
It is easy to see that if there is an f -factor M in G , then its restriction to G is a feasible assignment M of the same weight so that the number of unmatched Fig. 1 The transformation from WMLQ to an f -factor problem.The solid edges form G, while the dotted edges are the added ones, carrying weight 0. Here, applicants and the number of closed posts in P 1 add up to K .Since every post p i ∈ P 1 is connected to p d and f Regarding posts outside of P 1 , we need to show that the two edges incident to them are either both in G or neither of them are in G. Assume without loss of generality that

Bounded Treewidth Graphs
In this section, we investigate WMLQ from the point of view of fixed-parameter tractability and analyze how efficiently the problem can be solved for instances with a bounded treewidth.Graphs with bounded treewidth occur frequently in real-life instances of various problems, such as expert systems, evolution theory, or natural language processing [5].More specifically, WMLQ could be used as a potential modeling approach to handle load balancing in telecommunication networks that requires throughput maximization.In WLAN and P2P networks, servers have limited capacities and in addition the loads need to be reasonably balanced among the active servers [3].This could be quite efficiently modeled using the upper and lower quotas.Moreover, certain P2P and WLAN networks have bounded treewidth [19].
Fixed-Parameter Tractability This field of complexity theory is motivated by the fact that in many applications of optimization problems certain input parameters stay small even for large instances.A problem, parameterized by a parameter k, is fixed-parameter tractable (FPT) if there is an algorithm solving it in time f (k)•φ(n), where f : R → R is a function, φ is a polynomial function, and n is the input size of the instance.Note that this definition not only requires that the problem can be solved in polynomial time for instances where k is bounded by a constant, but also that the dependence of the running time on k is separable from the part depending on the input size.On the other hand, if a problem is shown to be W[1]-hard, then the latter property can only be fulfilled if FPT = W [1], which would imply NP ⊆ DTIME (2 o(n) ).For more details on fixed-parameter algorithms see, e.g., [27].
Treewidth In case of WMLQ we focus on the parameter treewidth, which, on an intuitive level, describes the likeness of a graph to a tree.A tree decomposition of graph G consists of a tree whose nodes-also called bags-are subsets of V (G).These must satisfy the following three requirements.
1. Every vertex of G belongs to at least one bag of the tree.2. For every edge {a, p} ∈ E(G), there is a bag containing both a and p. 3.If a vertex in V (G) occurs in two bags of the tree, then it also occurs in all bags on the unique tree-path connecting them.
The width of a tree decomposition with a set of bags B is max B∈B |B| − 1.The treewidth of a graph G, tw(G), is the smallest width among all tree decompositions of G.It is well known that a tree decomposition of smallest width can be found by a fixed-parameter algorithm when parameterized by tw(G) [6].
Nice Tree Decomposition A nice tree decomposition is a tree decomposition with the following additional properties: The decomposition tree has a root bag R, and every bag in the tree (including R) is of one of the four types below.
- For every tree decomposition with a specific treewidth, a nice tree decomposition of the same treewidth can be found in linear time [20].We will henceforth assume we are given such a nice tree decomposition.
In the following, we show that WMLQ is fixed-parameter tractable when parameterized simultaneously by the treewidth and u max , whereas it remains W [1]-hard when only parameterized by the treewidth.A similar study of the fixed-parameter tractability of the related extended global cardinality constraint problem (EGCC) was conducted in Ref. [32].EGCC corresponds to the special case of the D-matching problem where the graph is bipartite and on one side of the bipartition all vertices have the domain {1}.In contrast with WMLQ, EGCC is a feasibility problem (note that the feasibility version of WMLQ is trivial, as the empty assignment is always feasible).The authors of [32] provided a fixed-parameter algorithm for EGCC when parameterized simultaneously by the treewidth of the graph and the maximum domain size, and they showed that the problem is W[1]-hard when only parameterized by the treewidth.These results mirror our results for WMLQ, and indeed both our FPT-algorithm for WMLQ and the one in Ref. [32] are extensions of the same classic dynamic program for the underlying maximum independent set problem.However, our hardness result uses a completely different reduction than the one in Ref. [32].The latter makes heavy use of the fact that the domains can be arbitrary sets, whereas in WMLQ, we are confined to intervals.

Algorithm for Bounded Treewidth Graphs
We will now describe an algorithm for solving WMLQ in polynomial time for graphs with constant treewidth.The algorithm is a dynamic program that inductively computes a set of partial solutions for each bag of the nice tree decomposition and each possible degree profile within that bag.It starts at the leaf bags and then generates partial solutions for each inner node bag by combining or extending partial solutions of its children.The final solution can then be obtained from the root bag.We now formalize the concepts of a partial solution and its corresponding degree profile.
Partial Assignments For any bag B, let V B ⊆ V denote the set of vertices contained in the union of bags present in the subtree rooted at B. We define the graph , where E[U ] denotes the set of edges with both endpoints in U ⊆ V .A partial assignment for the subtree rooted at a bag B (or partial assignment for B in short) is an assignment 1 Note that this definition allows applicants and posts in B to have an arbitrary assignment, which is not restricted by their corresponding quota and that by definition of G B , no vertex in B is assigned to another vertex in B. Degree Profiles A degree profile for bag B is a vector α ∈ X B := {0, . . ., u max } B .We say a partial assignment M for B agrees with a degree profile α ∈ X B , if α(v) = deg M (v) for all v ∈ B. For every bag B and every α ∈ X B , let M B (α) be the set of partial assignments for B that agree with α and let denote the optimal value of any assignment that agrees with α for the graph G B (note that a value of −∞ implies that no partial assignment M agrees with α).We further denote the set of optimal partial assignments agreeing with α by In the following, we will provide a series of lemmas that reveals how to efficiently obtain an element of M * B (α) for every α ∈ X B for a bag B (or showing M * B (α) = ∅), assuming such representatives for each set M * B (α ) have already been computed for every child B of B and each α ∈ X B .
Notation Before we proceed with the formal statement of the lemmas, we introduce some useful notation.For U ⊆ U and α ∈ Z U define α| U as the restriction of α to U , i.e., α| U ∈ Z U and α| We first observe that for leaf bags, the only partial assignment possible is the empty assignment.

Lemma 1 Let B = {v} be a leaf bag and let
Proof This follows directly from the fact that E B = ∅ for all leaf bags and thus the only assignment in G B is the empty assignment.
For introduce bags, the set of partial assignments is identical to that of its child, extending the degree profiles by a 0-entry for the new vertex.

Lemma 2 Let B be an introduce bag such that B is the only child of B and B
Proof Note that Γ (v ) ∩ V B ⊆ B by Properties 2 and 3 of a tree decomposition.This implies δ(v ) ∩ E B = ∅ and hence the lemma follows.
For a forget bag, every partial assignment corresponds to the union of a partial assignment for its child bag and a subset of edges incident to the removed vertex (connecting it to the vertices in forget bag).

Lemma 3 Let B be a forget bag such that B is the unique child of B and B
In particular, this implies that the optimal solution value of [forget] is finite and thus there is some For join bags, every partial assignment is a union of partial assignments for the two child bags.

Lemma 4 Let B be a join bag such that B
. We first observe that V B 1 ∩ V B 2 = B by Properties 2 and 3 of the tree decomposition and hence Finally, we observe that after computing W R (α) and the corresponding elements of M * R (α) for each α for the root bag R, an optimal assignment for G can be easily obtained.
Lemma 5 Let (S * , α * ) be an optimal solution to Then S * ∪ M is an optimal solution to WMLQ for any M ∈ M * R (α * ).
and thus M * is indeed an optimal solution to WMLQ.
Theorem 4 WMLQ can be solved in time O(T + (u max ) 3 tw(G)+3 |E|), where T is the time needed for computing a tree decomposition of G of width tw(G).In particular, WMLQ can be solved in polynomial time when restricted to instances of bounded treewidth, and WMLQ parameterized by max{tw(G), u max } is fixedparameter tractable.
Proof In order to solve a given WMLQ instance, the algorithm starts by computing a nice tree decomposition of G of width tw(G).Note that T is of the same order for tree decompositions and nice tree decompositions.Using Lemmas 1-5, we can inductively compute a representative M ∈ M * B (α) for every bag B and every α ∈ X b , or deduce that M * B (α) = ∅.We first observe that |X B | = (u max + 1) |B| , thus only (u max + 1) tw(G)+1 representatives have to be computed per bag.Furthermore, for each of the above lemmas, the necessary computations to derive an ).This is obvious for Lemmas 1 and 2. For Lemmas 3-5 we observe that the sets of feasible solutions for the corresponding optimization problems [forget], [join], and [root] have size at most 2 |B| • (u max + 1), (u max + 1) 2|B| , and 2 |R| 2 • (u max ) |R| , respectively (note that without loss of generality we can assume |R| to be of constant size by introducing at most tw(G) additional forget bags).The theorem then follows from the fact that the number of bags is linear.

W[1]-Hardness for Parameterizing by Treewidth Only
While our algorithm runs in polynomial time for bounded treewidth, the degree of the polynomial depends on the treewidth and the algorithm only becomes a fixedparameter algorithm when parameterizing by treewidth and u max simultaneously.We will now show by a reduction from Minimum Maximum Outdegree that this dependence is necessary under the assumption that FPT = W [1].

Problem 2 Minimum Maximum Outdegree
Input: A graph G = (V, E), edge weights w : E → Z + encoded in unary and a degree-bound r ∈ Z + .Task: Find an orientation D of G such that e∈δ + D (v) w(e) ≤ r for all v ∈ V , where δ + D (v) stands for the set of edges oriented so that their tail is v.We also add 2w(e) + 1 applicants a We show that the constructed instance has a solution serving all applicants if and only if the Minimum Maximum Outdegree instance has an orientation respecting the bound on the weighted outdegree.
First assume there is an orientation D of G with maximum weighted outdegree at most r .Then consider the assignment that assigns for every oriented edge (v, v ) ∈ D the w(e) applicants a i e,v to p v and the w(e) + 1 applicants a i e,v and z e to p e,v .As Fig. 2 The transformation of the Minimum Maximum Outdegree instance in the upper right corner to a mlq instance.The numbers on the edges of the Minimum Maximum Outdegree instance are the edge weights the weighted outdegree of vertex v is at most r , every post p v gets assigned at most r = u( p v ) applicants.Now assume M is a feasible assignment of applicants to posts serving every applicant.In particular, for every edge e = {v, v } ∈ E, applicant z e is assigned to either p e,v or p e,v and exactly one of these two posts is open because the lower bound of w(e) + 1 can only be met if z e is assigned to the respective post.If p e,v is open then all w(e) applicants a i e,v are assigned to p v and none of the applicants a i e,v is assigned to p v , and vice versa if p e,v is open.Consider the orientation obtained by orienting every edge e from v to v if and only if p e,v is open.By the above observations, the weighted outdegree of vertex v corresponds to the number of applicants assigned to post p v , which is at most r .
Finally, note that G can be constructed in time polynomial in the input size of the Minimum Maximum Outdegree instance as the weights are encoded in unary there.Furthermore, the treewidth of G is at most max{tw(G), 3}.To see this, start with a tree decomposition of G and identify each vertex v ∈ V with the corresponding post p v .For every edge e = {v, v } ∈ E, there is a bag B with p v , p v ∈ B. We add the new bag B e = {p v , p v , p e,v , p e,v } as a child to B. We further add the bags = {p v , p e,v , a i e,v } for i ∈ {1, . . ., w(e)} as children to B e .Observe that the tree of bags generated by this construction is a tree decomposition.Furthermore, since we did not increase the size of any of the existing bags and added only bags of size at most 4, the treewidth of G is at most max{tw(G), 3}.

Approximation
Having established the hardness of WMLQ even for very restricted instances in Theorem 1, we turn our attention towards approximability.In this section, we give an approximation algorithm and corresponding inapproximability bounds expressed in terms of |A|, |P| and upper quotas in the graph.
The method, which is described formally in Algorithm 1, is a simple greedy algorithm.We say a post p is admissible if it is not yet open and |Γ (p)| ≥ ( p).The algorithm iteratively opens an admissible post maximizing the assignable weight, i.e., it finds a post p ∈ P and a set A of applicants in its neighborhood Γ (p ) with ( p ) ≤ |A | ≤ u( p ) such that a∈A w(a, p ) is maximized among all such ( p , A ) pairs.It then removes the assigned applicants from the graph (potentially rendering some posts inadmissible) and re-iterates until no admissible post is left.

Algorithm 1 Greedy algorithm for WMLQ
Find a pair p ∈ P 0 and A ⊆ Γ (p ) ∩ A 0 with |A | ≤ u( p ) such that a∈A w(a, p ) is maximized among all such pairs.Open p and assign all applicants in A to it.Remove p from P 0 and remove the elements of A from A 0 .for p ∈ P 0 with ( p) > |Γ (p) ∩ A 0 | do Remove p from P 0 .end for end while Remark 2 As an alternative to Algorithm 1, one could use a reduction from WMLQ to the set packing problem.The elements in the universe of the set packing problem would be A ∪ P. For each post p and for each subset S ⊂ Γ (p), such that l( p) ≤ |S| ≤ u( p), we create a set S ∪ {p} for the set packing instance.A feasible set packing then corresponds to a feasible assignment of the same weight.However, if the difference between p's upper and lower quota is not bounded by a constant, this would create an exponential-sized input for the set packing problem and we could only employ an oracle-based algorithm known for the set packing problem to solve WMLQ.The greedy algorithm known for the set packing problem [7] can be made to work in a fashion similar to the algorithm presented above.
In the following we give a tight analysis of the algorithm, establishing approximation guarantees in terms of the number of posts |P|, the number of applicants |A|, and the maximum upper quota u max := max p∈P u( p) over all posts.We also provide two examples that show that our analysis of the greedy algorithm is tight for each of the described approximation factors.We further show that the approximation ratios given above for WMLQ are almost tight from the point of view of complexity theory.Proof Let p i be the post chosen by the algorithm in iteration i and let A i be the corresponding set of applicants for every i ∈ {1, . . ., n}.Furthermore, consider an optimal solution of weight OPT, consisting of open posts p 1 , . . ., p k and the corresponding sets of applicants A 1 , . . ., A k assigned to those posts.
We first observe that the first two approximation ratios of |P| and |A| are already achieved by the initial selection of p 1 and A 1 chosen in the first round of the algorithm.For every i ∈ {1, . . ., k}, post p i is an admissible post in the first iteration of the algorithm.The first iteration's choice of the pair ( p 1 , A 1 ) implies a∈A 1 w(a, p 1 ) ≥ a∈A i w(a, p i ) ≥ w(a , p i ) for every a ∈ A i .As the optimal solution opens at most |P| posts and serves at most |A| applicants, we deduce that min{|P|, |A|} • a∈A 1 w(a, p 1 ) ≥ OPT.We now turn our attention to the remaining approximation guarantees, which are u max + 1 for WMLQ and √ |A| + 1 for mlq.For every i ∈ {1, . . ., k}, let π(i) denote the first iteration of the algorithm such that A π(i) ∩ A i = ∅ or p π(i) = p i .This is the first iteration in which post p i is opened or an applicant assigned to it in the optimal solution becomes assigned.Note that such an iteration exists, because p i is not admissible after the termination of the algorithm.Furthermore, observe that We now turn to proving the bound on the running time.We will describe how to implement the search for the greedy choice of the pair ( p , A ) in each iteration efficiently using a heap data structure.Initially, for every post p, we sort the applicants in its neighborhood by non-increasing order of w(a, p).This takes time at most O(|E| log |E|) as the total number of entries to sort is p∈P |Γ (p)| = |E|.We then introduce a heap containing all admissible posts, and associate with each post p the total weight of the first u( p) edges in its neighborhood list.Note that these entries can be easily kept up to date whenever the algorithm opens a post and assigns applicants to it: In the list of every other post p we simply replace the assigned applicants with the first not-yet-assigned entry in the list (or we remove the post if less than ( p) applicants are available).As every edge in the graph can only trigger one such replacement, only O(|E|) updates can occur and each of these requires O(log |P|) time for reinserting the post at the proper place in the heap.Now, in each iteration of the algorithm, the optimal pair ( p , A ) can be found by retrieving the maximum element from the heap.This happens at most |P| times and requires O(log |P|) time in each step.

Example 8
The following two examples show that our analysis of the greedy algorithm is (asymptotically) tight for each of the described approximation factors.
(a) The bounds |P| and u max + 1 are tight, and √ |A| + 1 is asymptotically tight: Consider an instance of mlq with k + 1 posts p 0 , . . ., p k and k(k + 1) applicants a 0,1 , . . ., a 0,k , a 1,1 , . . ., a k,k .Let ( p i ) = u( p i ) = k for i ∈ {0, . . ., k}.Each applicant a i, j applies to post i, and if i > 0, additionally to post 0. For the greedy algorithm, opening post p 0 and assigning applicants a 1,1 , . . ., a k,k to it is a valid choice in its first iteration, after which no further posts are admissible.Thus, it only assigns k applicants in total.The optimal solution, however, can assign all k(k +1) applicants by assigning applicants a i,1 , . . ., a i,k to p i for each i.Therefore, the greedy algorithm cannot achieve an approximation factor better than k + 1 on this family of instances, for which To see that the approximation ratio of |A| is tight for WMLQ consider the following instance with k posts p 1 , . . ., p k and k applicants a 1 , . . ., a k .Let ( p i ) = 0 and u( p i ) = k for every i.Every applicant applies for every post, and w(a i , p i ) = 1 for every i but w(a i , p j ) = ε for every j = i for some arbitrarily small ε > 0. In its first iteration, the greedy algorithm might choose to open post p 1 and assign all applicants to it.This solution accumulates a weight of 1 + (k − 1)ε, while the weight of the optimal solution is k = |A|.Proof Once again we use the maximum independent vertex set problem.Given an instance of mis on a graph G = (V, E) with |V | = n and |E| = m, we create an mlq instance with n posts p 1 , . . ., p n , post p i corresponding to vertex v i .We also introduce n 2 − m applicants as follows.Initially, we introduce n applicants a i,1 , a i,2 , . . ., a i,n applying for each post p i .Then, for every edge {v i , v j } ∈ E, we merge the applicants a i, j and a j,i , obtaining a single applicant applying for both p i and p j .Furthermore, we set ( p j ) = u( p j ) = n for every post.This construction is shown in Fig. 3.Note that due to the choice of upper and lower bounds, any open post must be assigned to all the applicants in its neighborhood.Thus, a solution to the mlq instance is feasible if and only if Γ (p i ) ∩ Γ (p j ) = ∅ for all open posts p i and p j with i = j, Fig. 3 The transformation of the mis instance in the upper left corner to a mlq instance which is equivalent to v i and v j not being adjacent in G by construction of the instance.Therefore, the mlq instance has a feasible solution opening k posts (and thus serving kn applicants) if and only if there is an independent set of size k in G.We conclude that OPT mlq = n • OPT mis for the two instances under consideration.Note that in the constructed mlq instance, n = |P| = u max ≥ √ |A|.Therefore any approximation algorithm with a factor better than |P| 1−ε or √ |A| 1−ε or u 1−ε max for ε > 0 yields a solution of the instance that serves at least (1/n 1−ε )OPT mlq applicants and therefore opens at least (1/n 2−ε )OPT mlq = (1/n 1−ε )OPT mis posts, corresponding to an independent set of the same size.By Ref. [35], this implies P = NP.

Matchings with Lower Quotas in General Graphs
Throughout this paper, we focused on many-to-one matchings in bipartite graphs because these fit most applications in the centralized formation of groups that motivated our investigation.A straightforward generalization of WMLQ to matchings in an arbitrary (not necessarily bipartite) graph G allows all vertices of the graph to have lower and upper quotas.

Problem 3 gwmlq
Input: I = (G, w, , u); a not necessarily bipartite graph G = (V, E) with edge weights w, lower quotas and upper quotas u.Task: Find an assignment of maximum weight.If w(e) = 1 for all e ∈ E, we refer to the problem as gmlq.
One can see this generalization as a variant of the D-matching problem (see Sect. 1.1), where each vertex has a domain consisting of 0 and an interval.Clearly, the hardness results derived in the previous sections are valid for gwmlq as well.We now briefly argue that the positive results from Sects. 3 and 4 carry over to this generalized setting.However, our approximation results do not hold even if G is bipartite and only a single applicant is equipped with lower and upper quotas.In fact, gwmlq does not allow for any approximation even in this very restricted case unless P = NP.
The two positive results in Sect.3, namely Theorems 2 and 3, are applicable to gwmlq.Note that Theorem 2 (bounded degree for all posts) is a special case of Theorem 3 (bounded upper quota for all posts).
Theorem 10 gwmlq can be solved in polynomial time when restricted to instances with u(v) ≤ 2 for all v ∈ V .Proof We will work with the proof of Theorem 3, which requires some simple modifications to fit the case of arbitrary graphs.All we need to do is to add a dummy vertex v d to G-this resembles dummy post p d in the proof of Theorem 3. The steps corresponding to a post vertex should now be executed for all vertices of the graph.We can assume there are no vertices with lower quota 0 and upper quota 2 by a similar reasoning given in Theorem 2. For every vertex v i with (v i ) = 2, we add two dummy vertices q 1 i and q 2 i and connect them to each other and v i .For all of these vertices, we set (q 1 i ) = u(q 1 i ) = (q 2 i ) = u(q 2 i ) = 1.Then, the dummy vertex v d is connected to vertices with upper quota 1.We finish the construction by adding triangles to v d to ensure that only two f -factors need to be computed.The arguments in the proof of Theorem 3 can now be applied to this f -factor instance.
As for Theorem 4, the algorithm for bounded treewidth and upper quota carries over to gwmlq without any modification.Note that in the proof we never used the bipartiteness of G or that u(a) = 1 for the applicants.
Theorem 11 gwmlq can be solved in time O(T + (u max ) 3 tw(G)+3 |E|), where T is the time needed for computing a tree decomposition of G of width tw(G).In particular, gwmlq can be solved in polynomial time when restricted to instances of bounded treewidth, and WMLQ parameterized by max{tw(G), u max } is fixedparameter tractable.
Finally, we prove that Algorithm 1 cannot be generalized even for bipartite mlq with lower and upper quotas on both sides.Proof To every instance of mis we construct an instance of gmlq so that the mis instance admits an independent set of size K if and only if OPT > 0 for the gmlq instance.We start with the same mlq instance that was constructed from an mis instance in the proof of Theorem 9.The changes are depicted in Fig. 4. A dummy applicant a d is added to the graph and connected to all posts.We set (a d ) = u(a d ) = K and change ( p) = u( p) to n + 1 for every post p ∈ P. Since every post is adjacent to exactly n + 1 applicants, opening a post requires allocating all its applicants to it, including a d as well.Thus, opening any post implies allocating a d to exactly K posts.These K open posts do not share applicants other than a d , which is equivalent to the K vertices corresponding to them in the mis instance forming an independent set.

Conclusion
We discussed the complexity, approximability and fixed-parameter tractability of WMLQ from various viewpoints such as bounded degree, quota and treewidth.
Further work on the topic might include imposing common quotas on some groups of posts.That is, we may have subsets P 1 , . . ., P k , where for each i (1 ≤ i ≤ k), P i ⊆ P, P i has a common quota u(P i ) ≥ 1, where u(P i ) ≤ p∈P i u( p), and any assignment M must now satisfy the additional property that p∈P i |δ( p) ∩ M| ≤ u(P i ).Common quotas are similar to regional caps studied in Economics [17] and they can model constraints such as the limited availability of resources required for certain projects-for example P 1 might correspond to those projects that require access to high-performance computing facilities.
We have seen that WMLQ as defined in Problem 1 has a natural application in the context of student-project allocation, where the weight on a given edge (s, p) corresponds to the utility of student s being assigned to project p. However in many applications students have ordinal preferences over projects.Cardinal utilities can of course follow from these via the use of Borda scores, so we can obtain WMLQ as before.But ordinal preferences themselves allow alternative optimality criteria to be formulated.For example we may optimize on the profile of a matching M, which is a vector whose ith position indicates the number of students who obtain their ithchoice project in M [24].A greedy maximum matching is a matching whose profile is lexicographically maximum, taken over all maximum cardinality matchings, whilst a generous maximum matching is a matching whose reverse profile is lexicographically minimum, taken over all maximum cardinality matchings.There are efficient algorithms to find greedy and generous maximum matchings in the absence of lower quotas [21], but it remains open to extend the positive results in this paper to the setting involving both lower quotas and preferences.

Theorem 3
WMLQ with u( p) ≤ 2 for every p ∈ P can be solved in O(nm +n 2 log n) time, where n = |V | and m = |E|.

2 .
be an f -factor.So far we have shown that it is sufficient to test |A| + |P 1 | + 1 values for f ( p d ), and collect the optimal assignments given by the maximum weight f -factors.Comparing the weight of these locally optimal solutions delivers a global optimum.A slight modification on the the graph corresponding to the f -factor instance will allow us to solve the problem by constructing just two instances, as against |A| + |P 1 | + 1 instances.Similar to the triangles attached to posts in P \ P 1 , triangles are added to p d as well.The added vertices have f -value 1 and the added edges carry weight 0. The number of such triangles hanging on p d is |A|+|P 1 | These triangles can take up all the f -value of p d if necessary, but by choosing the edge not incident to p d they can also allow p d to fill up its f -value with other edges.Since a triangle either takes up 0 or 2 of p d 's f -value, we need to separate the two different parity cases.Thus, to cover all the |A| + |P 1 | + 1 cases for possible values for f ( p d ), in one instance we set f ( p d ) to |A| + |P 1 | + 1 and in the other instance f ( p d ) = |A| + |P 1 |.
Leaf bag: |B| = 1 and B has no child; -Introduce bag: B has exactly one child B 1 , so that B 1 ⊂ B and |B \ B 1 | = 1; -Forget bag: B has exactly one child B 1 , so that B ⊂ B 1 and |B 1 \ B| = 1; -Join bag: B has exactly two children B 1 and B 2 , so that B = B 1 = B 2 .
by the feasibility of S * for [root].We conclude that M * is indeed a feasible solution to WMLQ.Now let M ⊆ E be any solution to WMLQ.Define S := M ∩ E[R] and α := α M ,R − α S ,R .Observe that (S , α ) is a feasible solution to [root] and that further M \ S ∈ M R (α ).We conclude that

Theorem 5 (
Theorem 5 from[34]) Minimum Maximum Outdegree is W[1]-hard when parameterized by treewidth.Theorem 6 mlq is W[1]-hard when parameterized by treewidth, even when restricted to instances where ( p) ∈ {0, u( p)} for every p ∈ P. Proof Given an instance (G = (V, E), w, r ) of Minimum Maximum Outdegree, we construct an instance (G = (A ∪ P, E ), , u) of mlq as follows: -For every vertex v ∈ V we introduce a post p v ∈ P with lower quota ( p v ) = 0 and upper quota u( p v ) = r .-For every edge e = {v, v } ∈ E, we introduce two posts p e,v and p e,v with identical lower and upper quotas of w(e) + 1, i. e. , ( p e,v ) = ( p e,v ) = u( p e,v ) = u( p e,v ) = w(e) + 1.
vertex pv with lower quota 0 and upper quota r post vertex pe,v with lower quota and upper quota w(e)
and u max = k.(b) The bound |A| is tight:

Fig. 4
Fig.4 The transformation of the mis instance in the upper left corner to a generalized mlq instance , z e } and {z e , p e,v }.This construction is shown in Fig.2.
≥ a∈A i w(a, p i ), because the pair ( p i , A i ) was a valid choice for the algorithm in iteration π(i).Now for iteration j define P j := {i : π(i) = j} and observe that |P j | ≤ |A j | + 1, because P j can only contain one index i with p i = p j , and all other i ∈ P j \ {i } must have A i ∩ A j = ∅ (where the sets A i are disjoint).We conclude that