# Envy-free item allocation

Envy-free (EF) item allocation is a fair item allocation problem, in which the fairness criterion is envy-freeness - each agent should receive a bundle that they believe to be at least as good as the bundle of any other agent.$^{:296–297}$
Since the items are indivisible, an EF assignment may not exist. The simplest case is when there is a single item and at least two agents: if the item is assigned to one agent, the other will envy.
One way to attain fairness is to use monetary transfers. When monetary transfers are not allowed or not desired, there are allocation algorithms providing various kinds of relaxations.

## Finding an envy-free allocation whenever it exists
### Preference-orderings on bundles: envy-freeness

The undercut procedure finds a complete EF allocation for two agents, if-and-only-if such allocation exists. It requires the agents to rank bundles of items, but it does not require cardinal utility information. It works whenever the agents' preference relations are strictly monotone, but does not need to assume that they are responsive preferences. In the worst case, the agents may have to rank all possible bundles, so the run-time might be exponential in the number of items.

### Preference-orderings on items: necessary/possible envy-freeness

It is usually easier for people to rank individual items than to rank bundles. Assuming all agents have responsive preferences, it is possible to lift the item-ranking to a partial bundle-ranking. For example, if the item-ranking is w>x>y>z, then responsiveness implies that {w,x}>{y,z} and {w,y}>{x,z}, but does not imply anything about the relation between {w,z} and {x,y}, between {x} and {y,z}, etc. Given an item-ranking:
* An allocation is necessarily envy-free (NEF) if it is envy-free according to all responsive bundle-rankings consistent with the item-ranking;
* An allocation is possibly envy-free (PEF) if for each agent i, there is at least one responsive bundle-ranking consistent with i's item-ranking, by which i does not envy;
* An allocation is weakly possibly envy-free (WPEF) if for each pair of agents i,j, there is at least one responsive bundle-ranking consistent with i's item-ranking, by which i does not envy j;
* An allocation is necessarily Pareto-optimal (NPE) if it is Pareto-optimal according to all responsive bundle-rankings consistent with the item-ranking (see Ordinal Pareto efficiency);
* An allocation is possibly Pareto-optimal (PPE) if it is Pareto-optimal according to at least one responsive bundle-ranking consistent with the item-ranking.
The following results are known:
* Bouveret, Endriss and Lang assume that all agents have strict preferences. They study the algorithmic questions of finding a NEF/PEF allocation with an additional efficiency condition, particularly, completeness or NPE or PPE. In general, PEF is easy while NEF is hard: checking whether a NEF allocation exists is NP-complete, while checking existence of WPEF can be done in polynomial time.
* Aziz, Gaspers, Mackenzie and Walsh study the more general setting in which agents may have weak preferences (with indifferences). In this setting, checking existence of WPEF is NP-complete. Deciding whether a PEF allocation exists is in P for strict preferences or for n=2, but it is NP-complete in general. It is an open question whether, when the number of agents is constant, deciding the existence of NEF allocation is in P.

### Cardinal utilities

The empty allocation is always EF. But if we want some efficiency in addition to EF, then the decision problem becomes computationally hard:$^{:300–310}$
* Deciding whether an EF and complete allocation exists is NP complete. This is true even when there are only two agents, and even when their utilities are additive and identical, since in this case finding an EF allocation is equivalent to solving the partition problem.
* Deciding whether a fair allocation exists requires exponential communication (in the number of goods) when there are more than two agents. When there are two agents, the communication complexity depends on specific combinations of parameters.
* Deciding whether an EF and Pareto efficient allocation exists is above NP: it is $\Sigma _{2}^{\textrm {P}}$-complete even with dichotomous utilities and even with additive utilities. ($\Sigma _{2}^{\textrm {P}}$ is the class of problems that can be solved in nondeterministic time given an oracle that can solve any problem in NP).
The decision problem may become tractable when some parameters of the problem are considered fixed small constants:
* Considering the number of objects m as a parameter, the existence of a PE+EF allocation can be decided in time $O^{*}(m^{2m})$ for additive or dichotomous utilities. When the utilities are binary and/or identical, the runtime drops to $O^{*}(m^{m})$. Here, the notation $O^{*}$ hides expressions that are polynomial in the other parameters (e.g. number of agents).
* Considering the number of agents n as a parameter, the existence of a PE+EF allocation remains hard. With dichotomous utilities, it is NP-hard even for n=2. However, it is now in NP, and can be solved efficiently with an NP oracle (e.g. a SAT solver). With $n\geq 5$ agents, it can be done with $2^{n+1}$such oracles, and at least $2^{n-4}$ oracles are needed unless P=NP. With additive utilities, it is NP-hard even for n=2. Moreover, it is W[1]-complete w.r.t. the number of agents even if all utilities are identical and encoded in unary.
* Considering both the number of agents n and the largest utility V as parameters, the existence of a PE+EF allocation can be decided in time $O^{*}((m\cdot V+1)^{n^{2}}\cdot mn^{2})$ for additive utilities using dynamic programming.
* Considering both the number of agents n and the number of utility levels z as parameters, the existence of a PE+EF allocation for identical additive utilities can be decided using an integer linear program with $d=n\cdot z^{n}$ variables; Lenstra's algorithm allows solving such ILP in time $O^{*}(d^{2.5d})$

## Finding an allocation with a bounded level of envy

Many procedures find an allocation that is "almost" envy-free, i.e., the level of envy is bounded. There are various notions of "almost" envy-freeness:

### EF1 - envy-free up to at most one item

An allocation is called EF1 if for every two agents A and B, if we remove at most one item from the bundle of B, then A does not envy B. An EF1 allocation always exists and can be found efficiently by various procedures, particularly:
* When all agents have weakly additive utilities, the round-robin protocol finds a complete EF1 allocation. Weak additivity is required since each agent should be able to pick, in each situation, a "best item".
* In the more general case, when all agents have monotonically increasing utilities, the envy-graph procedure finds a complete EF1 allocation. The only requirement is that the agents can rank bundles of items. If the agents' valuations are represented by a cardinal utility function, then the EF1 guarantee has an additional interpretation: the numeric envy-level of each agent is at most the maximal-marginal-utility - the largest marginal utility of a single item for that agent.
* When agents have arbitrary utilities (not necessarily additive or monotone), the A-CEEI mechanism returns a partial EF1 allocation. The only requirement is that the agents can rank bundles of items. A small number of items might remain unallocated, and a small number of items may have to be added. The allocation is Pareto-efficient with respect to the allocated items.
* The Maximum Nash Welfare algorithm selects a complete allocation that maximizes the product of utilities. It requires each agent to provide a numeric valuation of each item, and assumes that the agents' utilities are additive. The resulting allocation is both EF1 and Pareto-efficient.
* Various other algorithms return EF1 allocations that are also Pareto-efficient; see Efficient approximately fair item allocation.
* For two agents with arbitrary monotone valuations, or three agents with additive valuations, an EF1 allocation can be computed using a number of queries logarithmic in the number of items.
* For two agents with arbitrary utility functions (not necessarily monotone), an EF1 allocation can be found in polynomial time.
* For at most 4 agents with arbitrary monotone valuations, or n agents with identical monotone valuations, there always exists an EF1 allocation that is also connected (when items are pre-ordered on a line, such as houses in a street). The proof uses an algorithm similar to the Simmons–Su protocols. When there are n > 4 agents, it is not known whether a connected EF1 allocation exists, but a connected EF2 allocation always exists.

### EFx - envy-free up to at most any item

An allocation is called EFx if for every two agents A and B, if we remove any item from the bundle of B, then A does not envy B. EFx is strictly stronger than EF1: EF1 lets us eliminate envy by removing the item most valuable (for A) from B's bundle; EFx requires that we eliminate envy by removing the item least valuable (for A). An EFx allocation is known to exist in some special cases:
* When there are two agents, or when there are n agents with identical valuations. In this case, the leximin-optimal allocation is EFx and Pareto-optimal. However, it requires exponentially many queries to compute.
* When there are n agents with additive valuations, but there are at most two different values for goods. In this case, any max-Nash-welfare allocation is EFx. Moreover, there is an efficient algorithm for calculating an EFx allocation (though not necessarily max-Nash-welfare).
* When there are n agents with additive valuations, but there are at most two different kinds of valuations.
* When there are three agents with additive valuations. In this case, a polynomial-time algorithm exists.
Some approximations are known:
* A 1/2-approximate EFx allocation (that also satisfies a different approximate-fairness notion called Maximin Aware) can be found in polynomial time.
* A 0.618-approximate EFx allocation (that is also EF1 and approximates other fairness notions called groupwise maximin share and pairwise maximin share) can be found in polynomial time.
* There always exists a partial EFx allocation, where the Nash welfare is at least half of the maximum possible Nash welfare. In other words, after donating some items to a charity, the remaining items can be allocated in an EFx way. This bound is the best possible. In large markets, where the valuations of an agent for every item is relatively small, the algorithm attains EFx with almost optimal Nash welfare. It is sufficient to donate n-1 items, and no agent envies the set of donated items.
It is an open question whether an EFx allocation exists in general. The smallest open case is 4 agents with additive valuations.
In contrast to EF1, which requires a number of queries logarithmic in the number of items, computing an EFx allocation may require a linear number of queries even when there are two agents with identical additive valuations.
Another difference between EF1 and EFx is that the number of EFX allocations can be as few as 2 (for any number of items), while the number of EF1 allocations is always exponential in the number of items.

### EFm - approximate envy-free for a mixture of divisible and indivisible items

Some division scenarios involve both divisible and indivisible items, such as divisible lands and indivisible houses. An allocation is called EFm if for every two agents A and B:
* If B's bundle contains some divisible goods, then A does not envy B (as in an EF allocation).
* If B's bundle contains only indivisible goods, then A does not envy B after removing at most one item from B's bundle (as in an EF1 allocation).
An EFm allocation exists for any number of agents. However, finding it requires an oracle for exact division of a cake. Without this oracle, an EFm allocation can be computed in polynomial time in two special cases: two agents with general additive valuations, or any number of agents with piecewise-linear valuations.
In contrast to EF1, which is compatible with Pareto-optimality, EFm may be incompatible with it.

### Minimizing the envy

Rather than using a worst-case bound on the amount of envy, one can try to minimize the amount of envy in each particular instance. See envy minimization for details and references.

## Finding a partial EF allocation

The AL procedure finds an EF allocation for two agents. It may discard some of the items, but, the final allocation is Pareto efficient in the following sense: no other EF allocation is better for one and weakly better for the other. The AL procedure only requires the agents to rank individual items. It assumes that the agents have responsive preferences and returns an allocation that is necessarily envy-free (NEF).
The Adjusted winner procedure returns a complete and efficient EF allocation for two agents, but it might have to cut a single item (alternatively, one item remains in shared ownership). It requires the agents to report a numeric value for each item, and assumes that they have additive utilities.
When each agent may get at most a single item, and the valuations are binary (each agent either likes or dislikes each item), there is a polynomial-time algorithm that finds an envy-free matching of maximum cardinality.

## Existence of EF allocations with random valuations

If the agents have additive utility functions that are drawn from probability distributions satisfying some independence criteria, and the number of items is sufficiently large relative to the number of agents, then an EF allocation exists with high probability. Particularly:
* If the number of items is sufficiently large: $m=\Omega (n\log n/\log \log n)$, then w.h.p. an EF allocation exists (the probability goes to 1 as m goes to infinity) and can be found by the round-robin protocol.
* If $m=\Omega (n\log n)$, then w.h.p. an EF allocation exists and can be found by maximizing the social welfare. This bound is also tight due to connections to the coupon collector's problem.
* If $m\geq 2n$ and m is divisible by n, then w.h.p. an EF allocation exists and can be found by a matching-based algorithm.
On the other hand, if the number of items is not sufficiently large, then, with high probability, an EF allocation does not exist.
* If the number of items is not sufficiently large, i.e., $m=n+o(n)$, then w.h.p. an EF allocation does not exist.
* If $m=o(n\log n/\log \log n)$ and m is not "almost divisible" by n, then w.h.p. an EF allocation does not exist.

## Envy-freeness vs. other fairness criteria

* Every EF allocation is min-max-fair. This follows directly from the ordinal definitions and does not depend on additivity.
* If all agents have additive utility functions, then an EF allocation is also proportional and max-min-fair. Otherwise, an EF allocation may be not proportional and even not max-min-fair.
* Every allocation of a competitive equilibrium from equal incomes is also envy-free. This is true regardless of additivity.
* Every Nash-optimal allocation (allocation that maximizes the product of utilities) is EF1.
* Group-envy-freeness is a strengthening of envy-freeness, which is applicable to both divisible and indivisible objects.
See Fair item allocation for details and references.

## Summary table

Below, the following shorthands are used:
* $n$ = the number of agents participating in the division;
* $m$ = the number of items to divide;
* EF = envy-free, EF1 = envy-free except-1-item (weaker than EF), MEF1 = marginal-envy-free except-1-item (weaker than EF1).
* PE = Pareto-efficient.
| Name | #partners | Input | Preferences | #queries | Fairness | Efficiency | Comments |
| Undercut | 2 | Bundle ranking | Strictly monotone | $2^{m}$ | EF | Complete | If-and-only-if a complete EF allocation exists |
| AL | 2 | Item ranking | Weakly additive | $Poly(m)$ | Necessarily EF | Partial, but not Pareto-dominated by another NEF | |
| Adjusted winner | 2 | Item valuations | Additive | $Poly(m)$ | EF and equitable | PE | Might divide one item. |
| Round-robin | $n$ | Item ranking | Weakly additive | $m$ | Necessarily EF1 | Complete | |
| Envy-graph | $n$ | Bundle ranking | Monotone | $O(mn^{3})$ | EF1 | Complete | |
| A-CEEI | $n$ | Bundle ranking | Any | ? | EF1, and $(n+1)$-maximin-share | Partial, but PE w.r.t. allocated items | Also approximately strategyproof when there are many agents. |
| Maximum-Nash-Welfare | $n$ | Item valuations | Additive | NP-hard (but there are approximations in special cases) | EF1, and approximately $n$-maximin-share | PE | With submodular utilities, allocation is PE and MEF1. |