This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Matchings with Group Fairness Constraints: Online and Offline Algorithms

Govind S. Sankar Indian Institute of Technology Madras, Chennai Anand Louis111These three authors contributed equally. Indian Institute of Science, Bangalore Meghana Nasrefootnotemark: Indian Institute of Technology Madras, Chennai Prajakta Nimbhorkarfootnotemark: Chennai Mathematical Institute, Chennai UMI ReLaX
Abstract

We consider the problem of assigning items to platforms in the presence of group fairness constraints. In the input, each item belongs to certain categories, called classes in this paper. Each platform specifies the group fairness constraints through an upper bound on the number of items it can serve from each class. Additionally, each platform also has an upper bound on the total number of items it can serve. The goal is to assign items to platforms so as to maximize the number of items assigned while satisfying the upper bounds of each class. In some cases, there is a revenue associated with matching an item to a platform, then the goal is to maximize the revenue generated.

This problem models several important real-world problems like ad-auctions, scheduling, resource allocations, school choice etc.We also show an interesting connection to computing a generalized maximum independent set on hypergraphs and ranking items under group fairness constraints.

We show that if the classes are arbitrary, then the problem is NP-hard and has a strong inapproximability. We consider the problem in both online and offline settings under natural restrictions on the classes. Under these restrictions, the problem continues to remain NP-hard but admits approximation algorithms with small approximation factors. We also implement some of the algorithms. Our experiments show that the algorithms work well in practice both in terms of efficiency and the number of items that get assigned to some platform.

1 Introduction

Graph matching is a fundamental problem in graph theory and theoretical computer science that has been studied extensively over the years. Computing the maximum matching in bipartite graphs, both in the online and the offline setting is an important building block in many applications in allocation problems such as ad-auctions [Meh13, MSVV07], scheduling [MAW99], resource allocation [HLL12], school choice [AS03] etc. Since the notation used in these various problems differ, we use the general terms items and platforms to refer to the two parts of the bipartite graph. In practice, items may be classified based on different properties and hence may belong to certain groups or classes. Modeling the allocation problems as a vanilla matching problem seeks to optimize the cost of the solution alone and may inadvertently be “unfair” to some classes of items. Necessitated by the need to be fair and unbiased towards any group of items in the input, there has been a lot of recent work studying algorithms for various problems augmented with fairness constraints, such as [CSV18, KMM15, CHRG16, BCZ+16]).

In this paper, we enforce group fairness through constraints that place an upper bound on the number of items that can be matched from a particular class to a platform. We note that group fairness constraints usually involve both upper and lower bounds. This is incompatible with the practical applications that we have in mind, namely ad-allocation and course allocation problems. For this reason, we focus only on upper bounds. We formally define the problem as follows.

Classified maximum matching (CMM)

We have a set AA of items and a set PP of platforms, and these sets form the two parts of a bipartite graph. The presence of an edge (a,p)(a,p) indicates that item aa can be matched to platform pp. Let N(p)N(p) denote the neighborhood of pp. Each platform pp has a collection of classes 𝒞p2N(p)\mathcal{C}_{p}\subseteq 2^{N(p)}, i.e., each item in N(p)N(p) may belong to some of the classes in 𝒞p\mathcal{C}_{p}. Each class C𝒞pC\in\mathcal{C}_{p} has an associated quota qpCq_{p}^{C} denoting the maximum number of items from CC that can be assigned to pp. In addition, each platform pp has a quota qpq_{p}, which is an upper bound on the total number of items it can serve. Our goal is to compute an assignment of items to platforms so as to maximize the number of items assigned, while satisfying all the quotas.

Classes allow platforms to specify group fairness constraints – for instance the classes can be seen as properties or categories and the quotas impose the constraints that not too many items from one category are assigned to a platform. These types of fairness constraints have been studied in many practical applications. In  [AS03], the authors address the school choice problem where fairness constraints are imposed to achieve racial, ethnic, and gender balance. In the assignment of medical residents to hospitals in Japanese Residency Matching Program (JRMP), regional quotas are introduced to ensure fairness amongst urban and rural hospitals [KK12, KK15]. Huang [Hua10] motivates classifications from the perspective of enabling diversity in academic hiring. Apart from matchings, group fairness constraints have also been studied for many other problems like the knapsack problem [PKL21], and clustering problems [BCFN19], to name a few.

Some recent pre-prints have discussed fairness in matching problems. Soriano and Bonchi [GSB20] study a different notion of individual fairness that they call maxmin-fairness. Their goal is to output a solution such that the satisfaction of one agent cannot be improved without making another agent worse-off. Ma and Xu [MX20] measure fairness by the ratio of expected number of agents matched from a particular group to the expected number of agents from that group and their goal is to maximize the minimum of this ratio over all groups. Basu et al. [BDLK20] also measure fairness based on metrics involving the ratio of agents across groups and the utility they provide. While qualitatively similar, our constraints can be seen as being orthogonal to such notions of fairness.

In different applications, the fairness constraints can have a different structure. In [KK12, KK15], each hospital belongs to exactly one region, hence fairness constraints partition the set of hospitals. On the other hand, in the school choice problem in [AS03], a student belongs to multiple constraints. The structure of the constraints crucially affects the computational complexity of finding a fair allocation. This has been illustrated in the context of bipartite matchings where one or both sides of the bipartition express preferences over the other side. Huang [Hua10] and Fleiner and Kamiyama [FK12], address the CMM problem when both sides of the bipartition have preferences over each other and the notion of optimality is stability, whereas [NNP19] study the CMM problem under the optimality criteria of rank-maximality and popularity. In all these cases, it has been shown that the CMM problem can be efficiently solved if the constraints have a laminar222 A family 𝒞\mathcal{C} of subsets of a set SS is laminar if, for every pair of sets X,Y𝒞X,Y\in\mathcal{C}, either XYX\subseteq Y or YXY\subseteq X or XY=X\cap Y=\emptyset. structure, and is NP-hard in general [NNP19]. Such a restriction has been considered before in the literature, such as in the hospital-resident problem [KK12] or the college admissions problem [BFIM10, GIK+16]. However, a finer relation between the structure of the class constraints and the computational efficiency has not received much attention in literature. In this paper, we address this issue by focusing on a quantification of non-laminarity in the classes and its effect on computational efficiency. We strengthen the hardness results in [NNP19] and obtain new approximation algorithms for the CMM problem in the offline setting.

Next, we turn our attention to the online version of the problem. Online matching problems have numerous practical applications, such as in ad-allocations [MSVV07], resource allocations [DJSW11], etc. See [Meh13] for a survey on online bipartite matchings. Fairness has also been studied in online settings such as online learning [GJKR18] or ride-hailing platforms [SBZ+19]. ‘Fairness’ in another form has been considered previously in the online literature. For example, the ‘frequency caps’ mentioned in [FMMM09] places a restriction on the total number of ads that are shown to the same user, or users from a particular demographic. We study some natural online versions of the CMM problem. We first show that one of our approximation algorithms for the offline non-laminar case also works as an online algorithm, regardless of the input model. For the setting where we restrict classes to be laminar, we show that existing algorithms for online bipartite matching carry over to our setting.

1.1 Models

We study CMM problem in various settings. In practice, assigning an item aa to a platform pp may generate a revenue, which can be modelled as the weight of the edge (a,p)(a,p). In such a case the goal of the weighted CMM problem is to compute an assignment of items to platforms so as to maximize the total weight of edges in the matching, while satisfying the quotas of all the classes. We now formally define our models.

Model 1 (Many-to-one).

This is the setting described earlier. In this setting, items can match to at most one platform.

Model 2 (Many-to-many).

This is a more general setting in which items may be matched to multiple platforms. In addition to the classes of platforms, each item ii also has a collection of classes 𝒞i2N(i)\mathcal{C}_{i}\subseteq 2^{N(i)}, i.e., each platform in N(i)N(i) belongs to some of the classes in 𝒞i\mathcal{C}_{i}, and the items also have quotas for their classes. This model arises in scenarios like course allocation, where students may be allotted multiple courses subject to various restrictions. Courses may have restrictions over the number of students allotted to it from each department or from each batch.

In the setting of online matchings, the platforms are available offline and the items arrive online. When an item aAa\in A arrives online, its neighbours in PP, and the classes that it participates in are revealed. It must be immediately decided if we match aa to some platform and any edges matched cannot be unmatched later. In the literature, the order in which the items arrive has been studied in various models. In the adversarial model, the items can arrive in an arbitrary order. We study a natural online arrival model for the items, called the Random input model. See [Meh13] for a survey of other work on such models.

Model 3 (Random input [GM08]).

In this setting, there is an underlying graph G=(AP,E)G=(A\cup P,E). The vertices of AA arrive according to a permutation chosen uniformly at random.

1.2 Our results

In most applications, an item typically belongs to small number of classes, hence we first study this setting. For example, [AS03] discusses the Boston student assignment mechanism which divides students into two categories based on whether they already have a sibling in the school and whether they are within walking distance to the school. Similarly, in a faculty hiring scenario, the number of classes (which would correspond to specializations) is independent of the number of applicants. For the scenario when there are constant number of classes we show the following result.

Theorem 1 (Informal version of Theorem 6).

The CMM  problem can be solved in polynomial time if there is a constant number of platforms, each with a constant number of classes. This leads to a 12\frac{1}{2}-approximation algorithm for an arbitrary number of platforms, each with a constant number of classes.

Now we turn to a more general setting where the number of classes is arbitrary and exploit the structural relation amongst the classes. We know from [NNP19] that when the classes of every platform form exactly one laminar family then the CMM problem is solvable in polynomial time. We prove the following theorem.

Theorem 2.

There is a polynomial-time algorithm achieving an approximation ratio of 1Δ+1\frac{1}{\Delta+1} for the many-to-one setting (Model 1) where each item belongs to at most Δ\Delta laminar families of classes per platform. This generalizes to the weighted many-to-many setting (Model 2) where for each edge (a,p)(a,p), the classes of aa and pp that contain (a,p)(a,p) can be partitioned into Δ+1\Delta+1 laminar families.

The above result is applicable in scenarios like ad-allocation where the number of classes can be arbitrary, but any ad belongs to a few of them. Complementing this, we also obtain hardness results for computing the optimal CMM.

Proposition 1.
  1. (i)

    CMM  cannot be approximated to a factor of nϵ1n^{\epsilon-1} for any ϵ>0\epsilon>0 unless 𝖯=𝖭𝖯{\sf P}={\sf NP}, where n=|A|n=|A|, even when there is a single platform and all edge weights are one.

  2. (ii)

    When there is a single platform, and additionally, each item appears in at most Δ\Delta classes, the problem is NP-hard to approximate within a factor O(log2ΔΔ)O\left(\frac{\log^{2}\Delta}{\Delta}\right).

The proof of Proposition 1 follows from a reduction from the maximum independent set problem.

Online algorithms.

We first remark that our algorithm from Theorem 2 works as an online algorithm in the unweighted case, even when the input is adversarially chosen.

Theorem 3.

There is a polynomial-time online algorithm achieving, in any input model, a competitive ratio of 1Δ+1\frac{1}{\Delta+1} for the many-to-one setting (Model 1) where each item belongs to at most Δ\Delta laminar families of classes per platform. The algorithm extends to the many-to-many setting (Model 2) where the classes of aa and pp containing each edge (a,p)(a,p) can be partitioned into Δ+1\Delta+1 laminar families.

Having achieved a competitive ratio that is close to the lower bound (from Proposition 1 (ii)), we consider the case where classes are restricted to be laminar. We consider the random order input model (Model 3) and show that a simple greedy algorithm from the literature also works for CMM  and that it achieves the same competitive ratio. We use the technique of randomized dual fitting which has been used to analyse competitive ratios in works such as [DJK13, HKT+18].

Theorem 4.

There is a polynomial-time algorithm achieving a competitive ratio of 11e1-\frac{1}{e} for CMM with laminar classes in the random input model.

2 Implications for other problems

Although the CMM problem is modelled as a matching of items to platforms, we show that the classes capture problems which are well studied and are of independent interest.

Maximum Independent set on hypergraphs

Given a hypergraph H=(V,E)H=(V,E), and a function f:E+f:E\to\mathbb{Z}^{+}, compute the largest set of vertices SS such that for every eEe\in E, |Se|f(e)|S\cap e|\leq f(e). We note that when f(e)=1f(e)=1\ for each edge ee, this is the problem of computing the strong maximum independent set and when f(e)=|e|1f(e)=|e|-1, this is the weak maximum independent set problem. These problems are well-studied for bounded-degree hypergraphs; [HL09] describe algorithms achieving factors of 1Δ\frac{1}{\Delta} and 5Δ+3\frac{5}{\Delta+3} for the strong and weak cases respectively, where Δ\Delta denotes the maximum degree of a vertex in HH. For the weak independent set, this was further improved to O(logΔΔloglogΔ)O\left(\frac{\log\Delta}{\Delta\log\log\Delta}\right) in [AHL13]. However, to the best of our knowledge, there is no known approximation algorithm for the case when f(e)f(e) is an arbitrary value – we call this the generalized maximum independent set  on hypergraphs. We state our approximation result for independent sets on hypergraphs below, which is a consequence of Theorem 2.

Proposition 2.

There is a polynomial time 1Δ\frac{1}{\Delta} approximation algorithm for the problem of computing a generalized maximum independent set on hypergraphs with maximum degree Δ\Delta.

For the case when average degree of the vertices is Δ\Delta, we get the following:

Theorem 5.

There is a r4Δ\frac{r}{4\Delta} approximation algorithm for the generalized independent set where r=OPTnr=\frac{OPT}{n} and Δ\Delta denotes the average degree of a vertex.

For the CMM problem, this implies an OPT4Δn\frac{OPT}{4\Delta n} approximation algorithm when we only have an upper bound on the average number of laminar families of classes an item belongs to, and there is only one platform.

Ranking and group fairness

In an apparently different model, Celis et al. [CSV18] consider ranking nn items from a universe of mm items, where nmn\ll m. Items are assigned properties, and upper quotas for the number of items from any property in the top kk ranks. When items have at most Δ\Delta properties each, they give a 1Δ+2\frac{1}{\Delta+2} approximation while allowing constraints to be violated by a factor of 22. This problem can be reduced to the CMM problem and our algorithm from Theorem 2 achieves the same approximation factor without violating any class constraints.

We now show a reduction from their problem to the CMM problem. The fair rankings problem is defined as follows: Given a set of mm items, our objective is to choose nn among them and rank them. Every item ii has a value WijW_{ij} when ranked in the jthj^{th} position. Every item also has some properties, and every property can be represented as a subset of the mm items that share that property. The objective is to rank them such that this the total value is maximized, subject to some fairness constraints on the properties. A fairness constraint corresponding to the property pp is set of values U1p,U2p,,UnpU_{1}^{p},U_{2}^{p},\ldots,U_{n}^{p} such that UkpU_{k}^{p} is the maximum number of items with property pp that can be ranked in the top kk positions.

In the reduction, we create one platform pp. For every item ii in the ranking instance we have nn items (i,1),(i,2),,(i,n)(i,1),(i,2),\ldots,(i,n) in the CMM instance. The item (i,j)(i,j) being matched to pp will be equivalent to ranking the ithi^{th} item in the jthj^{th} position. Then our classes are

  • One class for every item to ensure that an item is ranked at most once. That is, i{1,2,,m}\forall\ i\in\{1,2,\ldots,m\}, we have the class

    C={(i,1),(i,2),(i,3)(i,n)}q(C)=1C=\{(i,1),(i,2),(i,3)\ldots(i,n)\}\quad q(C)=1
  • One class for every rank to ensure that at most one item is ranked in one position. That is, j{1,2,,n}\forall\ j\in\{1,2,\ldots,n\}, we have the class

    C={(1,j),(2,j),(3,j)(m,j)}q(C)=1C=\{(1,j),(2,j),(3,j)\ldots(m,j)\}\quad q(C)=1
  • One laminar family of classes for every property pp with constraints U1p,U2p,,UnpU_{1}^{p},U_{2}^{p},\ldots,U_{n}^{p}. There are nn constraints, one for each position in the ranking. Let p={i1,i2,,ik}p=\{i_{1},i_{2},\ldots,i_{k}\} be the items with property pp. Then p,j{1,2,,n}\forall\ p,\forall j\in\{1,2,\ldots,n\} we have

    Cjp={(i1,j),(i2,j),(i3,j)(ik,j)}Cj1p\displaystyle C_{j}^{p}=\{(i_{1},j),(i_{2},j),(i_{3},j)\ldots(i_{k},j)\}\cup C_{j-1}^{p}
    q(Cjp)=Ujp\displaystyle q(C_{j}^{p})=U_{j}^{p}

    where C0p={}C_{0}^{p}=\{\}. It is easily seen that this is a laminar family.

Thus, for an item ii in the ranking instance that belongs to Δ\Delta properties, for any j{1,2,,n}j\in\{1,2,\ldots,n\}, (i,j)(i,j) in the constructed CMM instance belongs to Δ+2\Delta+2 laminar families of classes. Using the algorithm from Theorem 2, we get a 1Δ+2\frac{1}{\Delta+2} approximation without any violation in quotas. However, it has to be noted that in [CSV18], they insist on finding a ranking with nn elements whereas we may output a possibly smaller ranking. We also note that this reduction immediately gives a better hardness of approximation of O(logΔΔ)O\left(\frac{\log\Delta}{\Delta}\right) for the setting where every item lies in Δ\Delta laminar families of classes per platform.

Simultaneous matchings

Kutz et al. [KEKM08] study the problem called simultaneous matchings which is defined as follows: given a bipartite graph G=(XD,E)G=(X\cup D,E) and a collection 2X\mathcal{F}\subseteq 2^{X}, find the largest solution MEM\subseteq E such that C,M(C×D)\forall\ C\in\mathcal{F},M\cap(C\times D) is a matching. This problem can be reduced to the CMM problem where every vertex dd in DD has constraints \mathcal{F} (excluding vertices to which dd has no edge), and each class has quota 11. The approximation factor in [KEKM08] is better but the constraints are significantly more restricted than ours.

3 Offline Approximation algorithms

We start by showing the hardness of the CMM problem.

Proof of Proposition 1.

Consider an arbitrary instance of the maximum independent set (MIS) problem, which is an undirected graph G=(V,E)G=(V,E). From GG, we will create an instance of the CMM problem denoted as a graph H=(A{p},E)H=(A\cup\{p\},E^{\prime}), and a set of platform classes 𝒞\mathcal{C}, where AA is the set of items and pp is a single platform.

A\displaystyle A =\displaystyle= {aiviV}\displaystyle\{a_{i}\mid v_{i}\in V\}
𝒞\displaystyle\mathcal{C} =\displaystyle= {Cij(vi,vj)E}\displaystyle\{C_{ij}\mid(v_{i},v_{j})\in E\}
E\displaystyle E^{\prime} =\displaystyle= {(ai,p)aiA}\displaystyle\{(a_{i},p)\mid a_{i}\in A\}

Thus, there is an item aiAa_{i}\in A for each viVv_{i}\in V, and every item in AA has an edge to pp. There is a class CijC_{ij} with quota 11 for every edge (vi,vj)E(v_{i},v_{j})\in E. We claim that the instance HH so constructed has a feasible matching of size kk if and only if GG has an independent set of size kk.

Since an independent set consists of at most one end-point of an edge (vi,vj)(v_{i},v_{j}), the corresponding set of items respects quota of each class CijC_{ij}. Thus, given an independent set of size kk, there is a feasible matching of size kk in the CMM instance. Similarly, given a feasible matching of size kk in the CMM instance, the set of vertices corresponding to the matched items form an independent set in GG. There cannot be two matched items ai,aja_{i},a_{j} such that (vi,vj)E(v_{i},v_{j})\in E because of the quota of the class CijC_{ij}. Part (i) of Proposition 1 follows from the hardness of approximation of MIS [Zuc06].

The MIS problem is known to be NP-hard even when the input instance consists of a graph where the maximum degree of any vertex is at most Δ\Delta, where Δ3\Delta\geq 3 [GJ90]. It is also known to be NP-Hard to approximate below a factor of O(Δlog2Δ)O(\frac{\Delta}{\log^{2}\Delta}) when Δ=O(1)\Delta=O(1) [BK19]. Part (ii) of Proposition 1 follows from this, by the same reduction, since the degree of a vertex viv_{i} in the MIS instance is the number of classes containing the corresponding item aia_{i}. ∎

3.1 Proof of Theorem 2

In this section, we consider the case when, for each platform pp and item aa, the classes containing aa can be partitioned into at most Δ\Delta laminar families. We first present a 1Δ\frac{1}{\Delta}-approximation algorithm for the case when there is only one platform. This algorithm also generalizes the maximum independent set in hypergraphs (Proposition 2). We extend this algorithm to a 1Δ+1\frac{1}{\Delta+1}-approximation algorithm for the case with multiple platforms and even to the many-to-many setting.

Single platform case

Let G=(A{p},E)G=(A\cup\{p\},E) be an instance of the CMM problem with a single platform pp and a family of classes 𝒞\mathcal{C} with the above restriction.

Reduction to the generalized maximum independent set problem: We construct from GG an instance of the generalized maximum independent set problem H=(V,EH)H=(V,E_{H}) by setting V={viaiA}V=\{v_{i}\mid a_{i}\in A\} and EH={eCC𝒞}E_{H}=\{e_{C}\mid C\in\mathcal{C}\}, and f(eC)=q(C)f(e_{C})=q(C). We call a set SVS\subseteq V feasible if for every eEe\in E , |Se|f(e)|S\cap e|\leq f(e). We call a set SVS\subseteq V maximal if SS is feasible and S{v}S\cup\{v\} is not feasible for every vVSv\in V\setminus S. Our algorithm is a simple greedy algorithm: output a maximal set of vertices. To prove the approximation, we use the following lemma.

Lemma 1.

Consider a set SVS\subseteq V and a set BVSB\subseteq V\setminus S such that SBS\cup B is a maximal set of vertices. Then for every feasible set CC such that SCS\subseteq C and CB=C\cap B=\emptyset, we have |C||S|+Δ|B||C|\leq|S|+\Delta|B|.

Proof.

We prove this by induction on |B||B|. For any pair of sets S,BS,B that satisfy the conditions of the lemma, the base case of |B|=0|B|=0 is trivially true by maximality of SBS\cup B. To prove the induction step, assume that the lemma is true for all S,BS,B where SBS\cup B is maximal and |B|k|B|\leq k. We will show that the lemma holds for all S,BS,B that satisfies the lemma conditions and where |B|=k+1|B|=k+1. Suppose, for contradiction, that we have a feasible set CC such that SC,CB=S\subseteq C,C\cap B=\emptyset and |C|>|S|+Δ|B||C|>|S|+\Delta|B|.

Now consider the set C{v}C\cup\{v\}, for some vBv\in B. If C{v}C\cup\{v\} is feasible, then we let C=C{v}C^{\prime}=C\cup\{v\}, else we construct a feasible set CC^{\prime} as below.

Consider the set of edges EvE_{v} that contain vv. We partition the set EvE_{v} into Δ\Delta laminar families and call these sets E1,E2,,EΔE_{1},E_{2},\ldots,E_{\Delta}. Since each EiE_{i} is laminar and every edge in EiE_{i} contains the vertex vv, we can arrange the edges of EiE_{i} as ei(1),ei(2),e_{i}^{(1)},e_{i}^{(2)},\ldots such that ei(j)ei(j+1)e_{i}^{(j)}\subset e_{i}^{(j+1)} for all jj. Since CC is feasible and C{v}C\cup\{v\} is not feasible, for every edge ee we have |(C{v})e|f(e)+1|(C\cup\{v\})\cap e|\leq f(e)+1, that is, the violation is by at most one. For each ii, we find the smallest jj (if any) such that ei(j)e_{i}^{(j)} has a violation of 1. We remove a vertex uiei(j)u_{i}\in e_{i}^{(j)} such that uiCBu_{i}\in C\setminus B. Note that the set C{v}uiC\cup\{v\}\setminus u_{i} is feasible for all the edges in EiE_{i} since ei(j)ei(j)e_{i}^{(j)}\subset e_{i}^{(j^{\prime})} where j>jj^{\prime}>j. Further, note that uiu_{i} exists because we assumed that SBS\cup B and hence S{v}S\cup\{v\} is feasible. We repeat this process for each laminar family and hence may have removed at most Δ\Delta vertices from C{v}C\cup\{v\} obtaining a CC^{\prime} which is feasible. Thus,

|C||C|+1Δ>|S|+1+Δ(|B|1).\displaystyle|C^{\prime}|\geq|C|+1-\Delta>|S|+1+\Delta(|B|-1).

The second inequality follows from the assumption that |C|>|S|+Δ|B||C|>|S|+\Delta|B|. Now consider the induction hypothesis for S=S{v}S^{\prime}=S\cup\{v\}, B=B{v}B^{\prime}=B\setminus\{v\}. Since |B|=k|B|=k, and CC^{\prime} is a feasible set containing SS^{\prime} and is disjoint from BB^{\prime} we have

|C||S|+1+Δ(|B|1)\displaystyle|C^{\prime}|\leq|S|+1+\Delta(|B|-1)

from the induction hypothesis. This is a contradiction. Thus, induction hypothesis is true and the lemma follows.

Let ALGALG denote any maximal independent set of HH and OPTOPT be the optimal independent set. In the above lemma, set S=ALGOPT,B=ALGOPT,C=OPTS=ALG\cap OPT,B=ALG\setminus OPT,C=OPT. The lemma implies |OPT|Δ|ALG||OPT|\leq\Delta|ALG|. This proves Proposition 2. We note that this also gives us a 1Δ\frac{1}{\Delta}-approximation for the CMM  problem in the single platform case when every item belongs to at most Δ\Delta laminar families of the platform. It is also easy to see that this algorithm runs in time O(|V||EH|)O(|V||E_{H}|). For every vertex, we add it if it does not exceed the quota of any edge it belongs to.

Multiple platforms

We can use the previous result to obtain a 1Δ+1\frac{1}{\Delta+1} approximation for the multiple platforms case via a simple O(|E|)O(|E|)-time reduction to the single platform case: For every edge (a,p)(a,p), make a new item ea,pe_{a,p}. Replace all the platforms by a single dummy platform. Since classes are subsets of the neighbourhood sets of items or platforms, they can also be seen as subsets of edges of the graph. These naturally form classes over the items ea,pe_{a,p}.This combined with the result for the single platform case gives an O(|E||𝒞|)O(|E|\cdot|\mathcal{C}|) algorithm for the multiple platform case where |𝒞||\mathcal{C}| is the total number of classes, establishing Theorem 2.

Remark 1 (Weights on items).

We remark that the same analysis goes through even if items have weights and the goal is to compute a maximum weight matching. The algorithm simply keeps matching the highest weight item that can feasibly match to the platform.

3.2 Constant number of classes

We can also prove Theorem 2 via the following general statement combined with Proposition 2. We will also need this to prove Theorem 1.

Lemma 2.

Given a polynomial time α\alpha-approximation algorithm for the many-to-one matching problem with a single platform, we can obtain a polynomial time α1+α\frac{\alpha}{1+\alpha}-approximation for the matching problem with multiple platforms.

Proof.

Suppose we have a set VV of items and a set PP of platforms. There is a hypergraph GiG_{i} and function fi:Vi+f_{i}:V_{i}\xrightarrow{}\mathbb{Z}^{+} for each platform for the associated instance of generalized maximum independent set. Let OPT(Gi)OPT(G_{i}) be the set of items chosen in graph GiG_{i} in OPT. Clearly, the set OPT(Gi)OPT(G_{i}) is a feasible set in GiG_{i}. Note that the goal is to maximize the global number of items selected. Thus, the optimum does not necessarily pick the optimal sets in each hypergraph as there may be vertices which lie in multiple hypergraphs.

Let our algorithm apply the α\alpha-approximation algorithm to G1G_{1}. Let the selected independent set be ALG(G1)V1ALG(G_{1})\subseteq V_{1}. Now apply the α\alpha-approximation to the graph induced on G2G_{2} by the vertex set V2ALG(G1)V_{2}\setminus ALG(G_{1}). Then on the graph induced on G3G_{3} by the vertex set V3ALG(G1)ALG(G2)V_{3}\setminus ALG(G_{1})\cup ALG(G_{2}) and so on. For i=1,2,3,|P|,j=1,2,3,|P|i=1,2,3,\ldots|P|,j=1,2,3,\ldots|P| define the sets,

Vi(0)\displaystyle V_{i}^{(0)} ={v:vOPT(Gi),vALG(Gj)j<i}\displaystyle=\{v:v\in OPT(G_{i}),v\notin ALG(G_{j})\ \forall\ j<i\}
j<i,Vi(j)\displaystyle\forall j<i,V_{i}^{(j)} ={v:vOPT(Gi),vALG(Gj)}\displaystyle=\{v:v\in OPT(G_{i}),v\in ALG(G_{j})\}

Then, we have

|OPT(Gi)|=k=0i1|Vi(k)||OPT(G_{i})|=\sum_{k=0}^{i-1}|V_{i}^{(k)}| (1)
|ALG(Gj)|k=j+1|P||Vk(j)||ALG(G_{j})|\geq\sum_{k=j+1}^{|P|}|V_{k}^{(j)}| (2)

because the |Vi(j)||V_{i}^{(j)}|s form a partition over OPT(Gi)OPT(G_{i})s and ALG(Gj)ALG(G_{j})s. The latter may not completely be covered by the partition, and thus we have a lower bound. Note that Vi(0)V_{i}^{(0)} is a feasible set in GiG_{i} because it is a subset of the OPT(Gi)OPT(G_{i}) which is a feasible set. Now consider the graph induced on GiG_{i} by the vertex set Vij<iALG(Gj)V_{i}\setminus\bigcup_{j<i}ALG(G_{j}). Every vertex in Vi(0)V_{i}^{(0)} is present in this graph by the definition of Vi(0)V_{i}^{(0)} and since Vi(0)V_{i}^{(0)} is a feasible set in GiG_{i}, it is feasible in any subgraph of GiG_{i}. Thus, using our α\alpha-approximation algorithm, we have

|ALG(Gi)|α|Vi(0)||ALG(G_{i})|\geq\alpha|V_{i}^{(0)}| (3)

Adding equation 3 over all ii and adding equation 2 multiplied by α\alpha over all jj we have

(1+α)j=1|P||ALG(Gj)|\displaystyle(1+\alpha)\sum_{j=1}^{|P|}|ALG(G_{j})| αj=1|P|k=j+1|P||Vk(j)|+αi=1|P||Vi(0)|\displaystyle\geq\alpha\sum_{j=1}^{|P|}\sum_{k=j+1}^{|P|}|V_{k}^{(j)}|+\alpha\sum_{i=1}^{|P|}|V_{i}^{(0)}|
(1+α)j=1|P||ALG(Gj)|\displaystyle(1+\alpha)\sum_{j=1}^{|P|}|ALG(G_{j})| αk=2|P|j=1k1|Vk(j)|+αi=1|P||Vi(0)|\displaystyle\geq\alpha\sum_{k=2}^{|P|}\sum_{j=1}^{k-1}|V_{k}^{(j)}|+\alpha\sum_{i=1}^{|P|}|V_{i}^{(0)}|
(1+α)j=1|P||ALG(Gj)|\displaystyle(1+\alpha)\sum_{j=1}^{|P|}|ALG(G_{j})| αk=1|P|j=0k1|Vk(j)|\displaystyle\geq\alpha\sum_{k=1}^{|P|}\sum_{j=0}^{k-1}|V_{k}^{(j)}|

Using equation 1,

(1+α)j=1|P||ALG(Gj)|\displaystyle(1+\alpha)\sum_{j=1}^{|P|}|ALG(G_{j})| αk=1|P||OPT(Gj)|\displaystyle\geq\alpha\sum_{k=1}^{|P|}|OPT(G_{j})|
(1+α)ALG\displaystyle\implies(1+\alpha)\ ALG αOPT\displaystyle\geq\alpha\ OPT
ALGOPT\displaystyle\implies\frac{ALG}{OPT} α1+α\displaystyle\geq\frac{\alpha}{1+\alpha}

because ALGALG and OPTOPT are partitioned perfectly into the item set for each platform, as no item can be chosen by multiple platforms. ∎

Theorem 6 (Formal version of Theorem 1).

The CMM problem can be represented as an IP with 2Δ2^{\Delta} variables if there is only one platform with Δ\Delta classes. This can be solved in time O(22Δ𝗉𝗈𝗅𝗒(n))O(2^{2^{\Delta}}{\sf poly}(n)), and also gives rise to a 12\frac{1}{2}-approximation in time O(22Δ𝗉𝗈𝗅𝗒(n))O(2^{2^{\Delta}}{\sf poly}(n)) for multiple platforms, each with Δ\Delta classes of items.

Proof.

We first reduce our instance of CMM with 11 platform to an instance of generalized maximum independent set. Let the hypergraph corresponding to the platform be HH. Let the set of hyperedges of HH be EE. Define 2E={S|SE}2^{E}=\{S~{}|~{}S\subseteq E\} to be the power set of the edge set. Let the quota of a hyperedge eEe\in E be qeq_{e}. For S2ES\in 2^{E}, let xSx_{S} be the number of vertices we pick from the set

eSeeESe¯\bigcap_{e\in S}e\cap\bigcap_{e\in E\setminus S}\overline{e}

where e¯=V(H)e\overline{e}=V(H)\setminus e. Then we have our ILP as

Maximize S2ExS\text{Maximize }\sum_{S\in 2^{E}}x_{S}

subject to

eE,\displaystyle\forall~{}e\in E,
S2E:eSxSqe\displaystyle\sum_{S\in 2^{E}:e\in S}x_{S}\leq q_{e}
S2E,\displaystyle\forall~{}S\in 2^{E},
xSmin(qS,|eSeeESe¯|)\displaystyle x_{S}\leq\min\left(q_{S},\left|\bigcap_{e\in S}e\cap\bigcap_{e\in E\setminus S}\overline{e}\right|\right)
S2E,\displaystyle\forall~{}S\in 2^{E}, xS{0,1}\displaystyle~{}x_{S}\in\{0,1\}

The above ILP has 2|E|2^{|E|} variables, and |E|+2|E||E|+2^{|E|} constraints. It is known that an ILP with nn variables and mm constraints can be solved in time exponential in nn and polynomial in mm [Len83]. Thus, when |E|=O(loglogn)|E|=O(\log\log n), where n=|A|n=|A|, the number of items, we can find the optimum solution in time polynomial in the input size. If we have that the number of posts |P||P| is greater than 1 but still a constant, then we can keep one variable xS,px_{S,p} for every type-post pair. We can similarly proceed and get a polynomial-time algorithm. ∎

3.3 Bounded Average degree

We extend the result from the previous section for a single platform to the case when the average number of laminar families of classes an item belongs to is bounded by Δ\Delta. We state it in terms of generalized maximum independent sethere. Now consider the case where the hypergraph HH constructed above has only bounded average degree of Δ\Delta.

Proof of Theorem 5.

Since the average degree is Δ\Delta, for any ff, there cannot be more than nf\frac{n}{f} vertices of degree more than fΔf\Delta. Suppose we estimate rr and set f=2rf=\frac{2}{r}. We call a vertex low degree if its degree is at most fΔf\Delta, otherwise the vertex is high degree. Then the number of low degree vertices is n(1r2)\geq n\left(1-\frac{r}{2}\right). In the graph induced by the low degree vertices, the size of the optimal independent set is at least OPT2\frac{OPT}{2}, since at most OPT2\frac{OPT}{2} vertices of high degree. We use our 1Δ\frac{1}{\Delta} approximation algorithm on the graph induced by the low degree vertices. Since this graph has maximum degree 2Δr\leq\frac{2\Delta}{r}, the size of the independent set has size rOPT4Δ\geq\frac{r\cdot OPT}{4\Delta}.

Thus, our approximation ratio is at least r4Δ\frac{r}{4\Delta}. We finally need to estimate rr. We guess a value of OPTOPT from 1 to nn and run the above procedure for each of the guesses. Amongst all the solutions that we obtain, we pick the one with the highest cardinality. This is guaranteed to do at least as well as the case when we picked the correct value of OPTOPT. ∎

4 Online algorithms

The online algorithm for Theorem 3 is essentially the same as the one in Proposition 2 and works even for an arbitrary input model. Whenever an item arrives online, we match it to a platform such that the matching remains feasible. If there is no such platform, we leave it unmatched. The output is a maximal set, which by Proposition 2, gives us the required competitive ratio. However, we point out that this only works for the unweighted version.

Since the CMM problem is NP-Hard in general, we also give online algorithms for the case where the classes form a laminar family. This version is known to have an efficient offline algorithm, via the construction of a simple flow network. A similar construction is used to compute the rank-maximal matching in [NNP19].

In this setting, we study the many-to-many CMM model (Model 2), when the classes are laminar. We assume an input model where the item set arrives in a uniformly random permutation (Model 3). For the sake of the analysis, we assume that a random variable yiy_{i} picked uniformly at random from [0,1][0,1] for every item aia_{i}, and the items arrive in the increasing order of yiy_{i}. Therefore the random vector y:=(y1,y2,,yn)\vec{y}:=(y_{1},y_{2},\ldots,y_{n}) fully describes the order of arrival of the items. We use yi\vec{y}_{-i} to represent the vector after removing yiy_{i} from y\vec{y}. We use the following greedy algorithm, and analyze its competitive ratio (in expectation): Keep an arbitrary, fixed ranking of all the platforms in PP. When an item arrives online, match it to as many platforms as possible, picking the highest ranked ones.

We use a linear programming relaxation of our problem to analyze our algorithm. We set the primal values according to the output of our algorithm, thereby ensuring the feasibility of the primal solution. Now we need to construct an appropriate dual solution. We use the following folklore fact about the well-known method of dual fitting in designing algorithms. This technique is used in [DJK13, HKT+18] among others.

In the primal LP, we have a variable xij=1x_{ij}=1\iff item aia_{i} is matched to platform pjp_{j}. We also have constraints for both the item and platform classes. In the dual LP, we have variables corresponding to constraints in the primal LP. Let the dual variables corresponding to the item and platform classes Ci(k)C_{i}^{(k)} and Cj(k)C_{j}^{(k)} be αi(k),βj(k)\alpha_{i}^{(k)},\beta_{j}^{(k)} respectively.

Primal

Maximizej:pjPi:(ai,pj)Exij\text{Maximize}\sum_{j:p_{j}\in P}\sum_{i:(a_{i},p_{j})\in E}x_{ij}

Subject to

i:aiA,k:Ci(k)\displaystyle\forall~{}i:a_{i}\in A,\forall~{}k:C_{i}^{(k)} j:(ai,pj)E,pjCi(k)xijq(Ci(k))\displaystyle\sum_{j:(a_{i},p_{j})\in E,p_{j}\in C_{i}^{(k)}}x_{ij}\leq q(C_{i}^{(k)})
j:pjP,k:Cj(k)\displaystyle\forall~{}j:p_{j}\in P,\forall~{}k:C_{j}^{(k)} i:(ai,pj)E,aiCj(k)xijq(Cj(k))\displaystyle\sum_{i:(a_{i},p_{j})\in E,a_{i}\in C_{j}^{(k)}}x_{ij}\leq q(C_{j}^{(k)})
i:aiA,j:pjP,\displaystyle\forall~{}i:a_{i}\in A,j:p_{j}\in P, 0xij1\displaystyle\qquad 0\leq x_{ij}\leq 1

Dual

Minimize i:aiAkαi(k)q(Ci(k))+j:pjPkβj(k)q(Cj(k))\text{Minimize }\sum_{i:a_{i}\in A}\sum_{k}\alpha_{i}^{(k)}q(C_{i}^{(k)})+\sum_{j:p_{j}\in P}\sum_{k}\beta_{j}^{(k)}q(C_{j}^{(k)})

Subject to

(ai,pj)E,\displaystyle\forall~{}(a_{i},p_{j})\in E, k:pjCi(k)αi(k)+k:aiCj(k)βj(k)1\displaystyle\sum_{k:p_{j}\in C_{i}^{(k)}}\alpha_{i}^{(k)}+\sum_{k:a_{i}\in C_{j}^{(k)}}\beta_{j}^{(k)}\geq 1
aiA,αi(k)0\displaystyle\forall\ a_{i}\in A,\qquad\alpha_{i}^{(k)}\geq 0 pjP,k,βj(k)0\displaystyle\quad\qquad\forall\ p_{j}\in P,\forall\ k,\qquad\beta_{j}^{(k)}\geq 0
Fact 1 (Folklore).

Suppose we can set the dual variables such that the primal objective is equal to the dual objective, and the dual constraints of the form α1\alpha\geq 1 instead satisfy 𝔼[α]F\mathop{\mathbb{E}}[\alpha]\geq F. Then, our algorithm has a competitive ratio FF in expectation.

Proof.

Consider the dual solution obtained by setting α^i(k)=𝔼[αi(k)]F,β^j(k)=𝔼[βj(k)]F\hat{\alpha}_{i}^{(k)}=\frac{\mathop{\mathbb{E}}[\alpha_{i}^{(k)}]}{F},\hat{\beta}_{j}^{(k)}=\frac{\mathop{\mathbb{E}}[\beta_{j}^{(k)}]}{F}. Clearly this is a feasible solution. Further, we have from weak duality

aiAkα^i(k)q(Ci(k))+pjPkβ^j(k)q(Cj(k))\displaystyle\sum_{a_{i}\in A}\sum_{k}\hat{\alpha}_{i}^{(k)}q(C_{i}^{(k)})+\sum_{p_{j}\in P}\sum_{k}\hat{\beta}_{j}^{(k)}q(C_{j}^{(k)}) OPT.\displaystyle\geq OPT.
Taking the expectation over the randomness of the input on both sides
𝔼[aiAkαi(k)q(Ci(k))F+pjPkβj(k)q(Cj(k))F]\displaystyle\mathop{\mathbb{E}}\left[\sum_{a_{i}\in A}\sum_{k}\frac{\alpha_{i}^{(k)}q(C_{i}^{(k)})}{F}+\sum_{p_{j}\in P}\sum_{k}\frac{\beta_{j}^{(k)}q(C_{j}^{(k)})}{F}\right] OPT\displaystyle\geq OPT
𝔼[jPi:(i,j)Exij]FOPT.\displaystyle\implies\mathop{\mathbb{E}}\left[\sum_{j\in P}\sum_{i:(i,j)\in E}x_{ij}\right]\geq F\cdot OPT.

Thus, the dual solution will certify a competitive ratio of FF in expectation. ∎

Now, we need to set the dual variables so that the dual constraints have a lower bound of FF. Let g:[0,1][0,1]g:[0,1]\to[0,1] be a monotonically increasing function to be fixed later. Initially, all dual variables are zero. When a new item arrives, we update the primal solution based on whether we matched the item or now, and update the dual solution as follows.

  • If an edge (i,j)(i,j) is chosen by the algorithm (i.e. xij=1x_{ij}=1) then set αi(j):=1\alpha_{i}^{(j)}:=1, where αi(j)\alpha_{i}^{(j)} is the dual variable corresponding to the class Ci(j)={pj}C_{i}^{(j)}=\{p_{j}\}.

  • If any class Cj(k)C^{(k)}_{j} of platform jj is tight then for all items aia_{i} in the class Cj(k)C_{j}^{(k)} set αi(j)=g(yi)\alpha_{i}^{(j)}=g(y_{i}) if we had that αi(j)=1\alpha_{i}^{(j)}=1 before the new item arrived. Fix βj(k)=0\beta_{j}^{(k^{\prime})}=0 for all kk^{\prime} such that Cj(k)Cj(k)C_{j}^{(k^{\prime})}\subset C_{j}^{(k)}. Let it remain unchanged henceforth. Also set

    βj(k):=1i:iCj(k),αi0g(yi)q(Cj(k))1maxiCj(k),αi0g(yi).\beta_{j}^{(k)}:=1-\frac{\sum_{i:i\in C_{j}^{(k)},\alpha_{i}\neq 0}g(y_{i})}{q(C_{j}^{(k)})}\geq 1-\max_{i\in C_{j}^{(k)},\alpha_{i}\neq 0}g(y_{i}).
  • If any class Ci(k)C_{i}^{(k)} of item aia_{i} is tight then set

    αi(k):=1q(Cj(k))k:Ci(k)Ci(k)αi(k)q(Ci(k))g(yi).\alpha_{i}^{(k)}:=\frac{1}{q(C_{j}^{(k)})}\sum_{k^{\prime}:C_{i}^{(k^{\prime})}\subset C_{i}^{(k)}}\alpha_{i}^{(k^{\prime})}q(C_{i}^{(k^{\prime})})\geq g(y_{i}).

    Fix αik=0\alpha_{i}^{k^{\prime}}=0 for all kk^{\prime} such that Ci(k)Ci(k)C_{i}^{(k^{\prime})}\subset C_{i}^{(k)}. Let it remain unchanged henceforth.

It can be easily seen that the dual objective function is equal to the primal objective function. It remains to be shown that the dual constraints are always greater than some FF in expectation.

The following is the key lemma in analyzing how the algorithm behaves depending on y\vec{y}. Although it is inspired by [DJK13, HKT+18, GM08], our many-to-many model (Model 2) is more complicated in that moving one vertex up the ranking can cause more changes to the matching because an item can match to multiple platforms. Even apart from the platform classes, we must take care of item classes as well. To that end, we show the following lemma.

Lemma 3.

For any i,ji,j such that jij\neq i, if an item aja_{j} is matched to some platforms at yi=1y_{i}=1, then it cannot be unmatched from any platform at yi=θ[0,1]y_{i}=\theta\in[0,1] due to an item class.

Proof.

Suppose the platforms are ranked p1p2p3p_{1}\succ p_{2}\succ p_{3}\ldots and the items arrive in the order a1,a2,a_{1},a_{2},\ldots so that y1<y2y_{1}<y_{2}\ldots. We first fix an ii. We will prove this on induction for jj. That is, we first show that the lemma is true for item a1a_{1} (ie j=1j=1) and then inductively argue that it has to be true for every jj.

For the base case, suppose a1a_{1} is matched to pup_{u} when yi=1y_{i}=1. Then if yi(y1,1]y_{i}\in(y_{1},1], item a1a_{1} is unaffected and the statement is true. Now let yi<y1y_{i}<y_{1}. We consider the changes that yiy_{i} brings. The only way a1a_{1} can get unmatched from some platform due to an item class is if the following chain of events ocurred. aia_{i} matches to some platform pup_{u}, forcing a1a_{1} to unmatch from pup_{u} due to a platform class. a1a_{1} matches to a platform pvp_{v}, which it couldn’t do before because pu,pvp_{u},p_{v} belonged to a tight item class C1C_{1}. a1a_{1} is forced to unmatch from some platform pwp_{w} because pv,pwp_{v},p_{w} belong to a tight item class C2C_{2}. Note that both C1,C2C_{1},C_{2} contain pvp_{v} and by laminarity, one class must contain the other. We can argue that in either case, we get a contradiction.

Suppose the induction hypothesis is true up to (but not including) some jj. Then we will show that it is true for aja_{j} as well. Suppose not. Then for yi=θy_{i}=\theta, aja_{j} is unmatched from some pup_{u} due to an item class C1C_{1}. Then, there is a platform pvC1p_{v}\in C_{1} such that aja_{j} was not matched to pvp_{v} at yi=1y_{i}=1, but replaced pup_{u} at yi=θy_{i}=\theta. This replacement can happen only if pvpup_{v}\succ p_{u}.

Why was pvp_{v} not matched at yi=1y_{i}=1? Through a similar argument as in the base case, it can be seen that it is not possible due to an item class of aja_{j}. Thus, pvp_{v} could not match to aja_{j} at yi=1y_{i}=1 due to a platform class (let it be C2C_{2}). Since it could match at yi=θy_{i}=\theta, there must be some item aka_{k} that was matched to pvp_{v} at yi=1y_{i}=1 but not at yi=θy_{i}=\theta. Then, it must be that yk<yjy_{k}<y_{j}.

Why was aka_{k} unmatched from pvp_{v} at yi=θy_{i}=\theta? By the induction hypothesis, it must be due to a platform class of pvp_{v}. Let it be C3C_{3}. Then there is an item ala_{l} that is matched to pvp_{v} at yi=θy_{i}=\theta but not at yi=1y_{i}=1, such that yl<yky_{l}<y_{k}. Now consider C2,C3C_{2},C_{3}. Since akC2C3a_{k}\in C_{2}\cap C_{3}, one class must contain the other by laminarity. We can argue that in both cases, we get a contradiction. ∎

Once we have the lemma, we show Theorem 4 the following way. Let α1\alpha\geq 1 be such a dual constraint. We want to show that 𝔼[α]F\mathop{\mathbb{E}}\left[\alpha\right]\geq F or equivalently, 𝔼yi[𝔼yi[α]]F\mathop{\mathbb{E}}_{y_{-i}}\left[\mathop{\mathbb{E}}_{y_{i}}\left[\alpha\right]\right]\geq F. We look at the inner expectation. We fix yiy_{-i} and vary yiy_{i} from 0 to 1, and show using dual-fitting arguments and Lemma 3 that 𝔼[α](11e)\mathop{\mathbb{E}}\left[\alpha\right]\geq\left(1-\frac{1}{e}\right). From Fact 1, this completes the proof of Theorem 4.

Proof of Theorem 4.

Consider a fixed platform pjp_{j}. Suppose that some item class that aia_{i} is in is tight until yi=θy_{i}=\theta. Thus, we have

k:pjCi(k)α1(k)g(y1).\sum_{k:p_{j}\in C_{i}^{(k)}}\alpha_{1}^{(k)}\geq g(y_{1}).

until yi=θy_{i}=\theta. Afterwards, we have two cases,

  1. 1.

    Case 1: At yi=θy_{i}=\theta, aia_{i} matches to pjp_{j}. Note that kαi(k)g(yi)\sum_{k}\alpha_{i}^{(k)}\geq g(y_{i}) remains true as long as aia_{i} is matched to pjp_{j}.

    1. (a)

      Case 1(a): aia_{i} remains matched to pjp_{j} until yi=1y_{i}=1. Then the previous inequality kαi(k)g(yi)\sum_{k}\alpha_{i}^{(k)}\geq g(y_{i}) continues to hold and we have

      𝔼yi[kαi(k)]01g(yi)𝑑yi.\displaystyle\mathop{\mathbb{E}}_{y_{i}}\left[\sum_{k}\alpha_{i}^{(k)}\right]\geq\int_{0}^{1}g(y_{i})dy_{i}.
    2. (b)

      Case 1(b): aia_{i} becomes unmatched from pjp_{j} at some point when yi=θ>θy_{i}=\theta^{\prime}>\theta due to a class of pjp_{j}. In this case some platform class (say C(1)C^{(1)}) must have been tight. We claim that in this case, at least one class of pjp_{j} that aia_{i} belongs to is tight regardless of the value of yiy_{i}.

      Clearly, increasing the value of yiy_{i} beyond θ\theta^{\prime} does not affect the tightness of C(1)C^{(1)}. Thus, the class is tight even at yi=1y_{i}=1. Now at any other value of yiy_{i}, if the class is not tight then some item must’ve been replaced. By lemma 3, it must have been due to a platform constraint (say C(2)C^{(2)}). In this case, we have either

      • C(1)C(2)C^{(1)}\subset C^{(2)}, in which case aia_{i} also belongs to this tight class.

      • C(2)C(1)C^{(2)}\subset C^{(1)}, in which case the replacing element does not reduce the number of elements matched in C(1)C^{(1)} (and cannot relax the constraint).

      Since the highest rank of the items matched to pjp_{j} in the tight class (either C(1)C^{(1)} or C(2)C^{(2)}) is at most θ\theta^{\prime}, and kαi(k)g(yi)\sum_{k}\alpha_{i}^{(k)}\geq g(y_{i}) remained true until yi=θy_{i}=\theta^{\prime} we have

      𝔼yi[kαi(k)+kβj(k)]0θg(yi)𝑑yi+1g(θ).\mathop{\mathbb{E}}_{y_{i}}\left[\sum_{k}\alpha_{i}^{(k)}+\sum_{k}\beta_{j}^{(k)}\right]\geq\int_{0}^{\theta^{\prime}}g(y_{i})dy_{i}+1-g(\theta^{\prime}).
    3. (c)

      Case 1(c): aia_{i} becomes unmatched from pjp_{j} at some point when yi=θ>θy_{i}=\theta^{\prime}>\theta due to a class of aia_{i}. We will show that this case is not possible.

      Suppose that at yi=θ>θy_{i}=\theta^{\prime}>\theta, item aia_{i} got matched to pkp_{k}, which prevented aia_{i} from matching to pjp_{j}. Thus, pj,pkC(1)p_{j},p_{k}\in C^{(1)} for some class which was tight. Since aia_{i} could not match to pjp_{j} at yi=θy_{i}=\theta, it must be that it was prevented from doing so owing to a item class. If it was due to a platform class, then it would not be possible for it to match at yi=θy_{i}=\theta^{\prime} since it now has a worse rank than before.

      Thus, there is some plp_{l} such that aia_{i} was matched to plp_{l} at yi=θy_{i}=\theta (but not at yi=θy_{i}=\theta^{\prime}) and pl,pkC(2)p_{l},p_{k}\in C^{(2)} for another class which was tight. Again, due to laminarity and the non-empty intersection of C(1)C^{(1)} and C(2)C^{(2)} we have

      • If C(1)C(2)C^{(1)}\subset C^{(2)} then it should not have been possible to match pjp_{j} at yi=θy_{i}=\theta because C(2)C^{(2)} was tight.

      • If C(2)C(1)C^{(2)}\subset C^{(1)}, then pkp_{k} is not the replacing element since matching pkp_{k} and unmatching plp_{l} cannot relax the constraint.

  2. 2.

    Case 2: aia_{i} never matches to pjp_{j}. We assumed that some item class was tight till yi=θy_{i}=\theta. After that, since it was not possible for aia_{i} to match to pjp_{j}, then some class of pjp_{j} that aia_{i} belonged to was tight. By a similar logic as before, it can be seen that a class is tight regardless of the value of yiy_{i} and the highest rank of any item in the class is θ\theta. Thus, we have

    𝔼yi[kαi(k)+kβj(k)]0θg(yi)𝑑yi+1g(θ).\displaystyle\mathop{\mathbb{E}}_{y_{i}}\left[\sum_{k}\alpha_{i}^{(k)}+\sum_{k}\beta_{j}^{(k)}\right]\geq\int_{0}^{\theta}g(y_{i})dy_{i}+1-g(\theta).

    Note that the case where θ=1\theta=1 is when some class of aia_{i} always prevented aija_{i}^{j} from matching to pjp_{j}. In this case, like before we have 𝔼[kαi(k)]01g(yi)𝑑yi\mathop{\mathbb{E}}\left[\sum_{k}\alpha_{i}^{(k)}\right]\geq\int_{0}^{1}g(y_{i})dy_{i}.

Thus, we have that

𝔼yi[𝔼yi[kαi(k)+kβj(k)]]\displaystyle\mathop{\mathbb{E}}_{\vec{y}_{-i}}\left[\mathop{\mathbb{E}}_{y_{i}}\left[\sum_{k}\alpha_{i}^{(k)}+\sum_{k}\beta_{j}^{(k)}\right]\right]
min(01g(yi)𝑑yi,minθ[0,1](0θg(yi)𝑑yi+1g(θ)))\displaystyle\geq\min\left(\int_{0}^{1}g(y_{i})dy_{i},\min_{\theta\in[0,1]}\left(\int_{0}^{\theta}g(y_{i})dy_{i}+1-g(\theta)\right)\right)

as required. ∎

5 Experiments

In this section, we present the experimental evaluation of our offline algorithms from Theorem 1 and Theorem 2. We use a total of seven datasets which we categorize as real-world and synthetic datasets. The three real-world datasets are sourced from an elective allocation process at an educational institution. The four synthetic datasets are generated as described below. All experiments were run on a laptop running on a 64-bit Windows 10 Home edition, and equipped with an Intel Core i7-7500U CPU @2.7GHz and 12GB of RAM. For solving integer programs, we used IBM ILOG CPLEX Optimization Studio 20.1 through its Python API. All code was written to run on Python 3.8.

Dataset 12\frac{1}{2}-approx Δ\Delta-approx OPT
Real-1 1871.5 (0.92) 1899.8 (0.93) 2035 (1)
Real-2 1988.6 (0.92) 2014.0 (0.93) 2170 (1)
Real-3 1938.6 (0.92) 1936.7 (0.92) 2107 (1)
Table 1: Comparison of (average) solution values on the real-world datasets. Relative values are in parentheses.
Dataset 12\frac{1}{2}-approx Δ\Delta-approx OPT
Real-1 0.39 (1.23) 0.11 (4.29) 0.48 (1)
Real-2 0.43 (1.03) 0.11 (3.89) 0.44 (1)
Real-3 0.33 (1.23) 0.10 (3.90) 0.40 (1)
Table 2: Comparison of (average) running-times in seconds on the real-world datasets. Relative speedups are in parentheses.
Dataset 12\frac{1}{2}-approx Δ\Delta-approx OPT
large-dense 239552 (0.97) 239566.4 (0.97) 247537 (1)
large-sparse 212600.1 (0.97) 211885.1 (0.97) 218622 (1)
small-sparse 72676.4 (0.93) 72821.5 (0.93) 78279 (1)
small-dense 75887.7 (0.95) 76133.4 (0.95) 79827 (1)
Table 3: Comparison of (average) solution values in the synthetic datasets. Relative values are in parentheses.
Dataset 12\frac{1}{2}-approx Δ\Delta-approx OPT
large-dense 5.68 (14.41) 2.90 (28.21) 81.99 (1)
large-sparse 4.67 (15.14) 2.19 (32.19) 70.73 (1)
small-sparse 1.55 (3.00) 0.46 (10.07) 4.68 (1)
small-dense 1.73 (5.39) 0.58 (16.14) 9.37 (1)
Table 4: Comparison of (average) running-times in seconds in the synthetic datasets. Relative speedups are in parentheses.

Real-world datasets:

We use data from three course-registration periods at an educational institution. Each dataset has around 100 courses and 2000 students. The students and the courses correspond to items and platforms respectively in our model. The edges represent the courses that a student is interested in. The students are partitioned into 13 departments (majors) as well as 5 batches (1st year–5th year). Each course has an overall quota denoting the maximum number of students that can be allotted to it. For each course, we introduce a quota for each department and a quota for each batch. Each course belongs to one of two categories, and each student can be matched to at most one course of each category. The goal is to maximize the number of edges selected subject to these constraints. This can be immediately viewed as an instance of CMM.

Synthetic Datasets:

Modelled on the real-world datasets, we synthetically generate large instances and compare the performance of our algorithms to the optimal algorithm implemented using a matching Integer Linear Program. The synthetic datasets are generated as follows. Datasets labelled ‘large’ have 500 courses, and 20 departments with 10,000 students in each department. The datasets labelled ‘small’ have 300 courses, and 20 departments with 2,000 students in each department. The students have a degree that is chosen uniformly at random between 3 and 10 in the ‘dense’ datasets and between 3 and 5 in the ‘sparse’ datasets. Students choose their courses randomly based on a non-uniform probability distribution. This distribution is defined by assigning a random ‘popularity’ value to each course. We observe this feature in the real-world dataset, where all courses are not equally popular. We also experiment without this feature, and obtain similar results.  

We compare our performance and running-time with the optimal solution obtained by solving the standard Matching ILP augmented with the constraints for each class. All running-times include the time taken for file I/O. The solution values and running-times are averaged over 10 runs. Though our algorithms are deterministic, these implementations utilize some randomness because of the use of hash-tables. Observe that since we have two laminar families of classes, Theorem 1 and Theorem 2 provide theoretical guarantees of only 12\frac{1}{2} and 13\frac{1}{3} respectively. However, the performance of the algorithms on both real-world and random data are close to optimal. All our tables provide absolute values of the solution value and running-time of the algorithm from Theorem 1 (column 12\frac{1}{2}-approx) and algorithm from Theorem 2 (column Δ\Delta-approx), as well as the relative value or relative speedup in comparison to that of the Matching ILP (column OPT).

5.1 Observations

Table 1 and Table 2 provide the solution values and running times for real-world instances whereas Table 3 and Table 4 provide the same for the synthetically datasets. In both the real-world and synthetic datasets, both of our algorithms output solutions with value at least 90% of the optimum value. This seems to suggest that both real-world or random settings are ‘easier’ than the worst-case instances for our algorithms. Furthermore, we believe that the significantly improved running-time more than makes up for loss of 10% in the output value. The biggest speedups are observed in the ‘large’ datasets, where our algorithms achieve speedups of 15×15\times and 30×30\times respectively. This is expected because the ILP takes time exponential in the size of the graph.

5.2 Additional Synthetic Datasets

In addition to the previous results, we evaluate the performance of our algorithms on synthetically generated datasets where the adjacency for each vertex was generated uniformly at random. That is, we did not use the ‘popularity’ measure of the courses when selecting adjacent courses for a student. Like before, datasets labelled ‘large’ have 500 courses, and 20 departments with 10,000 students in each department. The datasets labelled ‘small’ have 300 courses, and 20 departments with 2,000 students each in each department. In the datasets labelled ‘dense’, students have a degree that is chosen uniformly at random between 3 and 10, and in datasets labelled ‘sparse’, students have a degree that is chosen uniformly at random between 3 and 5. Students choose their courses randomly based on a uniform probability distribution over the courses, while ensuring that they apply to at least one course from each category. Table 5 and Table 6 provide the solution values and running times for the synthetically generated datasets described here. We observe a similar pattern here. Our algorithms achieve at least 95% of the optimal solution in each case, while being faster than the Matching ILP (OPT).

Dataset 12\frac{1}{2}-approx Δ\Delta-approx OPT
large-dense 245650.0 (1) 245650.0 (1) 245650 (1)
large-sparse 251420.9 (0.99) 251304.1 (0.99) 251840 (1)
small-sparse 74850.7 (0.95) 74914.4 (0.95) 78692 (1)
small-dense 77839.0 (0.97) 77848.1 (0.97) 79849 (1)
Table 5: Comparison of (average) solution values for the second set of synthetic datasets.
Dataset 12\frac{1}{2}-approx Δ\Delta-approx OPT
large-dense 5.91 (24.97) 3.05 (48.41) 147.72 (1)
large-sparse 4.74 (17.52) 2.30 (36.09) 83.07 (1)
small-sparse 1.60 (2.40) 0.50 (7.62) 3.83 (1)
small-dense 1.71 (4.53) 0.58 (13.29) 7.78 (1)
Table 6: Comparison of (average) running times for the second set of synthetic datasets. All times are in seconds.

6 Conclusion

In this paper we gave approximation algorithms for the CMM problem in various offline and online settings. Improving these approximation factors or showing matching lower bounds are natural open questions. There are existing algorithms that break the 11/e1-1/e barrier for online bipartite matching (without group fairness constraints) [FMMM09, KMT11]; obtaining similar bounds for online CMM is also an interesting open problem.

Acknowledgements

We acknowledge some initial discussions with Ajay Saju Jacob. We are grateful to the anonymous reviewers for their comments. AL was supported in part by SERB Award ECR/2017/003296 and a Pratiksha Trust Young Investigator Award. MN and PN are supported in part by SERB Award CRG/2019/004757.

References

  • [AHL13] Geir Agnarsson, Magnús M. Halldórsson, and Elena Losievskaja, Sdp-based algorithms for maximum independent set problems on hypergraphs, Theoretical Computer Science 470 (2013), 1–9.
  • [AS03] Atila Abdulkadiroglu and T. Sönmez, School choice: A mechanism design approach, The American Economic Review 93 (2003), no. 3, 729–747.
  • [BCFN19] Suman Bera, Deeparnab Chakrabarty, Nicolas Flores, and Maryam Negahbani, Fair algorithms for clustering, NeurIPS, 2019, pp. 4955–4966.
  • [BCZ+16] Tolga Bolukbasi, Kai-Wei Chang, James Zou, Venkatesh Saligrama, and Adam Kalai, Man is to computer programmer as woman is to homemaker? debiasing word embeddings, NIPS, 2016, p. 4356–4364.
  • [BDLK20] Kinjal Basu, Cyrus DiCiccio, Heloise Logan, and Noureddine El Karoui, A framework for fairness in two-sided marketplaces, arXiv preprint arXiv:2006.12756 (2020).
  • [BFIM10] Péter Biró, Tamás Fleiner, Robert W. Irving, and David F. Manlove, The college admissions problem with lower and common quotas, Theoretical Computer Science 411 (2010), no. 34-36, 3136–3153.
  • [BK19] Amey Bhangale and Subhash Khot, Ug-hardness to np-hardness by losing half, pp. 3:1–3:20, 2019.
  • [CHRG16] Matthew Costello, James Hawdon, Thomas Ratliff, and Tyler Grantham, Who views online extremism? individual attributes leading to exposure, Computers in Human Behavior 63 (2016), 311–320.
  • [CSV18] L. Elisa Celis, Damian Straszak, and Nisheeth K. Vishnoi, Ranking with fairness constraints, ICALP, vol. 107, 2018, pp. 28:1–28:15.
  • [DJK13] Nikhil R. Devanur, Kamal Jain, and Robert D. Kleinberg, Randomized primal-dual analysis of ranking for online bipartite matching, SODA, 2013, pp. 101–107.
  • [DJSW11] Nikhil R. Devanur, Kamal Jain, Balasubramanian Sivan, and Christopher A. Wilkens, Near optimal online algorithms and fast approximation algorithms for resource allocation problems, Proc. of ACM Conf. on Electronic commerce, 2011, pp. 29–38.
  • [FK12] Tamás Fleiner and Naoyuki Kamiyama, A matroid approach to stable matchings with lower quotas, SODA, 2012, pp. 135–142.
  • [FMMM09] Jon Feldman, Aranyak Mehta, Vahab S. Mirrokni, and S. Muthukrishnan, Online stochastic matching: Beating 1-1/e, FOCS, 2009, pp. 117–126.
  • [GIK+16] Masahiro Goto, Atsushi Iwasaki, Yujiro Kawasaki, Ryoji Kurata, Yosuke Yasuda, and Makoto Yokoo, Strategyproof matching with regional minimum and maximum quotas, Artificial intelligence 235 (2016), 40–57.
  • [GJ90] Michael R. Garey and David S. Johnson, Computers and intractability; a guide to the theory of np-completeness, W. H. Freeman & Co., 1990.
  • [GJKR18] Stephen Gillen, Christopher Jung, Michael Kearns, and Aaron Roth, Online learning with an unknown fairness metric, NIPS, 2018, pp. 2605–2614.
  • [GM08] Gagan Goel and Aranyak Mehta, Online budgeted matching in random input models with applications to adwords, SODA, vol. 8, 2008, pp. 982–991.
  • [GSB20] David García-Soriano and Francesco Bonchi, Fair-by-design matching, Data Mining and Knowledge Discovery (2020), 1–45.
  • [HKT+18] Zhiyi Huang, Ning Kang, Zhihao Gavin Tang, Xiaowei Wu, Yuhao Zhang, and Xue Zhu, How to match when all vertices arrive online, STOC, 2018, pp. 17–29.
  • [HL09] Magnús M. Halldórsson and Elena Losievskaja, Independent sets in bounded-degree hypergraphs, Discrete applied mathematics 157 (2009), no. 8, 1773–1786.
  • [HLL12] Hassan Halabian, Ioannis Lambadaris, and Chung-Horng Lung, Optimal server assignment in multi-server parallel queueing systems with random connectivities and random service failures, IEEE International Conference on Communications, 2012, pp. 1219–1224.
  • [Hua10] Chien-Chung Huang, Classified stable matching, SODA, 2010, pp. 1235–1253.
  • [KEKM08] Martin Kutz, Khaled Elbassioni, Irit Katriel, and Meena Mahajan, Simultaneous matchings: Hardness and approximation, Journal of Computer and System Sciences 74 (2008), no. 5, 884–897.
  • [KK12] Yuichiro Kamada and Fuhito Kojima, Stability and strategy-proofness for matching with constraints: A problem in the japanese medical match and its solution, American Economic Review 102 (2012), no. 3, 366–70.
  • [KK15]  , Efficient matching under distributional constraints: Theory and applications, American Economic Review 105 (2015), no. 1, 67–99.
  • [KMM15] Matthew Kay, Cynthia Matuszek, and Sean A. Munson, Unequal representation and gender stereotypes in image search results for occupations, Proc. of ACM Conf. on Human Factors in Computing Systems, 2015, pp. 3819–3828.
  • [KMT11] Chinmay Karande, Aranyak Mehta, and Pushkar Tripathi, Online bipartite matching with unknown distributions, STOC, 2011, pp. 587–596.
  • [Len83] H. W. Lenstra, Integer programming with a fixed number of variables, Mathematics of operations research 8 (1983), no. 4, 538–548.
  • [MAW99] Nick McKeown, Venkat Anantharam, and Jean Walrand, Achieving 100% throughput in an input-queued switch, vol. 47, 1999, pp. 1260–1267.
  • [Meh13] Aranyak Mehta, Online matching and ad allocation, Foundations and Trends® in Theoretical Computer Science 8 (2013), no. 4, 265–368.
  • [MSVV07] Aranyak Mehta, Amin Saberi, Umesh Vazirani, and Vijay Vazirani, Adwords and generalized online matching, J. ACM 54 (2007), no. 5, 22–es.
  • [MX20] Will Ma and Pan Xu, Group-level fairness maximization in online bipartite matching, arXiv preprint arXiv:2011.13908 (2020).
  • [NNP19] Meghana Nasre, Prajakta Nimbhorkar, and Nada Pulath, Classified rank-maximal matchings and popular matchings – algorithms and hardness, WG, 2019, pp. 244–257.
  • [PKL21] Deval Patel, Arindam Khan, and Anand Louis, Group fairness for knapsack problems, AAMAS, 2021, p. 1001–1009.
  • [SBZ+19] Tom Sühr, Asia J. Biega, Meike Zehlike, Krishna P. Gummadi, and Abhijnan Chakraborty, Two-sided fairness for repeated matchings in two-sided markets: A case study of a ride-hailing platform, KDD, 2019, pp. 3082–3092.
  • [Zuc06] David Zuckerman, Linear degree extractors and the inapproximability of max clique and chromatic number, STOC, 2006, pp. 681–690.