1 Introduction
We study the problem of fairly allocating a set of indivisible goods among agents with additive valuations for the goods. The fairness of an allocation is quantified by its Nash social welfare [NJ50, KN79], which is the geometric mean of the valuations of the agents under that allocation. The notion of Nash social welfare has traditionally been studied in the economics literature for divisible goods [Mou04], where it is known to possess strong fairness and efficiency properties [Var74]. Besides, this notion is also attractive from a computational standpoint: For divisible goods, the Nash optimal allocation can be computed in polynomial time using the convex program of Eisenberg and Gale [EG59].
For indivisible goods, Nash social welfare once again provides notable fairness and efficiency guarantees [CKM16]. However, the computational results in this setting are drastically different from its divisible counterpart. Indeed, it is known that the problem of maximizing Nash social welfare for indivisible goods is APXhard when agents have additive valuations for the goods [Lee17]. On the algorithmic side, the first constantfactor (specifically, ) approximation for this problem was provided by Cole and Gkatzelis [CG15]. This approximation factor was subsequently improved to [AGSS17], [CDG17] and, most recently, to [BKV17]. Similar approximation guarantees have also been developed for more general market models such as piecewise linear concave (PLC) utilities [AGMV18], budget additive valuations [GHM18], and multiunit markets [BGHM17]. By and large, these approaches rely on either constructing an appropriate equilibrium of a Fisher market and later rounding it to an integral allocation, or using real stable polynomials. Although these approaches offer strong approximation guarantees in very general market models, they are also (justifiably) more involved and often lack a combinatorial interpretation. Our interest in this work, therefore, is to understand the power of simple, combinatorial algorithms (in particular, greedy techniques) in solving interesting special cases of this problem.
Our results and techniques
We consider the Nash social welfare objective () as a measure of fairness in and of itself, and develop greedy algorithms for maximizing either exactly or approximately. We focus on two special classes of additive valuations, namely identical valuations (i.e., for any good and any pair of agents , the value of the good for is equal to the value of the good for ; ) and binary valuations (i.e., for every agent and good , agent ’s value for is either or ; ). The class of identical valuations is wellstudied in the approximation algorithms literature, and binary valuations capture the setting where each agent finds a good either acceptable or not.
For identical valuations, we show that a simple greedy algorithm provides a approximation to the optimal Nash social welfare (Theorem 1). Note that the problem of maximizing Nash social welfare remains NPhard even for identical valuations (via a reduction from the Partition problem [RR10]). Our algorithm (Algorithm 1) works by allocating the goods one by one in descending order of value. At each step, a good is allocated to the agent with the least valuation. This implicitly corresponds to greedily choosing an agent that provides the maximum improvement in . We show that the allocation returned by our algorithm satisfies an approximate version of envyfreeness property (Lemma 1), and that any allocation with this property gives the desired approximation guarantee (Lemma 2). We remark that a polynomial time approximation scheme (PTAS) is already known for this problem [NR14]. However, this scheme uses Lenstra’s algorithm for integer programs [LJ83] as a subroutine, and hence is not combinatorial. Moreover, despite being polynomial time in principle, the actual running time of such algorithms often scales rather poorly. By contrast, our algorithm involves a single sorting step and at most one operation for each good, thus it requires time overall.
For binary valuations, we show that an exact solution to the problem (i.e., a Nash optimal allocation) can be found by a greedy algorithm in polynomial time (Theorem 2). However, unlike the algorithm for identical valuations which greedily picks an agent, our algorithm for binary valuations makes a greedy decision with respect to swaps (or chains of swaps) between a pair of agents. A swap refers to taking a good away from one agent and giving it to another agent. A chain of swaps refers to a sequence of agents and goods such that is swapped from to , is swapped from to , and so on. Given any suboptimal allocation, our algorithm (Algorithm 2) checks for every pair of agents whether there exists a chain of swaps between them that improves . The pair that provides the greatest improvement is chosen, and the corresponding swaps made. We show that the algorithm makes substantial progress towards the Nash optimal after each such reallocation (Lemma 3), which provides the desired running time and optimality guarantees. An interesting feature of our algorithm is that the guarantee for additive valuations extends to a more general utility model where the valuation of each agent is a concave function of its cardinality (i.e., the number of nonzerovalued goods in its bundle).^{1}^{1}1Notice that for binary and additive utilities, the valuation of each agent is a linear function of its cardinality. Prior work [DS15] has shown that a Nash optimal can be found efficiently under binary valuations (via reduction to minimumcost flow problem). However, these techniques crucially rely on valuations depending linearly on cardinality, and it is unclear how to extend these to the aforementioned utility model. Our results, therefore, provide novel, exact algorithms for maximizing Nash social welfare under concave valuations.
2 Preliminaries
Problem instance
An instance of the fair division problem is defined by (1) the set of agents , (2) the set of goods , and (3) the valuation profile that specifies the preferences of each agent over the set of goods via a valuation function . Throughout, the valuations are assumed to be additive, i.e., for any agent and any set of goods , , where . We use the shorthand instead of for a singleton good . We use to denote the set of goods that are positively valued by agent , i.e., .
Binary and identical valuations
We say that agents have binary valuations if for each agent and each good , . In addition, we say that agents have identical valuations if for any good and any pair of agents , we have . For identical valuations, we will assume, without loss of generality, that the value of each good is nonzero.
Allocation
An allocation refers to an partition of , where is the bundle allocated to the agent . Let denote the set of all partitions of . Given an allocation , the valuation of an agent for the bundle is . An allocation is said to be nonwasteful if it does not assign a zerovalued good to any agent, i.e., for each agent and each good , we have . We will use the terms allocation and partition interchangeably whenever the set of goods is clear from the context.
Nash social welfare
Given an instance and an allocation , the Nash social welfare of is given by . An allocation said to be Nash optimal if . An allocation is said to be a approximation (where ) for the instance if . For the approximation guarantees to be meaningful, we will assume that the Nash optimal for any given instance has nonzero Nash social welfare.
3 Main Results
We provide two main results: a approximation algorithm for identical valuations (Theorem 1), and an exact algorithm for binary valuations (Theorem 2). The proofs of these results are presented in Sections 5 and 4 respectively.
Theorem 1 (Identical valuations).
Given any fair division instance with additive and identical valuations, there exists a polynomial time approximation algorithm for the Nash social welfare maximization problem.
Theorem 2 (Binary valuations).
Given any fair division instance with additive and binary valuations, a Nash optimal allocation can be computed in polynomial time.
4 Identical Valuations: Proof of Theorem 1
Our proof of Theorem 1 relies on two intermediate results: First, we will show in Lemma 1 that the allocation computed by the greedy algorithm (called AlgIdentical, given in Algorithm 1) satisfies an approximate envyfreeness property called , defined below. We will then show in Lemma 2 that any allocation with this property—in particular, the allocation computed by AlgIdentical—provides a approximation guarantee.
We start by describing the notion of envyfreeness and some of its variants.
Envyfreeness and its variants
Given an instance and an allocation , we say that an agent envies another agent if prefers the bundle of over its own bundle, i.e., . An allocation is said to be envyfree () if each agent prefers its own bundle over that of any other agent, i.e., for every pair of agents , we have . Likewise, an allocation is said to be envyfree up to the least positively valued good () if for every pair of agents , we have for every such that . The notion of first appeared in the work of Caragiannis et al. [CKM16]. Plaut and Roughgarden [PR18] study the existence of allocations for special cases of the fair division problem.
We will now describe our algorithm called AlgIdentical.
Greedy algorithm for identical valuations
As mentioned earlier in Section 1, our algorithm AlgIdentical (Algorithm 1) allocates the goods one by one in descending order of their value. In each iteration, a good is assigned to the agent with the least valuation. Assigning goods in this manner ensures that at each step, the algorithm picks the agent providing the greatest improvement in . It is easy to see that AlgIdentical runs in polynomial time. Our next result (Lemma 1) shows that AlgIdentical always outputs an allocation.
Lemma 1.
The allocation returned by AlgIdentical is .
Proof.
Let be the allocation maintained by AlgIdentical at the end of the iteration. It suffices to show that for each , if is , then so is .
Write to denote the good allocated in the iteration, and let be the agent that receives this good; thus . Notice that only the valuation of agent is affected by the assignment of , while the allocation any other agent is unchanged. Therefore, in order to establish that is , we only need to consider agent and show that for all and each . Since AlgIdentical processes the goods in decreasing order of value, the good is the least valued good in . Thus, for any , we have that for all ; here, the last inequality follows from the agent selection rule of AlgIdentical, i.e., the fact that . This shows that must be . ∎
Our final result in this section shows that any allocation provides a approximation to Nash social welfare when the valuations are additive and identical.
Lemma 2.
Let be an instance with additive and identical valuations, and let be an allocation for . Then, , where is the Nash optimal allocation for .
Proof.
For notational convenience, we reindex the bundles in the allocation such that , where denotes the (additive and identical) valuation function for all agents. Let denote the valuation of the least valued bundle under (thus ).
For any agent with two or more goods in , property implies that
(1) 
In particular, Equation 1 implies that if for some , then consists of exactly one good. Let denote the set of agents with such singleton bundles. Write and let denote the set of goods owned by the agents in .
For analysis, we will now consider a set of allocations where only the goods in are required to be allocated integrally, and any other good can be allocated fractionally among the agents. Formally, we define a partiallyfractional allocation as follows: for every good , for any agent subject to , and for any other good , for any agent subject to . We let denote the set of all such partiallyfractional allocations, and let denote the Nash optimal allocation in .^{2}^{2}2The valuation of an agent under a fractional allocation is given by . Since all integral allocations belong to , we have . Therefore, in order to prove the lemma, it suffices to show that .
Define . Observe that all goods in , namely , must belong to separate bundles in . This is because the combined value of all goods in is strictly less than . Therefore, if two (or more) goods in belong to the same bundle in (say, ), then there must exist another bundle in (say, ) with value strictly less than . In that case, we can simply swap the bundle with one of the goods (of value more than ) in and strictly improve , which is a contradiction. Therefore, without loss of generality, each good in belongs to a unique bundle in . Using this observation, we can reindex the bundles in such that for all .
It is easy to see that .^{3}^{3}3If , then it must be that , i.e. a nonzero amount of fractional good is taken away from the bundle . In that case, one can reassign (part of) this fractional good—currently assigned to one of the agents in — to and strictly improve the Nash social welfare, contradicting the assumption that is the Nash optimal in . In addition, we can show that . Indeed, as argued above, . This implies that , i.e., . Using this bound we can establish a useful structural property of : For all , the bundles are singletons (i.e., for all ) and, for all , we have . This follows from the observation that any bundle in which has a fractionally allocatable good (say, good ) is of value equal to ; otherwise, we can “redistribute” between and to obtain another fractional allocation with strictly greater . Moreover, since for any , and (recall that ), the bundle does not contain a fractionally allocatable good. This, in particular, implies that . All the remaining goods in are fractionally allocatable, and hence the bundles for all are of value equal to . This structural property gives us the following bound for :
(2) 
We will now provide a lower bound for that will allow us to prove the desired approximation guarantee. This is done by constructing an allocation such that . Along with Equation 2, this provides an analysisfriendly lower bound for the quantity .
We start with the initialization . Next, while there exist two agents such that , we transfer goods of value from (the lesser valued bundle) to (the larger valued bundle). Such a transfer is possible because the goods in the bundles with value less than are allowed to be allocated fractionally. Notice that the Nash social welfare does not increase as a result of this transfer. Also, it is easy to see that this process terminates, since after each iteration of the while loop, either or or both, and hence some agent can take no further part in any future iterations. Upon termination of the above procedure, there can be at most one agent (say, ) such that ; for every other agent , .
Let and let . Notice that by construction of , ; hence, . We then have the following bound on the Nash social welfare of the allocation :
(3) 
Let denote the combined value of all goods except for those in the set . We will now use the allocations and to obtain upper and lower bounds for , which in turn will help us achieve the desired approximation ratio for the allocation .
First, recall that the goods in the set are allocated as singletons in to the bundles . Along with the fact that for all , this gives
(4) 
Next, in the allocation , each bundle corresponding to agents in is valued at exactly , and that for each agent in (except for the agent ) is valued at exactly . By overestimating to be , we get
(5) 
Equations 5 and 4 together imply that
(6) 
We can lower bound the quantity of interest , as below:
In the penultimate inequality, the reason for using the approximation is as follows: Imagine constructing a scaledup instance consisting of copies of the instance , where is arbitrarily large. Notice that has additive and identical valuations. Moreover, for any allocation that is a approximation for the instance , the allocation is approximation for . Similarly, is for if and only if is for . Finally, write to denote the analogues of in . It is easy to see that , , and . Since the agent with the least valuation in (under allocation ) values his bundle at strictly below , we know that , and thus the quantity can be made arbitrarily large for appropriately chosen . We can therefore ignore the term in the exponent of without loss of generality. This completes the proof of Lemma 2. ∎
The following example shows that the approximation guarantee of Lemma 2 is almost tight.
Example 1 (Tightness of approximation factor for allocations).
Consider a fair division instance with goods ( is even) and agents, where the (additive and identical) valuations are given as follows: , and for . Notice that the allocation is . Additionally, . It is also clear that . The approximation ratio of is given by
which closely matches the approximation guarantee of Lemma 2.
5 Binary Valuations: Proof of Theorem 2
Our proof of Theorem 2 relies on a greedy algorithm (Algorithm 2, hereafter referred to as AlgBinary). Starting from any suboptimal allocation, AlgBinary identifies a pair of agents such that a chain of swaps between them provides the greatest improvement in Nash social welfare (from among all pairs of agents). Lemma 3 quantifies the progress towards the Nash optimal allocation made by AlgBinary in each step. As it turns out, the algorithm is required to run for at most iterations. Overall, this provides a polynomial time algorithm for computing a Nash optimal allocation for binary valuations. The detailed description of AlgBinary follows.
Greedy algorithm for binary valuations
The input to AlgBinary is an instance with additive and binary valuations along with a suboptimal allocation, and output is a Nash optimal allocation. At each step, the algorithm performs a greedy local update over the current allocation. Specifically, given a partition , AlgBinary constructs a directed graph as follows: There is a vertex for each agent (hence vertices overall), and between any pair of vertices and , there are parallel edges directed from to .^{4}^{4}4Recall that . A directed edge exists if and only if there exists a good that is valued by and is currently assigned to . Observe that a directed simple path in corresponds to a sequence of reallocations. For each directed edge , there exists a good that can be reassigned to via the updates and .
Let denote the partition obtained by reallocating goods along the path . Such a reallocation increases (decreases) the valuation of () by one, while the valuations of all intermediate agents are unchanged. The algorithm AlgBinary greedily selects a specific path in , and reallocates the goods along to obtain the partition . Lemma 3 below describes the progress towards the optimal solution made by such a reallocation.
Lemma 3.
Given a suboptimal partition , there exist agents and such that is reachable from in , and reallocating along any directed path from to leads to a partition that satisfies
Here denotes the Nash optimal partition.
Remark 1.
Note that there can be multiple paths from to in , and different goods that can be reallocated along a fixed edge of , which might lead to different partitions . However, the Nash social welfare of any resulting partition is the same, since the valuation of () goes down (up) by one and that of every other agent remains the same. Hence, the choice of path between a fixed pair of vertices is inconsequential.
In the remainder of this section, we will show that Lemma 3 can used to prove Theorem 2, followed by a proof of Lemma 3.
Proof of Theorem 2.
Lemma 3 ensures that if there does not exist an improving reallocation, then the current allocation is optimal. Hence, for the rest of the proof, we will focus on the case wherein the forloop executes for all steps.
The update rule followed by AlgBinary and Lemma 3 together guarantee that at the end of iteration , we have
Repeated use of the above bound gives
Since AlgBinary executes for iterations, the difference between the optimal partition and the partition returned by the algorithm is given by
Thus, . We already know that . Since the valuations are assumed to be integral, and , we have that . Hence, is Nash optimal. This completes the proof of Theorem 2. ∎
We will now provide a proof of Lemma 3.
Proof of Lemma 3.
Our proof of existence of the desired path in the graph is made convenient by the formulation of another graph . This graph is utilised only in the analysis of the algorithm and never explicitly constructed.
Recall that refers to a Nash optimal allocation. Consider the directed graph consisting of vertices, one for each agent, and a directed edge for each good . The edge indicates that the good must be transferred from to to reach the optimal partition . Note that the total number of edges in is at most .
Besides defining the graph
, we also classify the agents depending on their valuation relative to
. In particular, let and denote the set of agents with excess and deficit valuations respectively, i.e., and .^{5}^{5}5For binary valuations and a nonwasteful allocation , we have for each agent . Any agent satisfies .The remainder of the proof consists of two parts: First, we will show that the edge set of can be partitioned into simple directed paths and cycles such that each path starts at a vertex in and ends at a vertex in . Second, we will use this decomposition to argue that one of the paths leads to a partition that satisfies the bound in Lemma 3. The lemma will then follow by observing that the edges of are also contained in the graph constructed by AlgBinary. Note that the existence of shows that the end vertex of (say, ) is reachable from the start vertex of (say, ) in . As noted earlier in Remark 1, reallocating along any path between and leads to the stated improvement in Nash social welfare.
We will start by proving the claim about decomposition of the edge set of . Consider a graph where for each vertex of , we include vertices, say . Suppose the vertex has incoming edges and outgoing edges in . To construct , first we pick an arbitrary onetoone assignment between the incoming edges and . Similarly, each outgoing edge gets uniquely assigned to one of the vertices in . With these assignments in hand, for every directed edge in , we include a directed edge in if and only if is assigned to and . It is easy to see that each edge in corresponds to an edge in and vice versa.
Notice that each vertex in has at most one incoming and at most one outgoing edge. Furthermore, if is a source in , then . Similarly, if is a sink in , then . These properties together imply that the edges in can be partitioned into paths and cycles such that each path starts at a vertex with and ends at a vertex with . The correspondence between the edges of and gives us the desired collection of paths and cycles in .^{6}^{6}6We can ensure that the paths in are simple by removing cycles from each and placing such cycles in . The aforementioned properties also imply that the paths in are edgedisjoint, therefore .
We will now show that for one of the paths in (and therefore, also in ), the partition achieves the bound in Lemma 3. First, observe that reallocating along a cycle in does not change the Nash social welfare. Hence, in order to reach a Nash optimal partition starting from , it suffices to reallocate goods along the paths . Moreover, since the paths in are edge disjoint in the graph , they correspond to reallocation of disjoint sets of goods. This means that the reallocations corresponding to a path can be performed independently of those corresponding to another path .
Next, consider the sequence of partitions , obtained by successively reallocating along the paths . That is, , and so on. Thus, the partition must be Nash optimal, i.e., . Consider the telescoping sum given by , where . Since , there must exist such that
(7) 
We will now show that the partition satisfies
(8) 
Indeed, recall that each path in starts at a vertex in and ends at a vertex in . Hence, as we proceed through reallocations corresponding to , the cardinality of the set of goods assigned to any agent is nonincreasing and that of is nondecreasing. Therefore, if () is the start (end) vertex of , then and , where , , and are the number of goods assigned to and in partitions and respectively. Since and , the concavity of implies Equation 8. Finally, Equations 7 and 8 give us the desired relation
Notice that the proof of Lemma 3 works exactly the same way when for each agent , for some concave function . That is, the valuation of an agent can be an (agentspecific) concave function of the cardinality (i.e., the number of nonzero valued goods owned by the agent). Thus, AlgBinary can find a Nash optimal allocation in polynomial time even when the valuation functions of agents are concave in cardinality. This observation is formalized in Corollary 1.
Corollary 1.
Given any fair division instance with concave and binary valuations, a Nash optimal allocation can be computed in polynomial time.
Remark 2.
A wellstudied class of valuation functions captured by Corollary 1 is that of budgetadditive valuations [LLN01]. Under this class, the valuation of an agent for a set of goods is given by , where is an (agentspecific) constant, known as the utility cap.
Garg et al. [GHM18] recently gave a approximation algorithm for this class (for any ). For binary valuations, a budgetadditive valuation function turns out to be a special case of the concaveincardinality functions mentioned above. Hence, by Corollary 1, a Nash optimal allocation can be found in polynomial time when the valuations are binary and budgetadditive. It is unclear whether the existing techniques for finding a Nash optimal allocation under binary and additive valuations [DS15] admit a similar generalization.
References
 [AGMV18] Nima Anari, Shayan Oveis Gharan, Tung Mai, and Vijay V Vazirani. Nash Social Welfare for Indivisible Items under Separable, PiecewiseLinear Concave Utilities. In Proceedings of the 29th Annual ACMSIAM Symposium on Discrete Algorithms (SODA), pages 2274–2290, 2018.
 [AGSS17] Nima Anari, Shayan Oveis Gharan, Amin Saberi, and Mohit Singh. Nash Social Welfare, Matrix Permanent, and Stable Polynomials. In Proceedings of the 8th Conference on Innovations in Theoretical Computer Science (ITCS), 2017.

[BGHM17]
Xiaohui Bei, Jugal Garg, Martin Hoefer, and Kurt Mehlhorn.
Earning Limits in Fisher Markets with SpendingConstraint
Utilities.
In
Proceedings of the International Symposium on Algorithmic Game Theory (SAGT)
, pages 67–79, 2017.  [BKV17] Siddharth Barman, Sanath Kumar Krishnamurthy, and Rohit Vaish. Finding Fair and Efficient Allocations. arXiv preprint arXiv:1707.04731, 2017.
 [CDG17] Richard Cole, Nikhil Devanur, Vasilis Gkatzelis, Kamal Jain, Tung Mai, Vijay V Vazirani, and Sadra Yazdanbod. Convex Program Duality, Fisher Markets, and Nash Social Welfare. In Proceedings of the 2017 ACM Conference on Economics and Computation (EC), pages 459–460, 2017.

[CG15]
Richard Cole and Vasilis Gkatzelis.
Approximating the Nash Social Welfare with Indivisible Items.
In
Proceedings of the FortySeventh Annual ACM on Symposium on Theory of Computing (STOC)
, pages 371–380, 2015.  [CKM16] Ioannis Caragiannis, David Kurokawa, Hervé Moulin, Ariel D Procaccia, Nisarg Shah, and Junxing Wang. The Unreasonable Fairness of Maximum Nash Welfare. In Proceedings of the 2016 ACM Conference on Economics and Computation (EC), pages 305–322, 2016.
 [DS15] Andreas Darmann and Joachim Schauer. Maximizing Nash Product Social Welfare in Allocating Indivisible Goods. European Journal of Operational Research, 247(2):548–559, 2015.

[EG59]
Edmund Eisenberg and David Gale.
Consensus of Subjective Probabilities: The Parimutuel Method.
The Annals of Mathematical Statistics, 30(1):165–168, 1959.  [GHM18] Jugal Garg, Martin Hoefer, and Kurt Mehlhorn. Approximating the Nash Social Welfare with BudgetAdditive Valuations. In Proceedings of the 29th Annual ACMSIAM Symposium on Discrete Algorithms (SODA), pages 2326–2340, 2018.
 [KN79] Mamoru Kaneko and Kenjiro Nakamura. The Nash Social Welfare Function. Econometrica: Journal of the Econometric Society, pages 423–435, 1979.
 [Lee17] Euiwoong Lee. APXhardness of Maximizing Nash Social Welfare with Indivisible Items. Information Processing Letters, 122:17–20, 2017.
 [LJ83] Hendrik W Lenstra Jr. Integer Programming with a Fixed Number of Variables. Mathematics of Operations Research, 8(4):538–548, 1983.
 [LLN01] Benny Lehmann, Daniel Lehmann, and Noam Nisan. Combinatorial Auctions with Decreasing Marginal Utilities. In Proceedings of the 3rd ACM Conference on Electronic Commerce (EC), pages 18–28, 2001.
 [Mou04] Hervé Moulin. Fair Division and Collective Welfare. MIT press, 2004.
 [NJ50] John F Nash Jr. The Bargaining Problem. Econometrica: Journal of the Econometric Society, pages 155–162, 1950.
 [NR14] Trung Thanh Nguyen and Jörg Rothe. Minimizing Envy and Maximizing Average Nash Social Welfare in the Allocation of Indivisible Goods. Discrete Applied Mathematics, 179:54–68, 2014.
 [PR18] Benjamin Plaut and Tim Roughgarden. Almost Envyfreeness with General Valuations. In Proceedings of the TwentyNinth Annual ACMSIAM Symposium on Discrete Algorithms (SODA), pages 2584–2603. SIAM, 2018.
 [RR10] Magnus Roos and Jörg Rothe. Complexity of Social Welfare Optimization in Multiagent Resource Allocation. In Proceedings of the 9th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 641–648, 2010.
 [Var74] Hal R Varian. Equity, Envy, and Efficiency. Journal of Economic Theory, 9(1):63–91, 1974.