1 Introduction
Fair allocation of indivisible items is a wellstudied, fundamental problem in economics. Given a set of items, and agents with individual valuations, the goal is to completely allocate all the items among the agents in a fair manner. Several notions of fairness have been considered in the literature. One of the most wellstudied notions is envyfreeness (EF). An allocation is considered to be an EF allocation if no agent envies another agent, i.e., prefers the set of items received by another agent to their own set. While such an allocation might be ideal from the fairness point of view, complete EF allocations do not always exist. For example, say we want to allocate one item among two agents; certainly the agent who does not get the item is going to be envious. This led to the study of relaxed versions of envyfreeness. Envyfreeness up to one item (EF1), introduced by Budish in [ef1_defn], is one such notion. In an EF1 allocation, while agents are allowed to be envious, the envy of any agent disappears when some item is removed from the set of an agent they envy. It is wellknown that a complete EF1 allocation always exists, and can be obtained in polynomial time using the “envycycles” procedure by Lipton, Markakis, Mossel, and Saberi [envy_cycles]. In fact, in the special case when all agents have additive valuations, there is a simpler procedure: order the agents arbitrarily, and keep allocating their most preferred among the remaining items onebyone in a roundrobin way.
Unfortunately, there are many settings where an EF1 allocation may not be intuitively fair. For example, say we have two agents whose valuations are additive, and three items , , and that are valued as 10, 4, and 5 respectively by both the agents. While the allocation where one agent gets and the other agent gets is an EF1 allocation, an intuitively fairer allocation is one in which one agent gets and the other agent gets . This disparity led to the definition of a stronger notion of fairness, envyfreeness up to any item (EFX), by Caragiannis, Kurokawa, Moulin, Procaccia, Shah, and Wang in [efx_nashwelfare]. An allocation is said to be an EFX allocation if no agent envies any strict subset of items received by any other agent. Note that by definition, an EFX allocation is also an EF1 allocation. In the example stated above, the only complete EFX allocations are and . Despite significant efforts, complete EFX allocations have been shown to exist only when valuations are identical [efx_leximin_general, efx_charity], [efx_leximin_general], or with additive valuations [efx_3agents]. The question of whether there exist valuations and a set of items for which there is no complete EFX allocation still remains open!
In this paper, we reformulate the fair allocation problem to allow to be a multiset. Specifically, we introduce a parameter for the number of distinct types of items. The main motivation behind introducing this parameter is that there are several natural settings where is small while and are arbitrarily large. For example, consider a scenario where a local farm has excess produce and wants to distribute them fairly among their employees. The number of distinct types of produce is usually small, while the excess produce and the number of employees can be quite large. This is in contrast to the setup in many previous works which restrict to be small [efx_leximin_general, efx_3agents, efx_4agents].
In what follows, we will precisely define the fair allocation problem, and the notions of fairness that we consider, and then state our results.
1.1 Setup
Let denote the number of distinct types of items, and let denote the item of type . Let be the collection of all multisets of items of these types. Consider any multiset , where denotes the multiplicity of (i.e., number of items of type ) in . It is associated with a nonnegative integer point , where
are the standard unit vectors of
. This gives a onetoone correspondence between and .The following are some standard operations on multisets and :

Containment: An item of type is contained in , i.e., , if .

Inclusion: is a subset of , i.e., , if for all . The inclusion is strict, i.e., , if in addition for some .

Union: The union of and is .

Intersection: The intersection of and is .

Sum: The sum of and is .

Difference: The difference of and is .
In this paper, we need only the first two and the last two operations. Intuitively, for any multiset and any item , the sum is the same as adding the item to and the difference is the same as removing the item from if .
There are agents. Each agent has a valuation that satisfies monotonicity, i.e., if for all . We use and interchangeably because of the correspondence between and . Then, monotonicity can be stated as if . The valuation is said to be additive if for every , , where the function is such that is agent ’s value for item .^{1}^{1}1We assume that every agent has a positive value for at least one type of item, i.e., is not the zero function; otherwise, even if no items are allocated to them, they do not envy anyone.
Consider a multiset associated with . We want to allocate these items to the agents. An allocation is an ordered partition of a multiset into multisets, i.e., , such that is allocated to agent . An allocation is said to be partial if , and complete if . We say that an allocation is

an EF allocation if for every , ,

an EF1 allocation if for every , there is a such that , and

an EFX allocation if for every , and any , .
Observe that is an EFX allocation if and only if for every , and any , . It is also worth noting that when agents have additive valuations, is an EFX allocation if and only if for every , , where is the least preferred item of in .
1.2 Our results
1.2.1 Result 1
Our first result is that if agents have distinct additive valuations, then a complete EF allocation always exists as long as there are enough
items of each type in the multiset to be allocated. While complete EF allocations are known to exist (with high probability) in certain
randomized settings [EFX_random_14, EFX_random_20, EFX_random_21], ours is the first such result in a deterministic setting.Let us now define what we mean by distinct valuations.
Definition 1.1.
The valuations and are said to be identical if for any , . They are said to be distinct otherwise.
The result can now be stated formally below, and it will be proved in Section 2:
Theorem 1.2.
If the valuations are additive and pairwise distinct, then there exists an such that as long as there are at least items of each type in , i.e., for all , there exists a complete EF allocation.
Note that the assumption that the valuations are all pairwise distinct is crucial. For example, when , all valuations are identical by Definition 1.1 and monotonicity, so Theorem 1.2 is not applicable. Indeed, unless is a multiple of , there is no complete EF allocation even if is large. We will, therefore, assume that .
We now give an overview of the proof techniques. We first formulate the EF allocation problem as an
integer linear programming
problem in variables. Let denote the number of items of type allocated to agent . It is a complete EF allocation if and only ifLet , and let denote the feasible set of the LP relaxation of this problem with the integrality constraints removed. Our goal then is to show that if the valuations are distinct, then contains an integer point whenever for all .
However, even if we could show that contains an integer point, it is not immediately clear how to extend this result to whenever for all .^{2}^{2}2We use the notation , and for any positive integer . This is because, is not contained in in general.
To overcome this problem, we reformulate the LP problem in terms of a new set of variables, for and . Let denote the feasible set of this new LP problem. We show that it has the following nice properties:

If contains an “integer cube” (a cube with integer points as corners), with edges parallel to the coordinate axes, then one of the corners maps to an integer point in .

Unlike , satisfies the “containment” property: if for all , then contains .
Combining these properties, it suffices to show that contains such an “integer cube” for sufficiently large . The bulk of Section 2 is devoted to showing precisely this.
1.2.2 Result 2
Our second result is that when agents have additive valuations with identical preferences, a complete EFX allocation always exists. Before we state the actual theorem, let us first define what we mean by identical preferences:
Definition 1.3.
For each agent with additive valuation , a valid preference order is a bijective map that satisfies for all .
An agent with additive valuation has more than one valid preference order if they have the same value for more than one type of item. We denote the set of all valid preference orders of agent as .
Definition 1.4.
The agents have additive valuations with identical preferences if they all share a valid preference order, i.e., .
Observe that the agents having additive valuations with identical preferences does not imply that they have identical valuations. For example, consider and , with , , , and . Then, both agents share the valid preference order and , so they have identical preferences. However, , while , so they do not have identical valuations. This means the algorithms of [efx_leximin_general, efx_charity], which work for identical valuations, do not immediately apply to identical preferences.
In Section 3, we prove the following theorem:
Theorem 1.5.
Complete EFX allocations exist when agents have additive valuations with identical preferences.
We give an algorithm (see Algorithm 1) that allocates one item in every step while maintaining EFX; in the end, we are left with a complete EFX allocation. Let be a common preference order valid for all agents. We first sort the items according to , and then allocate them onebyone in the order of their preference, starting with the most preferred type of item.
Who do we allocate an item to in each step? To answer this question, we will need the concept of envy graph. Recall that, in an envy graph, the agents are the vertices, and there is a directed edge if envies [envy_cycles]. Recall also that we can always decycle an envy graph while preserving EFX [envy_cycles, efx_charity], so, without loss of generality, we can assume that it is a directed acyclic graph (DAG). In particular, the envy graph has a source.
In each step, we give the next unallocated item to a source in the envy graph. Any agent who now envies the source does not envy after removing any item from the source. This is because, by the ordering on the items, the newly allocated item is the least preferred among all the allocated items. So the new allocation is also EFX.
We give the formal pseudocode for the algorithm and its proof of correctness in Section 3.
1.2.3 Result 3
Our final result is the following (proved in Section 4):
Theorem 1.6.
Complete EFX allocations exist when the agents have additive valuations and the number of distinct types of items is at most two, i.e., .
When , there is a simple way to allocate the items. We first allocate items to every agent. The remaining unallocated items are allocated equally among an arbitrary choice of agents. Although these agents are envied, removing any item from them removes the envy. Hence, this is a complete EFX allocation.
For , our algorithm (see Algorithm 2) is more involved, and consists of four steps. In each step, we allocate items onebyone such that the allocation at the end of the step is EFX. We first divide the agents into two sets: is the set of agents who prefer a type item to a type item, and is the set of remaining agents. We now briefly outline the four steps.

In the first step, we give all agents their most preferred items in a roundrobin way. Each round in this step consists of allocating one item to every agent. The step ends when there are not enough unallocated items to complete a round. Observe that the allocation at the end of this step is EF because all agents have equal number of items, and every item they have is their most preferred.

Say fewer than type unallocated items are leftover after the previous step.^{3}^{3}3If not, then there must be fewer than type unallocated items. In this case, the rest of the algorithm is the same with the types and exchanged. In the second step, we give these items, one each, to the agents who most value a type item over a type item. We denote the set of these agents as , and define . Observe that removing any item from an agent in removes any envy towards them, and hence the resulting allocation is EFX.

There are only type unallocated items leftover after the previous step. In the third step, we give them onebyone to all the agents in in a roundrobin way. At the end of every round, we check if some agent in envies some agent. If so, the step ends, else, we proceed to the next round. The step can also end if we run out of unallocated items. Whichever way the step ends, we show that the resulting allocation is EFX. Roughly, the idea is that agents in are better off at the end of this step compared to the previous step, and hence their envy towards agents in only decreases. (In fact, if this step ends with an agent in envying some agent, we show that no agent in envies any agent. The proof of this crucially uses the fact that agents in are those who most value a type item over a type item.) On the other hand, since this step ends as soon as some agent in envies some agent, and their least preferred (type) item was the last item to be allocated, removal of this item removes the envy.

In the fourth step, we simply allocate the leftover type items in a roundrobin way to all agents, starting with those in . To show that the resulting allocation is EFX, we crucially rely on the fact (mentioned above) that agents in do not feel envy initially, and agents in lose any envy as soon as they receive a type item.
We give the formal pseudocode for the algorithm and its proof of correctness in Section 4.
In Appendix A, we give an alternative geometrical proof of Theorem 1.6, and discuss roadblocks to generalizing this proof for .
1.3 Future questions
There are several directions in which our results can be extended. We list a few of them here.

Do complete EFX allocations exist for when agents have additive valuations?

Do complete EFX allocations exist when every agent has additive valuation with at least one of two valid preference orders, i.e., when there are two preference orders such that or for all ? This would extend the recent result of existence of EFX when every agent has one of two additive valuations [efx_two_valuations].^{4}^{4}4Note that the agents having additive valuations with at least one of two valid preference orders does not imply that they have one of two (general) valuations. So the results of [efx_additive_to_general] are not immediately applicable here.

What is the dependence of on the valuations in Theorem 1.2? In particular, how small can be?

Is the converse of Theorem 1.2 true? That is, if the valuations are additive but not pairwise distinct, can we show that for any , there exists an , with for all , such that there is no complete EF allocation?

Finally, do any of our results extend to general valuations? Some previous results of existence of EFX have been recently extended from additive to general valuations [efx_additive_to_general].
1.4 Related work
Fair division has received a lot of attention since the introduction of the cake cutting problem by Steinhaus in [cake_cutting]. While there are finite bounded cake cutting protocols that guarantee envyfreeness for any number of agents [ef_protocol95, ef_protocol97, ef_protocol00, ef_protocol16, ef_anyagents], as discussed earlier, such envyfree (EF) allocations do not always exist when items are indivisible. In fact, the problem of deciding whether a complete EF allocation exists or not is known to be NPcomplete [envy_cycles]
. However, complete EF allocations are known to exist with high probability in randomized settings, where the agents have additive valuations drawn from independent probability distributions and the number of items is sufficiently large
[EFX_random_14, EFX_random_20, EFX_random_21]. Several recent works study allocation of items under relaxed notions of envyfreeness such as EF1 and EFX in various settings [EFX_cite_0, efx_nashwelfare, EFX_cite_2, EFX_cite_3, EFX_cite_4, EFX_cite_00, EFX_cite_5, efx_leximin_general, efx_charity, efx_3agents, efx_4agents, efx_two_valuations, efx_additive_to_general, EFX_cite_6, EFX_cite_7, EFX_cite_8, EFX_cite_9, EFX_cite_10, EFX_cite_11, efx_with_copies].The setting considered in [efx_with_copies] is related to our setting in that they consider allocation of sets that contain “copies” of items but with the number of copies of each item upper bounded by the number of agents. However, the crucial difference is that they restrict the allocations so that no agent gets more than one item of each type. This restriction is so strong that there is not always a complete EFX allocation among the restricted set of allocations, even for three agents with identical additive valuations.^{5}^{5}5Recall that complete EFX allocations do exist for three agents with additive valuations [efx_3agents].
2 EF for distinct additive valuations when items are plentiful
In this section, we show that if agents have distinct additive valuations, then a complete EF allocation always exists as long as there are enough items of each type in the multiset to be allocated. Let denote the number of items of type allocated to agent . It is a complete EF allocation if and only if
(2.1)  
(2.2)  
(2.3)  
(2.4) 
We call these the EF constraints, the positivity constraints, the completeness constraints, and the integrality constraints respectively. Let , and let denote the feasible set of the LP relaxation of this problem with the integrality constraints removed. The main result of this section is the following:
Theorem 2.5.
If the valuations are additive and pairwise distinct, then there is an such that as long as for all , contains an integer point.
This is a restatement of Theorem 1.2. We will prove Theorem 2.5 in the next subsection.
2.1 Proof of Theorem 2.5
Let us define a new set of variables, for and , so that we can write for any and . Note that this is a unimodular transformation,^{6}^{6}6
A unimodular transformation is an integer linear transformation with determinant
. In particular, it maps to itself bijectively. which maps integer points to integer points bijectively. In terms of the new variables and ’s, the constraints (2.1), (2.2) and (2.3) can be written as(2.6)  
(2.7)  
(2.8) 
Let denote the feasible set of these new constraints. Since the old and new variables are related by a unimodular transformation, contains an integer point if and only if contains an integer point. However, shares the “containment” issue of mentioned in the introduction.
To get a better handle on the problem, we solve for using the completeness constraints (2.8):
where denotes the remaining variables. We are then left with only the EF and positivity constraints in variables,
(2.9)  
(2.10) 
Let denote the feasible set of (2.9) and (2.10). Although every integer point in maps to an integer point in , the opposite is not true because need not be an integer for every integer point . Nonetheless, the following is true:
Lemma 2.11.
If there is an integer point such that for all , then there is a such that is an integer for all .
In other words, if contains an dimensional “integer cube” (a cube with integer points as corners) of length , with edges parallel to the coordinate axes, then one of the corners of this cube maps to an integer point in .
Proof of Lemma 2.11.
For each , let , where . Choose such that for each and , where denotes the Kronecker delta.^{7}^{7}7The Kronecker delta is defined as if , and if . Since , is also an integer point in by hypothesis. Moreover, for each ,
So, together with gives an integer point in . ∎
Owing to Lemma 2.11, we have to show only that contains an dimensional “integer cube” of length , with edges parallel to the coordinate axes. For this, it suffices to show that contains an dimensional cube of length , with edges parallel to the coordinate axes, because any (closed) interval of length on the real line contains two consecutive integers. For example, in , a square of length with edges parallel to the coordinate axes, say for some , contains the “integer square” of length with corners , , , and .
In what follows, we will show that contains an dimensional cube of length , with edges parallel to the coordinate axes, when ’s are large enough. Let us relax to be real. It is wellknown that is a convex region in because it is an intersection of halfspaces. Moreover, the following is true:
Lemma 2.12.
If the valuations are additive and pairwise distinct, then has nonzero dimensional volume for any .
We will prove this lemma soon but let us pursue its consequences now. In particular, one consequence of Lemma 2.12, and convexity, is that contains an dimensional cube of nonzero length, say (which depends on ), with edges parallel to the coordinate axes.^{8}^{8}8Recall that we use the notation , and for any positive integer . What can we say about for ?
Lemma 2.13.
For any , if and only if . In other words, .
Proof.
It follows from Lemma 2.13 that contains an dimensional cube of length with edges parallel to the coordinate axes. If we choose to be a positive integer such that , then, as we desired, contains an dimensional cube of length with edges parallel to the coordinate axes!
Now comes the punchline: unlike or , has a nice “containment” property.
Lemma 2.14.
If for all , then .
Proof.
Lemma 2.14 ensures that contains an dimensional cube of length with edges parallel to the coordinate axes, whenever for all . Thus, Theorem 2.5 is proved.
Let us tie up the only remaining loose end: proving Lemma 2.12.
Proof of Lemma 2.12.
Let us replace (2.9) with “stronger” inequalities
After removing repetitions, these are same as the inequalities
(2.9)  
Let denote the feasible set of the modified constraints (2.9) and (2.10). It is clear that because (2.9) is stronger than (2.9), i.e., if satisfies (2.9) then it satisfies (2.9) as well. So, it suffices to show that the dimensional volume of is nonzero.
Actually, there is a subtlety here. Although the LP problem given by (2.9) and (2.10) is independent of the ordering on the agents, the modified LP problem given by (2.9) and (2.10) does depend on this ordering. We will show that there is an ordering (not necessarily unique) on the agents for which the dimensional volume of is nonzero.
Let us first find a convenient ordering on the agents. For each
, consider the hyperplane in
, passing through the origin , given by . We denote the halfspaces of the hyperplane by and respectively. Namely,Note that satisfies (2.9) if and only if for each . In other words, satisfies (2.9) if and only if .
Since the valuations are assumed to be distinct, the hyperplanes are all distinct. Indeed, say two hyperplanes and are the same. Then there is a such that for all . This implies that and are identical valuations contradicting our assumption.
Since the hyperplanes are distinct, there is a directed line in that does not pass through the origin , but passes through the positive orthant , and intersects the hyperplanes transversally in distinct points, [hyperplane].^{9}^{9}9Such a line always exists when but not when . This is okay because we do not consider anyway. Recall that by Definition 1.1, there are no distinct valuations when . Let and be two points on such that is in the allpositive orthant , and is not. The direction of is given by an arrow pointing from to . Let the agents be ordered such that, as we traverse the line along this arrow, we first cross at , followed by at , and so on. Note that this ordering depends on the choice of . See Fig. 1 for an illustration of this ordering when and .
With this ordering on the agents, for each , the segment of between the points and is contained in the region . By the choice of , any tubular neighborhood^{10}^{10}10Intuitively, a tubular neighborhood of a line in can be thought of as “thickening” to a dimensional cylinder, or a tube, containing it. of this segment intersects in a region of nonzero dimensional volume. So, itself has nonzero dimensional volume (see Fig. 1), and hence, has nonzero dimensional volume.
Having taken care of (2.9), let us now turn to (2.10). Let be an dimensional ball of radius centered at the origin in . Note that because by hypothesis, so has nonzero dimensional volume. Then, any satisfies (2.10) because for any and ,
Since any satisfies both (2.9) and (2.10), it follows that contains . Since is a convex region with the origin as a vertex (because it is an intersection of halfspaces of hyperplanes passing through the origin), the intersection has nonzero dimensional volume. Therefore, has nonzero dimensional volume as well. ∎
3 EFX for additive valuations with identical preferences
In this section, we show that when agents have additive valuations with identical preferences (as in Definition 1.4), a complete EFX allocation always exists.
We will need the concept of an envy graph of an allocation, introduced in [envy_cycles] and stated as Definition 1 of [efx_charity]. We restate it here:
Definition 3.1.
The envy graph of allocation has a vertex for each agent, and a directed edge from to if , i.e., if agent envies agent .
It is wellknown that directed cycles in the envy graph of an allocation can be removed while preserving EFX. This is done by picking a directed cycle and assigning to agent for every edge in the directed cycle until there are no more directed cycles. We refer to this procedure as decycling. (See Lemma 2 of [efx_charity] for a formal proof of this.)
Before turning to the algorithm, let us point out the essential idea behind it:
Lemma 3.2.
Say is an EFX allocation such that is a directed acyclic graph, and is an unallocated item such that for all , and all . Then, we can give to some agent while preserving EFX.
What this means is that, if no agent prefers to any item in , then we can give to some agent while preserving EFX.
Proof of Lemma 3.2.
Since is assumed to be a directed acyclic graph, there is a source . Give the item to agent . For any and , we have . Here, the first inequality follows from agent being a source, and the second inequality follows from additivity of the valuations and the hypothesis. So the new allocation , with and for , is also EFX. ∎
We now give an algorithm (see Algorithm 1) that returns a complete EFX allocation when all agents have additive valuations with identical preferences. In the algorithm, we use and interchangeably to denote the multiset of unallocated items in each step, and to denote a common preference order valid for all agents. The function “Decycle” applies the decycling procedure described above on the input allocation, and returns the resulting allocation. The function “Findasource” returns a vertex in the input directed acyclic graph that is a source, i.e., has indegree zero (recall that a source vertex always exists in a directed acyclic graph).
Let us show that the allocation returned by Algorithm 1 is a complete EFX allocation, thereby proving Theorem 1.5.
Theorem 3.3.
Algorithm 1 returns a complete EFX allocation.
Proof.
In every step (execution of while loop) of the algorithm, the choice of ensures that , where is the type of any allocated item in , and is the type of any unallocated item. In other words, we ensure that no agent prefers any unallocated item to any allocated item in every step. So, for all , and all in every step. By Lemma 3.2, we can give to some agent (after decycling if necessary) while preserving EFX, if is itself an EFX allocation. Since we start with the empty allocation, which is EFX, by induction, is EFX in every step of the algorithm. So, the algorithm returns a complete EFX allocation. ∎
Algorithm 1 runs in time polynomial in , , and . It takes constant time to assign each item. The while loop executes times. In each execution, updating the envy graph after assigning an item takes at most time. The “Decycle” method involves detecting and removing a cycle, which can be done in time; the whole method takes time since only new edges are added in every execution. The “Findasource” method takes time. Choosing the most preferred unallocated item takes time.