Manuscript Offprint
arXiv:2611.12740Computing EF1 Allocations under Budget Constraints in Polynomial Time
Abstract
We study the fair allocation of indivisible items to agents with budget constraints and additive valuations. Each agent compares its own bundle with the subsets of another bundle that fit its budget. An allocation is envy-free up to one item (EF1) if, for every agent and every nonempty subset under comparison, removing an item of maximum value to that agent eliminates its envy. We require EF1 both between agents and towards the charity, which contains all unallocated items. EF1 allocations exist, but computing them in polynomial time has remained open even for homogeneous valuations [1]. We resolve this problem with a polynomial-time algorithm for EF1 allocations under heterogeneous valuations. We also prove that detecting an EF1 violation is NP-complete. Equivalently, checking whether a given allocation is EF1 is coNP-complete. Finally, we give polynomial-time algorithms for envy-freeness up to any item (EFX) both when each agent's valuation is proportional to item size and when each agent has a fixed number of distinct positive item values. As an application, for homogeneous valuations and any , we obtain an EF1 allocation with at least a fraction of the maximum social welfare in time polynomial in the input length and .
1 Introduction
We study the fair allocation of indivisible items among agents with budget constraints. Each item has a size, and each agent has a budget and an additive valuation. A bundle is budget-feasible for an agent if its total size does not exceed the agent's budget. Our goal is to find a fair allocation in which every agent receives a budget-feasible bundle.
A standard fairness criterion is envy-freeness, which requires each agent to value its own bundle at least as much as any other agent's bundle. However, envy-free allocations need not exist when items are indivisible, even with a single item and two agents. This motivates envy-freeness up to one item (EF1) [3, 4], which allows envy to be eliminated by removing a suitable item from the other agent's bundle.
With different budgets, one agent's bundle may be infeasible for another agent. In this setting, we require each agent to be EF1 towards every subset of another agent's bundle that is feasible under its own budget. That is, for each such nonempty subset, the agent values its own bundle at least as much as the subset after removing a suitable item.
Budget constraints may also prevent all items from being allocated. We call the set of unallocated items the charity. In addition to EF1 between agents, we require every agent to be EF1 towards the charity. The existence of allocations satisfying both requirements follows from the stronger feasible EFX result of Barman et al. [5]. The remaining difficulty is computational. For homogeneous valuations, Barman et al. [2] give a polynomial-time EF2 algorithm, where envy can be eliminated by removing at most two items. However, obtaining exact EF1 in polynomial time has remained open, even in this homogeneous setting. Elkind, Igarashi, and Teh [1] also highlight this question.
Our algorithm repeatedly replaces one agent's bundle with a subset of the charity. It first identifies a candidate bundle whose proper budget-feasible subsets satisfy a sufficient condition for EF1. If every agent is also EF1 towards the entire candidate, it is assigned directly. Otherwise, the algorithm selects an agent with an EF1 violation, removes an item of minimum value to that agent, and assigns the remaining bundle to it. Correctness follows from the candidate condition and the increase in the recipient's own value. Bounding the running time is harder because a repair may increase this value by an arbitrarily small amount. For each agent, we define a fixed set of value breakpoints and show that it receives at most repairs, where is the number of items. We prove this bound using a telescoping argument.
We also study the complexity of verification. Given an arbitrary budget-feasible allocation, deciding whether it violates EF1 is NP-complete. Deciding whether it satisfies EF1 is coNP-complete. Hardness holds even for one agent and a charity, or for two agents with homogeneous valuations and an empty charity. These results do not contradict the construction algorithm. The algorithm maintains sufficient fairness conditions for the allocations it produces, rather than testing all feasible subsets of an arbitrary allocation.
Finally, we give exact polynomial-time algorithms for envy-freeness up to any item (EFX) in two special cases. When each agent's valuation is proportional to item size, a simple greedy algorithm uses arithmetic operations, where is the number of agents. When each agent has at most distinct positive item values for a fixed constant , exact knapsack optimization and a bound on the number of possible bundle values yield a polynomial-time algorithm. This algorithm also satisfies the stronger FEFx condition of [5], defined in Section 6.1.
As an application, we analyze the social welfare of our EF1 algorithm for homogeneous valuations. Its stopping condition yields welfare arbitrarily close to half the optimum while preserving exact EF1. Specifically, for any , a change in the knapsack approximation parameter gives a welfare guarantee in time polynomial in the input length and . The price-of-fairness (PoF) lower bound of Hu et al. [6] rules out a uniform constant guarantee strictly greater than one half as the number of agents grows.
1.2 Related work
EF1 and EFX without budget constraints. EF1 was formalized by Budish [3]. The earlier algorithm of Lipton et al. [4], based on eliminating envy cycles, already yields an EF1 allocation in polynomial time for additive valuations. Caragiannis et al. [7] show that maximizing Nash social welfare gives both EF1 and Pareto optimality, and introduce the stronger notion of EFX. These results concern the classical setting, where every bundle is feasible for every agent.
Complete EFX allocations exist in several cases. Plaut and Roughgarden [8] study EFX under general valuations, including the cases of identical valuations and two agents. Chaudhury, Garg, and Mehlhorn [9] prove existence for three agents with additive valuations.
Charity and partial EFX allocations. Allowing unallocated items can help achieve EFX. Chaudhury et al. [10] show that an EFX allocation exists with at most unallocated items, with no agent preferring the unallocated set to its own bundle. Berger et al. [11] obtain an EFX allocation for four agents with at most one unallocated item, again without envy towards the unallocated set.
Other work studies partial EFX allocations with high Nash social welfare. Caragiannis, Gravin, and Huang [12] show that leaving items unallocated can achieve EFX with at least half the maximum Nash social welfare. Feldman, Mauras, and Ponitka [13] characterize optimal tradeoffs between approximate EFX and Nash social welfare. Nash social welfare is the geometric mean of the agents' values.
Budget and generalized assignment constraints. Wu, Li, and Gan [14] show that a budget-feasible allocation maximizing Nash social welfare is 1/4-EF1, and that this guarantee is tight. For homogeneous valuations, Gan, Li, and Wu [15] give a polynomial-time 1/2-EF1 algorithm. Their journal article [16] also establishes exact polynomial-time algorithms when both valuations and budgets are identical, and when there are two agents, whose valuations and budgets may differ. Barman et al. [2] obtain a polynomial-time EF2 algorithm for homogeneous valuations and heterogeneous budgets, with exact EF1 guarantees when item values, item sizes, or their ratios are equal. The factors 1/4 and 1/2 in these fairness results multiply the compared value after an item is removed. These are fairness approximation factors, not welfare ratios.
Barman et al. [5] study generalized assignment constraints, in which both sizes and values may depend on the agent. They prove that FEFx allocations exist and give a pseudo-polynomial algorithm for exact FEFx and a fully polynomial-time approximation scheme (FPTAS) for its multiplicative approximation. Elkind, Igarashi, and Teh [1], in their study of chores with budgets, also identify exact polynomial-time EF1 computation for goods as an open question. Cohen et al. [17] study online fair division with budget constraints and irrevocable assignments.
Other feasibility constraints. Suksompong [18] surveys constrained fair division, including budget constraints. For example, Biswas and Barman [19] give polynomial-time EF1 algorithms under category-wise cardinality constraints with additive valuations. Such constraints limit the number of items from each category, whereas budgets limit a weighted sum of item sizes and may differ across agents.
The price of fairness. The price of fairness measures the loss in optimal welfare caused by a fairness requirement. Early studies by Bertsimas, Farias, and Trichakis [20] and by Caragiannis et al. [21] examined this welfare loss. Bei et al. [22] study the price of fairness for indivisible goods under several fairness notions. For normalized additive valuations, their lower bound and the upper bound of Barman, Bhaskar, and Shah [23] give a tight bound for EF1. In the two-agent normalized case, Li et al. [24] establish the exact EF1 price of 8/7. Normalization requires every agent to assign the same total value to all items. This assumption matters for welfare comparisons because rescaling an individual agent's values preserves envy comparisons but can change the allocation maximizing total welfare.
Hu et al. [6] extend the price-of-fairness analysis to budget constraints. For homogeneous valuations, they prove an upper bound of 2 and lower bounds approaching , for both
EF1 and EFX. Their upper bounds prove that high-welfare allocations exist but do not give a polynomial-time algorithm.
Optimizing welfare subject to fairness. Computing an arbitrary fair allocation and finding the best fair allocation are different computational tasks. Aziz et al. [25] study welfare maximization under EF1, including hardness even for two agents and pseudo-polynomial algorithms for a fixed number of agents. Bu et al. [26] study welfare approximation under EF1 and EFX for both normalized and unnormalized valuations. These works concern optimization over fair allocations in the classical setting.
1.3 Organization of the paper
Section 2 defines the model and fairness requirement. Section 3 presents the EF1 algorithm and proves its correctness. Section 4 establishes its polynomial running time. Section 5 studies verification complexity, and Section 6 gives the EFX algorithms for special cases. Section 7 applies the EF1 algorithm to social welfare under homogeneous valuations. We conclude in Section 8.
2 Preliminaries
Let be the set of agents and let be a set of indivisible items, where . Each item has size . Each agent has a budget and a value for each item. Valuations are additive. For every , write
The valuations are homogeneous if for all agents and items . Otherwise, they are heterogeneous. Item sizes are common to all agents throughout the paper.
An allocation profile is , where the bundles are pairwise disjoint subsets of . The charity is . An allocation is budget-feasible if for every agent . There is no size constraint on the charity.
Definition 2.1 (EF1 under budget constraints). Consider a budget-feasible allocation. Agent is EF1 towards agent , where , if, for every nonempty subset with , there exists an item such that
Agent is EF1 towards the charity if, for every nonempty subset with , there exists an item satisfying the same inequality. The allocation is EF1 if every agent is EF1 towards every other agent and every agent is EF1 towards the charity.
Since valuations are additive, each of these EF1 conditions is equivalent to
for every such nonempty subset . The right-hand side is the value remaining after removing an item of maximum value to agent . Empty comparison sets impose no fairness condition. We say that agent envies a set if and . The value of agent 's current bundle is denoted by .
For the construction algorithms, we omit agents who value every item at zero, leaving their bundles empty, and reserve items valued at zero by every agent for the final charity. If no agents or items remain after this preprocessing, assigning all items to the charity suffices. Otherwise, we reuse , and for the remaining instance. Then and for every remaining agent.
3 An algorithm for EF1 allocations
We begin with empty bundles and place all items in the charity. In each iteration, the algorithm selects a candidate from the charity, possibly removes one item from it, and uses the resulting set to replace an agent's current bundle. The old bundle is returned to charity. We first describe the knapsack subroutine and candidate selection, then prove that the algorithm returns an EF1 allocation. Its running time is analyzed separately in Section 4.
3.1 Approximate knapsack optimization
The algorithm needs a high-value feasible subset of a given set of items. Exact knapsack optimization is unnecessary here, since EF1 permits the deletion of a maximum-value item, whose value is at least the average value in the comparison set. This leaves room for a small approximation error. We use the approximation factor
The acceptance test uses the same factor. To account for both, write .
For an item set , let be the maximum value agent can obtain from within its budget:
Let denote the subset returned by a deterministic knapsack subroutine, with
The index specifies both the objective and the budget . Fix orders on agents and items to resolve ties throughout.
We implement this subroutine with the standard knapsack FPTAS. For any , it returns a feasible subset of value at least using elementary operations on an instance with at most items, as described by Vazirani [27, Section 8.2]. Taking gives (1) with operations per call and polynomial bit complexity. For this call only, items that exceed or have zero value to agent may be omitted. These items remain available to other agents. If no items remain, the subroutine returns the empty set. Fixed orders make it deterministic. The analysis uses only the guarantee in (1) for each call.
For every nonempty and every agent ,
because a maximum is at least an average and . This converts a multiplicative certificate into an exact EF1 guarantee.
3.2 The allocation algorithm
The main difficulty is to give an agent a better bundle without creating envy elsewhere. Increasing the recipient's own value preserves its comparisons with unchanged bundles. However, other agents may envy the new bundle. We therefore construct a candidate that is valuable to one agent while every proper feasible subset already satisfies EF1 for every observing agent. Only the entire candidate will then require a separate check.
Finding a candidate in the charity. Let be agent 's current bundle, its current value, and the current charity. For each agent , the knapsack subroutine returns a budget-feasible subset of the charity. We accept this subset as a candidate if
This test requires the candidate to offer more than a strict improvement: assigning it would increase a positive current value by a factor greater than . We call an agent that can feasibly receive and satisfies a witness of . If no agent passes the test, the approximation guarantee gives for every . By (2), all comparisons with the charity then satisfy EF1, so the algorithm can stop.
Protecting all proper subsets. Let be an accepted candidate with witness . To make safe for other agents, we look for a smaller subset that still passes the same improvement test for some agent. For every agent and every item , we test whether . Whenever the test succeeds, we replace by the returned subset, record as its new witness, and restart the scan. The current allocation stays fixed during this process, so all comparisons use the same values .
Checking single-item deletions covers all proper subsets because every proper subset omits some item , and hence is contained in one of the tested sets . When no further replacement is possible, the failed test and the approximation guarantee together imply whenever is feasible for agent . Equation (2) then gives EF1 for . The process ends because every successful replacement removes at least one item. Its purpose is to establish this condition for all proper subsets. It does not require exact knapsack optimization.
An ordinary update. An agent may still envy the whole candidate after its most valuable item is removed. We check this directly for each agent whose budget can accommodate . If no such violation exists, all feasible comparisons with satisfy EF1. We give to its witness , who strictly benefits. This is an ordinary update. It preserves EF1 between agents and provides the multiplicative improvement used in the running-time analysis.
Why a repair is needed. The procedure above guarantees that every agent is EF1 towards every proper subset of that fits its budget. However, an agent may still envy itself even after the item it values most is removed. If such a violation occurs for an agent , we give the bundle after deleting an item of minimum value to . The recipient may differ from the witness. This is a repair. The new bundle is a proper subset of , so every feasible subset of it is covered by this guarantee. Agent strictly benefits because its old value was smaller than the value of after deleting a maximum-value item, and deleting a minimum-value item leaves at least as much value.
After an ordinary update or a repair, the recipient's previous bundle is returned to charity and all other assigned bundles stay unchanged. An item deleted in a repair also stays in charity. Thus the algorithm maintains EF1 between agents throughout its execution. The stopping test guarantees EF1 towards the final charity. Algorithm 1 states the procedure, whose correctness we prove next.
Algorithm 1 Computing an EF1 allocation
-
Set for all and .
-
Set for all . Scan agents in the fixed order, computing for each agent . At the first agent with , set , , and proceed to Step 3. If no agent passes the test, return .
-
Scan pairs with and . For each pair compute . If , set , , and restart this step. If a full scan finds no such pair, continue.
-
If some agent satisfies and , choose such an , choose , and set (a repair). Otherwise set and (an ordinary update).
-
Let . Set and . Keep all other bundles and return to Step 2.
All choices follow fixed tie-breaking orders. Each test uses the valuation of the observing agent.
3.3 Correctness
The next lemma states the candidate property that preserves EF1 for each agent.
Lemma 3.1 (Candidate property). Every candidate construction terminates after at most successful shrinks. The final candidate is nonempty, is contained in , and has a witness with
For every agent and every nonempty proper subset with ,
Proof. The initial candidate has the stated witness. Each successful shrink replaces by a feasible subset of with positive value for its new witness, so it is nonempty and strictly smaller. Thus there are at most shrinks. At the final unsuccessful scan, for every and ,
For a nonempty proper feasible , choose . Then , proving the first inequality in (4). The second follows from (2).
Theorem 3.2 (Correctness). Algorithm 1 terminates and returns a budget-feasible allocation that is EF1 between agents and EF1 towards the charity, as required by Definition 2.1.
Proof. Each iteration preserves feasibility and strictly increases the recipient's value. Write and for the value of recipient 's bundle before and after the update. In an ordinary update, the recipient receives , so the candidate property gives
For a repair, the test and the deletion of a minimum-value item give
(6)
Thus every repair strictly increases the recipient's utility.
A singleton cannot pass the repair test, because its residual value is zero. Thus a repair leaves a nonempty subset of . In both types of update, the assigned set is a subset of the charity and fits the recipient's budget. Returning the old bundle to charity preserves the partition. Every other agent keeps its bundle, and therefore its own value.
We next prove EF1 between agents, the first condition in Definition 2.1, by induction on the updates. It holds initially because all assigned bundles are empty. Consider an update to agent . Comparisons between two unchanged agents are unaffected. The recipient's comparisons with other bundles remain valid, since its own value increases and those bundles do not change.
It remains to consider another agent and a nonempty feasible subset of the new bundle . If the update is ordinary, then . A proper subset satisfies by Lemma 3.1. If , the absence of a repair gives the same inequality whenever is feasible for agent . If the update is a repair, then , so every nonempty is a proper subset of and is covered by Lemma 3.1. Hence all comparisons between agents continue to satisfy EF1.
Each candidate construction is finite by Lemma 3.1. Moreover, an agent's own value increases strictly whenever it receives a new bundle. There are only finitely many subset values for each agent. Thus the algorithm makes finitely many updates and terminates. This establishes termination without assuming a polynomial bound.
At termination, the stopping test and the approximation guarantee give
for every agent . Any nonempty feasible therefore satisfies
by (2). Thus every agent is EF1 towards the charity, the second condition in Definition 2.1. Restoring the reserved zero-valued items does not change any EF1 residual. Together with the induction argument, this proves the theorem.
4 Running time
Strict improvement proves termination but not a polynomial running time. An agent may have exponentially many possible bundle values, separated by arbitrarily small gaps. We bound the two types of update separately. Ordinary updates multiply the recipient's positive value by more than , so only logarithmically many can occur between a lower and an upper bound on that value. Repairs need a different argument. We divide the possible values into polynomially many intervals and show that fewer than m repairs can start and end in the same interval. Let I denote the input instance and its total binary encoding length.
Theorem 4.1 (Polynomial running time). Algorithm 1 runs in time polynomial in . Each agent receives at most repairs. If J denotes the total number of updates, including both ordinary updates and repairs, then
Using the knapsack FPTAS described in Section 3.1, the algorithm performs
arithmetic operations on numbers of polynomial bit length.
4.1 Bounding the number of repairs
Fix an agent . Throughout this subsection, values are measured using .
By (6), a repair increases the agent's value by more than the difference between the largest and smallest item values in its candidate. This quantity may be small. If the old and new utilities lie in the same interval between consecutive breakpoints, the candidate's range of item values is large relative to the width of that interval.
To choose the thresholds, consider a bundle of items. Its total value is times its average item value. We therefore use all numbers obtained by multiplying an individual item value by a possible bundle cardinality, giving
We call these numbers breakpoints. There are at most positive breakpoints, since there are items and choices of . They depend only on the original instance, so they stay fixed even when bundles and the charity change.
Write the distinct breakpoints in increasing order as
For , the number is the th positive breakpoint, and is their number. The largest breakpoint is , which is at least the value of any bundle. Thus the intervals , for , together with the final point , cover every value the agent can attain. We give this final point index . An update ending at a breakpoint enters the interval starting there, or the final singleton. All interval widths are positive, but no lower bound on their size is needed.
Since the agent's value never decreases, it can only move forward through these intervals. A repair either stays within one interval or crosses to a larger index. The number of crossing repairs is at most . For repairs within one interval, the next lemma shows that each increase exceeds a fraction of that interval's width. This is the reason for using the breakpoints in (7).
Lemma 4.2 (Progress within one interval). Suppose a repair changes the value of agent 's bundle from to , and both values belong to the same interval . Then
Proof. Let be the candidate, let be the minimum-value item removed from under , and let be the assigned set. Write . Since and , we have
For every , the number belongs to . There is no breakpoint strictly between and , so each such item satisfies either or . Both types must occur. If all were of the first type the sum would be at most a, and if all were of the second type it would be at least b. Consequently,
The value range on is at least the range on . Equation (6) says that is strictly greater than the range on , proving (8).
If is a singleton, or all items in have the same value to , then is itself a breakpoint. Such a repair crosses an interval boundary and is counted separately below.
Lemma 4.3 (Repair count). In every finite execution prefix, each agent receives at most repairs.
Proof. The value of agent 's own bundle never decreases. Both types of update increase it when is the recipient, and updates to other agents leave it unchanged. Fix an interval . List the repairs whose pre- and post-update values both lie in this interval, in chronological order, as , . If , then
In particular, the intervening gaps are nonnegative, regardless of how many ordinary updates are interleaved. Telescoping gives
(9)
By Lemma 4.2, the left side exceeds . Thus r < m, and integrality gives . This bound also holds when r = 0.
Every remaining repair moves to a strictly higher interval index, possibly reaching the terminal singleton. The index starts at zero, never decreases, and is at most . There are therefore at most such crossing repairs. Crossings caused by ordinary updates reduce the number left for repairs. Once an interval is left it cannot be revisited, and no strict improvement is possible from . Combining internal and crossing repairs gives
The argument applies to any finite prefix, without assuming termination.
4.2 Ordinary updates and bit complexity
We now use the multiplicative improvement of an ordinary update. For each agent i, let
Every positive bundle value is at least , while every bundle value is at most . The ratio therefore bounds the cumulative multiplicative increase.
Lemma 4.4 (Ordinary updates). For every agent i, the number of ordinary updates in any finite execution prefix is at most
Proof. Any positive bundle value for agent is at least . There can be at most one ordinary update from utility zero. Once utility becomes positive, each ordinary update multiplies utility by strictly more than , while repairs only increase it. If there are ordinary updates after this point, then for the final value exceeds and is at most . Thus , also valid for . If the first positive update is a repair, the extra one in the bound is unnecessary. Finally, for , with , gives the second inequality.
Proof of Theorem 4.1. We first combine the two update counts. By Theorem 3.2, the algorithm terminates, so let be its total number of updates. Each agent receives at most repairs, by Lemma 4.3, and the number of ordinary updates is bounded by Lemma 4.4. Consequently,
Every positive input value lies between and , while sums at most item values. Hence
Substitution in (11) gives , as claimed.
Next consider the work per iteration. The initial charity tests make at most oracle calls. Candidate construction has at most successful scans and one final scan, each examining at most agent-item pairs. There are therefore oracle calls in one iteration. The tests on the entire candidate and the value computations are dominated by these calls. Since a call takes operations by Section 3.1, an iteration takes operations. There are iterations that update an allocation and one final stopping iteration, for a total of
Finally, these operations use numbers of polynomial bit length. The algorithm maintains exact values of subsets of the original items. It does not repeatedly approximate previously computed values. To carry out exact arithmetic, multiply the sizes and budgets by the product of their denominators. Independently for each agent, multiply its item values by the product of their denominators. The resulting integers and their subset sums have bits. These positive scalings preserve feasibility, all update tests, and all fairness comparisons. The standard knapsack FPTAS also uses numbers of polynomial bit length. Here its precision parameter is , and the factors and have bits. Every arithmetic operation therefore takes a polynomial number of bit operations. The breakpoints are used only in the analysis and need not be computed by the algorithm.
5 Verifying EF1 allocations
We now study the complexity of checking whether a given allocation is EF1. All completeness statements in this section use polynomial-time many-one reductions.
Definition 5.1. EF1-VALID asks whether a supplied feasible allocation satisfies Definition 2.1. Its complement, EF1-INVALID, asks whether there are an agent , a target bundle equal to another agent's bundle ( ) or to the charity , and a nonempty subset such that
Partition and budget feasibility can be checked in polynomial time. The hardness results below hold even when these conditions are guaranteed for the supplied allocation.
Theorem 5.2 (One agent and charity). For one agent and a charity, EF1-VALID is coNP-complete.
Proof. A certificate for EF1-INVALID consists of . The subset, feasibility, and strict inequality in (12) can be checked in polynomial time, including for rational inputs. Thus EF1-INVALID belongs to NP and EF1-VALID to coNP.
For hardness, reduce from the positive-integer SUBSET SUM problem. Given and an integer , decide whether some subset sums to . This is a standard NP-complete problem [28]. Construct one agent of budget . There are original items , an anchor item , and an endowment item , with
| item | size | value |
|---|---|---|
| 1 | ||
Supply the allocation
It is feasible, all sizes and the budget are positive integers, and all values are nonnegative integers. Its binary encoding length is polynomial in that of the SUBSET SUM instance.
Consider any nonempty feasible . If , then implies by integrality. Since all original items have positive integer values,
Thus such a subset cannot violate EF1.
If , write . The anchor is strictly more valuable than every original item, and
Consequently, violates EF1 if and only if
which, by integrality, is equivalent to . There are no comparisons with other agents. Hence
Thus EF1-INVALID is NP-complete and EF1-VALID is coNP-complete.
For any prescribed fixed , first double all constructed sizes and the original budget. Add agents with budget 1, empty bundles, and the same valuation. Every item now has size at least 2, so the added agents have no nonempty feasible comparison subsets. The original agent's comparisons with their empty bundles are vacuous. The reduction is therefore preserved, with all budgets positive integers and all valuations identical.
Assigning the comparison bundle to a second agent gives hardness with empty charity. The same construction proves that computing the maximum EF1 residual is NP-hard.
For an additive valuation , the EF1 residual of a nonempty set is the value remaining after removing an item of maximum value, namely . For a target bundle and budget , the maximum EF1 residual is
We set if there is no nonempty feasible subset of . An agent with valuation and budget is EF1 towards precisely when the value of its own bundle is at least .
Theorem 5.3 (Two agents and empty charity). For two agents with identical valuations and an empty charity, EF1-VALID is coNP-complete. Computing the maximum EF1 residual exactly is NP-hard.
Proof. Consider a 0-1 knapsack decision instance with items of positive integer sizes , nonnegative integer profits , budget , and target profit . Let
Deciding whether is NP-complete. Its hardness already follows from SUBSET SUM by setting and .
Give the original items sizes and common values . Add an anchor of size 1 and value , and an item of size 1 and value . Set
Both assigned bundles are feasible. Write for the common valuation. We claim
If a feasible contains , its residual equals the profit of , whose original size is at most . If , its total constructed size is even. Thus implies , and its residual is at most its profit, which is at most . Conversely, adding to an optimal knapsack subset yields a feasible subset of with residual . This proves (13).
The only potentially violated comparison is agent 1 against , since agent 2 compares with a singleton of zero residual and charity is empty. Therefore
The construction has polynomial binary length. Membership in coNP follows from the certificate argument in the proof of Theorem 5.2. Together with the reduction, this proves coNP-completeness of verification. Finally, identity (13) also reduces exact knapsack optimization to exact computation of .
Under polynomial-time Turing reductions, EF1-VALID is also NP-hard. Negating the answer from a validity oracle solves EF1-INVALID.
Compatibility with polynomial-time construction. These results concern an arbitrary allocation supplied as part of the input. The algorithm in Theorems 3.2 and 4.1 constructs a particular EF1 allocation without solving either verification problem. Knapsack approximations provide sufficient candidate conditions, and the invariants certify each update. These conditions need not hold for an arbitrary EF1 allocation. Checking or replaying an execution certifies the allocation it produces, but does not give a polynomial-time test for arbitrary allocations.
6 EFX allocations in special cases
We now consider EFX, which requires envy to disappear after the removal of any item from a feasible comparison subset. Both algorithms handle charity, any number of agents, and heterogeneous budgets. The first assumes valuations proportional to item size. The second allows arbitrary rankings but bounds the number of distinct positive item values for each agent by a fixed constant.
6.1 EFX and the stronger FEFx condition
Definition 6.1 (EFX with charity). Consider a budget-feasible allocation. Agent is EFX towards agent , where , if, for every nonempty subset with and every , one has
Agent is EFX towards the charity if the same inequality holds for every nonempty subset with and every . The allocation is EFX if every agent is EFX towards every other agent and every agent is EFX towards the charity. For additive valuations, each of these conditions is equivalent to
for every such subset .
For a target bundle , which may be another agent's bundle or the charity, we also use the stronger condition
Condition (15), imposed for every agent and target, is the FEFx notion of Barman et al. [5]. We call it strong FEFx here to distinguish it from Definition 6.1. It implies EFX because is always a proper feasible subset of . The converse need not hold. Consider one agent with budget 1, an empty assigned bundle, and two charity items with pairs and . Every nonempty feasible subset is a singleton, so EFX holds. Strong FEFx fails on the proper feasible subset consisting of the first item. Thus strong FEFx is strictly stronger than EFX.
6.2 Valuations proportional to item size
Suppose each agent has a positive coefficient such that
In particular, identical valuations of the form satisfy this assumption. Identical valuations alone do not imply it.
Algorithm 2 Minimum-load, largest-fitting allocation
Initialize , loads , remaining set , and mark every agent active. While at least one agent remains active, perform the following steps.
-
Choose an active agent of minimum current load .
-
If some satisfies , choose a maximum-size such item, assign it to , set , and remove it from .
-
Otherwise, mark inactive permanently.
Return , where . All ties follow fixed orders.
Theorem 6.2 (Proportional valuations). Under (16), Algorithm 2 returns a feasible EFX allocation with charity using elementary operations on numbers of polynomial bit length. No restriction on is required.
Proof. Each iteration either assigns one item or deactivates one agent. There are at most iterations. Assignments preserve feasibility, and unassigned items are exactly the final charity.
First, the sizes in each agent's bundle are nonincreasing in order of assignment. Indeed, if an agent receives before , then was still unassigned and also fit when was chosen, since the agent's load was no larger at that earlier time. The largest-fitting rule gives .
Fix an observer , and let denote its final bundle. Let be its deactivation time. No remaining item fits its residual budget at . Thus every item assigned after , and every final charity item, has size strictly greater than .
Fix another agent , and let be the prefix of assigned before . If is nonempty, let be its last assigned item. At the time was assigned, agent was still active. Since was chosen with minimum active load,
The nonincreasing size order makes a minimum-size item in , so
For nonempty sets, the total size remaining after deletion of a minimum-size item is monotone under inclusion. Indeed, adding an item of size at least the previous minimum increases this quantity by the new item's size. Adding a smaller item increases it by the previous minimum.
Now take any nonempty with . If , monotonicity and (17) give
Otherwise, the last-assigned item of was assigned after . It is a minimum-size item of , by the established assignment order, and its size exceeds . Hence
For a nonempty feasible , every item has size greater than , so the same inequality applies. If no such feasible subset exists, the comparison is vacuous.
Multiplying these size inequalities by yields (14).
A direct implementation scans at most active loads and remaining items per iteration, giving operations. Loads and residual budgets are exact sums and differences of input sizes and budgets, with polynomial bit length. Hence the bit complexity is also polynomial.
6.3 A fixed number of positive value types
For agent , let be the distinct positive values among , where is their number. Suppose for every , where is a fixed constant. The value levels, their magnitudes, and the items in each value class may all differ between agents. Values remain binary-encoded rationals. Their magnitudes are not bounded by a polynomial.
Lemma 6.3 (Exact knapsack with few value types). An exact optimizer for can be computed in
elementary operations with polynomial bit complexity.
Proof. Partition the positive-valued items in into classes according to the levels , allowing empty classes. Sort each class by increasing size and compute prefix size sums. For a count vector , choosing the smallest items of class minimizes the total size among all subsets with those counts. Discard a count vector if it requests more items than its class contains. For each remaining vector, its smallest realization is feasible exactly when the sum of the corresponding prefix sizes is at most , and its value is
Enumerate all vectors with coordinates in and return a feasible realization of maximum value. Any optimal subset can have its zero-valued items removed without losing value or feasibility. Its positive class counts are enumerated, and the corresponding smallest realization is feasible. Thus the returned solution is exact.
Sorting and prefix sums take operations, and there are at most vectors, each tested in time. Reconstructing the optimal subset costs . All sums and comparisons involve polynomial-bit rationals.
Algorithm 3 Exact minimal-candidate replacement
Start with and . Repeat the following steps.
-
Set for every . Scan agents in the fixed order, computing for each agent . At the first agent with , set , , and proceed to Step 2. If no agent passes the test, stop.
-
Keeping all utilities fixed, scan every pair with . If satisfies , replace , , and restart the scan. Continue until a complete scan makes no replacement.
-
Let . Assign the entire candidate T to agent k and return its old bundle to charity. Thus
Keep all other bundles and repeat.
There is no full-candidate repair step and no approximation factor.
Theorem 6.4 (Fixed positive value-type count). If for every agent and is fixed, Algorithm 3 constructs a strong FEFx allocation, and therefore an EFX allocation, in time polynomial in the binary input length. The number of updates satisfies
For fixed , its elementary-operation count is
The algorithm allows heterogeneous valuations and any number of agents.
Proof. During candidate construction,
hold initially and after every successful shrink. A shrink removes at least one item and leaves a nonempty candidate, so there are at most successful shrinks.
At the final failed scan, for every and ,
For any proper feasible , choose to obtain the exact certificate
Giving to its witness is feasible and strictly increases agent 's utility. All comparisons between unchanged agents remain valid. The recipient's comparisons with unchanged bundles remain valid because its own utility increases. Every other agent's comparison with every proper feasible subset of the new bundle follows from (19). Thus strong FEFx between agents holds inductively, starting from empty bundles.
At termination, exact optimization gives
Thus no agent envies a feasible subset of charity, which implies strong FEFx towards charity and remains true after the reserved zero-valued items are restored.
We now bound the number of updates. For fixed , every attainable bundle value is of the form
There are at most such values, including zero. Different count vectors can give the same value, which only decreases this number. Each update received by strictly increases its utility, and updates of other agents leave it unchanged. Starting at zero, agent can therefore receive at most updates. This proves (18) for every finite prefix and hence also proves termination.
Each iteration uses at most initial oracle calls and at most scans of at most pairs, hence exact knapsack calls. For fixed , Lemma 6.3 bounds each call by operations, and (18) bounds the number of iterations, including the stopping test, by . Multiplying these three bounds gives the stated operation count. All arithmetic has polynomial bit complexity, yielding poly() bit operations.
7 An application to social welfare under homogeneous valuations
We now assume that all agents share the same additive valuation , while their budgets may still differ. The social welfare of an allocation is the total value assigned to agents,
Let be the maximum of this quantity over all budget-feasible allocations, without fairness constraints. This is the multiple-knapsack optimum for the given items and budgets. It differs from the sum of the optima of n independently solved knapsacks, which might use the same item more than once.
Hu et al. [6, Theorems 3 and 4] prove that homogeneous instances admit EFX allocations with welfare at least , and give instances whose best EF1 welfare approaches this fraction as the number of agents grows. Their construction does not establish a polynomial running time in the binary input length. Moreover, the one-half argument assumes that each agent values its own bundle at least as much as every feasible subset of charity. This is stronger than EF1 towards charity. Our algorithm satisfies an approximate version of this property. We derive the resulting welfare bound, then adjust the approximation parameter to approach one half in polynomial time.
7.1 From the charity condition to a welfare bound
The next lemma derives a welfare bound from the charity condition. The proof uses an optimal allocation, but the algorithm need not compute one.
Lemma 7.1 (Welfare from a charity bound). Suppose a budget-feasible allocation A with charity C satisfies, for some ,
Then
Proof. Fix an optimal allocation . Since is feasible for agent , the assumed inequality gives
The sets are pairwise disjoint and contain only items allocated by . Homogeneity and nonnegativity therefore give
Rearranging proves the claim.
At termination, Algorithm 1 satisfies for every . Thus its unmodified version guarantees
7.2 Approaching one half in polynomial time
The approximation precision can be increased without changing the candidate construction or the repair rule. The repair bound is independent of this precision. Only the cost of knapsack calls and the number of ordinary updates change.
Theorem 7.2 (EF1 with a near-half welfare guarantee). For homogeneous nonnegative additive valuations and any rational , a budget-feasible EF1 allocation with charity and welfare at least can be computed in time polynomial in the binary input length and . No optimal multiple-knapsack allocation is required.
Proof. Choose the knapsack error parameter
and run Algorithm 1 with these values. Use the knapsack FPTAS from Section 3.1 with error parameter to implement . It provides the approximation factor using operations per call.
Because , we have . Therefore (2) remains valid. The candidate condition and the proof of Theorem 3.2 apply without further changes, so the output is exactly EF1, both among agents and towards charity. The stopping condition gives . By Lemma 7.1, its welfare is at least . Finally,
which proves the welfare guarantee.
The algorithm remains polynomial-time with this smaller error. The progress inequality for repairs, (6), does not involve . The proof of Lemma 4.3 therefore still gives at most repairs per agent. An ordinary update increases positive utility by a factor greater than . Since , the total number of updates is at most
As in Section 4.2, each logarithm is . Each iteration makes knapsack calls, each costing operations. Moreover, , and all numbers have bit length polynomial in the instance encoding and the encoding of . These bounds establish the claimed running time.
7.3 The price-of-fairness lower bound
Hu et al. [6, Theorem 4] construct homogeneous instances with identical budgets whose optimal EF1 welfare fraction approaches 1/2 as the number of agents grows. Thus no constant welfare guarantee greater than 1/2 can hold uniformly over all numbers of agents, making the limiting fraction in Theorem 7.2 optimal.
8 Conclusion
We have given a polynomial-time algorithm for computing EF1 allocations under budget constraints and heterogeneous additive valuations. The allocation is fair both among agents and towards the charity. The correctness proof follows from a condition on proper feasible subsets of each candidate. The running-time proof bounds the number of repairs without a lower bound on each utility increase, giving at most repairs per agent.
We have also shown that verifying an arbitrary allocation is coNP-complete, although an EF1 allocation can be constructed in polynomial time. Finally, we obtained polynomial-time EFX algorithms for valuations proportional to item size and for a fixed number of positive value types per agent.
For homogeneous valuations, the charity stopping condition also yields a welfare guarantee. Adjusting the approximation precision gives exact EF1 with welfare at least in time polynomial in the input length and . The PoF lower bound rules out any constant welfare guarantee strictly greater than that holds uniformly over all numbers of agents.
Acknowledgements
The polynomial-time EF1 algorithm was developed through multiple rounds of interaction between the authors and GPT6 Astra. GPT6 Astra provided the hardness proofs for EF1 verification and the EFX algorithms for the special cases studied in this paper.
References
[1] Edith Elkind, Ayumi Igarashi, and Nicholas Teh. Fair division of chores with budget constraints. In Proceedings of the International Symposium on Algorithmic Game Theory, 2024. Full version: arXiv:2410.23979.
[2] Siddharth Barman, Arindam Khan, Sudarshan Shyam, and K. V. N. Sreenivas. Finding fair allocations under budget constraints. Proceedings of the AAAI Conference on Artificial Intelligence, 37(5):5481–5489, 2023. doi:10.1609/aaai.v37i5.25681.
[3] Eric Budish. The combinatorial assignment problem: Approximate competitive equilibrium from equal incomes. Journal of Political Economy, 119(6):1061–1103, 2011. doi:10.1086/664613.
[4] Richard J. Lipton, Evangelos Markakis, Elchanan Mossel, and Amin Saberi. On approximately fair allocations of indivisible goods. In Proceedings of the ACM Conference on Electronic Commerce, pages 125–131, 2004. doi:10.1145/988772.988792.
[5] Siddharth Barman, Arindam Khan, Sudarshan Shyam, and K. V. N. Sreenivas. Guaranteeing envy-freeness under generalized assignment constraints. In Proceedings of the ACM Conference on Economics and Computation, pages 242–269, 2023. doi:10.1145/3580507.3597698. Full version: arXiv:2305.01339.
[6] Tingwei Hu, Lili Mei, Zhen Wang, and Guochuan Zhang. Nearly tight bounds on the price of fairness for indivisible items under budget constraints. Theoretical Computer Science, 1080:116036, 2026. doi:10.1016/j.tcs.2026.116036.
[7] Ioannis Caragiannis, David Kurokawa, Hervé Moulin, Ariel D. Procaccia, Nisarg Shah, and Junxing Wang. The unreasonable fairness of maximum Nash welfare. ACM Transactions on Economics and Computation, 7(3):12:1–12:32, 2019. doi:10.1145/3355902.
[8] Benjamin Plaut and Tim Roughgarden. Almost envy-freeness with general valuations. SIAM Journal on Discrete Mathematics, 34(2):1039–1068, 2020. doi:10.1137/19M124397X.
[9] Bhaskar Ray Chaudhury, Jugal Garg, and Kurt Mehlhorn. EFX exists for three agents. In Proceedings of the ACM Conference on Economics and Computation, pages 1–19, 2020. Full version: arXiv:2002.05119.
[10] Bhaskar Ray Chaudhury, Telikepalli Kavitha, Kurt Mehlhorn, and Alkmini Sgouritsa. A little charity guarantees almost envy-freeness. SIAM Journal on Computing, 50(4):1336–1358, 2021. doi:10.1137/20M1359134.
[11] Ben Berger, Avi Cohen, Michal Feldman, and Amos Fiat. Almost full EFX exists for four agents. Proceedings of the AAAI Conference on Artificial Intelligence, 36(5):4826–4833, 2022. doi:10.1609/aaai.v36i5.20410.
[12] Ioannis Caragiannis, Nick Gravin, and Xin Huang. Envy-freeness up to any item with high Nash welfare: The virtue of donating items. In Proceedings of the ACM Conference on Economics and Computation, pages 527–545, 2019. Full version: arXiv:1902.04319.
[13] Michal Feldman, Simon Mauras, and Tomasz Ponitka. On optimal tradeoffs between EFX and Nash welfare. Proceedings of the AAAI Conference on Artificial Intelligence, 38(9):9688–9695, 2024. doi:10.1609/aaai.v38i9.28826.
[14] Xiaowei Wu, Bo Li, and Jiarui Gan. Budget-feasible maximum Nash social welfare is almost envy-free. In Proceedings of the International Joint Conference on Artificial Intelligence, pages 465–471, 2021. doi:10.24963/ijcai.2021/65.
[15] Jiarui Gan, Bo Li, and Xiaowei Wu. Approximation algorithm for computing budget-feasible EF1 allocations. In Proceedings of the International Conference on Autonomous Agents and Multiagent Systems, pages 170–178, 2023.
[16] Xiaowei Wu, Bo Li, and Jiarui Gan. Approximate envy-freeness in indivisible resource allocation with budget constraints. Information and Computation, 303:105264, 2025. doi:10.1016/j.ic.2024.105264.
[17] Saar Cohen, Nicholas Teh, Paul W. Goldberg, and Michael J. Wooldridge. Online fair division with budget constraints. arXiv:2607.23310, 2026.
[18] Warut Suksompong. Constraints in fair division. ACM SIGecom Exchanges, 19(2):46–61, 2021.
[19] Arpita Biswas and Siddharth Barman. Fair division under cardinality constraints. In Proceedings of the International Joint Conference on Artificial Intelligence, pages 91–97, 2018. doi:10.24963/ijcai.2018/13.
[20] Dimitris Bertsimas, Vivek F. Farias, and Nikolaos Trichakis. The price of fairness. Operations Research, 59(1):17–31, 2011. doi:10.1287/opre.1100.0865.
[21] Ioannis Caragiannis, Christos Kaklamanis, Panagiotis Kanellopoulos, and Maria Kyropoulou. The efficiency of fair division. Theory of Computing Systems, 50(4):589–610, 2012. doi:10.1007/s00224-011-9359-y.
[22] Xiaohui Bei, Xinhang Lu, Pasin Manurangsi, and Warut Suksompong. The price of fairness for indivisible goods. Theory of Computing Systems, 65(7):1069–1093, 2021. Full version: arXiv:1905.04910.
[23] Siddharth Barman, Umang Bhaskar, and Nisarg Shah. Optimal bounds on the price of fairness for indivisible goods. In Proceedings of the International Conference on Web and Internet Economics, pages 356–369, 2020. Full version: arXiv:2007.06242.
[24] Zihao Li, Shengxin Liu, Xinhang Lu, Biaoshuai Tao, and Yichen Tao. A complete landscape for the price of envy-freeness. In Proceedings of the International Conference on Autonomous Agents and Multiagent Systems, pages 1183–1191, 2024. Full version: arXiv:2401.01516.
[25] Haris Aziz, Xin Huang, Nicholas Mattei, and Erel Segal-Halevi. Computing welfare-maximizing fair allocations of indivisible goods. European Journal of Operational Research, 307(2):773–784, 2023. Full version: arXiv:2012.03979.
[26] Xiaolin Bu, Zihao Li, Shengxin Liu, Jiaxin Song, and Biaoshuai Tao. Approximability landscape of welfare maximization within fair allocations. In Proceedings of the ACM Conference on Economics and Computation, pages 412–440, 2025. Full version: arXiv:2205.14296.
[27] Vijay V. Vazirani. Approximation algorithms. Springer, 2001. doi:10.1007/978-3-662-04565-7.
[28] Richard M. Karp. Reducibility among combinatorial problems. In Complexity of Computer Computations, pages 85–103. Plenum Press, 1972. doi:10.1007/978-1-4684-2001-2_9.