Algorithmcore
Adjusted winner procedure
Also called Brams-Taylor adjusted winner.
Two agents spread 100 points over divisible goods. Each good goes to the higher bidder, then goods move by point ratio until both have equal points.
- Time
- Θ(m log m) worst
- Space
- Θ(m) extra
- Where
- m = the number of goods
- Model
- Real RAM
- Properties
- deterministicofflineiterative
- Evidence
- Proof sketchCode in 1 languages
The adjusted winner procedure divides a set of divisible goods between two agents. Each agent spreads 100 points over the goods to show how much it values them. Each good first goes to the agent that gives it more points. Then the agent with more points, the winner, gives goods to the other agent, in the order of the ratio of their points, until both agents have the same number of points; at most one good is split. The result is envy-free, equitable (both agents get the same number of points) and Pareto optimal, if the agents report their true points. Brams and Taylor designed it for disputes such as divorce settlements.
In plain words
Two people must share some things, such as a house, a car and savings. Each person gets 100 points and puts them on the things, more points on the things that matter more to that person. First each thing goes to the person who put more points on it.
Usually one person now has more points. That person must give something back. It gives first the thing where its own points are closest to the points of the other person, because that costs it the least for the most help to the other. It gives things until the points are equal, and it may give only a part of the last thing. In the end both have the same points, neither prefers the share of the other, and no other division is better for both.
The problem
There are divisible goods and two agents, and . Agent gives good the points , with , and likewise . Valuations are additive and linear in shares: if gets the share of each good and gets , then
The goal is a share vector that is equitable (), envy-free ( and , since the share of the other agent is worth the rest of the 100 points), and Pareto optimal (no other gives both agents at least as much and one agent more), with as few split goods as possible.
The algorithm
ADJUSTED-WINNER(p_A, p_B) ▷ points on m goods, each list sums to 100- 1
for each good g: give g to A if p_A(g) ≥ p_B(g), else to B - 2
T_A, T_B ← the points of A and of B for their own goods - 3
if T_A = T_B then return the shares - 4
W ← the agent with more points; L ← the other agent - 5
G ← the goods of W with p_W(g) > 0, sorted by p_W(g)/p_L(g) increasing (p_L(g) = 0 counts as ∞) - 6
for each good g of G, in order do - 7
if T_W − p_W(g) ≥ T_L + p_L(g) then move all of g to L - 8
else move the share α = (T_W − T_L)/(p_W(g) + p_L(g)) of g to L ▷ now T_W = T_L; stop - 9
return the shares
Line L1 gives ties to ; any fixed rule works. Each good of has , so every ratio in line L5 is at least 1. Moving a good with a small ratio costs few points for each point that gains. Line L7 moves a whole good when still has at least as many points after the move, and updates and . Line L8 solves for .
Example
Two agents split a house, a pension, a car and a boat.
| good | after L1 | ratio | ||
|---|---|---|---|---|
| house | 50 | 40 | A | 1.25 |
| pension | 20 | 30 | B | |
| car | 15 | 10 | A | 1.5 |
| boat | 15 | 20 | B |
After line L1, and , so . The goods of in the order of line L5 are the house (1.25) and the car (1.5). For the house, , so line L8 moves the share
of the house to . Agent keeps of the house and the car, with points. Agent gets of the house, the pension and the boat, with points. Both get more than 50, so neither envies the other.
If instead and , line L1 gives the first two goods to and the last two to , with 70 points each, and line L3 returns at once.
Correctness
Equitable. Each whole move of line L7 keeps , and line L8 makes them equal. If every good of moved whole, would hold only goods with , so , and the last move would have been a move of line L8. So the loop ends with .
Pareto optimal. Let be the ratio of the last good that moved (or if none moved). At the end, holds a share only of goods with ratio , and holds a share only of goods with ratio at most . Such a division maximizes over all share vectors, because each good goes to the agent with the larger weighted points. A division that is better for one agent and not worse for the other would give a larger value of , since . So none exists.
Envy-free. Let be the common number of points. If , each agent values the share of the other at , so swapping the shares makes both agents better off, which contradicts Pareto optimality. So , and each agent values its share at least as much as the other share. The full proof is in proofs/correctness.md.
Proof: Adjusted winner is equitable, Pareto optimal and envy-free, with at most one split goodfull
Setting. There are goods and two agents. The points are nonnegative, and . A share vector gives agent the share of good and agent the share . We write and , so , where is the share of . We refer to the lines L1 to L9 of the page. After line L4, is the agent with more points and the other, and is the share of in good . The running totals always equal the points of and for their current shares.
Lemma 1 (the goods of each agent after line L1). Every good held by after line L1 has , and every good held by has . A good held by with has .
Proof. Line L1 gives to the agent with more points on it, and ties to . So the holder has at least as many points as the other agent. If the holder has 0 points, so does the other agent.
So the goods left out of in line L5 are worth 0 to both agents, and every ratio of a good of is at least 1.
Lemma 2 (the loop ends with equal points at a good with ). Suppose line L3 does not return, so when the loop of line L6 starts. Then the loop reaches a good with at which either line L7 makes or line L8 runs, and in both cases after that good, and the loop stops. Before that good, holds after each move.
Proof. A move of line L7 is made only if , so it keeps ; if it gives equality, the loop stops. If line L7 does not apply, then , and since , the share lies strictly between 0 and 1. After the move, , so the totals are equal.
Suppose that the loop moves every good of with whole and still has . By Lemma 1, now holds all goods with , so , a contradiction. So the loop stops at the latest at the last good of with . The goods with come after all others in the order of line L5, so the loop stops before it reaches them.
Theorem 1 (equitable, with at most one split good). The output has , and at most one good has a share strictly between 0 and 1.
Proof. If line L3 returns, the totals are equal and no good is split. Otherwise Lemma 2 gives at the end. Line L1 gives whole goods, line L7 moves whole goods, and line L8 runs at most once, because the loop stops after it. So at most one good is split.
Theorem 2 (Pareto optimal). No share vector has and with one of the two strict, where is the output.
Proof. Let if line L3 returns. Otherwise let for the good at which the loop stops; by Lemma 2, , so is finite, and by Lemma 1. (If line L3 returns, take and .) We claim that at the end
- every good with has , and
- every good with has .
A good with is a good of after line L1 that was not moved whole. It is either , with ; or a good of after in the order, with ratio at least ; or a good outside , with . A good with is either a good of after line L1, which has by Lemma 1 and ; or a good of that was moved in whole or in part, which comes no later than and has ratio at most . If line L3 returns, the same holds with by Lemma 1 alone.
Now let , where is the share of . Each term is linear in , with slope . By the claim, when the slope is positive, unless is split, and the split good has slope 0; and when the slope is negative. So maximizes every term and for every . If were at least as good as for both agents and better for one, then because , a contradiction.
Theorem 3 (envy-free). Each agent values its own share at least as much as the share of the other agent.
Proof. Let by Theorem 1. Agent values the share of at , and agent values the share of at . If , the swapped vector gives each agent , which contradicts Theorem 2. So .
Corollary (the value is unique). All equitable Pareto optimal share vectors give the same number of points . If two of them gave , the second would give both agents more than the first, so the first would not be Pareto optimal. Hence the output of the procedure is the equitable point of the Pareto frontier.
Running time. Lines L1 to L4 take operations, the sort of line L5 takes , and the loop takes , because each good is visited at most once.
Complexity
Lines L1 and L2 take time. The sort of line L5 takes , and the loop of lines L6 to L8 takes . So the time is in the worst case, and if the goods are already sorted by ratio. Extra space is .
Properties
- Equitable, envy-free and Pareto optimal for the reported points, as proved above. For two agents, all equitable Pareto optimal divisions give the same number of points, so no other rule with these two goals gives either agent more.
- At most one split good. Only line L8 splits a good, and it runs once.
- At least 50 points each. Both agents get the same , often more.
- Not strategyproof. An agent that knows the points of the other can gain by false points, for example by putting points just below the bids of the other on goods that it will lose anyway. Then its reported points on the goods that it wins are lower, and the step that makes the points equal gives it more of these goods. An agent that reports its true points is still sure of at least 50 true points, whatever the other reports, because the result is envy-free for the reported points.
- Divisible goods. The guarantees need the split of one good. With indivisible goods, a split can be replaced by joint ownership, a sale or a lottery, or by the weaker goals of indivisible goods allocation.
Variants and improvements
- More agents. The procedure works for two agents only. With three or more agents, envy-free, equitable and Pareto optimal divisions of goods with linear values need not exist together, and other rules are used, such as the competitive equilibrium from equal incomes or maximum Nash welfare.
- Proportional allocation of points. Brams and Taylor also describe a simpler point rule that gives each good to the two agents in proportion to their points. It is equitable but in general not Pareto optimal.
- Divide and choose. For one heterogeneous good, such as a cake, divide and choose is the classic two-agent rule. It is envy-free but not equitable.
- A link to knapsack. The order of line L5 is the order of a greedy rule for the fractional knapsack problem: the winner gives up the goods with the lowest value per point gained by the other, and only the last item is split.
When to use it
Use adjusted winner for two parties who must share several divisible goods or issues and can state their values in points, as in a divorce, a business breakup or a negotiation on several issues. It suits cases where the parties want equal satisfaction and no waste. It needs honest points to keep its guarantees, so it fits best when parties cannot learn much about the points of the other, or when a mediator checks the reports.
Pitfalls
- Points that do not sum to 100. The test for envy uses the totals. If one agent spreads 120 points, its share must be compared with the rest of its own total.
- The wrong order. Moving goods in an order other than increasing still gives equal points, but the result need not be Pareto optimal: both agents could get more by moving a different good.
- Moving goods with . They give points at no cost to , but holds such a good only if too (by line L1), so they do not matter. Code that leaves them out of line L5 avoids a division by zero in the order.
- Floating point. The share and the test of line L7 should use exact rationals; with floats the totals may differ by a rounding error, and the test for equality fails.
Implementations
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/adjusted-winner/. The authors are listed in prov/8XAEP1.jsonl.
from fractions import Fraction
from typing import Sequence
TOTAL = Fraction(100)
def adjusted_winner(pa: Sequence, pb: Sequence) -> list[Fraction]:
"""Brams and Taylor's adjusted winner for agents A and B.
pa[g] and pb[g] are the nonnegative points of A and B on good g; each
list sums to 100. Returns s, where s[g] is the share of good g that A
gets and 1 - s[g] is the share of B. At most one s[g] is strictly
between 0 and 1, and both agents get the same number of points.
"""
p = [[Fraction(x) for x in pa], [Fraction(x) for x in pb]]
m = len(p[0])
if len(p[1]) != m or any(x < 0 for x in p[0] + p[1]):
raise ValueError("two lists of the same length with nonnegative points")
if sum(p[0]) != TOTAL or sum(p[1]) != TOTAL:
raise ValueError("the points of each agent must sum to 100")
s = [Fraction(1) if p[0][g] >= p[1][g] else Fraction(0) for g in range(m)] # @line L1
t = [sum(p[0][g] * s[g] for g in range(m)), sum(p[1][g] * (1 - s[g]) for g in range(m))] # @line L2
if t[0] == t[1]: # @line L3
return s
w = 0 if t[0] > t[1] else 1 # @line L4
lo = 1 - w
def held_by_w(g: int) -> bool:
return s[g] == 1 if w == 0 else s[g] == 0
def ratio_key(g: int) -> tuple:
# pW / pL in increasing order; pL = 0 means an infinite ratio
if p[lo][g] == 0:
return (1, Fraction(0), g)
return (0, p[w][g] / p[lo][g], g)
goods = sorted((g for g in range(m) if held_by_w(g) and p[w][g] > 0), key=ratio_key) # @line L5
for g in goods: # @line L6
if t[w] - p[w][g] >= t[lo] + p[lo][g]: # @line L7
share_to_lo = Fraction(1)
else:
share_to_lo = (t[w] - t[lo]) / (p[w][g] + p[lo][g]) # @line L8
t[w] -= share_to_lo * p[w][g]
t[lo] += share_to_lo * p[lo][g]
s[g] = s[g] - share_to_lo if w == 0 else s[g] + share_to_lo
if t[w] == t[lo]:
break
return s # @line L9
def points(pa: Sequence, pb: Sequence, s: Sequence[Fraction]) -> tuple[Fraction, Fraction]:
"""The points of A and of B under the shares s."""
ta = sum(Fraction(pa[g]) * s[g] for g in range(len(s)))
tb = sum(Fraction(pb[g]) * (1 - s[g]) for g in range(len(s)))
return ta, tb
test_adjusted_winner.py 126 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/adjusted-winner/. The authors are listed in prov/8XAEP1.jsonl.
import itertools
import random
from fractions import Fraction
import pytest
from adjusted_winner import adjusted_winner, points
F = Fraction
def random_points(rng: random.Random, m: int) -> list[int]:
cuts = sorted(rng.randint(0, 100) for _ in range(m - 1))
edges = [0] + cuts + [100]
return [edges[g + 1] - edges[g] for g in range(m)]
def equitable_po_value(pa, pb) -> Fraction:
"""A second method: walk along the goods in decreasing order of pA/pB.
A takes a prefix of this order and B the rest, with one good split. The
points of A grow and the points of B fall along the walk, so the walk
meets equality once. Every point of the walk is Pareto optimal, and two
agents have only one equitable Pareto optimal value.
"""
m = len(pa)
order = sorted(range(m), key=lambda g: (pb[g] == 0, F(pa[g], pb[g]) if pb[g] else F(0)), reverse=True)
for j, g in enumerate(order):
ua = sum(F(pa[h]) for h in order[:j])
ub = sum(F(pb[h]) for h in order[j + 1 :])
# with a share f of good g for A: ua + f pa[g] = ub + (1 - f) pb[g]
if pa[g] + pb[g] == 0:
continue
f = (ub + pb[g] - ua) / (pa[g] + pb[g])
if 0 <= f <= 1:
return ua + f * pa[g]
raise AssertionError("no equitable point on the walk")
def dominated_on_grid(pa, pb, s, steps: int) -> bool:
"""Brute force: does a share vector on the grid Pareto dominate s?"""
ta, tb = points(pa, pb, s)
grid = [F(k, steps) for k in range(steps + 1)]
for y in itertools.product(grid, repeat=len(pa)):
ya, yb = points(pa, pb, list(y))
if ya >= ta and yb >= tb and (ya > ta or yb > tb):
return True
return False
def check(pa, pb, s) -> None:
m = len(pa)
assert len(s) == m and all(0 <= x <= 1 for x in s)
assert sum(1 for x in s if 0 < x < 1) <= 1 # at most one good is split
ta, tb = points(pa, pb, s)
assert ta == tb # equitable
# envy-free: each agent values its own share at least as much as the other share
assert ta >= 100 - ta and tb >= 100 - tb
# Pareto optimal: an exchange certificate. No good g held (in part) by A
# and good h held (in part) by B have pA(g) pB(h) < pA(h) pB(g).
for g in range(m):
for h in range(m):
if s[g] > 0 and s[h] < 1:
assert F(pa[g]) * pb[h] >= F(pa[h]) * pb[g] or (pa[g] == 0 and pb[g] == 0)
assert ta == equitable_po_value(pa, pb)
def test_example() -> None:
pa, pb = [50, 20, 15, 15], [40, 30, 10, 20]
s = adjusted_winner(pa, pb)
assert s == [F(5, 6), 0, 1, 0]
assert points(pa, pb, s) == (F(170, 3), F(170, 3))
check(pa, pb, s)
assert not dominated_on_grid(pa, pb, s, 6)
def test_no_transfer_needed() -> None:
pa, pb = [40, 30, 20, 10], [10, 20, 30, 40]
s = adjusted_winner(pa, pb)
assert s == [1, 1, 0, 0] and points(pa, pb, s) == (70, 70)
def test_identical_points() -> None:
pa = [25, 25, 50]
s = adjusted_winner(pa, pa)
assert points(pa, pa, s) == (50, 50)
check(pa, pa, s)
def test_zero_points() -> None:
pa, pb = [100, 0, 0], [0, 0, 100]
s = adjusted_winner(pa, pb)
assert points(pa, pb, s) == (100, 100)
pa, pb = [0, 60, 40], [50, 50, 0]
s = adjusted_winner(pa, pb)
check(pa, pb, s)
def test_random_against_brute_force() -> None:
rng = random.Random(77)
for _ in range(40):
m = rng.randint(1, 4)
pa, pb = random_points(rng, m), random_points(rng, m)
s = adjusted_winner(pa, pb)
check(pa, pb, s)
assert not dominated_on_grid(pa, pb, s, 4)
def test_random_more_goods() -> None:
rng = random.Random(78)
for _ in range(300):
m = rng.randint(1, 7)
pa, pb = random_points(rng, m), random_points(rng, m)
check(pa, pb, adjusted_winner(pa, pb))
def test_bad_input() -> None:
with pytest.raises(ValueError):
adjusted_winner([50, 50], [100])
with pytest.raises(ValueError):
adjusted_winner([50, 40], [50, 50])
with pytest.raises(ValueError):
adjusted_winner([150, -50], [50, 50])
History
Steven Brams and Alan Taylor introduced adjusted winner in their 1996 book Fair Division, where Chapter 4 proves its properties and Chapter 5 applies it to disputes. They wrote about it for a general readership in The Win-Win Solution (1999). The procedure brings the goals of the cake cutting problem (envy-freeness, equitability and efficiency) to the division of several goods by points.
References
- Steven J. Brams and Alan D. Taylor, Fair Division, From Cake-Cutting to Dispute Resolution, Cambridge University Press, 1996, Chapter 4, Envy-freeness and equitability for n = 2 (the point-allocation procedures and adjusted winner), and Chapter 5, Applications of the point-allocation procedures
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 8XAEP1 Edit this page History Report an error Markdown