# Envy-freeness up to any item with high Nash welfare: The virtue of donating items

Several fairness concepts have been proposed recently in attempts to approximate envy-freeness in settings with indivisible goods. Among them, the concept of envy-freeness up to any item (EFX) is arguably the closest to envy-freeness. Unfortunately, EFX allocations are not known to exist except in a few special cases. We make significant progress in this direction. We show that for every instance with additive valuations, there is an EFX allocation of a subset of items with a Nash welfare that is at least half of the maximum possible Nash welfare for the original set of items. That is, after donating some items to a charity, one can distribute the remaining items in a fair way with high efficiency. This bound is proved to be best possible. Our proof is constructive and highlights the importance of maximum Nash welfare allocation. Starting with such an allocation, our algorithm decides which items to donate and redistributes the initial bundles to the agents, eventually obtaining an allocation with the claimed efficiency guarantee. The application of our algorithm to large markets, where the valuations of an agent for every item is relatively small, yields EFX with almost optimal Nash welfare. To the best of our knowledge, this is the first use of large market assumptions in the fair division literature. We also show that our algorithm can be modified to compute, in polynomial-time, EFX allocations that approximate optimal Nash welfare within a factor of at most 2ρ, using a ρ-approximate allocation on input instead of the maximum Nash welfare one.

• 23 publications
• 11 publications
• 74 publications
11/25/2019

### Greedy Algorithms for Fair Division of Mixed Manna

We consider a multi-agent model for fair division of mixed manna (i.e. i...
05/16/2018

### On Fair Division of Indivisible Items

We consider the task of assigning indivisible goods to a set of agents i...
01/27/2020

### Maximum Nash Welfare and Other Stories About EFX

We consider the classic problem of fairly allocating indivisible goods a...
03/16/2020

### Finding Fair and Efficient Allocations When Valuations Don't Add Up

In this paper, we present new results on the fair and efficient allocati...
08/01/2018

### Almost Envy Freeness and Welfare Efficiency in Fair Division with Goods or Bads

We consider two models of fair division with indivisible items: one for ...
12/10/2021

### EEF1-NN: Efficient and EF1 allocations through Neural Networks

Neural networks have shown state-of-the-art performance in designing auc...
08/01/2019

### The Constrained Round Robin Algorithm for Fair and Efficient Allocation

We consider a multi-agent resource allocation setting that models the as...

## 1. Introduction

The agenda of fairly allocating items to agents has received much attention by the EconCS community recently. Most of the solution concepts with compelling properties such as envy-freeness and proportionality cannot always be attained when the items are indivisible, in contrast to the traditionally studied case of divisible items. Recent work put forth several promising fairness notions that adapt and “approximate” the definition of envy-freeness to the case of individual items and demonstrated that allocations that satisfy some of these notions are possible, with some minimum efficiency guarantees at the same time.

A very natural adaptation of envy-freeness for settings with indivisible items was defined by Budish (Budish, 2011) (but is also implicit in the earlier work of Lipton et al. (Lipton et al., 2004)). An allocation of items is envy-free up to some item (EF1) if any possible envy of an agent for the allocation of another can be eliminated by removing some item from the envied bundle. It is well known that EF1 allocations can always be achieved, and recently Caragiannis et al. (Caragiannis et al., 2016)

showed that the Nash welfare maximizing allocation is Pareto-optimal and EF1. This is indeed a success story for the Nash welfare efficiency measure defined as the geometric mean of the agent valuations, a standard and well studied objective that is particularly well aligned with fair division applications.

For example, consider the problem of fairly dividing the inheritance of four items, a car, a ring, a painting, and a necklace, among three agents named Alice, Bob, and Carol. Agents have preferences for the items, which are expressed in the table at the right, where each number represents the amount in thousands of USD of how much each agent values the corresponding item. Clearly, there is no envy-free allocation in this example, because someone must get at least two items, and then one of the two other agents would have a higher total value for these items compared to what the agent got. The allocation which gives the ring to Alice, the car and the painting to Bob, and the necklace to Carol, is EF1 with the valuations of , , and , respectively. In this allocation, Bob does not envy anyone, while Alice and Carol would prefer to swap Bob’s allocation with their own: Alice values the car and the painting in Bob’s bundle for the total of , and Carol values them for . This is still an EF1 allocation as Alice’s and Carol’s envy can be eliminated by ignoring their most valued item in Bob’s bundle (i.e., the car) when comparing valuations.

The above allocation in our inheritance example maximizes the Nash welfare objective, which is widely considered as an important efficiency measure for allocations. It provides an appealing compromise between utilitarian and egalitarian social welfare objectives, defined as the sum of agent valuations for their allocated items and minimum valuation among all agents, respectively. Finding a Nash welfare maximizing allocation is well-known to be computationally tractable in settings with divisible items (by minimizing the convex program of Eisenberg and Gale (Eisenberg and Gale, 1959)), where the resulting allocation also happens to be envy-free. In the case of indivisible goods, besides being EF1, Nash welfare maximizing allocations have some additional fairness properties (see e.g. (Caragiannis et al., 2016)), including a remarkable scale-invariant property that rescaling the valuation of an agent does not change the allocation that maximizes Nash welfare (see (Moulin, 2003) for a detailed discussion).

On the other hand, the Nash welfare maximizing allocation from the example above can hardly be considered fair, since Bob gets more value than Alice and Carol put together in our symmetric instance111The instance is invariant under a cyclic permutation of agents’ names and the respective cyclic permutation of all items except the car.. Consider another allocation, where Alice gets the ring for the value of , Bob gets the car for the value of , while the painting and the necklace go to Carol with the total value of . This allocation is slightly sub-optimal in terms of the Nash welfare, but it looks clearly better than the previous allocation from the fairness point of view. Indeed, observe that, inevitably, one agent must get the car; it is Bob in our case. This already creates some envy from Alice and/or Carol. So, it makes more sense to allocate the remaining three items only to them and give nothing more to Bob. More concretely, such allocations have the much more appealing property of envy-freeness up to any item (EFX), introduced by Caragiannis et al. (Caragiannis et al., 2016). Now, the envy of Alice and Bob for Carol can be eliminated by ignoring their least-valued item in Bob’s bundle when comparing valuations. Arguably, EFX is the best fairness analog of envy-freeness for indivisible items. But even though EF1 allocations can be computed in many different ways (e.g., by a simple draft mechanism, by the local-search algorithm of Lipton et al. (Lipton et al., 2004), by maximizing the Nash welfare, etc.), for EFX allocations, we do not even know whether they always exist. Moreover, asking for EFX allocations that simultaneously satisfy some efficiency guarantee is way beyond the reach of known techniques.

#### Donation of items.

A natural way to deal with the (hypothetical) issue of the existence of EFX allocations is to consider partial allocations, which leave some of the items unallocated. The unallocated items could then be donated to a charity or sold at auction with the profit equally distributed between the agents. Actually, in situations like the above inheritance example that arise in practice, it is usually observed that people donate some of their possessions to charities before distributing the rest to their heirs. Undoubtedly, the donation of items can completely eliminate envy, e.g., by donating all items and allocating nothing to the agents. However, although beneficial for the charity cause, this outcome cannot be considered as good for the problem at hand. Therefore, an important question to ask is:

How can we achieve an EFX allocation of high Nash welfare by donating items smartly?

#### Our results.

We make careful use of the idea of donating items and hit many birds with one stone. We present an algorithm that takes an allocation of maximum Nash welfare as input and, after donating some of the items, outputs an allocation of the remaining ones that is EFX and has a Nash welfare that is at least half the optimal one for the original instance (that includes the donated items). As we show, this efficiency guarantee is best possible for EFX allocations, no matter whether there are donated items or not. A remarkable bonus property is that the bundle that is allocated to each agent is a subset of the bundle he/she initially gets in the maximum Nash welfare allocation. When the same approach is applied to large market instances, where any item’s contribution is only a small fraction of the total value of any agent, our algorithm outputs almost optimal allocations. The algorithm can be modified to work with input allocations that have sub-optimal Nash welfare. Combined with a -approximation algorithm for maximizing Nash welfare (such as the algorithms of Cole and Gkatzelis (Cole and Gkatzelis, 2015) or Barman et al. (Barman et al., 2018)), the modified algorithm runs in polynomial-time and computes an EFX allocation that is -approximation to the maximum Nash welfare.

#### Techniques.

We remark that our algorithms are purely combinatorial. This comes in contrast to the heavily used convex programming and rounding techniques for Nash welfare maximization as well as the use of duality techniques and item prices for the computation of fair allocations.

Our algorithms do not reallocate any items between the bundles in the initial allocation but permanently remove items from the instance. This removal operation gives us fine control of the agents’ preferences. For example, if an agent is “happy” with a bundle from which we do not remove an item, then she stays happy with it after the removal of an item. At a high level, we always seek to find a complete EFX feasible matching of agents with bundles and carefully remove an item so that the size of the matching never decreases. From the Nash welfare maximality property, we derive that no bundle can lose more than a certain fraction of its value for the agent who had it in the initial Nash welfare maximizing allocation, yielding the desired Nash welfare guarantee. For large markets, we are able to obtain our considerably improved result by proving a number-theoretic lemma using Karamata’s inequality for the logarithm function.

#### Significance.

We employ the natural and practical operation of donating/removing items to resolve the challenging issues related to the EFX solution concept. Our approach contrasts with the recent attempts to mitigate such challenges by considering approximate versions of EFX (e.g., in the papers by Plaut and Roughgarden (Plaut and Rougligarden, 2018) and Amanatidis et al. (Amanatidis et al., 2018)). Instead, we keep the precise definition of EFX and use approximation only for the efficiency guarantee which is unavoidable. This approach of considering item donations could be useful in the study of the interplay of other fairness notions with efficiency. Furthermore, to the best of our knowledge, this is the first time that large market assumptions are considered in the fair division literature.

### 1.1. Related work

#### Fair division with indivisible items.

The rigorous study of fair division with divisible items has a long history; it origininates from the work of Steinhaus (Steinhaus, 1948) in the 40’s and includes very recent breakthroughs like the envy-free cake-cutting protocol of Aziz and McKenzie (Aziz and Mackenzie, 2016)

. In contrast, fairly allocating indivisible items among agents has not been as popular until very recently. Most probably, the reason for this delay is that the beautiful fairness notions of envy-freeness and proportionality, that have received so much attention in the literature on divisible items, are rarely achievable with indivisible items. To give an embarassing example, just consider a single item and two agents with identical valuations for the item.

The recent interest for the indivisible items setting was sparked with the definition of fairness notions that approximate envy-freeness and proportionality. In particular, the notion of maxmin fair share (MMS), defined by Budish (Budish, 2011) and Bouveret and Lemaître (Bouveret and Lemaître, 2016) can be thought of as an approximate version of proportionality and has received much attention recently, e.g., see (Kurokawa et al., 2018; Amanatidis et al., 2017; Barman and Krishna Murthy, 2017; Ghodsi et al., 2018). Besides the concepts of EF1 and EFX mentioned above, approximate versions of envy-freeness include epistemic envy-freeness (Aziz et al., 2018) or notions that require the minimization of the envy-ratio (Lipton et al., 2004) and degree of envy (Chevaleyre et al., 2007; Nguyen and Rothe, 2014) objectives.

As mentioned earlier, EF1 is easy to achieve with several different methods. What is really challenging is to achieve EF1 and Pareto-optimality simultaneously. This was proved to be possible in (Caragiannis et al., 2016), by an allocation of maximum Nash welfare. The popular website Spliddit (Goldman and Procaccia, 2014), available at www.spliddit.org, returns such allocations as part of its “Divide goods” application. Following (Caragiannis et al., 2016), Barman et al. (Barman et al., 2018) investigate whether EF1 and Pareto-optimal allocations can be computed efficiently and present a pseudo-polynomial-time algorithm.

Unlike EF1, the existence of EFX allocations is still a mystery, even for three agents with additive valuations. Plaut and Roughgarden (Plaut and Rougligarden, 2018) prove the existence of EFX allocations for setting with two agents only or with more agents and identical valuations. In addition, they present an algorithm for computing an -EFX allocation, where the value of each agent from her bundle is at least half of what the EFX property requires it to be. Caragiannis et al. (Caragiannis et al., 2016) and Amanatidis et al. (Amanatidis et al., 2018) consider different approximations of EFX (namely, approximations of the strongly related pairwise MMS fairness concept).

#### Nash welfare.

The history of Nash social welfare (or, simply, Nash welfare) dates back to the 50’s, where it was used in bargaining problems (Nash Jr, 1950). In fair division, it is considered as a good measure to balance fairness with efficiency. In particular, in settings with divisible items, maximizing the Nash welfare can be done in polynomial-time using the convex program of Eisenberg and Gale (Eisenberg and Gale, 1959), which also leads to envy-free allocations. Unfortunately, such nice properties dissappear in the indivisible items setting as the problem of computing an allocation of maximum Nash welfare becomes APX-hard (Lee, 2017) (see also (Nguyen et al., 2014) for a weaker hardness result). Still, as the Nash welfare is a very important efficiency measure, several constant-approximation algorithms have been proposed recently. The first such algorithm was due to Gkatzelis and Cole (Cole and Gkatzelis, 2015) and approximates the Nash welfare within a factor of . This was improved to by Cole et al. (Cole et al., 2017), and further to by Barman et al. (Barman et al., 2018). See also (Anari et al., 2018, 2017; Garg et al., 2018) for approximation algorithms in more general settings (with non-additive valuations). With the exception of (Barman et al., 2018) that uses item pricing techniques, rounding of convex programming relaxations is the main algorithmic tool in this line of research.

#### Other related papers.

Our main positive result bounds the efficiency gap of the best EFX allocation in terms of Nash welfare. As such, this is a price of fairness result, a notion that was introduced independently by Bertsimas et al. (Bertsimas et al., 2011) and Caragiannis et al. (Caragiannis et al., 2012). Also, the general structure of our algorithms has conceptual similarities (but also many technical differences) to algorithms for computing combinatorial walrasian equilibria (Feldman et al., 2016a), where items are packaged into groups instead of being donated. Finally, we remark that large market assumptions have been considered in a few different areas recently, such as in the study of the price of anarchy of large games (Cole and Tao, 2016; Feldman et al., 2016b), in budget-feasible mechanisms (Anari et al., 2014), and in optimizing over (very different from ours) fairness constraints (Balkanski and Singer, 2015).

The rest of the paper is structured as follows. We begin with formal definitions in Section 2. Our counter-example showing that the Nash welfare of EFX allocations can be far from optimal is given in Section 3. The description and analysis of our main positive result is presented in Section 4. Our modifications that allow the algorithm work with allocations of sub-optimal Nash welfare on input are given in Section 5. The large market assumption is considered in Section 6. We conclude in Section 7 with a short discussion and open problems.

## 2. Preliminaries

Let be the set of agents and be the set of indivisible items. We enumerate agents and items from through and through , respectively. We will often refer to the set of agents as and to the set of items as , where for any positive integer number . Each agent is endowed with a valuation function , where is the set of positive real numbers. Valuations are additive; by slight abuse of notation, agent has a value of for any set .

We refer to a set of items as a bundle and extensively consider partitions of items into bundles. Formally, a partition of a set of items is a set of disjoint bundles such that and . An allocation of the items in to the agents of is an ordered partition of the item set , where each agent gets the bundle . We denote the set of all possible allocations of to the agents of as . From now on, the term allocation implies an allocation to the agents of .

An allocation is called

• [noitemsep,nolistsep]

• envy-free (EF) if for any ;

• envy-free up to one item (EF1) if for any ;

• envy-free up to any item (EFX) if for any 222If the set is empty we assume that . We remark that our definition is slightly different than the one in (Caragiannis et al., 2016), where the maximum is taken over the items of bundle for which agent has strictly positive valuation. However, our positive results are only stronger in this way, and in the proof of Theorem 1, all agent valuations are non-zero..

We measure the efficiency of an allocation using its Nash social welfare (or, simply Nash welfare) , which is defined as the geometric mean of . For any set of items , we denote by the maximum Nash welfare over all allocations of . Formally,

 NW(X)def=⎛⎝∏i∈[n] vi(Xi)⎞⎠1/n,opt(S)def=maxX∈X(S)NW(X).

Our goal is to find an EFX allocation with as large Nash welfare as possible. We say that the allocation of is -efficient if . An allocation is called Pareto-optimal if there is no other allocation with at least as high value for every agent , i.e., , and strictly higher value for one of the agents. In particular, the Nash welfare maximizing allocation is Pareto-optimal.

We now introduce large markets. These are allocation problems, in which the valuation of every agent for any item is a small fraction of her total value for all items of .

###### Definition 0 (Large Market).

An allocation problem satisfies the large market condition with parameter if for every agent and any item .

In Section 6, we actually use the following weaker large market condition, which is defined with respect to any allocation of optimal Nash welfare.

###### Definition 0 (Large market w.r.t. optimal allocation X).

An allocation of optimal Nash welfare satisfies the large market condition with parameter if for every agent and any item .

###### Claim 1 ().

The large market condition with parameter implies the large market condition for an optimal Nash welfare allocation with parameter .

###### Proof.

We use the fact that a Nash welfare maximizing allocation is also EF1 (Caragiannis et al., 2016). Let us fix any agent . The EF1 condition for agent implies that , such that . By summing these inequalities over all and the equality , we get

 n⋅vi(Xi)≥vi(Xi)+∑j≠ivi(Xj∖{gij})=vi(M)−∑j≠ivi(gij)≥vi(M)−(n−1)⋅εnvi(M).

Therefore, for any agent and item we have

 vi(g)≤εnvi(M)≤εnn⋅vi(Xi)(1−n−1nε)−1=ε′⋅vi(Xi).\qed

## 3. A lower bound on the Nash welfare of EFX allocations

Before presenting our positive results, we give an allocation problem where almost half of the optimal Nash welfare must be sacrificed in order to achieve EFX, either for the original set of items or for any subset of them.

###### Theorem 1 ().

For any positive integer and , there is an allocation problem with agents and set of items , such that any EFX allocation of any subset of items satisfies .

###### Proof.

Consider the allocation problem with agents, set of items , and valuation function of agent that is defined as follows:

 vi(g)def=⎧⎪⎨⎪⎩1when % g∈{1,...,n−1},1−εwhen g=2n−i,ε/2n, otherwise.

The allocation with for , and has Nash welfare . Hence, the optimal Nash welfare is

 opt(M) ≥n√(2−ε)n−1(1−ε)=21−1/n⋅(1−ε2)(n−1)/n(1−ε)1/n >21−1/n(1−ε2⋅n−1n)(1−εn)>21−1/n−2ε.

The second inequality follows by Bernoulli inequality for .

Now consider any EFX allocation of a set of items . By the pigeonhole principle, there must be some agent who does not receive any of the first items. Then, agent ’s value is at most It means that, if any other agent receives a large item , then her allocation must contain only that item, i.e., . Indeed, if there is an item different than so that and belong to bundle , then the EFX condition is violated, as . This means that no agent gets value higher than : either agent gets a large item and, subsequently, , or she gets (a subset of) items and has value . Therefore, which, together with the inequality on above, completes the proof. ∎

## 4. Main algorithm

We now present our algorithm for computing an EFX allocation of some of the items to the agents. Together with the allocation problem (a set of items and agents with valuations for the items in ), the algorithm receives as input a Nash welfare maximizing allocation for it. It tries to match as many bundles from the initial allocation to agents as possible and repeatedly removes items from the bundles as long as this matching does not correspond to an EFX allocation. The algorithm is guaranteed to output an EFX allocation with Nash welfare which is at least half of the original one. More precisely, we will show that .

Before presenting our algorithm in detail, we introduce several useful notions, giving forward pointers to the lines of the pseudocode (see Algorithm 1) where these notions are used. During its execution, the algorithm maintains a disjoint set of bundles. Initially (see Line 1), consists of the bundles in . The algorithm progresses in rounds. In each round (defined by an execution of Lines 3-12 of the pseudocode in the “repeat-until” loop), it tries to compute an EFX allocation (with particular properties) by assigning the bundles of to the agents. Whenever this is not possible, it removes an item from a bundle of and proceeds to the next round. When a bundle of misses an item, it becomes a touched bundle.

In order to compute the EFX allocation in each round, the algorithm uses the notion of the EFX feasibility graph, which is defined as follows. The EFX feasibility graph is a bipartite graph between two sets of vertices: the first part contains all agents , each agent as a vertex; the second part contains the bundles in , each bundle as a vertex. Edges of are defined as

 E(G)def={(i,Zj)| (i) Zj is EFX feasible for i; (ii) vi(Zj)>vi(Zi) if i≠j}.

In particular, EFX feasibility in condition (i) requires that for all . Condition (ii) in the definition of restricts the space of possible allocations and expresses our preference for matching agents to their initial bundles whenever possible. The call of the subroutine EFX-feasibility-graph in Line 3 of Algorithm 1 builds the EFX feasibility graph for the current set of bundles .

In each round, the algorithm computes a matching in the EFX feasibility graph. This matching can naturally be thought of as a partial allocation of the current bundles to the agents. If the matching is perfect, the corresponding (complete) allocation is returned and the algorithm terminates. Otherwise, an item is removed from some bundle and the algorithm proceeds to the next round. The matching computed in each round has particular properties that guarantee that the algorithm makes progress during its execution. In particular, all touched bundles are matched (condition (a) in Line 6). Under this condition, the matching contains the maximum number of edges of the form (condition (b) in Line 7). And, under these two conditions, the size of the matching is maximized (condition (c) in Line 8).

The algorithm finds the robust demand bundle of an arbitrary unmatched agent (Line 10) if the current matching is not perfect. The robust demand for agent is defined as any bundle

 robust-demand(i,Z)def=Zj∈argmaxZ∈Z{maxc∈Zvi(Z∖{c})},

breaking ties arbitrarily. Then, the algorithm updates the set of bundles by removing from the robust-demand bundle the least valued item of agent (Line 11). The definition of the robust demand guarantees that the bundle will be EFX feasible for agent in the next round. In addition, as we will see, the edge will belong to the EFX feasibility graph in the next iteration.

Algorithm 1 will eventually terminate and output some allocation , since in every iteration of the repeat loop (except the last time ) it removes an item from . Next, we need to argue that in every iteration of the repeat loop the algorithm is correct, i.e., that in Line 6 of Algorithm 1, all touched bundles from can be simultaneously matched in graph 333In the iteration, represents before the execution of the if statement in Lines 9-12 of the algorithm.. This is proved in Lemma 1; the proof uses several useful observations about the structure of the EFX feasibility graph .

###### Lemma 0 ().

All bundles in can be simultaneously matched to agents in at any iteration .

###### Proof.

The proof proceeds by induction on . For , the statement is true, as and we can choose . We assume that at time the matching covers all bundles from . Let us assume that agent is chosen in the execution of the if statement (Line of Algorithm 1) at time and the item is removed from the bundle in Lines 10-11. Now, in order to show that all bundles in can be matched to agents in , we will need a few useful observations about the edges of .

###### Claim 2 ().

Graph contains every edge with of the graph .

###### Proof.

Indeed, since no item is removed from bundle , we have . Similarly, remains EFX feasible for agent . Thus . ∎

###### Claim 3 ().

There is no edge between and in .

###### Proof.

We prove this claim by contradiction. Suppose the edge belongs to , but was not matched in . Then we may increase the number of matched pairs in by adding or possibly substituting another edge to in . As the set of matched bundles in can only increase after such an operation, we get a contradiction to condition (b) (Line 7 of Algorithm 1). ∎

###### Claim 4 ().

There is an edge between and in both graphs and .

###### Proof.

Claim 3 says that is not EFX feasible for agent , i.e., there exists agent such that for some item . As bundle is the robust demand of at time , we have

 vi∗(Zj∗(t+1))=vi∗(Zj∗(t)∖{c∗})≥maxc∈Zi(t)vi∗(Zi(t)∖{c})>vi∗(Zi∗(t))≥vi∗(Zi∗(t+1)).

Similarly, and are EFX feasible for agent , as is at least as high as for all and any item . Therefore, and . ∎

We can now show that the algorithm will match to some agent.

###### Claim 5 ().

Bundle is matched in to an agent .

###### Proof.

If the bundle is unmatched in , then there is a bigger matching in : by Claim 4, the edge belongs to and, as the agent chosen when Line 9 is executed during iteration , is unmatched in . This contradicts property (c) in Line 8 of Algorithm 1. ∎

Finally, we note that , as bundle is the only new bundle that can become touched in iteration . Now consider the matching

 (1) M′def=M(t)∖{(k,Zj∗)}∪{(i∗,Zj∗)}

in that covers all bundles in . Indeed, according to Claim 2, contains all edges of and, according to Claim 4, the edge belongs to as well. Hence, is a matching in . Since (by our induction hypothesis) all bundles of are matched in , covers all bundles in . The proof of the induction step is complete. ∎

As the algorithm terminates after finding a complete matching in the EFX feasibility graph, the returned solution must be an EFX allocation. We note that Algorithm 1 runs in polynomial time: it executes at most iterations and all steps in each iteration can be completed in polynomial time. Indeed, the only non trivial part is the computation of matching (Line 5) under the conditions (a)-(c) (Lines 6-8). To this end, we can assign weights to the edges of the graph that express our preferences (a)-(c) and compute a maximum weighted matching in the weighed version of .444We remark that this is apparently not the fastest way to compute the desired matching. For example, we can give a weight of to the edges of incident to bundle , a weight of to edges for , and weight of to the remaining edges of .

In the following we give efficiency guarantees for the returned EFX allocation . Very informally, Algorithm 1 does not remove too many items. First, we observe that at the end of the algorithm there must be at least one untouched bundle, i.e., a bundle from which no items have been removed.

###### Claim 6 ().

There is an untouched bundle upon termination of Algorithm 1.

###### Proof.

Assume to the contrary that the algorithm has removed items from every bundle in after iteration , i.e., the set of touched bundles becomes the set of size after iteration . Then, by Lemma 1, the algorithm will match all bundles in and terminate at round . Let agent and bundle be the ones chosen, respectively, when Algorithm 1 executes Lines 9 and 10 at iteration . At this time, we have for all . Thus, all touched bundles with must be matched in (due to the condition (a) in Line 6). According to Claim 5, bundle must also be matched in . Therefore, and the algorithm should have terminated after iteration leaving bundle untouched. ∎

We are now ready to present guarantees for the Nash welfare of allocation .

###### Lemma 0 ().

for any agent and there exists an agent such that .

###### Proof.

We note first that when the algorithm terminates at time , then for all . Indeed, this is the case if agent is matched to bundle . If is matched to another bundle in , then by the definition of the EFX feasibility graph . Thus, Claim 6 proves the second part of the lemma since its states that there exists some agent such that .

To complete the proof of the lemma, it is sufficient to show that for any agent . We do so by contradiction. If this is not the case, let be the first time when becomes strictly smaller than for an agent after an item was removed. Let be the agent who was chosen in Line and be the bundle chosen in Line of the algorithm at iteration . Then is the agent for whom became smaller than . For convenience of notation, we denote the matching by . We consider the matching , that was also used in the proof of Lemma 1. Recall that, by Claim 5, bundle is matched to agent in . As agent is not matched in , we have . Therefore, one can represent the union of the matchings and as a collection of augmenting paths and cycles, including degenerate cycles that consist of a single edge that belongs to both and .

First, assume that has a non-degenerate cycle with vertices and .

 Cdef={(j1,Zj2),…,(jk−1,Zjk),(jk,Zj1)}∈M′,{(j1,Zj1),…,(jk,Zjk)}∈Mo.

For convenience of notation, let us denote . Since each is an edge in the EFX feasibility graph , we have for every . This implies that for every . Thus, we get a Pareto improvement in the allocation for each agent by replacing bundle with bundle for every . Hence, we can improve the Nash welfare of the allocation , a contradiction to its optimality.

Second, we observe that bundle is matched in to which, by Claim 3, must be different from . Since does not have non-degenerate cycles and bundle is not matched to in , bundle must belong to an augmenting path that originates from an unmatched bundle in ; notice that is unmatched in as well, since matching has the same set of bundles as . The augmenting path consists of agent vertices and bundle vertices , where , and edges:

 (2) Pdef={(j1,Zj2),…,(jk,Zjk+1)}∈M′,{(j1,Zj1),…,(jk,Zjk)}∈Mo.

We consider the following transformation of the initial allocation (see Figure 1):

 ˆXdef=⎧⎪ ⎪ ⎪ ⎪ ⎪⎨⎪ ⎪ ⎪ ⎪ ⎪⎩ˆXj1=Xj1∪Zj2,ˆXji=Xji∖Zji∪Zji+1,i∈{2,...,k}ˆXjk+1=Xjk+1∖Zjk+1ˆXj=Xj,j∉{j1,...,jk+1}

Let us denote the set of agents as . Similar to the previous case where we consdiered a non-degenerate cycle, we have for every . By our assumption for agent (with ), it holds that . Finally, since is unmatched in it must also be an untouched bundle, i.e., . Combining these properties, we get:

 NW(ˆX)n =vj1(Xj1∪Zj2)⋅vjk+1(Xjk+1∖Zjk+1)⋅k∏i=2vji(Xji∖Zji∪Zji+1)⋅∏j∉Jvj(Xj) =[vj1(Xj1)+vj1(Zj2)]⋅[vjk+1(Xjk+1)−vjk+1(Zjk+1)] ⋅k∏i=2[vji(Xji)−vji(Zji)+vji(Zji+1)]⋅∏j∉Jvj(Xj) >[vj1(Xj1)+vj1(Zj1)]⋅12vjk+1(Xjk+1)⋅k∏i=2vji(Xji)⋅∏j∉Jvj(Xj)=NW(X)n

We have reached a contradiction, since . ∎

Using Lemma 1 and 2, we obtain the following statement.

###### Theorem 3 ().

Given a Nash welfare maximizing allocation , Algorithm 1 computes in polynomial time a -efficient EFX and Pareto-optimal allocation of such that for all .

###### Proof.

The correctness of the algorithm was shown in Lemma 1. According to the definition of the EFX feasibility graph , the final allocation, which is a complete matching in , must be an EFX allocation. Finally, according to Lemma 2, the Nash welfare of the final allocation is at least a -fraction of .

Moreover, if the returned complete matching is different from the matching , then there must be a cycle in . Then one can get a strict improvement to the initial Nash welfare maximizing allocation , by setting where . Indeed, and for all , as is an edge in the EFX feasibility graph . Hence, for all and .

Finally, allocation is Pareto optimal, as otherwise one could first Pareto improve the allocation and then give back to each agent their original removed items ; the resulting allocation would be a Pareto-improvement of the initial allocation , contradicting its optimality. ∎

## 5. Suboptimal input allocation

One might hope that the algorithm we presented in Section 4 could also work with an input allocation of suboptimal Nash welfare. Indeed, the algorithm would result in an EFX allocation in this case too. Unfortunately, the proof of the efficiency guarantee in Lemma 2 crucially relies on the optimality of the input allocation. In this section we present a modified Algorithm 2 with a good efficiency guarantee, provided that the input allocation is efficient as well, albeit not necessarily optimal. In particular, starting with an initial allocation , the modified algorithm computes either an EFX allocation of some of the items in that recovers a large fraction of the Nash welfare of the initial allocation or indicates that the Nash welfare of the input allocation can be improved significantly and provides such an improved allocation as output. Repeating the algorithm with the allocation as input until it produces an EFX allocation will yield, in polynomial time, an EFX allocation with at least half the Nash welfare of the initial input allocation.