Popularity at Minimum Cost
aa r X i v : . [ c s . D S ] S e p Popularity at Minimum Cost ⋆ Telikepalli Kavitha , Meghana Nasre , Prajakta Nimbhorkar Tata Institute of Fundamental Research, India. [email protected] Indian Institute of Science, India. [email protected] The Institute of Mathematical Sciences, India. [email protected]
Abstract.
We consider an extension of the popular matching problemin this paper. The input to the popular matching problem is a bipartitegraph G = ( A ∪ B , E ), where A is a set of people, B is a set of items, andeach person a ∈ A ranks a subset of items in an order of preference, withties allowed. The popular matching problem seeks to compute a matching M ∗ between people and items such that there is no matching M wheremore people are happier with M than with M ∗ . Such a matching M ∗ is called a popular matching. However, there are simple instances whereno popular matching exists.Here we consider the following natural extension to the above problem:associated with each item b ∈ B is a non-negative price cost ( b ), thatis, for any item b , new copies of b can be added to the input graph bypaying an amount of cost ( b ) per copy. When G does not admit a popularmatching, the problem is to “augment” G at minimum cost such thatthe new graph admits a popular matching. We show that this problemis NP-hard; in fact, it is NP-hard to approximate it within a factor of √ n /
2, where n is the number of people. This problem has a simplepolynomial time algorithm when each person has a preference list oflength at most 2. However, if we consider the problem of constructing agraph at minimum cost that admits a popular matching that matches allpeople, then even with preference lists of length 2, the problem becomesNP-hard. On the other hand, when the number of copies of each item is fixed , we show that the problem of computing a minimum cost popularmatching or deciding that no popular matching exists can be solved in O ( mn ) time, where m is the number of edges. The popular matching problem deals with matching people to items, where eachperson ranks a subset of items in an order of preference, with ties allowed. Theinput is a bipartite graph G = ( A ∪ B , E ) where A is the set of people, B is theset of items and the edge set E = E ∪ · · · ∪ E r ( E i is the set of edges of rank i ). For any a ∈ A , we say a prefers item b to item b ′ if the rank of edge ( a, b ) issmaller than the rank of edge ( a, b ′ ). If the ranks of ( a, b ) and ( a, b ′ ) are the same, ⋆ This work was done as part of the DST-MPG partner group “Efficient Graph Algo-rithms”. hen a is indifferent between b and b ′ . The goal is to match people with itemsin an optimal manner, where the definition of optimality will be a function ofthe preferences expressed by the elements of A . The problem of computing suchan optimal matching is a well studied problem and several notions of optimalityhave been considered so far; for instance, pareto-optimality [1], rank-maximality[4], and fairness.One criterion that does not use the absolute values of the ranks is the notionof popularity . Let M ( a ) denote the item to which a person a is matched in amatching M . We say that a person a prefers matching M to M ′ if (i) a ismatched in M and unmatched in M ′ , or (ii) a is matched in both M and M ′ ,and a prefers M ( a ) to M ′ ( a ). Definition 1. M is more popular than M ′ , denoted by M ≻ M ′ , if the numberof people who prefer M to M ′ is higher than those that prefer M ′ to M . Amatching M ∗ is popular if there is no matching that is more popular than M ∗ . Popular matchings were first introduced by G¨ardenfors [3] in the context ofstable matchings for two-sided preference lists (here both sides of the graph G express preferences). In the domain of one-sided preference lists, popular match-ings can be considered to be stable as no majority vote of people can forcea migration to another matching; also, popularity is based on relative rankingrather than the actual ranks used by people. These properties make popularitya desirable notion of optimality in the domain of one-sided preferences.On the flip side, popularity does not provide a complete answer since thereexist simple instances that do not admit any popular matching. An example isthe following: let A = { a , a , a } , B = { b , b , b } , and each person a i , for i =1 , ,
3, prefers b to b , and b to b . Consider the three symmetrical matchings M = { ( a , b ), ( a , b ), ( a , b ) } , M = { ( a , b ), ( a , b ), ( a , b ) } and M = { ( a , b ), ( a , b ), ( a , b ) } . None of these matchings is popular, since M ≺ M , M ≺ M , and M ≺ M . Abraham et al. [2] designed efficient algorithms fordetermining if a given instance admits a popular matching and computing one,if it exists.The fact that popular matchings do not always exist has motivated severalextensions to the popular matching problem. McCutchen [10] considered theproblem of computing a least unpopular matching; he considered two measuresof unpopularity and showed that computing a matching that minimized either ofthese measures is NP-hard. Kavitha et al. [5] generalized the notion of popularityto mixed matchings or probability distributions over matchings and showed thata popular mixed matching always exists. Our problem.
Here we consider another natural generalization to the popularmatching problem: augment the input graph G such that the new graph admitsa popular matching. Our input consists of G = ( A ∪ B , E ) and a function cost : B → R + , where cost ( b ) for any b ∈ B is the cost of making a new copy of item b . The set B is a set of items, say books or DVDs, and new copies of any b ∈ B can be obtained by paying cost ( b ) for each new copy of b . There is no restriction2n the number of copies of any item that can be made. The only criterion thatwe seek to optimize is the total cost of augmenting G .Going to back to the earlier example on 3 people and 3 items that did notadmit a popular matching, it is easy to show that by making a new copy of either b or b , the resulting graph admits a popular matching. In order to minimizethe cost, we will make a new copy of that item in { b , b } which has lower cost.Our starting graph G = ( A ∪ B , E ) comes for free, every addition that we maketo G comes at a price and our goal is to make these additions such that the newgraph admits a popular matching and the total cost of additions is minimized.We call this the min-cost augmentation problem. A related problem.
A related problem is the following: we do not have astarting graph G . We are given a set A of people and their preference lists overa universe U of items where each item b ∈ U has a price cost ( b ) ≥ G = ( A ∪ B , E ) where B is a multiset of some elements in U such that G admits a popular matching andthe cost of constructing G , that is, P b ∈B cost ( b ), is as small as possible. Here wealso have an extra condition that the popular matching should leave no personunmatched, otherwise we have a trivial solution of B = ∅ . We call this problemthe min-cost popular instance problem.The above problem can also be regarded as a “gift buying” problem. Eachperson in A has a preference list over gifts that she would like to receive. Theproblem is to buy a gift for each person in A with the total cost as small aspossible and assign each person a gift such that this assignment is popular. Thatis, there is no reassignment of gifts that makes more people happier. This is themin-cost popular instance problem. We show the following results in this paper:1. The min-cost popular instance problem is NP-hard, even when each prefer-ence list has length at most 2 (i.e., every person has a top choice item andpossibly, a second choice item).2. The min-cost augmentation problem has a polynomial time algorithm wheneach preference list has length at most 2 .3. The min-cost augmentation problem is NP-hard for general lists. In fact,it is NP-hard to approximate to within a factor of √ n /
2, where n is thenumber of people.All our NP-hardness results hold even when preference lists are derived froma master list . A master list is a total ordering of the items according to someglobal objective criterion. Thus if b precedes b in the master list and if a person a has both b and b in her list, then it has to be the case that b precedes b in a ’s list. 3e would like to contrast the NP-hardness of the min-cost augmentationproblem with the problem of determining a popular matching with variable jobcapacities [7]. In this problem the input is a graph G = ( A ∪ B , E ) where A is aset of people and B is a set of jobs, we are also given a list h c , . . . , c |B| i denotingupper bounds on the capacities of each job. The problem is to determine ifthere exists ( x , . . . , x |B| ) such that for each i , setting the capacity of the i -thjob to x i , where 1 ≤ x i ≤ c i , enables the resulting graph to admit a popularmatching. This problem was shown to be NP-hard in [7]; however note that herethe capacity of each job has an upper bound. Instead, if we only had to maintainan overall upper bound on the total increase of capacities rather than individualupper bounds, a simple polynomial time algorithm solves this problem [7].In the min-cost augmentation problem recall that there is no upper bound onthe amount that we can spend on a particular item. What we seek to optimizeis the overall cost and this problem is NP-hard. Note that when each item hasthe same cost, then this problem can be solved in polynomial time (using theabove algorithm from [7]). However when the costs come from { , } the problembecomes NP-hard.The NP-hardness results for the min-cost augmentation/min-cost popularinstance problems are because the number of copies of each of the items need tobe determined so as to ensure the existence of a popular matching at minimumcost. Let copies ( b ) for any item b ∈ B denote the number of copies of item b inour graph G . We now consider the following problem: each b ∈ B has a fixed number of copies denoted by copies ( b ) and let the cost of a matching M be thesum of costs of items that are matched in M (we have to pay a cost of k. cost ( b )if k copies of item b are used in M , where k ≤ copies ( b )). Our final result is apolynomial time algorithm for the min-cost popular matching problem which wedefine below. ∗ The min-cost popular matching problem is to determine if G admits a pop-ular matching or not and if so, to compute the one with minimum cost.We show that this problem can be solved in O ( mn ) time, where m is thenumber of edges and n is the number of people. Manlove and Sng consid-ered this problem without costs in the context of House Allocation. Thereitems were called houses and copies of items as in our case were representedusing capacities for houses. They called it Capacitated House Allocationwith Ties (CHAT) and the problem was to determine if G admits a popularmatching or not, and if so, to compute one. Manlove and Sng [9] showed an O (( √ C + n ) m ) algorithm for the CHAT problem, where C is the sum ofcapacities of all items. Thus, our algorithm improves upon the algorithm in[9]. Abraham et al. [2] considered the problem of determining if a given graph G =( A ∪ B , E ) admits a popular matching or not, and if so, computing one. They4lso gave a structural characterization of graphs that admit popular matchings.Section 2 outlines this characterization and the algorithm that follows from it.Subsequent to this work, several variants of the popular matchings problemhave been considered. One line of research has been on generalizations of thepopular matchings problem while the other direction has been to deal with in-stances that do not admit any popular matchings. The generalizations includethe capacitated version studied by Manlove and Sng [9], the weighted versionstudied by Mestre [12] and random popular matchings studied by Mahdian [8].Kavitha and Nasre [6] as well as McDermind and Irving [11] independently stud-ied the problem of computing an optimal popular matching for strict instanceswhere the notion of optimality is specified as a part of the input. Note that theyalso considered the min-cost popular matchings but in this version the costs areassociated with edges whereas in our problem costs are associated with items.As described earlier, the line of research pursued for instances that do not admitpopular matchings includes the NP-hardness of least unpopular matchings [10],the existence and algorithms for popular mixed matchings [5] and NP-hardnessof the popular matchings problem with variable job capacities [7].
Organization of the paper.
Section 2 discusses preliminaries. Section 3 shows thatthe min-cost popular instance problem is NP-hard. Section 4 has our results forthe min-cost augmentation problem and Section 5 has our algorithm for themin-cost popular matching problem.
We review the characterization of popular matchings given in [2]. Let G =( A ∪ B , E ) be the graph containing only rank-1 edges. Then [2, Lemma 3.1]shows that a matching M is popular in G only if M ∩ E is a maximum matchingof G . Maximum matchings have the following important properties, which weuse throughout the rest of the paper. M ∩ E defines a partition of A∪B into three disjoint sets: a vertex u ∈ A∪B is even (resp. odd ) if there is an even (resp. odd) length alternating path in G (w.r.t. M ∩ E ) from an unmatched vertex to u . Similarly, a vertex u is unreach-able if there is no alternating path from an unmatched vertex to u . Denote by E , O and U the sets of even, odd, and unreachable vertices, respectively. Lemma 1 (Gallai-Edmonds Decomposition).
Let E , O and U be the setsof vertices defined by G and M ∩ E above. Then(a) E , O and U are pairwise disjoint, and independent of the maximum matching M ∩ E .(b) In any maximum matching of G , every vertex in O is matched with a vertexin E , and every vertex in U is matched with another vertex in U . The sizeof a maximum matching is |O| + |U| / .(c) No maximum matching of G contains an edge between a vertex in O anda vertex in O ∪ U . Also, G contains no edge between a vertex in E and avertex in E ∪ U . G matches all vertices u ∈O ∪ U , these vertices are called critical as opposed to vertices u ∈ E which arecalled non-critical . Using this partition of vertices, the following definitions canbe made. Definition 2.
For each a ∈ A , define f ( a ) to be the set of top choice items for a . Define s ( a ) to be the set of a ’s most-preferred non-critical items in G . Theorem 1 (from [2]).
A matching M is popular in G iff (i) M ∩ E is amaximum matching of G = ( A ∪ B , E ) , and (ii) for each person a , M ( a ) ∈ f ( a ) ∪ s ( a ) . The algorithm for solving the popular matching problem is now straightforward:each a ∈ A determines the sets f ( a ) and s ( a ). A matching that is maximum in G and that matches each a to an item in f ( a ) ∪ s ( a ) needs to be determined.If no such matching exists, then G does not admit a popular matching. In this section we consider the min-cost popular instance problem. Our input isa set A of people where each a ∈ A has a preference list over items in a universe U , where each item b ∈ U has a price cost ( b ) ≥
0. The problem is to “construct”a graph G or equivalently, set suitable values for copies ( b ) where b ∈ U , in orderto ensure that the resulting graph G admits a popular matching that matchesall a ∈ A , at the least possible cost.We will show that the above problem is NP-hard by showing a reductionfrom the monotone 1-in-3 SAT problem to this problem. The monotone 1-in-3 SAT problem is a variant of the 3SAT problem where each clause containsexactly 3 literals and no literal appears in negated form. The monotone 1-in-3SAT problem asks if there exists a satisfying assignment to the variables suchthat each clause has exactly 1 literal set to true. This problem is NP-hard [13].Let I be an instance of the monotone 1-in-3 SAT problem. Let C , . . . , C m be the clauses in I and let X , . . . , X n be the variables in I . We construct from I an instance of the min-cost popular instance problem as follows:Corresponding to each clause C i = ( X j ∨ X j ∨ X j ), we have 9 people A i = { a i . . . , a i } . Their preference lists are shown in Fig. 1. In this case everyperson has a preference list of length 2, that is a top item followed by a secondchoice item. For instance, a i treats item u j as its rank-1 item and item u j asits rank-2 item.The items u j , u j , u j are called public items and the items p i , p i , p i , and q i are called internal items. The internal items appear only on the preferencelists of the people of A i while the public items also appear on the preferencelists of people in A i as well as outside A i . The public item u j corresponds to thevariable X j . In every clause C i that X j belongs to, the item u j appears in thepreference lists of some of the people in the set A i as shown in Fig. 1.6 i u j u j a i u j u j a i u j u j a i u j p i a i u j p i a i u j p i a i p i q i a i p i q i a i p i q i Fig. 1.
The preference lists of people corresponding to the i -th clause in I .The set A of people in our instance is ∪ i A i . The universe U of all items isthe union of { u , . . . , u n } (the n public items) and the set ∪ i { p i , p i , p i , q i } of allthe internal items. It remains to describe the costs of the items. For each i , thecost of each p it for t = 1 , ,
3, is 1 unit, while the cost of q i is zero units. The costof each u j , for j = 1 , . . . , n , is 3 units.Recall that our problem is to determine a set B of items with suitable copiesso that the graph ( A ∪ B , E ) admits a popular matching that matches all a ∈ A and we want to do this at the least possible cost. We first show the followinglemma. Lemma 2.
Any instance ( A∪B , E ) that admits a popular matching that matchesall a ∈ A has cost at least m .Proof. Let us focus on the set A i of people corresponding to clause C i . Thepreference lists of people in A i are shown in Fig. 1. Since the cost of each itemon the lists of a i , a i , a i is 3, we have to spend 9 units to buy an item each forthese 3 people (since we seek an instance where all the persons get matched).People a i , a i , a i have a unit cost item in their preference lists (items p i , p i , p i ,respectively). Thus, we have to spend 3 units to buy an item each for these3 people. Finally, a i , a i , a i have a cost 0 item, i.e. q i , in their preference lists.Hence, we can get q i with copies ( q i ) = 3 for a cost of 0. Summarizing, we needto spend at least 9 + 3 + 0 = 12 units for the people in A i .However, it is not possible to spend just 12 units for the people in A i . This isbecause, in the first place, we are forced to have non-zero copies for at least 2 ofthe 3 items in { u j , u j , u j } and if we seek to match a i to p i while u j is around,then p i is a i ’s second choice item. Since p i is a i ’s top choice item, we also haveto match a i to p i since a popular matching has to be a maximum cardinalitymatching on rank-1 edges (see Theorem 1). Thus, it is not possible to match a i to q i in a popular matching while p i gets matched to a i who regards thisitem as a second choice item because u j is around. Thus we have the followingoptions:(i) set copies ( u j ) = 0 and then match a i to p i and a i to q i (ii) match both a i and a i to p i by setting copies ( p i ) = 2(iii) add one more copy of u j and set copies ( p i ) = 0 and thus match a i to u j and a i to q i A matching that contains the 3 edges ( a i , u ij ) , ( a i , p i ) , ( a i , q i ) cannot be popularsince by promoting a i from q i to p i , and a i from p i to u j , and leaving a i unmatched,we get a more popular matching.
7t is not possible to have option (i) for all the u j ’s since we are forced to havenon-zero copies for at least 2 of the 3 items in { u j , u j , u j } . Note that (ii) isalways better than (iii) (cost of 2 units vs cost of 3 units). Hence it is alwayscheaper to match a i , a i , a i to p i , p i , p i respectively than to any of u j , u j , u j .Thus, when we match a i , a i , a i to p i , p i , p i respectively, at least 2 of these3 people are getting matched to their second choice items. Hence, at least 2 outof the 3 people among a i , a i , a i will also have to be matched to their top choiceitems in order to ensure that the resulting matching is popular. This implies acost of at least 9 + 3 + 2 = 14 for A i .This holds for each A i , where 1 ≤ i ≤ m . Since the cost is at least 14 perclause, it amounts to at least 14 m in total for all the clauses. ⊓⊔ The following lemma establishes the correspondence between the instance I of monotone 1-in-3-SAT and the min-cost popular instance that we defined. Lemma 3.
There exists an instance ( A ∪ B , E ) with cost m that admits apopular matching that matches all a ∈ A iff there exists a 1-in-3 satisfyingassignment for I .Proof. We know from Lemma 2 that any instance (
A ∪ B , E ) that admits apopular matching that matches all a ∈ A has a cost of at least 14 m . What weneed to show here is that ( A ∪ B , E ) has cost 14 m if and only if the 1-in-3-SATinstance I is a “yes” instance, that is, there is a true/false assignment to thevariables X , . . . , X n such that each clause has exactly 1 literal set to true (andthus 2 literals set to false).Suppose I admits such an assignment. We now show how to construct a set B of cost 14 m such that the instance ( A ∪ B , E ) admits a popular matching thatmatches all a ∈ A . If X i = true then set copies ( u i ) = 0, else copies ( u i ) will beset to a suitable strictly positive value.Since the setting of true/false values to X i ’s is a satisfying assignment, everyclause has two literals set to false and 1 set to true. Let clause C i be ( X j ∨ X j ∨ X j ). Thus there is 1 variable X j k in { X j , X j , X j } that has been setto true. By our definition of copies of every item, the corresponding u j k has 0copies. Hence the people in the set A i can be matched as follows: – a i , a i , a i get matched to the 2 items in { u j , u j , u j } \ { u j k } by having 2copies of one of the lower indexed item and 1 copy of the higher indexeditem for these 3 people. – p ik becomes a ik +3 ’s top choice item (since u j k does not exist in the graphnow) and hence we can now match a ik +3 to p ik and a ik +6 to q i .This way we spend only 9 + 3 + 2 = 14 units for the people in A i and eachperson a has an item in f ( a ) ∪ s ( a ) to be matched to. Since every clause in I has exactly 1 variable set to true and 2 set to false, we achieve a cost of 14 foreach set A i . This shows that we can construct a set B of cost 14 m such that( A ∪ B , E ) admits a popular matching that matches all a ∈ A .To show the other direction, let us set the true/false values of variables in I as follows: for each j = 1 , . . . , n set X j = true if and only if copies ( u j ) = 0. We8eed to show that such an assignment sets exactly 1 variable in each clause tobe true.Let us consider any clause C i = ( X j ∨ X j ∨ X j ). Among the 3 items u j , u j , u j that correspond to these 3 variables we need at least 2 items to havenon-zero copies so as to match all the 3 people a i , a i , a i . Thus, our true/falseassignment does not set more than 1 variable per clause to true.We now need to show that there is at least 1 item in { u j , u j , u j } with zerocopies. This is where we will use the hypothesis that we can construct ( A ∪ B , E )of cost 14 m that admits a popular matching that matches all a ∈ A . It followsfrom the proof of Lemma 2 that each set A i of people corresponding to a clauseneeds a cost of at least 14. Since the total cost is only 14 m and there are m clauses, this implies that we have to spend exactly 14 per clause. In other words,the items for the 9 people of each A i have to be bought using only 14 units.If all the 3 items in { u j , u j , u j } have non-zero copies, then this implies thecost of items for all the 9 people in A i will be 9 + 3 + 3 = 15 since when each u j k has at least one copy, then the u j k ’s become top choice items for a i , a i , a i ,respectively and thus p i , p i , p i become their second choice items. This forces usto match each of a i , a i , a i to their top choice items (that is, p i , p i , p i , respec-tively) since a popular matching has to be a maximum cardinality matching onrank-1 edges. However, we are given that we can spend only 14 units per A i ;thus it has to be the case that there exists at least 1 item in { u j , u j , u j } whichhas zero copies. This finishes the proof of this lemma. ⊓⊔ Note that the preference lists of all the people in our instance G are strictand of length at most 2. Also, the preference lists are drawn from a master list .We have thus shown the following theorem. Theorem 2.
The min-cost popular instance problem is NP-hard, even wheneach preference list has length at most 2. Further, the hardness holds even whenthe preference lists are derived from a master list.
In this section we show various results for the min-cost augmentation problem.Recall that the input here is a graph G = ( A ∪ B , E ) where each item b ∈ B has a non-negative cost ( b ) associated with it. The problem is to determine howto make extra copies of items in B so that the resulting graph admits a popularmatching and the cost of the extra copies is minimized.Unlike the min-cost popular instance problem, the above problem admits asimple polynomial time algorithm when each a ∈ A has a preference list thatis strict and of length at most 2. We describe this algorithm below. We assumethroughout this section that we add at the end of each a ’s preference list adummy item called the last item ℓ a , where a being matched to ℓ a amounts to a being left unmatched. 9 .1 Preference lists of length 2 For any a ∈ A , a ’s preference list consists of a top choice item (let us use f a todenote this item), and possibly a second choice item (let us use z a to denote thisitem) and then of course, the last item ℓ a that we added for convenience. Let G be the graph G restricted to rank-1 edges. Let the graph G ′ = ( A ∪ B , E ′ ),where E ′ consists of – all the top ranked edges ( a, f a ): one such edge for each a ∈ A , and – the edges ( a, s a ), where a is even in G and s a is a ’s most preferred itemthat is even in G . Thus s a = z a when z a is nobody’s top choice item, else s a = ℓ a .It follows from Theorem 1 that G admits a popular matching if and only if G ′ admits an A -perfect matching. We assume that G does not admit a popularmatching and we have to decide now which items should be duplicated and howmany extra copies should be made. Since G ′ does not admit a popular matching,there exists a set S of people such that the neighborhood N ( S ) of S in G ′ satisfies | N ( S ) | < | S | . Let S denote a minimal such set of people. It is easy to see thatevery a ∈ S must be even in G . Thus, for each a ∈ S , the edge ( a, s a ) belongsto G ′ and it must be that s a = z a . Otherwise s a = ℓ a and since no vertex in A other than a has an edge to ℓ a , such an a will be always matched in anymaximum cardinality matching in G ′ . Hence, such an a cannot belong to S dueto its minimality. Further note that for any such minimal set S , the set N ( S )is a set of items that are all odd in the graph G ′ with respect to a maximumcardinality matching in G ′ .Since s a = z a for every a ∈ S , and the preference lists are of length at most2, there are no items sandwiched between f ( a ) and s ( a ) in a ’s preference listfor every a ∈ S . Thus, in order to ensure that these people get matched in anypopular matching, we need to make extra copies of items in N ( S ) or equivalentlyitems that are odd in the graph G ′ . Our algorithm precisely does this and in orderto get a min-cost augmentation, it chooses the odd item in G ′ which has leastcost. The steps of our algorithm are described in Algorithm 1.Our algorithm maintains the invariant that no person a changes her s -itemdue to the increase in copies. This is because we ensure that no top choice item b ever becomes even in H i , the graph H i restricted to rank-1 edges. Note thatthe set of odd items in H i is identified by constructing alternating paths from aperson who is unmatched in H i and every item b that appears on such a path isalways odd . Further, our duplications ensure that the total number of copies ofan item b in any augmented instance H i is bounded by the degree of b in G ′ . Inthe case of a top choice item b , the degree of b in G ′ is equal to the degree of b in G , the graph G restricted to rank-1 edges. Thus, even with the extra copies,a top choice item remains critical in the augmented graph restricted to rank-1edges. This implies that for every person, the most preferred even item in theaugmented graph restricted to rank-1 edges (i.e., its s -item) remains unchanged.We note that the above claim also implies that in every iteration of the whileloop in Step 4 of our algorithm, the size of the maximum cardinality matching10 lgorithm 1 Min-cost augmentation for strict lists of length at most 2.
1: Construct the graph G ′ = ( A ∪ B , E ′ ) where E ′ = { ( a, b ) : a ∈ A , b ∈ f ( a ) ∪ s ( a ) } .2: H = G , H ′ = G ′ , Let M denote a maximum cardinality matching in H ′ .3: i = 0.4: while M i is not A -complete matching do
5: Partition the vertices into odd ( O ), even ( E ), unreachable ( U ) w.r.t. M i .6: Let b denote the cheapest item in B ∩ O .7: Set copies ( b ) = copies ( b ) + 1.8: Construct the graph H ′ i +1 corresponding to H i +1 and update M i +1 to be amaximum cardinality matching in H ′ i +1 .9: i = i + 1.10: end while
11: Output the graph H i . increases by 1, that is, | M i +1 | = | M i | + 1. Therefore, the while loop terminatesin k = |A| − | M | iterations. Since k is bounded by n , the number of applicantsin G , the running time of our algorithm is O ( n ). It is clear that the graph H i returned by the algorithm admits an A -complete matching the graph H ′ i andhence admits a popular matching. To see that the instance returned is a min-costinstance, observe that there is no alternating path between an item b which gotduplicated in our algorithm and an item b ′ whose cost is strictly smaller thanthe cost ( b ). Otherwise in the iteration when b was odd , so was b ′ and it wouldhave been picked up by our algorithm.We can therefore conclude the following theorem. Theorem 3.
The min-cost augmentation problem with strict preference lists oflength at most 2 can be solved in O ( n ) time. We now show that the min-cost augmentation problem in the general case isNP-hard. The reduction is again from the monotone 1-in-3 SAT problem (referto Section 3). Let I be an instance of the monotone 1-in-3 SAT problem. Let C , . . . , C m be the clauses in I and let X , . . . , X n be the variables in I . Weconstruct from I an instance of the min-cost augmentation problem as follows.Let C i be ( X j ∨ X j ∨ X j ). Corresponding to this clause we have 6 people A i = { a i , a i , a i , a i , a i , a i } and 3 internal items D i = { p i , q i , r i } . In addition wehave public items u j , u j , u j which belong to preference lists of people in A i and whenever X j occurs in a clause C i , the item u j will belong to the preferencelists of some people in A i . The public items have unit cost whereas each internalitem b ∈ D i has cost 2. The preference lists of the people in A i are shown inFig. 2.The set B of items is the union of ∪ mi =1 D i (the set of all the internal items)and { u , . . . , u n } (consisting of all the public items, where vertex u j corre-sponds to the j -th variable X j ). The set A of people is the union of ∪ mi =1 A i i p i u j q i a i p i u j q i a i p i u j q i a i r i u j a i r i u j a i r i u j Fig. 2.
Preference lists of the 6 people in A i and { x , . . . , x n } , where the vertex x j corresponds to the variable X j . The pref-erence list of each x j is of length 1, it consists of the item u j . G has no popular matching. It is easy to see that the graph G describedabove does not admit any popular matching. To see this, first note that eachpublic item u j is a unique rank-1 item for exactly one applicant x j . Hence whenevery item has a single copy, these public items are unreachable or critical in G (the subgraph of rank-1 edges in G ). Now let us consider the people in A i : foreach a it ∈ { a i , a i , a i } , we have f ( a it ) = { p i } and s ( a it ) = { q i } . Since there areonly 2 items p i , q i for the 3 people a i , a i , a i to be matched to in any popularmatching, G does not admit a popular matching.Let ˜ G be a min-cost instance such that ˜ G admits a popular matching. Wenow state the following lemma that establishes the reduction. Lemma 4. ˜ G has cost at most m iff there exists a 1-in-3 satisfying assignmentfor the instance I .Proof. Assume that there exists a 1-in-3 satisfying assignment for I . For each j ,let c j denote the number of clauses in which X j appears. We will set the copiesof the items in the following manner: the copies of the internal items remain thesame, i.e., copies ( b ) = 1 for each b ∈ ∪ i D i and the copies of the public items areset as follows.For each j , where 1 ≤ j ≤ n do: • if X j = true , then set copies ( u j ) = 1 + c j • else copies ( u j ) remains 1.Let us determine the cost of this augmentation. For every X j that is true,we pay a cost of c j · c j and for X j that is false, we pay nothing. Since eachclause has exactly one variable set to true, we have: P j : X j = true c j = m . Thusthe cost of our augmentation is m .We now show that the graph ˜ G ′ admits an A -complete matching (the edgesin ˜ G ′ are ( a, b ) where b ∈ f ( a ) ∪ s ( a )). – Consider the people x , . . . , x n . Each x j gets matched to her f -item u j . – Consider the people in A i . We know that exactly one amongst u j , u j , u j has more than one copies (since the number of copies was based on a satis-fying assignment for 1-in-3 SAT). If copies ( u j k ) >
1, then a ik gets matchedto u j k and the 2 people in { a i , a i , a i } \ { a ik } get matched to p i and q i . Fi-nally, a ik +3 gets matched to her top choice item r i whereas the 2 people in12 a i , a i , a i } \ { a ik +3 } get matched to their last items (their most preferredeven item in G ).To prove the other direction, assume that the cost of ˜ G is m . We now translatethis into truth values for variables in I . If copies ( u j ) > G , then set variable X j = true , else set X j = f alse . We need to show that this is a 1-in-3 satisfyingassignment for I .Since the cost of adding one copy of any item is at least 1, we need to payat least 1 unit per clause in order to match the people in A i . Thus, we needto pay at least m to get a graph that admits a popular matching. However, weare given that with a cost of exactly m , the graph ˜ G that admits a popularmatching. Hence, the copies of items have been added such that exactly 1 unithas been spent per clause.Spending 1 unit has allowed all the people in A i , for each i , to have enoughitems to match themselves to in ˜ G ′ . Consider the items that occur in the pref-erence lists of people in A i (refer to Fig. 2). Since the cost of each internal itemis 2 and we cannot afford a cost of 2 for any clause, it has to be the case that copies ( u ) > u ∈ { u j , u j , u j } . Thus, we have at least 1 true variableper clause in I .We now have to show that there is exactly 1 true variable per clause in I . The point to note is that copies ( u ) > u implies that u is non-critical in ˜ G . This changes the most preferred even item in ˜ G forsome people. That is, suppose k items in { u j , u j , u j } have more than 1 copies.Then, we have k non-critical items in { u j , u j , u j } and so we have k peoplein { a i , a i , a i } satisfying the following: a ’s most preferred even item in ˜ G is nolonger the last resort item ℓ a , it is now the non-critical public item that is secondin a ’s preference list.Observe that one person in { a i , a i , a i } can be matched to her top choice item r i . However, to match the second person we need to spend another unit. In thefirst place, we have already spent 1 unit to add an extra copy of some u j k to matchall the people in { a i , a i , a i } . With more than one item in { u j , u j , u j } non-critical in ˜ G , we have pay at least 2 units for the people in A i . This contradictsthe fact that we spent exactly 1 unit for the people in A i . Hence there is exactly1 true variable per clause in I . ⊓⊔ We can now conclude the following theorem.
Theorem 4.
The min-cost augmentation problem is NP-hard, even for strictlists of length at most 3. Further, the lists can be derived from a master list.
We extend the above reduction from I to show that this problem is NP-hard toapproximate to within a factor of √ n /
2, where n is the size of A . We constructa graph H on at most 4 m people that satisfies the following property:13 ∗ ) If I is a yes instance for 1-in-3 SAT, then H can be augmented at a cost of m to admit a popular matching. If I is a no instance for 1-in-3 SAT, then H needs a cost strictly greater than m to admit a popular matching.We describe the construction of the graph H below. Recall that I has m clausesand corresponding to each clause C i , we have a set A i of people. The constructionof H is as follows. Let us call the group of 3 people ( a i , a i , a i ) in Fig. 2 a triplet .Instead of having just one triplet in A i , as was the case in the previous section,here we have many such triplets. In particular, we have m + 1 such triplets. Thepreference list for one particular triplet ( a i t +1 , a i t +2 , a i t +3 ) is shown in Fig. 3. a i t +1 r ti u j a i t +2 r ti u j a i t +3 r ti u j Fig. 3.
Preference lists of people corresponding to the t -th triplet.We now have 3 + 3( m + 1) people in A i , namely a i , a i , a i and 3 peopleper triplet, for each of the m + 1 triplets. Thus our overall instance H has m (3 + 3( m + 1)) (the people in ∪ i A i ), plus the n people in { x , . . . , x n } . Sinceeach clause has 3 variables, n ≤ m . Thus we can bound n , the number ofpeople in H as: n ≤ m + 9 m ≤ m for m ≥ j , the preference list of x j is of length 1, which consistsof only u j . The costs of the items are as follows: the cost of each of the internal items, i.e., p i , q i , and r ki , for k = 1 , . . . , m + 1 is m , and the cost of each u j for j = 1 , . . . , n is 1. We now show that the instance constructed as above satisfiesthe property ( ∗ ). Lemma 5. If I is a yes instance for 1-in-3 SAT, then H can be augmented ata cost of m to admit a popular matching. If I is a no instance for 1-in-3 SAT,then H needs a cost strictly greater than m to admit a popular matching.Proof. We first consider the case when I is an yes instance. The proof is similarto that of Lemma 4. For each j , where 1 ≤ j ≤ n , do the following: if X j = true ,then set copies ( u j ) = 1 + c j , where c j is the number of clauses in which X j ispresent. Else set copies ( u j ) = 1. The total cost involved here is P j : X j = true c j .Since each clause has exactly one variable set to true, we have: P j : X j = true c j = m . Thus, the cost of our instance ˜ H is m . It is easy to show that the graph ˜ H ′ admits an A -complete matching. – Consider the people x , . . . , x n . Each x j gets matched to her f -item u j . – Consider the people in A i . We know that exactly one amongst u j , u j , u j has more than one copies (since the number of copies was based on a satis-fying assignment for 1-in-3 SAT). If copies ( u j k ) >
1, then a ik gets matched14o u j k and the 2 people in { a i , a i , a i } \ { a ik } get matched to p i and q i . Foreach of the m + 1 triplets that we have here, we do as follows. The per-son a i t + k gets matched to her top choice item r ti whereas the 2 people in { a i t +1 , a i t +2 , a i t +3 } \ { a i t + k } get matched to their last items.This proves that H can be augmented at a cost of exactly m to admit apopular matching.We now prove the other direction, that is, if I is a no instance for 1-in-3 SAT,then H needs a cost of at least m + 1 to admit a popular matching. Suppose H can be augmented at a cost of at most m to admit a popular matching. We willshow that this translates to a 1-in-3 satisfying assignment for I . Let ˜ H denotethe augmented graph. Let us set the truth values of variables in I as follows.Set X j = true iff copies ( u j ) in ˜ H is greater than 1.We have only m units available to make extra copies so that people in eachset A i have items in ˜ H ′ to match themselves to. Recall that the cost of eachinternal item is m . Hence it is easy to see that we cannot afford an extra copyof any internal item and thus at least one public item in { u j , u j , u j } shouldhave more than one copy to match all of a i , a i , a i . Otherwise there are only 2items p i and q i for these 3 people to be matched to; since the first copies of u j , u j , u j will be matched to x j , x j , x j , respectively. Thus, we have shownthat at least one of u j , u j , u j has more than one copy. Hence in our assignmentof truth values, there is at least 1 variable in each clause that is set to true.Suppose 2 or more of the items in { u j , u j , u j } have more than one copy in˜ H . We have two people in { a i , a i , a i } having their most preferred even item in˜ H as an item in { u j , u j , u j } . In addition, in each of the m + 1 triplets, twopeople have their most preferred even item in { u j , u j , u j } . Although, one ofthese 2 people from each triplet can be matched to her unique top choice item,we still need to spend m + 1 for all the people in A i to be matched to itemsin ˜ H ′ . This contradicts the hypothesis that H can be augmented a cost of atmost m into ˜ H . Hence for each i , there is exactly 1 item in { u j , u j , u j } thathas more than one copy in ˜ H . In other words, for each i , there is exactly 1 truevariable in the i -th clause. Thus, our assignment is a 1-in-3 satisfying assignmentfor I . ⊓⊔ Now suppose that the min-cost augmentation problem admits a √ n / Algo1 . If I is a yes instance, then Algo1 has to return an augmentation of cost at most 1 / . √ m .m = m . If I is a no instance, then there is no augmentation of cost at most m , so Algo1 returns an answer of cost greater than m . Thus using Algo1 it is possible todetermine whether I has a 1-in-3 satisfying assignment or not, a contradiction.Hence we conclude the following theorem. Theorem 5.
It is NP-hard to approximate the min-cost augmentation problemon G = ( A ∪ B , E ) within p |A| / . .4 Perfect augmentation In this section we consider a variant of the min-cost augmentation problem wherewe are not content with only a popular matching, but insist on every applicantbeing matched to an item. Note that till now we allowed people to be matchedto their last items which was equivalent to leaving them unmatched. We calla popular matching that matches all the people as a perfect popular matching and denote the problem as min-cost perfect augmentation . We show that thisproblem becomes NP-hard even when preference lists are strict and have lengthat most 2 in contrast to the min-cost augmentation problem which has a simplepolynomial time algorithm for strict lists of length at most 2.The overall reduction is similar to the min-cost augmentation problem wherewe reduce from an instance I of monotone 1-in-3 SAT problem. As earlier,corresponding to every variable X j in I we have an applicant x j in our instance.The preference list of applicant x j contains only one item u j . Let C i = ( X j ∨ X j ∨ X j ) be a clause in I . Corresponding to clause C i we have a set of 6people A i = { a i , . . . , a i } and a set of internal items D i = { p i , q i } . The internalitems appear on preference lists of people only in A i . In addition public items u j , u j , u j also appear on the preference lists of people in A i . The preferencelists of people are as shown in Fig. 4. a i p i u j a i p i u j a i p i u j a i u j q i a i u j q i a i u j q i Fig. 4.
Preference lists of the 6 people in A i We define the sets A and B below. A = ∪ mi =1 A i ∪ { x , . . . , x n } . B = ∪ mi =1 D i ∪ { u , . . . , u n } . The graph G = ( A ∪ B , E ) with the preference lists as defined above is ourinstance G . It remains to describe the costs of items in G . The cost of everypublic item u j is 1 whereas the costs of every internal item is m . With a singlecopy of every item, all public items are critical in the graph G . Hence people a i , a i , a i belonging to A i treat their unique last resort items as their s -items.Further people a i , a i , a i treat the internal item q i as their s -item. It is easy toverify that the graph G described above does not admit a popular matching.Let ˜ G be an augmented instance that admits a perfect popular matching.In any perfect popular matching in ˜ G every applicant x j has to be matched toher f -item i.e. u j . Now let us consider the people in A i . Since the internal itemsare of cost m each and public items have cost 1, it is cheaper to make extracopies of public items. Further, recall that any popular matching has to be a16aximum cardinality matching on rank-1 edges. Therefore in order to matchone of { a i , a i , a i } (say a i ) to its s -item u j , we need to make 2 extra copiesof u j thus making u j non-critical in ˜ G . This ensures that applicant a i getsmatched to a copy of u j , her f -item. It is easy to see that in order to get aperfect popular matching, we need to make at least two public items non-criticalin the graph ˜ G . Thus we spend an amount of at least 4 units per clause in anyaugmented instance ˜ G that admits a perfect popular matching.We now show the following lemma which proves the correctness of our re-duction. Lemma 6.
The min-cost instance ˜ G corresponding to G that admits a perfectpopular matching has cost m iff there exists a 1-in-3 satisfying assignment for I .Proof. Assume that there exists a 1-in-3 satisfying assignment for I and let T ruthval denote the 1-in-3 satisfying assignment for I . For every variable X j ,let c j denote the number of clauses in which X j appears. We set the copies ofthe items in ˜ G as follows: If T ruthval ( X j ) = f alse , then copies ( u j ) = 2 c j + 1,otherwise copies ( u j ) = 1. Thus we pay 2 c j units for the extra copies of item u j whenever the corresponding variable X j is set to false.Since I has a 1-in-3 satisfying assignment, each clause has exactly two vari-ables set to false. We therefore have: X j : T ruthval ( X j )= false c j = 4 m. Thus the cost of our instance ˜ G is 4 m . We now show that in the graph ˜ G , everyapplicant has an item to match amongst her f or s items. – Consider the people x , x , . . . , x n . Each x j gets matched to her f -item u j . – Consider the people in A i corresponding to the clause C i = ( X j ∨ X j ∨ X j ).We know that exactly two among u j , u j , u j are non-critical. Assume that u j and u j are non-critical, then people a i and a i get matched to their s -items u j and u j respectively. Further a i and a i get matched to their f -items u j and u j respectively. Finally, a i gets matched to her f -item p i whereas a i gets matched to her s -item q i .To prove the other direction, assume that ˜ G admits a popular matching andhas cost 4 m . We now translate this into the truth values for variables in I . If copies ( u j ) > G , then set variable X j = f alse else set X j = true . We needto show that this assignment is a 1-in-3 satisfying assignment.Recall that for every clause we need to spend at least 4 units in order tomatch all the people in A i . Since the cost of ˜ G is 4 m , this implies that exactly4 units have been spent per clause for making extra copies.Now consider the people in A i . The internal items occurring on their prefer-ence lists of these people have cost m each, hence none of the internal items haveextra copies in the augmented instance. This implies that at least 2 public items17mongst { u j , u j , u j } have more than one copy in the augmented instance.Thus our truth assignment sets at least 2 variables to f alse . It remains to provethat for every clause exactly 2 variables are set to f alse . Assume not.Let C i be a clause in which our truth assignment set all the three variables X j , X j , X j to f alse . This implies that in the instance ˜ G all the three publicitems u j , u j , u j have more than one copy. The first copy of these public itemsis utilized in matching people x j , x j , x j respectively to their f -items. Furthersince any popular matching is a maximum cardinality matching on rank-1 edges,the second copies of these items will have to be assigned to people a i , a i , a i . Thusafter spending 3 units we are still left with 2 people amongst { a i , a i , a i } withoutany item. Hence we need to spend 2 more units to match 2 of these people, whichimplies that we spent 3+2=5 units for people in A i . This contradicts the factthat exactly 4 units was spent in order to match people in A i , for all i . Thusexactly one variable in every clause is set to true . ⊓⊔ The following theorem is immediate from the above lemma.
Theorem 6.
The min-cost perfect augmentation problem is NP-hard for strictlists of length at most . In this section we present an O ( mn ) time algorithm for the min-cost popularmatchings problem, where m = | E | and n = |A| . Our input is an instance G = ( A ∪ B , E ) where each item b ∈ B has associated with it the number copies ( b ) (denoting the maximum number of people that can be matched to b )and a price cost ( b ) ≥
0. Whenever a person gets matched to b , an amount of cost ( b ) has to be paid. Thus if k ≤ copies ( b ) copies of b gets used in a matching M , then a cost of k · cost ( b ) has to be paid by M . As done in the earlier sections,we will add a last item ℓ a at the end of a ’s preference list for each person a ∈ A .The cost of ℓ a is 0, since using the edge ( a, ℓ a ) amounts to leaving a unmatched.Our problem here is to decide whether G admits a popular matching or notand if so, to compute the one with minimum cost. As mentioned in Section 1,Manlove and Sng considered the popular matchings problem (referred to as theCHAT problem) where items (these were called houses) have capacities and theyshowed an O (( √ C + n ) m ) algorithm for this problem, where C is the sum ofall the capacities.In order to solve the min-cost popular matchings problem, for each b ∈ B ,we could make copies ( b ) copies of each vertex b , call them b , . . . , b copies ( b ) , whereeach b i has the same neighborhood as the original vertex b . However, such agraph has too many vertices and edges, hence we will stick to the original graph G = ( A ∪ B , E ) and simulate the larger graph in G itself. Note that a matching in G can contain up to copies ( b ) pairs ( a i , b ). It is easy to see that the structuralcharacterization for popular matchings from [2] holds for our problem as well.That is, any popular matching in our graph G has to be a maximum cardinalitymatching on rank-1 edges and every person a has to be matched to an item in18 ( a ) ∪ s ( a ). This is because by making copies ( b ) many duplicates of every item b in G our problem becomes equivalent to the original popular matchings problem. Our algorithm to compute a min-cost popular matching can be broadly parti-tioned into two stages. In the first stage we build the graph G ′ , i.e. the graphwhere every person adds edges to their f and s -items. Identifying s -items forpeople involves partitioning the vertices of G into odd, even and unreachable with respect to a maximum cardinality matching on rank-1 edges. We show howto efficiently do this by building Hungarian trees rooted at unmatched vertices.The second stage then computes a min-cost popular matching in the graph G ′ if one exists. The first stage.
We first construct the graph G which is the graph G restrictedto rank-1 edges. In order to find a maximum cardinality matching in the graph G , we use Ford-Fulkerson max-flow algorithm. The following transformationfrom G into a flow network is based on the standard transformation from thebipartite matching problem to the maximum flow problem: – add a vertex s and an edge directed from s to each person a ∈ A with anedge capacity of 1 on this edge. – add a vertex t and an edge directed from each item b ∈ B to t with an edgecapacity of copies ( b ) on this edge. – direct every edge ( a, b ) of G from a to b and set an edge capacity of 1 foreach such edge.Let F ( G ) denote the above graph. It is easy to see that a valid flow from s to t in the graph F ( G ) can be translated to a matching in G in which everyperson is matched to at most 1 item and every item b is matched up to copies ( b )people. A maximum flow in F ( G ) becomes a maximum cardinality matchingin G . We compute a maximum cardinality matching M of G by computing amax-flow from s to t in F ( G ). Using the matching M , our goal is to obtain apartition of A ∪ B into O ( odd ), E ( even ) and U ( unreachable ). This can be donein O (number of edges) provided we create copies ( b ) many duplicates of each item p and duplicate the neighborhood of b for each copy of b . However this is tooexpensive. The main point to note is that all the copies ( b ) many copies of b , foreach item b , have the same odd/even/unreachable status. We show below thatwe can remain in the graph G and determine the odd/even/unreachable statusof all the vertices in linear time.1. We begin with O = E = U = ∅ .2. We then add to the set E all people that are unmatched in M and all itemsthat are not fully matched by M (i.e. a item b that is matched to fewer than copies ( b ) many people). This is because if we would have made copies ( b ) manyduplicates of b , some of the copies would have remained unmatched by M and the other copies which are matched would be connected by even lengthalternating paths from these unmatched vertices.19. Our goal now is to build a Hungarian tree T u for each vertex u that isunmatched or not fully in M . In order to do so we first set all vertices asunmarked. We build the trees rooted at unmatched people and not fullymatched items as described below:(a) For u ∈ A that is unmatched, the children of u in T u are all the neigh-boring items of u that are unmarked so far. For each of these items b the children of b in T u are all the unmarked people matched to b . Thechildren of these people are their neighboring unmarked items and so on.As soon as a vertex gets visited in T u we mark it.(b) For u ∈ B the children of u are all the neighboring unmarked people of u . Note that some of these people could be matched to u – however, wewill include all these people since we are simulating the Hungarian treerooted at an unmatched copy of u . We mark each person in this childlist.Each person a in the above child list had a unique child, the item towhich a is matched. If this item is marked, then a is a leaf in this tree,else we add M ( a ) to the tree and mark it. We now continue to explorethe unmarked neighborhood of M ( a ) for all non-leaf people a .(c) Once T u is built, all vertices that belong to even levels of T u (the root isat level 0) are added to E and all vertices that belong to odd levels areadded to O .4. Once we finish building all the trees T u , where u is unmatched person/nota fully matched item, the set U gets set to the vertices of A ∪ B \ O ∪ E asthere is no alternating path from an unmatched vertex to such vertices.We note that while building a tree T u , we explore the neighborhood of avertex only if this vertex is unmarked and then this vertex immediately getsmarked. This ensures that a vertex occurs just once across all T u ’s. Havingobtained the partition, it is now possible to define s ( a ) for every person a as themost preferred even item of a . Let the graph G ′ be the graph G along with theedges ( a, b ) where a ∈ E and p ∈ s ( a ).Since a popular matching is a maximum cardinality matching on rank-1edges, all items that are critical in G , that is, all items in O ∪ U have to befully matched in every popular matching M ∗ of G . The only choice we haveis in choosing which items of E should participate with how many copies inthe min-cost popular matching. We make this choice in the second stage of ouralgorithm. The second stage.
Our goal in the second part of the algorithm is to augmentthe matching M to find a min-cost popular matching. However, we start withthe matching M , where M = M \ { all edges ( a, b ) where a ∈ O} . Thus M consists only of edges ( a, b ) where b ∈ O ∪ U . We take M to be our startingmatching rather than M because it may be possible to match people O ∩ A to cheaper rank-1 neighbors. Recall that while computing the max-flow M , thecosts of items played no role. 20ow let ρ be an augmenting path with respect to M , i.e., one end of ρ is anunmatched person and the other end of ρ is item b that is not fully matched. Thecost of augmenting the current matching along ρ is the cost of b . By augmentingthe current matching along ρ , every item other than b that is currently matchedstays matched to the same number of people and the item b gets matched to onemore person. Thus the cost of the new matching is the cost of the old matching + cost ( b ). In order to match an unmatched person a , our algorithm always choosesthe cheapest augmenting path starting from the person a .To find the cheapest augmenting path we build a Hungarian tree T a rootedat every person that is unmatched in M . Initially all vertices are unmarked andwhile building T a every visited vertex gets marked so that each vertex occursat most once in T a . We do not terminate the construction of T a as soon as wefind an augmenting path, but we build T a completely in order to find a min-costitem b such that there is an augmenting path between and a and b ; we augment M along this path to obtain M . On the other hand if T a has no augmentingpath then we quit and declare “ G does not admit a popular matching”. Algorithm 2
Algorithm for min-cost popular matching.
1: Construct the graph G = ( A ∪ B , E ) where E = { ( a, b ) : a ∈ A , b ∈ f ( a ) } .2: Construct the flow graph F ( G ) by adding two vertices s and t and adding directededges with appropriate capacities.3: Compute a maximum flow in F ( G ) and translate the flow to a matching M in G .4: Obtain a partition of the vertices of G as odd ( O ) , even ( E ) and unreachable ( U )using M .5: Construct the graph G ′ = ( A∪B , E ′ ) where every person adds edges to her f -itemsand every even person adds edges to her s -items.6: Delete from G ′ all OO and OU edges.7: Delete from M all edges that are incident on odd people in G ′ and call the resultingmatching M .8: i = 1.9: while there exists an unmatched person a in M i do
10: Build a Hungarian tree T a rooted at a .11: if there exists no augmenting path starting at a then
12: Quit and declare “ G does not admit any popular matching”.13: else
14: Augment M i along the cheapest augmenting path in T a and call the newmatching M i +1 .15: end if i = i + 1.17: end while
18: Return M i . We present our entire algorithm in Algorithm 2. To see the correctness ofthe algorithm we first note that if there is no augmenting path in T a , where a is an unmatched person in M i , then there is no popular matching in G . This is21ecause every popular matching is a maximum cardinality matching on rank-1edges and has to match every a ∈ A to a item in f ( a ) ∪ s ( a ). It remains to provethat if G admits a popular matching, then the matching M (= M i ) returned atStep 18 of Algorithm 2 is a min-cost popular matching. We prove that usingLemma 7. Lemma 7. If G admits a popular matching, then the matching M returned byour algorithm is a min-cost popular matching in G .Proof. Suppose M is not a min-cost popular matching in G and let OPT be sucha matching. For the purpose of this proof we operate on the cloned graph whereeach item b has copies ( b ) many copies and M and OPT both refer to matchingswhere each item is matched to at most one person. Consider
OPT ⊕ M - this isa collection of cycles and even length alternating paths (since both OPT and M are A -complete). The cycles do not contribute to any change in costs since both OPT and M match the same items in any cycle.Let ρ be a path in OPT ⊕ M . Let β and β M be the endpoints of this path,where OPT leaves β M unmatched while M leaves β unmatched. It suffices toshow that cost ( β M ) ≤ cost ( β ). Since OPT is a popular matching, it has tomatch all the items in
O ∪ U (the odd/unreachable items in G ). Since it leaves β M unmatched, it follows that β M ∈ E and thus there are items of E in ρ .It is the second stage of our algorithm that matches items in E . Let α be thelast person in the path ρ to get matched by our algorithm and let M ( α ) = β .Since β is unmatched in M it implies that during the execution of our algorithmwe found at least two augmenting paths from α – one ending in β and the otherending in β . Further, we found the augmenting path ending in β cheaper, thatis, cost ( β ) ≤ cost ( β ).We now repeat the same argument for the β - β M sub-path of ρ . Let α bethe last person in the β - β M sub-path that got matched by our algorithm andlet M ( α ) = β . Note that β was also unmatched at this time and hence ouralgorithm found at least two augmenting paths from α – one ending in β andanother ending in β . Since M ( α ) = β it implies that cost ( β ) ≤ cost ( β ).Repeating the same argument for the β - β M sub-path we get vertices β , . . . , β t = β M where cost ( β ) ≤ cost ( β ) ≤ · · · ≤ cost ( β t ). Combining all the inequalitiesyields cost ( β M ) ≤ cost ( β ). ⊓⊔ Time complexity of this algorithm.
The difference between our algorithm andthat of Manlove and Sng for the CHAT problem in the first stage is that theyuse Gabow’s algorithm to find a matching on rank-1 edges whereas we use Ford-Fulkerson max-flow algorithm. Gabow’s algorithm runs in time O ( √ Cm ) where C = P |B| i =1 copies ( b i ) whereas since the value of max-flow in the graph F ( G ) isupper bounded by |A| = n , Ford-Fulkerson algorithm takes O ( mn ) time. Also,the total time taken by our algorithm to partition vertices into O , E , and U is O ( m + n ) where n denotes the total number of vertices in G . It is easy to seethat the time spent by our algorithm in the second stage is also O ( mn ) sinceit takes O ( m ) time to build the tree T a and there are at most n such trees thatwe build. We can now conclude the following theorem.22 heorem 7. There exists an O ( mn ) time algorithm to decide whether a giveninstance G of the min-cost popular matchings problem admits a popular matchingand if so, to compute one with min-cost. Note that by assigning a huge cost ˆ
C > P b copies ( b ) . cost ( b ) to each of thelast items ℓ a , a ∈ A that we introduced, our algorithm also works for the min-cost maximum-cardinality popular matching problem where we seek among allpopular matchings of maximum cardinality, the one with minimum cost. Conclusions
In this paper we considered several extensions of the popular matching problem.We showed that the min-cost popular instance problem, which involves buildinga min-cost graph that admits a popular matching that matches all applicants,is NP-hard, even when preference lists are strict and of length at most 2. Incontrast, the min-cost augmentation problem admits a simple polynomial timealgorithm when preference lists are strict and of length at most 2. However,the min-cost augmentation problem is NP-hard in general; it is NP-hard evenwhen preference lists are strict and of length at most 3. In fact, it is NP-hard toapproximate the min-cost augmentation problem to within a factor of √ n / n is the number of people. We also showed that the min-cost popularmatching problem (the number of copies of each item is fixed here) can be solvedin O ( mn ) time, where m is the number of edges in the input graph. References
1. D. J. Abraham, K. Cechl´arov´a, D. F. Manlove, and K. Mehlhorn. Pareto-optimalityin house allocation problems. In
Proceedings of 15th Annual International Sympo-sium on Algorithms and Computation , pages 3–15, 2004.2. D. J. Abraham, R. W. Irving, T. Kavitha, and K. Mehlhorn. Popular matchings.
SIAM Journal on Computing , 37(4):1030–1045, 2007.3. P. G¨ardenfors. Match making: assignments based on bilateral preferences.
Be-havioural Sciences , 20:166–173, 1975.4. R. W. Irving, T. Kavitha, K. Mehlhorn, D. Michail, and K. Paluch. Rank-maximalmatchings.
ACM Transactions on Algorithms , 2(4):602–610, 2006.5. T. Kavitha, J. Mestre, and M. Nasre. Popular mixed matchings. In
Proceedingsof the 36th International Colloquium on Automata, Languages and Programming ,pages 574–584, 2009.6. T. Kavitha and M. Nasre. Note: Optimal popular matchings.
Discrete AppliedMathematics , 157(14):3181–3186, 2009.7. T. Kavitha and M. Nasre. Popular matchings with variable job capacities. In
Pro-ceedings of 20th Annual International Symposium on Algorithms and Computation ,pages 423–433, 2009.8. M. Mahdian. Random popular matchings. In
Proceedings of the 8th ACM Confer-ence on Electronic Commerce , pages 238–242, 2006.9. D. Manlove and C. Sng. Popular matchings in the capacitated house allocationproblem. In
Proceedings of the 14th Annual European Symposium on Algorithms ,pages 492–503, 2006.
0. R. M. McCutchen. The least-unpopularity-factor and least-unpopularity-margincriteria for matching problems with one-sided preferences. In
Proceedings of the15th Latin American Symposium on Theoretical Informatics , pages 593–604, 2008.11. E. McDermid and R. W. Irving. Popular matchings: Structure and algorithms. In
Proceedings of 15th Annual International Computing and Combinatorics Confer-ence , pages 506–515, 2009.12. J. Mestre. Weighted popular matchings. In
Proceedings of the 33rd InternationalColloquium on Automata, Languages and Programming , pages 715–726, 2006.13. T. Schaefer. The complexity of satisfiability problems. In
Proceedings of the 10thAnnual ACM Symposium on Theory of Computing , pages 216–226, 1978., pages 216–226, 1978.