Algorithmadvanced
Kelso-Crawford salary adjustment process
Also called Kelso-Crawford ascending auction.
An ascending auction in which bidders take items at the price plus a fixed step and items go to the last bidder. With gross substitutes valuations it ends at an approximate Walrasian equilibrium.
- Time
- O(k V n m^2 2^m) worst
- Space
- O(2^m + n) extra
- Where
- V = the largest value of a bundle; k = the number of price steps per unit of value; m = the number of items; n = the number of bidders
- Model
- Word RAM
- Properties
- deterministiciterative
- Evidence
- Proof sketchCode in 1 languages
- Origin
- Alexander S. Kelso, Vincent P. Crawford, 1982
The Kelso-Crawford process is an ascending auction for many items in which each bidder may want a bundle. A bidder sees the current price for each item she holds and the price plus a fixed step for every other item; she takes the new items of her best bundle, and their prices rise by . When every bidder has gross substitutes valuations, she never needs to give back an item, and the process ends at an allocation that is optimal up to and supported by prices. The Demange-Gale-Sotomayor auction is the exact, round-based version for unit-demand bidders; this process allows bundles but ends only near an equilibrium. The tatonnement of general equilibrium theory adjusts prices of divisible goods in both directions, while here prices only rise and goods are indivisible.
In plain words
Several firms want to hire workers, and each worker goes to the firm that offers the highest salary. A firm can want many workers. Each firm in turn looks at the salaries and asks: which group of workers gives me the most profit? For workers it already has, it pays the current salary. For others, it must offer a bit more. It makes offers to the new workers it wants, and those workers leave their old firms. Salaries only go up. When no firm wants to make a new offer, the process stops. If no firm ever drops a worker just because other workers got more expensive, every firm keeps the workers it has, and the final hiring is almost the best for all firms together.
The problem
There are bidders and items. Bidder has a valuation that gives a value to each bundle of items, with . Utility is quasilinear: bidder with bundle at prices gets , where . Items have no preferences except for money; in the job market reading, the bidders are firms, the items are workers and prices are salaries. The demand set is the set of bundles of maximum utility, and asking for one of them is a demand query.
The goal is a Walrasian (competitive) equilibrium: prices and an allocation of disjoint bundles with for every bidder and price on unsold items. Such an allocation maximizes the total value . This is the welfare problem of a combinatorial auction. For general valuations an equilibrium may not exist; Kelso and Crawford (1982) proved that it exists when every valuation has gross substitutes.
The algorithm
KELSO-CRAWFORD(valuations v_1, ..., v_n, step δ)- 1
p_j ← 0 and owner_j ← none for every item j - 2
repeat - 3
changed ← false - 4
for each bidder i do - 5
X ← {j : owner_j = i} - 6
q_j ← p_j for j ∈ X; q_j ← p_j + δ for j ∉ X - 7
S ← a bundle of D_i(q) with X ⊆ S - 8
for each j ∈ S \ X do p_j ← p_j + δ; owner_j ← i; changed ← true - 9
until not changed - 10
return p and the bundles {j : owner_j = i}
The vector of line L6 holds the personalized prices of bidder : to take an item she must outbid its owner by . Line L7 asks for a demanded bundle that keeps all her items; gross substitutes is exactly what makes such a bundle exist. Items she loses leave her bundle only when another bidder takes them at line L8. The implementation picks the smallest such bundle, enumerates all bundles to find the demand set, keeps prices in Fraction, uses by default, and raises ValueError when line L7 finds no bundle.
Example
Two items and and step . Bidder 1 is additive with and . Bidder 2 wants one item at most and values each at . The best allocation gives to bidder 1 and to bidder 2, for a total of .
| turn | bidder | holds | personalized prices | bundle chosen | prices after |
|---|---|---|---|---|---|
| 1 | 1 | nothing | |||
| 2 | 2 | nothing | (tie with ) | ||
| 3 | 1 | ||||
| 4 | 2 | nothing | |||
| 5 | 1 | (tie with ) | no change | ||
| 6 | 2 | no change |
Bidder 1 gets for and bidder 2 gets for , the optimal allocation. Bidder 1 loses in turn 4 without asking to; that is the mechanism by which bundles shrink. The test file reproduces this trace.
Correctness
The proof is in proofs/correctness.md. Its key steps:
- Right after a turn of bidder , her bundle is demanded at her personalized prices.
- Until her next turn, her personalized prices only rise, and the prices of the items she still holds do not change. By gross substitutes she still demands a bundle that contains those items, so line L7 never fails.
- A bidder takes item only if its marginal value in her bundle is at least its new price, so every price stays at most , and there are at most bids.
- At the end, for every bidder and every bundle , , and every unsold item has price . So the outcome is a Walrasian equilibrium up to per item.
- Summing step 4 over an optimal allocation gives total value at least . With integer values and , the allocation is optimal.
Proof: With gross substitutes valuations the process never gets stuck, stops, and ends at an approximate Walrasian equilibriumfull
Fix bidders, items and a step . Bidder has a valuation on bundles with and . Let be the largest value . For a price vector , the demand set is , where .
The valuation has gross substitutes when for all price vectors and every there is with : raising some prices never makes a bidder drop an item whose price did not change.
During the process, is the price vector, is the set of items whose owner is , and the personalized prices of bidder are for and otherwise. A bid is a turn of lines L5 to L8 in which .
Claim 1 (basic invariants). Prices never go down. An item has an owner if and only if its price is positive. The sets are disjoint. Proof. Line L8 is the only line that changes or an owner. It raises by and sets the owner of to at the same time. Each item has one owner entry.
Claim 2 (right after a turn). At the end of a turn of bidder , . Proof. Let be the vector of line L6 and the bundle of line L7, so and . After line L8 the new holding is . For , the new price is , and as is now held, the new personalized price is . For and for , neither the price nor the holding changed, so the personalized price is still . So the personalized prices after the turn are , and the holding is .
Claim 3 (line L7 never fails under gross substitutes). If has gross substitutes, then at every turn of some has . Proof. At the first turn of , , and is not empty. Otherwise, let and be the personalized prices and the holding at the end of the previous turn of ; by Claim 2, . Between the two turns only other bidders bid. When another bidder takes item , the price rises by ; if , the item also leaves the holding of . So for still held by the personalized price did not change, and every other personalized price went up or stayed. Hence the current personalized prices , and the current holding . Gross substitutes gives with .
Claim 4 (termination). Every price stays at most , and there are at most bids. Proof. Let bidder take a new item with the bundle . Then gives utility at most that of , so , using . The new price of is . Each bid raises by at least , and this sum is at most . A pass of the loop L2 to L9 with no bid ends the process, so there are at most passes.
Claim 5 (approximate equilibrium). When the process stops, for every bidder and every bundle ,
and every item without an owner has price . Proof. In the last pass no bidder bid, so in her last turn bidder chose , hence . Then , with and . The last statement is Claim 1.
Claim 6 (welfare). The final allocation has total value at least , where is the largest total value of an allocation. If all values are integers and , the final allocation is optimal. Proof. Let be an optimal allocation. Sum Claim 5 with over all :
The sets cover every item of positive price (Claim 1), and the sets are disjoint, so . The last sum is at most . So the total value is at least . With integer values both totals are integers, and forces equality.
The default step of the implementation is , so on integer gross substitutes valuations it always returns an optimal allocation. Claim 3 is the only place that uses gross substitutes; without it, line L7 can fail, and the implementation then raises ValueError.
Complexity
Let . There are at most bids, so at most passes of lines L2 to L9 and turns. With demand found by enumeration, a turn costs time, so the total is . With a demand oracle instead, the process makes demand queries; for gross substitutes valuations a demand query can be answered with value queries by a greedy algorithm (Paes Leme 2017). The extra space is for the enumerated demand set and for the holdings.
The time is pseudo-polynomial in the values and grows as . To find an exact equilibrium, prices can also be computed from the dual of a linear program, which has integral solutions for gross substitutes.
Properties
- Monotone prices. Prices never go down, and each bid raises one price by .
- No item is given back. Under gross substitutes a bidder never drops an item by choice; she loses items only when outbid.
- Approximate equilibrium. The final prices and bundles satisfy the equilibrium conditions up to per item.
- Optimal for small steps. With integer values and , the final allocation maximizes the total value.
- Not exactly truthful. The final prices are not the VCG payments in general, and a bidder with many items can gain by demand reduction.
- Order dependent. The outcome depends on the order of bidders and on how ties are broken.
Variants and improvements
- The original job market. In Kelso and Crawford (1982) workers have preferences over firms and salaries. Firms make salary offers, each worker holds her best offer and rejects the others, and a firm raises a rejected offer by a fixed step in the next round. With salaries held fixed, the process is the many-to-one Gale-Shapley deferred acceptance with firms proposing.
- Exact auctions. Gul and Stacchetti (2000) gave an ascending auction for gross substitutes that raises the prices of a minimal set in excess demand and ends at the minimum Walrasian prices. For unit demand it is the DGS auction.
- Matching with contracts. Hatfield and Milgrom (2005) put deferred acceptance and this process into one frame, with a substitutes condition on the choice of contracts.
- Spectrum auctions. The simultaneous ascending auction uses the same rising prices on many items with an activity rule, but bidders there often see items as complements, and then the guarantees here do not hold.
- Single item. With one item, the process is an English auction with step : the bidder with the highest value wins at about the second highest value.
When to use it
Use it as a model of decentralized price formation in labor or goods markets where buyers want bundles of substitutes, or to run an ascending auction when bidders can answer demand queries but should not report whole valuations. It is the simplest algorithm that shows why gross substitutes makes Walrasian equilibrium exist.
Pitfalls
- With complements, line L7 can fail. If bidder 1 values only the pair at and bidder 2 values at , bidder 1 can end up holding while gets too expensive, and then no demanded bundle keeps . The implementation raises
ValueErrorhere; a market version would leave her with an item she does not want (the exposure problem). - A large can end far from the optimum: the guarantee is only .
- A plain demand query can return a demanded bundle that drops a held item when there are ties. Line L7 needs a demanded bundle that keeps all held items; break ties in favor of held items, or take the whole demand set.
- Gross substitutes is a property of the whole valuation. Checking it from samples of bundles is not enough; see gross substitutes for exact tests.
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/kelso-crawford-process/. The authors are listed in prov/AYJGGA.jsonl.
"""The Kelso-Crawford ascending process, in the auction form with personalized prices.
Bidders (firms) are 0, ..., n - 1 and items (workers) are 0, ..., m - 1. Each bidder i has a
valuation values[i], a function from a frozenset of items to a number, with value 0 for the
empty set. Items have no preferences except for money, so an item goes to the bidder who bids
for it last. A bidder sees the price p[j] for an item she holds and p[j] + delta for any other
item. In each turn she picks a demanded bundle that keeps all her items and takes the new items
of that bundle, whose prices rise by delta. The process ends when no bidder wants to change.
When every valuation has gross substitutes, a demanded bundle that keeps her items always exists.
"""
from fractions import Fraction
from itertools import combinations
from typing import Callable, Optional
Valuation = Callable[[frozenset], object]
NONE = -1 # an item that no bidder holds
def bundles(m: int):
"""All subsets of range(m), by size and then in lexicographic order."""
for k in range(m + 1):
for c in combinations(range(m), k):
yield frozenset(c)
def demand(v: Valuation, prices, m: int) -> list[frozenset]:
"""All bundles of maximum utility v(S) - sum of prices over S."""
best, out = None, []
for S in bundles(m):
u = v(S) - sum((prices[j] for j in S), Fraction(0))
if best is None or u > best:
best, out = u, [S]
elif u == best:
out.append(S)
return out
def kelso_crawford(values: list[Valuation], m: int, delta=None, trace: Optional[list] = None):
"""Run the process. Return (prices, owner): prices[j] is a Fraction and owner[j] is the
bidder who holds item j, or NONE. delta defaults to 1 / (m + 1), which makes the final
allocation optimal when all values are integers.
If trace is a list, each bid appends (bidder, the new items, the prices after the bid).
Raise ValueError if some bidder has no demanded bundle that keeps her items, which can
happen only when her valuation does not have gross substitutes.
"""
n = len(values)
if m < 0:
raise ValueError("m must be nonnegative")
delta = Fraction(1, m + 1) if delta is None else Fraction(delta)
if delta <= 0:
raise ValueError("delta must be positive")
prices = [Fraction(0)] * m # @line L1
owner = [NONE] * m
while True: # @line L2
changed = False # @line L3
for i in range(n): # @line L4
X = frozenset(j for j in range(m) if owner[j] == i) # @line L5
q = [prices[j] if j in X else prices[j] + delta for j in range(m)] # @line L6
keep = [S for S in demand(values[i], q, m) if X <= S] # @line L7
if not keep:
raise ValueError("bidder %d has no demanded bundle that keeps her items" % i)
S = keep[0]
new = sorted(S - X)
for j in new: # @line L8
prices[j] += delta
owner[j] = i
changed = True
if new and trace is not None:
trace.append((i, new, list(prices)))
if not changed: # @line L9
break
return prices, owner # @line L10
def allocation(owner: list[int], n: int) -> list[frozenset]:
"""The bundle of each bidder."""
return [frozenset(j for j, o in enumerate(owner) if o == i) for i in range(n)]
test_kelso_crawford_process.py 149 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/kelso-crawford-process/. The authors are listed in prov/AYJGGA.jsonl.
import random
import unittest
from fractions import Fraction
from functools import lru_cache
from itertools import product
from kelso_crawford_process import NONE, allocation, bundles, kelso_crawford
def additive(w):
return lambda S: sum(w[j] for j in S)
def unit_demand(w):
return lambda S: max([0] + [w[j] for j in S])
def oxs(w):
"""An assignment valuation: the bidder has len(w) slots, slot s gives w[s][j] for item j,
and v(S) is the best value of placing items of S in distinct slots. It has gross substitutes."""
@lru_cache(maxsize=None)
def v(S):
items = sorted(S)
def best(k, free):
if k == len(items):
return 0
out = best(k + 1, free) # item items[k] stays unused
for s in free:
out = max(out, w[s][items[k]] + best(k + 1, free - {s}))
return out
return best(0, frozenset(range(len(w))))
return v
def welfare(values, owner):
return sum(values[i](S) for i, S in enumerate(allocation(owner, len(values))))
def best_welfare(values, m):
n = len(values)
return max(welfare(values, list(o)) for o in product(range(-1, n), repeat=m))
def random_oxs(rng, m, hi):
k = rng.randint(1, 3)
return oxs(tuple(tuple(rng.randint(0, hi) for _ in range(m)) for _ in range(k)))
class TestKelsoCrawford(unittest.TestCase):
def test_page_example(self):
values = [additive([2, 1]), unit_demand([2, 2])]
trace = []
prices, owner = kelso_crawford(values, 2, Fraction(1, 3), trace)
third = Fraction(1, 3)
self.assertEqual(
trace,
[
(0, [0, 1], [third, third]),
(1, [0], [2 * third, third]),
(0, [0], [1, third]),
(1, [1], [1, 2 * third]),
],
)
self.assertEqual(prices, [1, 2 * third])
self.assertEqual(owner, [0, 1])
self.assertEqual(welfare(values, owner), 4)
def test_single_item_is_english_auction(self):
delta = Fraction(1, 2)
prices, owner = kelso_crawford([additive([5]), additive([3])], 1, delta)
self.assertEqual(owner, [0])
self.assertTrue(3 - delta <= prices[0] <= 3 + delta)
def test_optimal_with_small_step(self):
rng = random.Random(1)
for _ in range(120):
n, m = rng.randint(1, 3), rng.randint(1, 4)
values = [random_oxs(rng, m, 5) for _ in range(n)]
_, owner = kelso_crawford(values, m)
self.assertEqual(welfare(values, owner), best_welfare(values, m))
def test_approximate_equilibrium(self):
# Each bidder's bundle is within delta per extra item of her best bundle at the prices.
rng = random.Random(2)
for _ in range(120):
n, m = rng.randint(1, 3), rng.randint(1, 4)
values = [random_oxs(rng, m, 5) for _ in range(n)]
delta = Fraction(1, rng.randint(1, 4))
prices, owner = kelso_crawford(values, m, delta)
held = allocation(owner, n)
for i in range(n):
u = values[i](held[i]) - sum(prices[j] for j in held[i])
for T in bundles(m):
uT = values[i](T) - sum(prices[j] for j in T)
self.assertGreaterEqual(u, uT - delta * len(T - held[i]))
for j in range(m):
if owner[j] == NONE:
self.assertEqual(prices[j], 0)
self.assertGreaterEqual(welfare(values, owner), best_welfare(values, m) - m * delta)
def test_bid_bound(self):
rng = random.Random(3)
for _ in range(100):
n, m = rng.randint(1, 3), rng.randint(1, 4)
hi = 6
values = [random_oxs(rng, m, hi) for _ in range(n)]
delta = Fraction(1, m + 1)
trace = []
prices, _ = kelso_crawford(values, m, delta, trace)
self.assertTrue(all(p <= hi + delta for p in prices))
self.assertLessEqual(len(trace) * delta, m * (hi + delta))
for k in range(1, len(trace)):
self.assertTrue(all(a <= b for a, b in zip(trace[k - 1][2], trace[k][2])))
def test_additive_bidders_get_their_items_cheaply(self):
# With additive values every item is a separate English auction.
rng = random.Random(4)
for _ in range(60):
n, m = rng.randint(2, 3), rng.randint(1, 3)
w = [[rng.randint(0, 6) for _ in range(m)] for _ in range(n)]
delta = Fraction(1, 4)
prices, owner = kelso_crawford([additive(r) for r in w], m, delta)
for j in range(m):
col = sorted((w[i][j] for i in range(n)), reverse=True)
if owner[j] != NONE:
self.assertEqual(w[owner[j]][j], col[0])
self.assertTrue(col[1] - delta <= prices[j] <= col[1] + delta)
def test_complements_break_the_process(self):
both = lambda S: 3 if len(S) == 2 else 0
with self.assertRaises(ValueError):
kelso_crawford([both, unit_demand([0, 3])], 2, Fraction(1, 3))
def test_bad_input(self):
with self.assertRaises(ValueError):
kelso_crawford([additive([1])], 1, 0)
with self.assertRaises(ValueError):
kelso_crawford([additive([1])], -1)
if __name__ == "__main__":
unittest.main()
History
Crawford and Knoer (1981) studied a salary adjustment process for one-to-one job matching. Kelso and Crawford (1982) let firms hire many workers, introduced the gross substitutes condition and showed that the process reaches a core allocation, which gives the existence of equilibrium. Gul and Stacchetti (1999) showed that gross substitutes is the largest class that contains unit-demand valuations and always has an equilibrium, and in 2000 gave an exact English auction for it. Hatfield and Milgrom (2005) joined this process and deferred acceptance in matching with contracts. Paes Leme (2017) surveyed the algorithmic side of gross substitutes and wrote the process in the form used here.
References
- Alexander S. Kelso and Vincent P. Crawford, Job matching, coalition formation, and gross substitutes, Econometrica 50(6), 1483 to 1504 (1982), the whole paper (the salary adjustment process and the gross substitutes condition)
- Faruk Gul and Ennio Stacchetti, Walrasian equilibrium with gross substitutes, Journal of Economic Theory 87(1), 95 to 124 (1999), the whole paper (existence of Walrasian equilibrium and the maximal class that contains unit demand)
- Faruk Gul and Ennio Stacchetti, The English auction with differentiated commodities, Journal of Economic Theory 92(1), 66 to 95 (2000), the whole paper (an exact ascending auction for gross substitutes)
- Renato Paes Leme, Gross substitutability, an algorithmic survey, Games and Economic Behavior 106, 294 to 316 (2017), Section 1 (the Walrasian tatonnement with personalized prices and Theorem 1.4)
- John William Hatfield and Paul R. Milgrom, Matching with contracts, American Economic Review 95(4), 913 to 935 (2005), the whole paper (a common frame for deferred acceptance and the Kelso-Crawford process)
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 AYJGGA Edit this page History Report an error Markdown